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

# Source Code for Module Products.ZenModel.DeviceReportClass

     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__='''DeviceReportClass
    12
    13  DeviceReportClass contain DeviceReports.
    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.ZenMessaging.audit import audit
    22  from Products.ZenUtils.deprecated import deprecated
    23  from Products.ZenUtils.Utils import getDisplayType
    24
    25  @deprecated
    26 -def manage_addDeviceReportClass(context, id, title = None, REQUEST = None):
    27      """
    28      Construct a new DeviceReportclass
    29      """
    30      frc = DeviceReportClass(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              'Organizer Created',
    36              'Device report organizer %s was created.' % id
    37          )
    38          return REQUEST['RESPONSE'].redirect(
    39              context.absolute_url() + '/manage_main')
    40
    41  addDeviceReportClass = DTMLFile('dtml/addDeviceReportClass',globals())
    42
    43
    44 -class DeviceReportClass(ReportClass):
    45
    46      portal_type = meta_type = "DeviceReportClass"
    47
    48      security = ClassSecurityInfo()
    49
    50 -    def getReportClass(self):
    51          ''' Return the class to instantiate for new report classes
    52          '''
    53          return DeviceReportClass
    54
    55
    56      security.declareProtected('Manage DMD', 'manage_addDeviceReport')
    57      @deprecated
    58 -    def manage_addDeviceReport(self, id, REQUEST=None):
    59          """Add a report to this object.
    60          """
    61          from Products.ZenModel.DeviceReport import DeviceReport
    62          fr = DeviceReport(id)
    63          self._setObject(id, fr)
    64          fr = self._getOb(id)
    65          if REQUEST:
    66              audit('UI.Report.Add', fr.id, reportType=getDisplayType(fr))
    67              url = '%s/%s/editDeviceReport' % (self.getPrimaryUrlPath(), id)
    68              return REQUEST['RESPONSE'].redirect(url)
    69          return fr
    70
    71
    72  InitializeClass(DeviceReportClass)
    73