Example #1
0
class IStaticPortlet(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)

    text = schema.Text(title=_(u"Text"),
                       description=_(u"The text to render"),
                       required=True)

    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=False)

    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)
Example #2
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.
    """
    schema = IStaticPortlet
    label = _(u"title_edit_static_portlet",
              default=u"Edit static text portlet")
    description = _(u"description_static_portlet",
                    default=u"A portlet which can display static HTML text.")
Example #3
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(IGDAssemblyPortlet)
    label = _(u"title_edit_assembly_portlet",
              default=u"Edit GroupDocs Assembly portlet")
    description = _(
        u"description_assembly_portlet",
        default=u"A portlet which can display GroupDocs Embedded Viwer.")
Example #4
0
class EditForm(base_EditForm):
    """Portlet edit form

    This is registered in configure.zcml.
    """
    if USE_AUTOFORM:
        schema = IStaticPortlet
    else:
        fields = field.Fields(IStaticPortlet)

    label = _(u"title_edit_static_portlet",
              default=u"Edit static text portlet")
    description = _(u"description_static_portlet",
                    default=u"A portlet which can display static HTML text.")
Example #5
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.
    """
    schema = IStaticPortlet
    label = _(u"title_add_static_portlet", default=u"Add static text portlet")
    description = _(u"description_static_portlet",
                    default=u"A portlet which can display static HTML text.")

    def create(self, data):
        return Assignment(**data)
Example #6
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(IGDAssemblyPortlet)
    label = _(u"title_add_assembly_portlet",
              default=u"Add groupdocs assembly portlet")
    description = _(
        u"description_assembly_portlet",
        default=u"A portlet which can display GroupDocs Embedded Viwer.")

    def create(self, data):
        return Assignment(**data)
Example #7
0
class Assignment(base.Assignment):
    """Portlet assignment.

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

    implements(IStaticPortlet)

    header = _(u"title_static_portlet", default=u"Static text portlet")
    text = u""
    omit_border = False
    footer = u""
    more_url = ''

    def __init__(self,
                 header=u"",
                 text=u"",
                 omit_border=False,
                 footer=u"",
                 more_url=''):
        self.header = header
        self.text = text
        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_static', default=u"Static Portlet")
Example #8
0
class AddForm(base_AddForm):
    """Portlet add form.

    This is registered in configure.zcml. The create() method actually
    constructs the assignment that is being added.
    """
    if USE_AUTOFORM:
        schema = IStaticPortlet
    else:
        fields = field.Fields(IStaticPortlet)

    label = _(u"title_add_static_portlet", default=u"Add static text portlet")
    description = _(u"description_static_portlet",
                    default=u"A portlet which can display static HTML text.")

    def create(self, data):
        return Assignment(**data)
Example #9
0
class Assignment(base.Assignment):
    """Portlet assignment.

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

    implements(IGDAssemblyPortlet)

    header = _(u"title_gdassembly_portlet",
               default=u"GroupDocs Assembly portlet")
    fileid = u""
    width = u""
    height = u""
    omit_border = False
    footer = u""
    more_url = ''

    def __init__(self,
                 header=u"",
                 fileid=u"",
                 width=u"",
                 height=u"",
                 omit_border=False,
                 footer=u"",
                 more_url=''):
        self.header = header
        self.fileid = fileid
        self.width = width
        self.height = height
        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.
        """
        return self.header
 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_firebase_chat', default=u"FireBase chat Portlet")
Example #11
0
class IGDAssemblyPortlet(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 GroupDocs Assembly portlet"),
        required=True)

    fileid = schema.TextLine(
        title=_(u"File ID"),
        description=_(u"GUID of the shared file from GroupDocs account"),
        required=True)

    width = schema.TextLine(title=_(u"Width"),
                            description=_(u"Width of the Assembly"),
                            required=True)

    height = schema.TextLine(title=_(u"Height"),
                             description=_(u"Height of the Assembly"),
                             required=True)

    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=False)

    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)
Example #12
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_static', default=u"Static Portlet")