Package Products :: Package ZenModel :: Module ZenMenuItem
[hide private]
[frames] | no frames]

Source Code for Module Products.ZenModel.ZenMenuItem

 1  ########################################################################### 
 2  # 
 3  # This program is part of Zenoss Core, an open source monitoring platform. 
 4  # Copyright (C) 2007, Zenoss Inc. 
 5  # 
 6  # This program is free software; you can redistribute it and/or modify it 
 7  # under the terms of the GNU General Public License version 2 or (at your 
 8  # option) any later version as published by the Free Software Foundation. 
 9  # 
10  # For complete information please visit: http://www.zenoss.com/oss/ 
11  # 
12  ########################################################################### 
13   
14   
15  from Acquisition import aq_parent 
16  from Globals import InitializeClass 
17  from AccessControl import ClassSecurityInfo, Permissions 
18  from Products.ZenModel.ZenModelRM import ZenModelRM 
19  from Products.ZenModel.ZenPackable import ZenPackable 
20  from Products.ZenRelations.RelSchema import * 
21   
22  import logging 
23  log = logging.getLogger("zen.Menu") 
24   
25 -class ZenMenuItem(ZenModelRM, ZenPackable):
26 27 meta_type = 'ZenMenuItem' 28 security = ClassSecurityInfo() 29 description = "" 30 action = "" 31 permissions = (Permissions.view,) 32 isglobal = True 33 isdialog = False 34 banned_classes = () 35 allowed_classes = () 36 banned_ids = () 37 ordering = 0.0 38 39 _properties = ( 40 {'id':'description', 'type':'text', 'mode':'w'}, 41 {'id':'action', 'type':'text', 'mode':'w'}, 42 {'id':'isglobal', 'type':'boolean','mode':'w'}, 43 {'id':'permissions', 'type':'lines', 'mode':'w'}, 44 {'id':'banned_classes','type':'lines','mode':'w'}, 45 {'id':'allowed_classes','type':'lines','mode':'w'}, 46 {'id':'banned_ids','type':'lines','mode':'w'}, 47 {'id':'isdialog', 'type':'boolean','mode':'w'}, 48 {'id':'ordering', 'type':'float','mode':'w'}, 49 ) 50 51 _relations = ( 52 ("zenMenus", ToOne(ToManyCont, 'Products.ZenModel.ZenMenu', 'zenMenuItems')), 53 ) + ZenPackable._relations 54 55 security = ClassSecurityInfo() 56
57 - def getMenuItemOwner(self):
58 parent = self.primaryAq() 59 for unused in range(4): 60 parent = aq_parent(parent) 61 return parent
62
63 - def __cmp__(self, other):
64 if isinstance(other, ZenMenuItem): 65 if other and other.ordering: 66 return cmp(other.ordering, self.ordering) 67 else: 68 return cmp(0.0, self.ordering) 69 return cmp(id(self), id(other))
70 71 InitializeClass(ZenMenuItem) 72