コード例 #1
0
 def applyNewForm(self, type_id, form_id):
     portal_pfgextender = getToolByName(self.context, TOOL_ID)
     if form_id == NO_EXTENSION_ID:
         portal_pfgextender.resetFormForPortalType(type_id)
         msg = _("content_type_no_more_extended",
             u"The content type is not extended anymore.")
     elif form_id:
         portal_pfgextender.registerFormForPortalType(form_id=form_id,
             portal_type=type_id)
         msg = _("content_type_extension_updated",
             u"The content type extension form has been modified")
     IStatusMessage(self.request).addStatusMessage(msg, type='info')
コード例 #2
0
 def get_forms(self):
     portal_pfgextender = getToolByName(self.context, TOOL_ID)
     is_registered = self.is_selected_type_registered()
     no_extension = dict(id=NO_EXTENSION_ID, title=_("No extension"),
         selected=not is_registered)
     result = [no_extension]
     for form_id in portal_pfgextender.objectIds():
         form = getattr(portal_pfgextender, form_id)
         title = form.Title()
         selected = is_registered and (form_id ==
         self.selected_type_form().getId())
         result.append(dict(id=form_id, title=title, selected=selected))
     return result