Exemplo n.º 1
0
 def edit(self):
     form = ObjectForm(view=self, loadFromType=self.context.configuration)
     form.use_ajax = True
     form.Setup(subset="edit")
     head = form.HTMLHead()
     result, data, action = form.Process(redirectSuccess="page_url")
     return {
         u"content": data,
         u"result": result,
         u"cmsview": self,
         u"head": head
     }
Exemplo n.º 2
0
 def add(self):
     name = self.context.app.GetObjectFld("name", "user").copy()
     name.settings["validator"] = UsernameValidator
     form = ObjectForm(loadFromType="user", view=self)
     form.subsets = {
         "create": {
             "fields": self.configuration.addfields,
             "actions": ["create"],
             "defaultAction": "default"
         }
     }
     form.Setup(subset="create")
     result, data, action = form.Process(redirectSuccess="obj_url",
                                         pool_type="user")
     return {u"content": data, u"result": result, u"head": form.HTMLHead()}
Exemplo n.º 3
0
 def add(self):
     typeID = self.GetFormValue("pool_type")
     if not typeID:
         return {
             u"content": u"",
             u"showAddLinks": True,
             u"result": True,
             u"head": u""
         }
     form = ObjectForm(view=self, loadFromType=typeID)
     form.Setup(subset="create", addTypeField=True)
     form.use_ajax = True
     head = form.HTMLHead()
     result, data, action = form.Process(redirectSuccess="page_url")
     return {
         u"content": data,
         u"result": result,
         u"cmsview": self,
         u"showAddLinks": False,
         u"head": head
     }
Exemplo n.º 4
0
    def edit(self):
        pwd = self.context.app.GetObjectFld("password", "user").copy()
        pwd.settings["update"] = True
        pwd.required = False
        form = ObjectForm(loadFromType="user", subset="edit", view=self)

        def removepasswd(data, obj):
            try:
                del data["password"]
            except:
                pass

        form.ListenEvent("loadDataObj", removepasswd)
        form.subsets = {
            "edit": {
                "fields": self.configuration.editfields,
                "actions": ["edit"],
                "defaultAction": "defaultEdit"
            },
        }
        form.Setup(subset="edit")
        result, data, action = form.Process()  #, redirectSuccess="obj_url")
        return {u"content": data, u"result": result, u"head": form.HTMLHead()}