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

# Source Code for Module Products.ZenModel.GraphReportClass

     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__="""GraphReportClass
    12
    13  GraphReportClass contain GraphReports.
    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.Utils import getDisplayType
    23  from Products.ZenUtils.deprecated import deprecated
    24  from Products.ZenModel.GraphReport import GraphReport
    25
    26  @deprecated
    27 -def manage_addGraphReportClass(context, id, title = None, REQUEST = None):
    28      """ Construct a new GraphReportclass
    29      """
    30      rc = GraphReportClass(id, title)
    31      context._setObject(rc.id, rc)
    32      if REQUEST is not None:
    33          audit('UI.ReportClass.Add', rc.id, title=title, organizer=context)
    34          messaging.IMessageSender(context).sendToBrowser(
    35              'Report Organizer Created',
    36              'Report organizer %s was created.' % id
    37          )
    38          REQUEST['RESPONSE'].redirect(context.absolute_url() + '/manage_main')
    39
    40  addGraphReportClass = DTMLFile('dtml/addGraphReportClass',globals())
    41
    42 -class GraphReportClass(ReportClass):
    43
    44      portal_type = meta_type = "GraphReportClass"
    45
    46      security = ClassSecurityInfo()
    47
    48 -    def getReportClass(self):
    49          """ Return the class to instantiate for new report classes
    50          """
    51          return GraphReportClass
    52
    53
    54      security.declareProtected('Manage DMD', 'manage_addGraphReport')
    55 -    def manage_addGraphReport(self, id, REQUEST=None):
    56          """Add a graph report to this object.
    57          """
    58          fr = GraphReport(id)
    59          self._setObject(id, fr)
    60          fr = self._getOb(id)
    61          if REQUEST:
    62              audit('UI.Report.Add', fr.id, reportType=getDisplayType(fr))
    63              url = '%s/%s/editGraphReport' % (self.getPrimaryUrlPath(),id)
    64              return REQUEST['RESPONSE'].redirect(url)
    65          return fr
    66
    67
    68  InitializeClass(GraphReportClass)
    69