コード例 #1
0
    def __call__(self, context):
        context = getattr(context, 'context', context)
        request = aq_get(context, 'REQUEST', None)

        return SimpleVocabulary.fromItems(
            ((translate(_('Pending'), context=request), 'pending'),
             (translate(_('Published'), context=request), 'published')))
コード例 #2
0
class IDiscussionPortlet(IPortletDataProvider):
    """A portlet

    It inherits from IPortletDataProvider because for this portlet, the
    data that is being rendered and the portlet assignment itself are the
    same.
    """
    portletTitle = schema.TextLine(title=_(u"Portlet title"),
                                   description=_(u"Insert the portlet title."),
                                   required=True)

    discussionState = schema.List(
        title=_(u'Discussions state'),
        description=
        _(u'Select the review state of the discussions. Leave empty to show all the discussions.'
          ),
        value_type=schema.Choice(
            vocabulary="collective.portlet.discussion.DiscussionStatesVocab",
            required=False))

    discussionFolder = schema.Choice(
        title=_(u"Discussions folder"),
        description=
        _(u"Insert the folder where you want to search the discussions. Leave empty to search in all the portal."
          ),
        required=False,
        source=SearchableTextSourceBinder(
            {'object_provides': IATFolder.__identifier__},
            default_query='path:'))

    nDiscussions = schema.Int(
        title=_(u"Number of discussions"),
        required=False,
        default=5,
        description=_(
            u"Specify how many discussions will be shown in the portlet."))
コード例 #3
0
 def getPortletTitle(self):
     """return the portlet title"""
     if self.data.portletTitle:
         return self.data.portletTitle
     else:
         return _("Discussions")
コード例 #4
0
    def __call__(self, context):
        context = getattr(context, 'context', context)
        request = aq_get(context, 'REQUEST', None)

        return SimpleVocabulary.fromItems(((translate(_('Pending'), context=request), 'pending'),
                                           (translate(_('Published'), context=request), 'published')))
コード例 #5
0
 def getPortletTitle(self):
     """return the portlet title"""
     if self.data.portletTitle:
         return self.data.portletTitle
     else:
         return _("Discussions")