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

# Source Code for Module Products.ZenModel.DeviceReportClass

     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  __doc__='''DeviceReportClass
    15
    16  DeviceReportClass contain DeviceReports.
    17  '''
    18
    19  from AccessControl import ClassSecurityInfo
    20  from Globals import DTMLFile
    21  from ReportClass import ReportClass
    22  from Globals import InitializeClass
    23  from Products.ZenWidgets import messaging
    24
    25
    26 -def manage_addDeviceReportClass(context, id, title = None, REQUEST = None):
    27      ''' Construct a new DeviceReportclass
    28      '''
    29      frc = DeviceReportClass(id, title)
    30      context._setObject(id, frc)
    31      if REQUEST is not None:
    32          messaging.IMessageSender(context).sendToBrowser(
    33              'Organizer Created',
    34              'Device report organizer %s was created.' % id
    35          )
    36          return REQUEST['RESPONSE'].redirect(
    37              context.absolute_url() + '/manage_main')
    38
    39  addDeviceReportClass = DTMLFile('dtml/addDeviceReportClass',globals())
    40
    41
    42 -class DeviceReportClass(ReportClass):
    43
    44      portal_type = meta_type = "DeviceReportClass"
    45
    46      security = ClassSecurityInfo()
    47
    48 -    def getReportClass(self):
    49          ''' Return the class to instantiate for new report classes
    50          '''
    51          return DeviceReportClass
    52
    53
    54      security.declareProtected('Manage DMD', 'manage_addDeviceReport')
    55 -    def manage_addDeviceReport(self, id, REQUEST=None):
    56          """Add an MultiGraph report to this object.
    57          """
    58          from Products.ZenModel.DeviceReport import DeviceReport
    59          fr = DeviceReport(id)
    60          self._setObject(id, fr)
    61          fr = self._getOb(id)
    62          if REQUEST:
    63              url = '%s/%s/editDeviceReport' % (self.getPrimaryUrlPath(), id)
    64              return REQUEST['RESPONSE'].redirect(url)
    65          return fr
    66
    67
    68  InitializeClass(DeviceReportClass)
    69