示例#1
0
 def update(self):
     actions = getFactoriesInContext(self.context)
     if IModule.providedBy(self.context):
         for (i, action) in enumerate(actions):
             # To be able to determine what button label to display, we
             # explicitly set the action.id to the fake "euphorie.submodule"
             if action.id == "euphorie.module":
                 actions[i] = FactoryInfo("euphorie.submodule",
                         _(u"Submodule"), *action[2:])
                 break
     self.actions = sorted(actions, key=lambda x: x.title)
     self.can_edit = checkPermission(self.context, "Modify portal content")
示例#2
0
 def update(self):
     actions = getFactoriesInContext(self.context)
     if IModule.providedBy(self.context):
         for (i, action) in enumerate(actions):
             # To be able to determine what button label to display, we
             # explicitly set the action.id to the fake "euphorie.submodule"
             if action.id == "euphorie.module":
                 actions[i] = FactoryInfo("euphorie.submodule",
                                          _("Submodule"), *action[2:])
                 break
     self.actions = sorted(actions, key=lambda x: x.title)
     self.can_edit = checkPermission(self.context, "Modify portal content")
     self.library_available = IQuestionContainer.providedBy(self.context)
示例#3
0
 def factories(self):
     """Helper method to generate the menu items for creating new content.
     If no content can be created None is returned.
     """
     menu = {"title": _("menu_add_new", default=u"Add new")}
     children = menu["children"] = []
     actions = getFactoriesInContext(self.context)
     actions.sort(key=lambda x: x.title)
     for action in actions:
         children.append({"title": action.title, "description": action.description, "url": action.url})
     if children:
         return menu
     else:
         return None
示例#4
0
 def factories(self):
     """Helper method to generate the menu items for creating new content.
     If no content can be created None is returned.
     """
     menu = {"title": _("menu_add_new", default="Add new")}
     children = menu["children"] = []
     actions = getFactoriesInContext(self.context)
     actions.sort(key=lambda x: x.title)
     for action in actions:
         children.append({
             "title": action.title,
             "description": action.description,
             "url": action.url,
         })
     if children:
         return menu
     else:
         return None