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

# Source Code for Module Products.ZenModel.UserCommand

     1  ##############################################################################
     2  #
     3  # Copyright (C) Zenoss, Inc. 2007, all rights reserved.
     4  #
     5  # This content is made available according to terms specified in
     6  # License.zenoss under the directory where your Zenoss product is installed.
     7  #
     8  ##############################################################################
     9
    10
    11  from Globals import DTMLFile
    12  from Globals import InitializeClass
    13  from AccessControl import ClassSecurityInfo, Permissions
    14  from Products.ZenModel.ZenossSecurity import *
    15
    16  from ZenModelRM import ZenModelRM
    17  from Products.ZenRelations.RelSchema import *
    18  from ZenPackable import ZenPackable
    19
    20
    21  manage_addUserCommand = DTMLFile('dtml/addUserCommand',globals())
    22
    23
    24 -class UserCommand(ZenModelRM, ZenPackable):
    25
    26      meta_type = 'UserCommand'
    27
    28      security = ClassSecurityInfo()
    29
    30      description = ""
    31      command = ''
    32
    33      _properties = (
    34          {'id':'description', 'type':'text', 'mode':'w'},
    35          {'id':'command', 'type':'text', 'mode':'w'},
    36          )
    37
    38      _relations =  ZenPackable._relations + (
    39          ("commandable", ToOne(
    40                  ToManyCont, 'Products.ZenModel.Commandable', 'userCommands')),
    41          )
    42
    43
    44      # Screen action bindings (and tab definitions)
    45      factory_type_information = (
    46      {
    47          'immediate_view' : 'userCommandDetailNew',
    48          'actions'        :
    49          (
    50              {'id'            : 'overview',
    51               'name'          : 'User Command',
    52               'action'        : 'userCommandDetailNew',
    53               'permissions'   : ( Permissions.view, ),
    54              },
    55          )
    56      },
    57      )
    58
    59      security.declareProtected('View', 'breadCrumbs')
    60 -    def breadCrumbs(self, terminator='dmd'):
    61          """Return the breadcrumb links for this object
    62          [('url','id'), ...]
    63          """
    64          crumbs = super(UserCommand, self).breadCrumbs(terminator)
    65          aqParent = self.getPrimaryParent()
    66          while aqParent.meta_type == 'ToManyContRelationship':
    67              aqParent = aqParent.getPrimaryParent()
    68          url = aqParent.absolute_url_path() + '/dataRootManage'
    69          return [(url, 'Commands')]
    70
    71
    72  InitializeClass(UserCommand)
    73