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

# Source Code for Module Products.ZenModel.MultiGraphReportClass

     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__='''MultiGraphReportClass
    15
    16  MultiGraphReportClass contain MultiGraphReports.
    17  '''
    18
    19  from AccessControl import ClassSecurityInfo
    20  from Globals import DTMLFile
    21  from ReportClass import ReportClass
    22  from Products.ZenRelations.RelSchema import *
    23  from Globals import InitializeClass
    24  from Products.ZenWidgets import messaging
    25
    26
    27 -def manage_addMultiGraphReportClass(context, id, title = None, REQUEST = None):
    28      ''' Construct a new MultiGraphreportclass
    29      '''
    30      frc = MultiGraphReportClass(id, title)
    31      context._setObject(id, frc)
    32      if REQUEST is not None:
    33          messaging.IMessageSender(self).sendToBrowser(
    34              'Organizer Created',
    35              'Report organizer %s was created.' % id
    36          )
    37          REQUEST['RESPONSE'].redirect(context.absolute_url() + '/manage_main')
    38
    39  addMultiGraphReportClass = DTMLFile('dtml/addMultiGraphReportClass',globals())
    40
    41 -class MultiGraphReportClass(ReportClass):
    42
    43      portal_type = meta_type = "MultiGraphReportClass"
    44
    45      # Remove this relationship after version 2.1
    46      _relations = ReportClass._relations +  (
    47          ('graphDefs',
    48              ToManyCont(ToOne, 'Products.ZenModel.GraphDefinition', 'reportClass')),
    49          )
    50
    51      security = ClassSecurityInfo()
    52
    53 -    def getReportClass(self):
    54          ''' Return the class to instantiate for new report classes
    55          '''
    56          return MultiGraphReportClass
    57
    58
    59      security.declareProtected('Manage DMD', 'manage_addMultiGraphReport')
    60 -    def manage_addMultiGraphReport(self, id, REQUEST=None):
    61          """Add an MultiGraph report to this object.
    62          """
    63          from Products.ZenModel.MultiGraphReport import MultiGraphReport
    64          fr = MultiGraphReport(id)
    65          self._setObject(id, fr)
    66          if REQUEST:
    67              url = '%s/%s/editMultiGraphReport' % (self.getPrimaryUrlPath(), id)
    68              return REQUEST['RESPONSE'].redirect(url)
    69          return self._getOb(id)
    70
    71
    72  InitializeClass(MultiGraphReportClass)
    73