class AddForm(base.AddForm): form_fields = form.Fields(IMediaPortlet) form_fields["target_media"].custom_widget = UberSelectionWidget label = _(u"Add media portlet") description = _(u"This portlet displays a media link") def create(self, data): return Assignment(**data)
class EditForm(formhelper.EditForm): """Portlet edit form. """ form_fields = form.Fields(IMediaPortlet) form_fields['target_media'].custom_widget = UberSelectionWidget schema = IMediaPortlet label = _(u"Edit media portlet") description = _(u"This portlet displays a media link")
class IMediaPortlet(IPortletDataProvider): header = schema.TextLine(title=_(u"Portlet title"), description=_(u"Title of the rendered portlet"), required=False) target_media = schema.Choice( title=_(u"Target Media"), description=_(u"Find the Media Link which provides the items to list"), required=True, source=SearchableTextSourceBinder({'portal_type': ('media_link', )}, default_query='path:'), )
def title(self): """This property is used to give the title of the portlet in the "manage portlets" screen. Here, we use the title that the user gave. """ if hasattr(self, "header"): return self.header return _(u"Media Portlet")
def title(self): """This property is used to give the title of the portlet in the "manage portlets" screen. Here, we use the title that the user gave. """ if hasattr(self, 'header'): return self.header return _(u"Media Portlet")