Пример #1
0
class DanceFloorExtender(object):
    component.adapts(IDanceFloor)
    interface.implements(IOrderableSchemaExtender, IBrowserLayerAwareExtender)
    layer = IDanceFloorLayer

    fields = [
        InterfaceMarkerField(
            "dancefloor_enabled",
            schemata="settings",
            default=False,
            widget=BooleanWidget(
                label=_("Enable local newsletter functionality"))),
    ]

    def __init__(self, context):
        self.context = context

    def getFields(self):
        return self.fields

    def getOrder(self, schematas):
        """ Manipulate the order in which fields appear.
        @param schematas: Dictonary of schemata name -> field lists
        @return: Dictionary of reordered field lists per schemata.
        """

        return schematas
Пример #2
0
class ChannelAdministrationView(channel.ChannelAdministrationView):
    __call__ = ViewPageTemplateFile('controlpanel.pt')
    label = _(u'Local channel administration')
    back_link = back_to_newsletter

    def contents(self):
        # use LocalManageChannelsForm to show local channels only
        # A call to 'switch_on' is required before we can render z3c.forms.
        z2.switch_on(self)
        return LocalManageChannelsForm(self.context.channels, self.request)()
 def getGlobalChannels(self):
     portal_newsletter=getToolByName(self.context,'portal_newsletters')
     global_channels=portal_newsletter.channels
     if not global_channels:
         return {}
     subscribeable_channels=[]
     for channel in global_channels.keys():
         if global_channels[channel].subscribeable:
             subscribeable_channels.append(global_channels[channel])
     if not subscribeable_channels:
         return {}
     return {'title':_("Global Newsletters"),
             'link':portal_newsletter.absolute_url(),
             'channels':subscribeable_channels}
 def getGlobalChannels(self):
     portal_newsletter = getToolByName(self.context, "portal_newsletters")
     global_channels = portal_newsletter.channels
     if not global_channels:
         return {}
     subscribeable_channels = []
     for channel in global_channels.keys():
         if global_channels[channel].subscribeable:
             subscribeable_channels.append(global_channels[channel])
     if not subscribeable_channels:
         return {}
     return {
         "title": _("Global Newsletters"),
         "link": portal_newsletter.absolute_url(),
         "channels": subscribeable_channels,
     }
Пример #5
0
def back_to_newsletter(self):
    root = get_site()
    return dict(label=_(u"Up to Local Singing & Dancing configuration"),
                url=root.absolute_url() + '/newsletter_administration_view')
Пример #6
0
class CollectorAdministrationView(collector.CollectorAdministrationView):
    __call__ = ViewPageTemplateFile('controlpanel.pt')
    label = _(u'Local collector administration')
    back_link = back_to_newsletter


class ChannelStatsForm(stats.StatsForm):
    def get_items(self):
        util = component.getUtility(IChannelLookup)
        return [(channel.name, stats.ChannelStatistics(channel)) 
                for channel in util()]

ChannelStatsView = layout.wrap_form(
    ChannelStatsForm,
    index=ViewPageTemplateFile('controlpanel.pt'),
    label = _(u"Local newsletter statistics"),
    back_link = back_to_newsletter)



class NewsletterAvailableCondition(BrowserView):
    """ Returns True or False depending on whether the current context is a
    local newsletter aware
    """

    @property
    def _action_condition(self):
        context = self.context
        return IDanceFloorParty.providedBy(context)

    def __call__(self):
Пример #7
0
class CollectorAdministrationView(collector.CollectorAdministrationView):
    __call__ = ViewPageTemplateFile('controlpanel.pt')
    label = _(u'Local collector administration')
    back_link = back_to_newsletter
Пример #8
0
class ControlPanelView(BrowserView):
    __call__ = ViewPageTemplateFile('controlpanel.pt')
    contents = ViewPageTemplateFile('controlpanel-links.pt')
    label = _(u"Local Singing & Dancing configuration")
Пример #9
0
def back_to_newsletter(self):
    root = get_site()
    return dict(label=_(u"Up to Local Singing & Dancing configuration"),
                url=root.absolute_url() + '/newsletter_administration_view')
Пример #10
0
    __call__ = ViewPageTemplateFile('controlpanel.pt')
    label = _(u'Local collector administration')
    back_link = back_to_newsletter


class ChannelStatsForm(stats.StatsForm):
    def get_items(self):
        util = component.getUtility(IChannelLookup)
        return [(channel.name, stats.ChannelStatistics(channel))
                for channel in util()]


ChannelStatsView = layout.wrap_form(
    ChannelStatsForm,
    index=ViewPageTemplateFile('controlpanel.pt'),
    label=_(u"Local newsletter statistics"),
    back_link=back_to_newsletter)


class NewsletterAvailableCondition(BrowserView):
    """ Returns True or False depending on whether the current context is a
    local newsletter aware
    """
    @property
    def _action_condition(self):
        context = self.context
        return IDanceFloorParty.providedBy(context)

    def __call__(self):
        return self._action_condition
Пример #11
0
class LocalNewsletterManagerRole(object):
    implements(ISharingPageRole)
    
    title = _(u"title_local_newsletter_manager", default="Manage Local Newsletters")
    required_permission = config.DelegateLocalNewsletterManager