Esempio n. 1
0
class PageTemplate(PersistentCoverTile):

    implements(IPageTemplate)

    index = ViewPageTemplateFile('templates/template.pt')

    is_configurable = True
    is_editable = True
    is_droppable = False
    short_name = _(u'Page template', default=u'Page Template')

    def is_empty(self):
        return not (self.data.get('template', None))

    def accepted_ct(self):
        """Return an empty list as no content types are accepted."""
        return []

    def getTemplate(self):
        nome = str(self.data.get('template', None))
        try:
            template = self.context.restrictedTraverse(nome)
            return template.render()
        except:
            pass

        return False
Esempio n. 2
0
    def populate_with_object(self, obj):
        super(Chamada, self).populate_with_object(obj)  # check permission

        if obj.portal_type in self.accepted_ct():
            header = obj.Title()  # use collection's title as header
            footer = _(u'More…')  # XXX: can we use field's default?
            uuid = IUUID(obj)

            data_mgr = ITileDataManager(self)
            data_mgr.set({
                'header': header,
                'footer': footer,
                'uuid': uuid,
            })
Esempio n. 3
0
    def populate_with_object(self, obj):
        super(Slider, self).populate_with_object(obj)  # check permission

        if obj.portal_type in self.accepted_ct():
            header = obj.Title()  # use collection's title as header
            footer = _(u'More…')  # XXX: can we use field's default?
            uuid = IUUID(obj)

            data_mgr = ITileDataManager(self)
            data_mgr.set({
                'header': header,
                'footer': footer,
                'uuid': uuid,
            })
Esempio n. 4
0
class IPageTemplate(IPersistentCoverTile):

    template = schema.TextLine(
        title=_(u'Page template'),
        required=True,
    )
Esempio n. 5
0
class ISlider(IPersistentCoverTile, form.Schema):

    header = schema.TextLine(
        title=_(u'Header'),
        required=False,
    )

    form.omitted('title')
    form.no_omit(IDefaultConfigureForm, 'title')
    title = schema.TextLine(
        title=_(u'Title'),
        required=False,
    )

    form.omitted('description')
    form.no_omit(IDefaultConfigureForm, 'description')
    description = schema.Text(
        title=_(u'Description'),
        required=False,
    )

    form.omitted('date')
    form.no_omit(IDefaultConfigureForm, 'date')
    date = schema.Datetime(
        title=_(u'Date'),
        required=False,
    )

    form.omitted('image')
    form.no_omit(IDefaultConfigureForm, 'image')
    image = NamedImage(
        title=_(u'Image'),
        required=False,
    )

    # FIXME: this field should be named 'count'
    number_to_show = schema.List(
        title=_(u'Number of items to display'),
        value_type=schema.TextLine(),
        required=False,
    )

    showDescription = schema.Bool(
        title=_(u'Show description'),
        required=False,
        default=True,
    )

    showControler = schema.Bool(
        title=_(u'Show number of banners'),
        required=False,
        default=True,
    )

    footer = schema.TextLine(
        title=_(u'Footer'),
        required=False,
    )

    uuid = schema.TextLine(
        title=_(u'UUID'),
        readonly=True,
    )