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

Source Code for Module 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 ZenossSecurity import ZEN_MANAGE_DMD 
23  from Globals import InitializeClass 
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 REQUEST['message'] = "Report organizer created" 33 return REQUEST['RESPONSE'].redirect(context.absolute_url() + '/manage_main')
34 35 addCustomDeviceReportClass = DTMLFile('dtml/addCustomDeviceReportClass',globals()) 36
37 -class CustomDeviceReportClass(ReportClass):
38 39 portal_type = meta_type = "CustomDeviceReportClass" 40 41 security = ClassSecurityInfo() 42
43 - def getReportClass(self):
44 ''' Return the class to instantiate for new report classes 45 ''' 46 return CustomDeviceReportClass
47 48 49 security.declareProtected('Manage DMD', 'manage_addDeviceReport')
50 - def manage_addDeviceReport(self, id, REQUEST=None):
51 """Add a report to this object. 52 """ 53 from Products.ZenModel.DeviceReport import DeviceReport 54 rpt = DeviceReport(id) 55 self._setObject(rpt.id, rpt) 56 rpt = self._getOb(rpt.id) 57 if REQUEST: 58 url = '%s/%s/editDeviceReport' % (self.getPrimaryUrlPath(), id) 59 return REQUEST['RESPONSE'].redirect(url) 60 return rpt
61 62 63 InitializeClass(CustomDeviceReportClass) 64