def __call__(self, context): return SimpleVocabulary( [SimpleTerm(value=pair[0], token=pair[0], title=pair[1]) for pair in [ (u'hidden', _(u'Hidden')), (u'text', _(u'Display as text')), (u'link', _(u'Display as a link')), ]] )
def __call__(self, context): return SimpleVocabulary([ SimpleTerm(value=pair[0], token=pair[0], title=pair[1]) for pair in [ (u'hidden', _(u'Hidden')), (u'text', _(u'Display as text')), (u'link', _(u'Display as a link')), ] ])
class EditForm(base.EditForm): """Portlet edit form. This is registered with configure.zcml. The form_fields variable tells zope.formlib which fields to display. """ label = _(u"Edit Content Portlet") description = _(u"") schema = IContentPortlet
def __call__(self, context): return SimpleVocabulary( [SimpleTerm(value=pair[0], token=pair[0], title=pair[1]) for pair in [ (u'date', _(u'Date')), (u'image', _(u'Image')), (u'description', _(u'Description')), (u'body', _(u'Body')), ]] )
def __call__(self, context): return SimpleVocabulary([ SimpleTerm(value=pair[0], token=pair[0], title=pair[1]) for pair in [ (u'date', _(u'Date')), (u'image', _(u'Image')), (u'description', _(u'Description')), (u'body', _(u'Body')), ] ])
class AddForm(base.AddForm): """Portlet add form. This is registered in configure.zcml. The form_fields variable tells zope.formlib which fields to display. The create() method actually constructs the assignment that is being added. """ schema = IContentPortlet label = _(u"Add Content Portlet") description = _(u"") def create(self, data): return Assignment(**data)
class IContentPortlet(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. """ content = schema.Choice( title=_(u"Content Item"), required=True, source=CatalogSource(object_provides=ILayoutAware.__identifier__))
def title(self): """This property is used to give the title of the portlet in the "manage portlets" screen. """ msg = _(u"Content portlet") return self.portlet_title or msg
class IContentPortlet(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. """ portlet_title = schema.TextLine( title=_(u'Portlet Title'), description=_('help_portlet_title', default=u'Enter a title for this portlet. ' "This property is used as the portlet's title " 'in the "@@manage-portlets" screen. ' 'Leave blank for "Content portlet".'), required=False, ) custom_header = schema.TextLine( title=_(u"Portlet header"), description=_('help_custom_header', default=u"Set a custom header (title) for the rendered " u"portlet. Leave empty to use the selected " u"content's title."), required=False, ) title_display = schema.Choice( title=_(u'Item Title in portlet content'), description=_('help_title_display', default=u"Do you want to render the item's title inside " u"the portlet content, and if yes, how?\n" u"Note that by default, the item's title will " u"be displayed in the portlet header."), vocabulary='collective.portlet.content.title_display_vocabulary', default=u'hidden', required=True, ) content = schema.Choice(title=_(u"Content Item"), required=True, source=SearchableTextSourceBinder( {}, default_query='path:')) item_display = schema.List( title=_(u'Item Display'), description=_('help_item_display', default=u"Select which of the selected item's fields " u"will be displayed in the portlet's content " u"area. Note that selecting Body (text) will " u"not work for an Image."), value_type=schema.Choice( vocabulary='collective.portlet.content.item_display_vocabulary', ), default=[u'date', u'image', u'description', u'body'], required=False, ) more_text = schema.TextLine( title=_(u'Read More Link'), description=_('help_more_text', default=u"Enter the text for the link in the portlet " u"footer. Leave blank for no footer."), default=u'', required=False, ) omit_border = schema.Bool( title=_(u"Omit portlet border"), description=_('help_omit_border', default=u"Tick this box if you want to render the " u"content item selected above without the " u"standard header, border or footer."), required=True, default=False) omit_header = schema.Bool( title=_(u"Omit portlet header"), description=_('help_omit_header', default=u"Tick this box if you don't want the portlet " "header to be displayed."), required=True, default=False)