class IBandeauContent(Interface):
    """
    Bandeau informations
    """

    bannerLocalOnly = schema.Bool(
        title=_(u"label_bannerLocalOnly", default=(u"Local Banner")),
        description=_(
            u'help_bannerLocalOnly',
            default=u"Display the banner in the current folder only"),
        required=False,
        default=False,
    )

    bannerStopAcquisition = schema.Bool(
        title=_(u"label_bannerStopAcquisition", default=(u"Stop Acquisition")),
        description=_(
            u'help_bannerStopAcquisition',
            default=
            u"Stop banners research to this folder and don't display banners in upper folders"
        ),
        required=False,
        default=True,
    )

    bannerImageLink = schema.Choice(
        title=_(u"label_bannerImageLink", default=u"A link for the banner"),
        source=PathSourceBinder(portal_type=['Document', 'Folder']),
        required=False)
class IPrintFooterContent(Interface):
    """
    Bandeau informations
    """

    printfooterLocalOnly = schema.Bool(
        title=_(u"label_printfooterLocalOnly", default=(u"Local Footer")),
        description=_(
            u'help_printfooterLocalOnly',
            default=u"Display the footer in the current folder only"),
        required=False,
        default=False,
    )

    printfooterStopAcquisition = schema.Bool(
        title=_(u"label_printfooterStopAcquisition",
                default=(u"Stop Acquisition")),
        description=_(
            u'help_printfooterStopAcquisition',
            default=
            u"Stop footers research to this folder and don't display footers in upper folders"
        ),
        required=False,
        default=True,
    )
class ILogoContent(Interface):
    """
    Bandeau informations
    """

    logoLocalOnly = schema.Bool(
        title=_(u"label_logoLocalOnly", default=(u"Local Logo")),
        description=_(u'help_logoLocalOnly',
                      default=u"Display the logo in the current folder only"),
        required=False,
        default=False,
    )
class IBackgroundContent(Interface):
    """
    Bandeau informations
    """

    bannerLocalOnly = schema.Bool(
        title=_(u"label_bannerLocalOnly", default=(u"Local Banner")),
        description=_(
            u'help_bannerLocalOnly',
            default=u"Display the banner in the current folder only"),
        required=False,
        default=False,
    )

    bannerStopAcquisition = schema.Bool(
        title=_(u"label_bannerStopAcquisition", default=(u"Stop Acquisition")),
        description=_(
            u'help_bannerStopAcquisition',
            default=
            u"Stop banners research to this folder and don't display banners in upper folders"
        ),
        required=False,
        default=True,
    )

    bannerImageLink = schema.Choice(
        title=_(u"label_bannerImageLink", default=u"A link for the banner"),
        source=PathSourceBinder(portal_type=['Document', 'Folder']))

    backgroundRepeat = schema.Choice(
        title=_(u"label_backgroundRepeat", default=u"Repeat the background"),
        values=['no-repeat', 'repeat-x', 'repeat-y', 'repeat'],
        required=True,
    )

    backgroundExtend = schema.Bool(
        title=_(u"label_backgroundExtend", default=u"Extend the background"),
        required=True,
        default=True,
    )

    backgroundFixed = schema.Bool(
        title=_(u"label_backgroundFixed", default=u"Fix the background"),
        required=True,
        default=True,
    )

    backgroundAlign = schema.Choice(
        title=_(u"label_backgroundAlign", default=u"Background alignment"),
        values=['left', 'center', 'right'],
    )
Example #5
0
class EnvironmentEdit(BaseEnvironmentForm):
    @button.buttonAndHandler(_('label_save'), name='apply')
    def handleApply(self, action):
        data, errors = self.extractData()
        changes = self.applyChanges(data)
        if changes:
            notify(zope.lifecycleevent.ObjectModifiedEvent(self.context))
            notify(
                event.EnvironmentModificationEvent(self.context,
                                                   self.interface,
                                                   self.interface))
            self.status = self.successMessage
        else:
            self.status = self.noChangesMessage
        extra = view_url(self.context)
        getToolByName(self.context, 'portal_css').cookResources()
        self.request.response.redirect('%s%s' %
                                       (self.context.absolute_url(), extra))

    @button.buttonAndHandler(_('label_cancel'), name='cancel')
    def handleCancel(self, action):
        self.request.RESPONSE.redirect(self.context.absolute_url())
Example #6
0
class EnvironmentFormCreation(BaseEnvironmentForm):

    actions = form.Actions()

    def update(self):
        marker.mark(self.context, self.marker)
        self.adapters = {
            self.interface: options.PropertyBag.makeinstance(self.interface),
            self.interface: options.PropertyBag.makeinstance(self.interface)
        }

        return super(BaseEnvironmentForm, self).update()

    @button.buttonAndHandler(_('label_enable'), name='activate')
    def activateEnvironment(self, action):
        data, errors = self.extractData()
        changes = self.applyChanges(data)
        notify(zope.lifecycleevent.ObjectModifiedEvent(self.context))
        notify(
            event.EnvironmentCreationEvent(self.context,
                                           self.adapters[self.interface],
                                           self.interface))

        # redirect to view

        translated_message = self.context.utranslate(
            u'Changes saved.', domain='plone').encode('utf-8')
        encoded_message = urlencode(
            {'portal_status_message': translated_message})
        extra = view_url(self.context)
        getToolByName(self.context, 'portal_css').cookResources()
        self.request.response.redirect(
            '%s%s?%s' % (self.context.absolute_url(), extra, encoded_message))

    @button.buttonAndHandler(_('label_cancel'), name='cancel')
    def handleCancel(self, action):
        marker.erase(self.context, self.marker)
        self.request.RESPONSE.redirect(self.context.absolute_url())