Back to index

plone3  3.1.7
Public Member Functions | Static Public Attributes | Private Member Functions | Private Attributes | Static Private Attributes
CMFPlone.PloneControlPanel.PloneControlPanel Class Reference
Inheritance diagram for CMFPlone.PloneControlPanel.PloneControlPanel:
Inheritance graph
[legend]
Collaboration diagram for CMFPlone.PloneControlPanel.PloneControlPanel:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def __init__
def registerConfiglets
def getGroupIds
def getGroups
def enumConfiglets
def unregisterConfiglet
def unregisterApplication
def addAction
def manage_editActionsForm

Static Public Attributes

tuple security = ClassSecurityInfo()
string id = 'portal_controlpanel'
string title = 'Control Panel'
string toolicon = 'skins/plone_images/site_icon.gif'
 meta_type = ToolNames.ControlPanelTool
tuple manage_options
list groups

Private Member Functions

def _extractAction

Private Attributes

 _actions

Static Private Attributes

tuple __implements__
tuple _actions_form = DTMLFile( 'www/editPloneConfiglets', globals() )
tuple _properties

Detailed Description

Weave together the various sources of "actions" which
are apropos to the current user and context.

Definition at line 44 of file PloneControlPanel.py.


Constructor & Destructor Documentation

Definition at line 77 of file PloneControlPanel.py.

00077 
00078     def __init__(self, **kw):
00079         if kw:
00080             self.__dict__.update(**kw)
00081         if not self.__dict__.has_key('groups'):
00082             self.__dict__['groups'] = self.groups


Member Function Documentation

def CMFPlone.PloneControlPanel.PloneControlPanel._extractAction (   self,
  properties,
  index 
) [private]
Extract an ActionInformation from the funky form properties.

Definition at line 150 of file PloneControlPanel.py.

00150 
00151     def _extractAction( self, properties, index ):
00152         """ Extract an ActionInformation from the funky form properties.
00153         """
00154         id          = str( properties.get( 'id_%d'          % index, '' ) )
00155         name        = str( properties.get( 'name_%d'        % index, '' ) )
00156         action      = str( properties.get( 'action_%d'      % index, '' ) )
00157         condition   = str( properties.get( 'condition_%d'   % index, '' ) )
00158         category    = str( properties.get( 'category_%d'    % index, '' ))
00159         visible     =      properties.get( 'visible_%d'     % index, 0  )
00160         permissions =      properties.get( 'permission_%d'  % index, () )
00161         appId       =      properties.get( 'appId_%d'  % index, '' )
00162         description =      properties.get( 'description_%d'  % index, '' )
00163 
00164         if not name:
00165             raise ValueError('A name is required.')
00166 
00167         if action is not '':
00168             action = Expression( text=action )
00169 
00170         if condition is not '':
00171             condition = Expression( text=condition )
00172 
00173         if category == '':
00174             category = 'object'
00175 
00176         if type( visible ) is not type( 0 ):
00177             try:
00178                 visible = int( visible )
00179             except ValueError:
00180                 visible = 0
00181 
00182         if type( permissions ) is type( '' ):
00183             permissions = ( permissions, )
00184 
00185         return PloneConfiglet( id=id
00186                                 , title=name
00187                                 , action=action
00188                                 , condition=condition
00189                                 , permissions=permissions
00190                                 , category=category
00191                                 , visible=visible
00192                                 , appId = appId
00193                                 , description = description
                                )

Here is the call graph for this function:

def CMFPlone.PloneControlPanel.PloneControlPanel.addAction (   self,
  id,
  name,
  action,
  condition = '',
  permission = '',
  category = 'Plone',
  visible = 1,
  appId = None,
  imageUrl = None,
  description = '',
  REQUEST = None 
)
Add an action to our list.
    attention: must be called AFTER portal_actionicons is installed

Definition at line 207 of file PloneControlPanel.py.

00207 
00208                  ):
00209         """ Add an action to our list.
00210             attention: must be called AFTER portal_actionicons is installed
00211         """
00212         if not name:
00213             raise ValueError('A name is required.')
00214 
00215         a_expr = action and Expression(text=str(action)) or ''
00216         c_expr = condition and Expression(text=str(condition)) or ''
00217 
00218         if type( permission ) != type( () ):
00219             permission = permission and (str(permission),) or ()
00220 
00221         new_actions = self._cloneActions()
00222 
00223         new_action = PloneConfiglet( id=str(id)
00224                                       , title=str(name)
00225                                       , action=a_expr
00226                                       , condition=c_expr
00227                                       , permissions=permission
00228                                       , category=str(category)
00229                                       , visible=int(visible)
00230                                       , appId=appId
00231                                       , description=description
00232                                       )
00233 
00234         new_actions.append( new_action )
00235         self._actions = tuple( new_actions )
00236 
00237         if imageUrl:
00238             actionicons=getToolByName(self,'portal_actionicons')
00239             actionicons.addActionIcon('controlpanel', new_action.id,
00240                                       imageUrl, new_action.title)
00241 
00242 
00243         if REQUEST is not None:
00244             return self.manage_editActionsForm(
00245                 REQUEST, manage_tabs_message='Added.')

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 103 of file PloneControlPanel.py.

00103 
00104     def enumConfiglets(self, group=None):
00105         portal=getToolByName(self, 'portal_url').getPortalObject()
00106         mtool = getToolByName(self, 'portal_membership')
00107         context=createExprContext(self, portal, self)
00108         res = []
00109         for a in self.listActions():
00110             verified = 0
00111             for permission in a.permissions:
00112                 if _checkPermission(permission, portal):
00113                     verified = 1
00114             if verified and a.category==group and a.testCondition(context):
00115                 res.append(a.getAction(context))
00116         # Translate the title for sorting
00117         if getattr(self, 'REQUEST', None) is not None:
00118             for a in res:
00119                 a['title'] = translate(a['title'],
00120                                        domain='plone',
00121                                        context=self.REQUEST)
00122         def _title(v):
00123             return v['title']
00124         res.sort(key=_title)
00125         return res

Here is the call graph for this function:

def CMFPlone.PloneControlPanel.PloneControlPanel.getGroupIds (   self,
  category = '' 
)

Definition at line 92 of file PloneControlPanel.py.

00092 
00093     def getGroupIds(self, category=''):
00094         return [g.split('|')[1] for g in self.groups
00095                 if category=='' or g.split('|')[0]==category]

Here is the caller graph for this function:

def CMFPlone.PloneControlPanel.PloneControlPanel.getGroups (   self,
  category = '' 
)

Definition at line 97 of file PloneControlPanel.py.

00097 
00098     def getGroups(self,category=''):
00099         return [{'id':g.split('|')[1], 'title':g.split('|')[2]}
00100                 for g in self.groups
00101                 if category=='' or g.split('|')[0]==category]

Here is the caller graph for this function:

def CMFPlone.PloneControlPanel.PloneControlPanel.manage_editActionsForm (   self,
  REQUEST,
  manage_tabs_message = None 
)
Show the 'Actions' management tab.

Definition at line 249 of file PloneControlPanel.py.

00249 
00250     def manage_editActionsForm( self, REQUEST, manage_tabs_message=None ):
00251         """ Show the 'Actions' management tab.
00252         """
00253         actions = []
00254 
00255         for a in self.listActions():
00256 
00257             a1 = {}
00258             a1['id'] = a.getId()
00259             a1['name'] = a.Title()
00260             p = a.getPermissions()
00261             if p:
00262                 a1['permission'] = p[0]
00263             else:
00264                 a1['permission'] = ''
00265             a1['category'] = a.getCategory() or 'object'
00266             a1['visible'] = a.getVisibility()
00267             a1['action'] = a.getActionExpression()
00268             a1['condition'] = a.getCondition()
00269             a1['appId'] = a.getAppId()
00270             a1['description']=a.getDescription()
00271             actions.append(a1)
00272 
00273         # possible_permissions is in AccessControl.Role.RoleManager.
00274         pp = self.possible_permissions()
00275         return self._actions_form( self
00276                                  , REQUEST
00277                                  , actions=actions
00278                                  , possible_permissions=pp
00279                                  , management_view='Actions'
00280                                  , manage_tabs_message=manage_tabs_message
00281                                  )
00282 
00283 InitializeClass(PloneControlPanel)
00284 registerToolInterface('portal_controlpanel', IControlPanel)

Here is the call graph for this function:

ATTENTION: must be called AFTER portal_actionicons
is installed

Definition at line 84 of file PloneControlPanel.py.

00084 
00085     def registerConfiglets(self,configlets):
00086         """ ATTENTION: must be called AFTER portal_actionicons
00087         is installed
00088         """
00089         for conf in configlets:
00090             self.registerConfiglet(**conf)

Here is the call graph for this function:

Definition at line 138 of file PloneControlPanel.py.

00138 
00139     def unregisterApplication(self,appId):
00140         acts=list(self.listActions())
00141         selection=[acts.index(a) for a in acts if a.appId==appId]
00142         self.deleteActions(selection)
00143 
00144         actionicons=getToolByName(self,'portal_actionicons')
00145         for a in acts:
00146             if (a.appId == appId and
00147                 actionicons.queryActionInfo('controlpanel', a.id, None)):
00148                 actionicons.removeActionIcon('controlpanel', a.id)
00149 

Here is the call graph for this function:

Definition at line 127 of file PloneControlPanel.py.

00127 
00128     def unregisterConfiglet(self,id):
00129         actids= [o.id for o in self.listActions()]
00130         selection=[actids.index(a) for a in actids if a==id]
00131         self.deleteActions(selection)
00132 
00133         actionicons=getToolByName(self,'portal_actionicons')
00134         if actionicons.queryActionInfo('controlpanel', id, None):
00135             actionicons.removeActionIcon('controlpanel', id)
00136 

Here is the call graph for this function:


Member Data Documentation

Initial value:
(PloneBaseTool.__implements__,
                      z2IControlPanel,
                      ActionProviderBase.__implements__,
                      SimpleItem.__implements__, )

Definition at line 49 of file PloneControlPanel.py.

Definition at line 234 of file PloneControlPanel.py.

tuple CMFPlone.PloneControlPanel.PloneControlPanel._actions_form = DTMLFile( 'www/editPloneConfiglets', globals() ) [static, private]

Definition at line 62 of file PloneControlPanel.py.

Initial value:
(
        {'id':'groups','type':'lines'},
    )

Definition at line 64 of file PloneControlPanel.py.

Initial value:
['member|Member|My Preferences',
              'site|Plone|Plone Configuration',
              'site|Products|Add-on Product Configuration']

Definition at line 72 of file PloneControlPanel.py.

string CMFPlone.PloneControlPanel.PloneControlPanel.id = 'portal_controlpanel' [static]

Definition at line 58 of file PloneControlPanel.py.

Initial value:
(ActionProviderBase.manage_options +
                      PropertyManager.manage_options)

Definition at line 68 of file PloneControlPanel.py.

Definition at line 61 of file PloneControlPanel.py.

tuple CMFPlone.PloneControlPanel.PloneControlPanel.security = ClassSecurityInfo() [static]

Definition at line 56 of file PloneControlPanel.py.

string CMFPlone.PloneControlPanel.PloneControlPanel.title = 'Control Panel' [static]

Definition at line 59 of file PloneControlPanel.py.

string CMFPlone.PloneControlPanel.PloneControlPanel.toolicon = 'skins/plone_images/site_icon.gif' [static]

Definition at line 60 of file PloneControlPanel.py.


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