Skip to content

Commit

Permalink
Add a control panel and role based notification setting
Browse files Browse the repository at this point in the history
  • Loading branch information
izak committed Oct 23, 2011
1 parent 36ed0d8 commit a6ef57f
Show file tree
Hide file tree
Showing 6 changed files with 58 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/slc/stickystatusmessages/browser/configure.zcml
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,11 @@
allowed_interface=".interfaces.IAJAXView"
/>

<browser:page
for="Products.CMFPlone.interfaces.IPloneSiteRoot"
name="stickystatusmessages-settings"
class=".views.StickyStatusMessagesControlPanel"
permission="cmf.ManagePortal"
/>

</configure>
13 changes: 13 additions & 0 deletions src/slc/stickystatusmessages/browser/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,13 @@
from Products.Five.browser.pagetemplatefile import ViewPageTemplateFile
from Products.CMFCore.utils import getToolByName
from plone.app.layout.viewlets.common import ViewletBase
from plone.app.registry.browser.controlpanel import RegistryEditForm
from plone.app.registry.browser.controlpanel import ControlPanelFormWrapper
from slc.stickystatusmessages.config import SSMKEY
from interfaces import IStickyStatusMessagesViewlet
from interfaces import IAJAXView
from slc.stickystatusmessages.interfaces import IStickyStatusMessagesSettings
from slc.stickystatusmessages import StickyStatusMessageFactory as _

class StickyStatusMessagesViewlet(ViewletBase):
""" """
Expand Down Expand Up @@ -59,3 +63,12 @@ def delete_message(self, message_id):
del ssm[message_id]
annotations[SSMKEY] = ssm


class StickyStatusMessagesSettings(RegistryEditForm):
schema = IStickyStatusMessagesSettings
label = _(u"Sticky Status Message Settings")
description = _(u"Use the settings below to configure "
u"slc.stickystatusmessages for this site")

class StickyStatusMessagesControlPanel(ControlPanelFormWrapper):
form = StickyStatusMessagesSettings
1 change: 1 addition & 0 deletions src/slc/stickystatusmessages/configure.zcml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
xmlns:five="http://namespaces.zope.org/five"
i18n_domain="slc.stickystatusmessages">

<include package="plone.app.registry" />
<include package=".browser" />

<genericsetup:registerProfile
Expand Down
12 changes: 12 additions & 0 deletions src/slc/stickystatusmessages/interfaces.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
from zope.schema import Bool
from zope.interface import Interface
from slc.stickystatusmessages import StickyStatusMessageFactory as _

class IStickyStatusMessagesLayer(Interface):
"""Marker Interface used by as BrowserLayer
"""

class IStickyStatusMessagesSettings(Interface):
""" Interface class that describes settings for plone.app.registry. """
rolebased = Bool(
title=_(u"Role Based Status Messages"),
description=_(u"Use this option to enable or disable role based "
u"status messages."),
required=True,
default=True,
)
21 changes: 21 additions & 0 deletions src/slc/stickystatusmessages/profiles/default/controlpanel.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?xml version="1.0"?>
<object
name="portal_controlpanel"
xmlns:i18n="http://xml.zope.org/namespaces/i18n"
i18n:domain="slc.stickystatusmessages"
purge="False">

<configlet
title="Sticky Status Messages"
action_id="stickystatusmessages"
appId="slc.stickystatusmessages"
category="Products"
condition_expr=""
url_expr="string:${portal_url}/@@stickystatusmessages-settings"
icon_expr="string:${portal_url}/maintenance_icon.png"
visible="True"
i18n:attributes="title">
<permission>Manage portal</permission>
</configlet>

</object>
4 changes: 4 additions & 0 deletions src/slc/stickystatusmessages/profiles/default/registry.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0"?>
<registry>
<records interface="slc.stickystatusmessages.interfaces.IStickyStatusMessagesSettings" />
</registry>

0 comments on commit a6ef57f

Please sign in to comment.