Back to index

plone3  3.1.7
Public Member Functions | Static Public Attributes | Private Member Functions
plone.app.contentrules.browser.controlpanel.ContentRulesControlPanel Class Reference
Inheritance diagram for plone.app.contentrules.browser.controlpanel.ContentRulesControlPanel:
Inheritance graph
[legend]
Collaboration diagram for plone.app.contentrules.browser.controlpanel.ContentRulesControlPanel:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def __call__
def globally_enabled
def registeredRules
def ruleTypesToShow

Static Public Attributes

tuple template = ViewPageTemplateFile('templates/controlpanel.pt')

Private Member Functions

def _rulesByState
def _rulesByTrigger
def _getRules
def _events

Detailed Description

Manage rules in a the global rules container

Definition at line 12 of file controlpanel.py.


Member Function Documentation

Definition at line 18 of file controlpanel.py.

00018 
00019     def __call__(self):
00020         form = self.request.form
00021         ruleIds = form.get('ruleId', [])
00022         storage = getUtility(IRuleStorage)
00023         if form.get('form.button.SaveSettings', None) is not None:
00024             storage.active = form.get('global_enable', True)
00025         elif form.get('form.button.EnableRule', None) is not None:
00026             for r in ruleIds:
00027                 if r in storage:
00028                     storage[r].enabled = True
00029         elif form.get('form.button.DisableRule', None) is not None:
00030             for r in ruleIds:
00031                 if r in storage:
00032                     storage[r].enabled = False
00033         elif form.get('form.button.DeleteRule', None) is not None:
00034             for r in ruleIds:
00035                 if r in storage:
00036                     del storage[r]
00037         return self.template()

Here is the caller graph for this function:

Definition at line 86 of file controlpanel.py.

00086 
00087     def _events(self):
00088         eventsFactory = getUtility(IVocabularyFactory, name="plone.contentrules.events")
        return eventsFactory(self.context)

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 81 of file controlpanel.py.

00081 
00082     def _getRules(self):
00083         storage = getUtility(IRuleStorage)
00084         return storage.values()
        

Here is the caller graph for this function:

Definition at line 75 of file controlpanel.py.

00075 
00076     def _rulesByState(self, state):
00077         return [r for r in self._getRules() if r.enabled == state]
        

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 78 of file controlpanel.py.

00078 
00079     def _rulesByTrigger(self, trigger):
00080         return [r for r in self._getRules() if r.event.__identifier__ == trigger]
        

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 38 of file controlpanel.py.

00038 
00039     def globally_enabled(self):
00040         storage = getUtility(IRuleStorage)
00041         return storage.active 

Definition at line 42 of file controlpanel.py.

00042 
00043     def registeredRules(self):
00044         selector = self.request.get('ruleType', 'all')
00045         rules = []
00046         if selector.startswith('state-'):
00047             rules = self._rulesByState(selector[6:] == 'enabled')
00048         elif selector.startswith('trigger-'):
00049             rules = self._rulesByTrigger(selector[8:])
00050         else:
00051             rules = self._getRules()
00052         events = dict([(e.value, e.token) for e in self._events()])
00053         info = []
00054         for r in rules:
00055             info.append(dict(id = r.__name__,
00056                         title = r.title,
00057                         description = r.description,
00058                         enabled = r.enabled,
00059                         trigger = events[r.event]))
00060         return info
     

Here is the call graph for this function:

Definition at line 61 of file controlpanel.py.

00061 
00062     def ruleTypesToShow(self):
00063         selector = []
00064         for event in self._events():
00065             selector.append(dict(id = "trigger-" + event.value.__identifier__,
00066                                  title = _(u"Trigger: ${name}", mapping = {'name' : event.token})),)
00067                                  
00068         selector += ({'id': 'state-enabled', 'title': _(u"label_rule_enabled", default=u"Enabled")},
00069                      {'id': 'state-disabled', 'title': _(u"label_rule_disabled", default=u"Disabled"),},
00070                      # {'id': 'state-rule-assigned', 'title': _(u"Rule is in use")},
00071                      # {'id': 'state-rule-not-assigned', 'title': _(u"Rule is not assigned anywhere"),},
00072                      )
00073         
00074         return selector
        

Here is the call graph for this function:


Member Data Documentation

tuple plone.app.contentrules.browser.controlpanel.ContentRulesControlPanel.template = ViewPageTemplateFile('templates/controlpanel.pt') [static]

Definition at line 16 of file controlpanel.py.


The documentation for this class was generated from the following file: