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 as published by
     8  # 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              { 'id'            : 'viewHistory',
    59                'name'          : 'Modifications',
    60                'action'        : 'viewNewHistory',
    61                'permissions'   : (ZEN_VIEW_MODIFICATIONS,),
    62              }
    63          )
    64      },
    65      )
    66
    67      security.declareProtected('View', 'breadCrumbs')
    68 -    def breadCrumbs(self, terminator='dmd'):
    69          """Return the breadcrumb links for this object
    70          [('url','id'), ...]
    71          """
    72          crumbs = super(UserCommand, self).breadCrumbs(terminator)
    73          aqParent = self.getPrimaryParent()
    74          while aqParent.meta_type == 'ToManyContRelationship':
    75              aqParent = aqParent.getPrimaryParent()
    76          url = aqParent.absolute_url_path() + '/dataRootManage'
    77          return [(url, 'Commands')]
    78
    79
    80  InitializeClass(UserCommand)
    81