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

# Source Code for Module Products.ZenModel.CustomDeviceReportClass

     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  __doc__='''CustomDeviceReportClass
    15
    16  CustomDeviceReportClass contain CustomDeviceReports.
    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_addCustomDeviceReportClass(context, id, title = None, REQUEST = None):
    27      ''' Construct a new CustomDeviceReportclass
    28      '''
    29      frc = CustomDeviceReportClass(id, title)
    30      context._setObject(id, frc)
    31      if REQUEST is not None:
    32          messaging.IMessageSender(context).sendToBrowser(
    33              'Report Organizer Added',
    34              'Custom report organizer %s has been created.' % id
    35          )
    36          return REQUEST['RESPONSE'].redirect(context.absolute_url() + '/manage_main')
    37
    38  addCustomDeviceReportClass = DTMLFile('dtml/addCustomDeviceReportClass',globals())
    39
    40 -class CustomDeviceReportClass(ReportClass):
    41
    42      portal_type = meta_type = "CustomDeviceReportClass"
    43
    44      security = ClassSecurityInfo()
    45
    46 -    def getReportClass(self):
    47          ''' Return the class to instantiate for new report classes
    48          '''
    49          return CustomDeviceReportClass
    50
    51
    52      security.declareProtected('Manage DMD', 'manage_addDeviceReport')
    53 -    def manage_addDeviceReport(self, id, REQUEST=None):
    54          """Add a report to this object.
    55          """
    56          from Products.ZenModel.DeviceReport import DeviceReport
    57          rpt = DeviceReport(id)
    58          self._setObject(rpt.id, rpt)
    59          rpt = self._getOb(rpt.id)
    60          if REQUEST:
    61              url = '%s/%s/editDeviceReport' % (self.getPrimaryUrlPath(), id)
    62              return REQUEST['RESPONSE'].redirect(url)
    63          return rpt
    64
    65
    66  InitializeClass(CustomDeviceReportClass)
    67