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

# Source Code for Module Products.ZenModel.UserCommand

     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  from Globals import DTMLFile
    15  from Globals import InitializeClass
    16  from AccessControl import ClassSecurityInfo, Permissions
    17  from Products.ZenModel.ZenossSecurity import *
    18
    19  from ZenModelRM import ZenModelRM
    20  from Products.ZenRelations.RelSchema import *
    21  from ZenPackable import ZenPackable
    22
    23
    24  manage_addUserCommand = DTMLFile('dtml/addUserCommand',globals())
    25
    26
    27 -class UserCommand(ZenModelRM, ZenPackable):
    28
    29      meta_type = 'UserCommand'
    30
    31      security = ClassSecurityInfo()
    32
    33      description = ""
    34      command = ''
    35
    36      _properties = (
    37          {'id':'description', 'type':'text', 'mode':'w'},
    38          {'id':'command', 'type':'text', 'mode':'w'},
    39          )
    40
    41      _relations =  ZenPackable._relations + (
    42          ("commandable", ToOne(
    43                  ToManyCont, 'Products.ZenModel.Commandable', 'userCommands')),
    44          )
    45
    46
    47      # Screen action bindings (and tab definitions)
    48      factory_type_information = (
    49      {
    50          'immediate_view' : 'userCommandDetailNew',
    51          'actions'        :
    52          (
    53              {'id'            : 'overview',
    54               'name'          : 'User Command',
    55               'action'        : 'userCommandDetailNew',
    56               'permissions'   : ( Permissions.view, ),
    57              },
    58          )
    59      },
    60      )
    61
    62      security.declareProtected('View', 'breadCrumbs')
    63 -    def breadCrumbs(self, terminator='dmd'):
    64          """Return the breadcrumb links for this object
    65          [('url','id'), ...]
    66          """
    67          crumbs = super(UserCommand, self).breadCrumbs(terminator)
    68          aqParent = self.getPrimaryParent()
    69          while aqParent.meta_type == 'ToManyContRelationship':
    70              aqParent = aqParent.getPrimaryParent()
    71          url = aqParent.absolute_url_path() + '/dataRootManage'
    72          return [(url, 'Commands')]
    73
    74
    75  InitializeClass(UserCommand)
    76