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

# Source Code for Module Products.ZenModel.CustomDeviceReportClass

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