Beispiel #1
0
class IHotThreads(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.
    """

    header = schema.TextLine(title=_(u'Header'),
                             description=_(u"The header for the portlet. "
                                           "Leave empty for none."),
                             required=False)

    forum = schema.TextLine(title=_(u'Forum'),
                            description=_(u"Specify the forum you wish to "
                                          "obtain the hot threads from."),
                            required=True)

    max_results = schema.Int(title=_(u'Maximum results'),
                             description=_(u"The maximum results number."),
                             required=True,
                             default=5)

    pretty_date = schema.Bool(
        title=_(u'Pretty dates'),
        description=_(u"Show dates in a pretty format (ie. '4 hours ago')."),
        default=True,
        required=False)

    anonymous_only = schema.Bool(
        title=_(u'Anonymous only'),
        description=_(u"Display this portlet only for anonymous users."),
        default=True,
        required=False)
class EditForm(base.EditForm):

    form_fields = form.Fields(ILatestNITFPortlet)
    form_fields = form_fields.omit('target_collection')

    label = _(u"Add latest NITF Portlet")
    description = _(u"This portlet display a list of latest NITF from a "
                    u"Collection. It will select between different collections"
                    u"based on the current context.")
class AddForm(base.AddForm):

    form_fields = form.Fields(ILatestNITFPortlet)
    form_fields = form_fields.omit('target_collection')

    label = _(u"Add latest NITF Portlet")
    description = _(
        u"This portlet display a list of latest NITF from a "
        u"Collection. It will select between different collections "
        u"based on the current context.")

    def create(self, data):
        return Assignment(**data)
Beispiel #4
0
class IRecentVideos(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.
    """

    tag = schema.TextLine(title=_(u'Tag'),
                          description=_(u"Tag to filter the videos "),
                          required=True)

    limit = schema.Int(title=_(u'Limit'),
                       description=_(u"The maximum results number."),
                       required=True,
                       default=5)
class ILatestNITFPortlet(IPortletDataProvider):
    """A portlet which renders the results of a collection object.
    """

    limit = schema.Int(
        title=_(u"Limit"),
        description=_(u"Specify the maximum number of items to show in the "
                      u"portlet. Leave this blank to show all items."),
        default=10,
        required=False)

    pretty_date = schema.Bool(
        title=_(u'Pretty dates'),
        description=_(u"Show dates in a pretty format (ie. '4 hours ago')."),
        default=True,
        required=False)

    anonymous_only = schema.Bool(
        title=_(u'Anonymous only'),
        description=_(u"Display this portlet only for anonymous users."),
        default=True,
        required=False)
class ILatestPolls(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.
    """

    header = schema.TextLine(title=_(u'Header'),
                             description=_(u"The header for the portlet. "
                                           "Leave empty for none."),
                             required=False)

    max_results = schema.Int(title=_(u'Maximum results'),
                             description=_(u"The maximum results number."),
                             required=True,
                             default=5)

    anonymous_only = schema.Bool(
        title=_(u'Anonymous only'),
        description=_(u"Display this portlet only for anonymous users."),
        default=True,
        required=False)
 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.
     """
     return _(u"Latest NITF")
Beispiel #8
0
 def title(self):
     """This property is used to give the title of the portlet in the
     "manage portlets" screen.
     """
     return _(u"Hot Threads")
 def title(self):
     """This property is used to give the title of the portlet in the
     "manage portlets" screen.
     """
     return _(u"Hot Threads")
Beispiel #10
0
 def title(self):
     """This property is used to give the title of the portlet in the
     "manage portlets" screen.
     """
     return _(u"Recent videos")
 def title(self):
     """This property is used to give the title of the portlet in the
     "manage portlets" screen.
     """
     return _(u"Latest polls")
 def title(self):
     """This property is used to give the title of the portlet in the
     "manage portlets" screen.
     """
     return _(u"Latest polls")
Beispiel #13
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.
     """
     return _(u"Latest NITF")