Esempio n. 1
0
class EditForm(base.EditForm):
    """Portlet edit form.

    This is registered with configure.zcml. The form_fields variable tells
    zope.formlib which fields to display.
    """
    form_fields = form.Fields(IPersonPortlet)
    label = _(u"title_edit_person_portlet", default=u"Edit person portlet")
    description = _(u"description_person_portlet",
        default=u"This portlet displays the faculty headshot. This form enables borders and footers.")
Esempio n. 2
0
class IPersonAddressPortlet(IPortletDataProvider):
    """A portlet which renders predefined static HTML.

    It inherits from IPortletDataProvider because for this portlet, the
    data that is being rendered and the portlet assignment itself are the
    same.
    """

    header = schema.TextLine(title=_(u"Portlet header"),
                             description=_(u"Title of the rendered portlet"),
                             constraint=re.compile("[^\s]").match,
                             required=False)

    omit_border = schema.Bool(
        title=_(u"Omit portlet border"),
        description=_(u"Tick this box if you want to render the text above "
                      "without the standard header, border or footer."),
        required=True,
        default=True)

    footer = schema.TextLine(title=_(u"Portlet footer"),
                             description=_(u"Text to be shown in the footer"),
                             required=False)

    more_url = schema.ASCIILine(title=_(u"Details link"),
                                description=_(
                                    u"If given, the header and footer "
                                    "will link to this URL."),
                                required=False)
Esempio n. 3
0
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.
    """
    form_fields = form.Fields(IPersonPortlet)
    label = _(u"title_add_person_portlet", default=u"Add person portlet")
    description = _(u"description_static_portlet",
        default=u"This portlet displays the faculty headshot. This form enables borders and footers.")

    def create(self, data):
        return Assignment(**data)
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 or
     static string if title not defined.
     """
     return self.header or _(u'portlet_person_address',
                             default=u"Person Address Portlet")
Esempio n. 5
0
class Assignment(base.Assignment):
    """Portlet assignment.

    This is what is actually managed through the portlets UI and associated
    with columns.
    """

    implements(IPersonAddressPortlet)

    header = _(u"title_person_address_portlet",
               default=u"Person Address Portlet")
    omit_border = True
    footer = u""
    more_url = ''

    def __init__(self,
                 header=u"",
                 text=u"",
                 omit_border=True,
                 footer=u"",
                 more_url=''):
        self.header = header
        self.omit_border = omit_border
        self.footer = footer
        self.more_url = more_url

    @property
    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 or
        static string if title not defined.
        """
        return self.header or _(u'portlet_person_address',
                                default=u"Person Address 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 or
     static string if title not defined.
     """
     return self.header or _(u'portlet_person_specialties', default=u"Person Specialties Portlet")