Esempio n. 1
0
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)
Esempio n. 2
0
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")
Esempio n. 3
0
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:'),
    )
Esempio n. 4
0
 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")
Esempio n. 5
0
 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")