1
2
3
4
5
6
7
8
9
10
11
12
13
14 __doc__="""Report
15
16 Report represents a group of devices
17
18 $Id: Report.py,v 1.3 2004/04/06 02:19:04 edahl Exp $"""
19
20 __version__ = "$Revision: 1.3 $"[11:-2]
21
22 from urllib import quote
23
24 from Globals import InitializeClass
25 from AccessControl import ClassSecurityInfo
26
27 from Products.PageTemplates.ZopePageTemplate import ZopePageTemplate
28 from Products.PageTemplates.PageTemplateFile import PageTemplateFile
29
30 from ZenModelRM import ZenModelRM
31 from ZenPackable import ZenPackable
32
33 -def manage_addReport(context, id, title = None, text=None,
34 REQUEST = None, submit=None):
62
63
64 addReport = PageTemplateFile('www/reportAdd', globals(),
65 __name__='addReport')
66
67
68 -class Report(ZenModelRM, ZenPackable):
69 """Report object"""
70
71 __pychecker__ = 'no-override'
72
73 meta_type = 'Report'
74
75
76 description = ""
77
78 security = ClassSecurityInfo()
79
80 _relations = ZenPackable._relations
81
82 - def __init__(self, id, title = None, text=None, content_type='text/html'):
86
88 """Return our rendered template not our default page
89 """
90 if not 'args' in kwargs:
91 kwargs['args'] = args
92 template = self._template.__of__(self)
93 path_info = template.REQUEST['PATH_INFO'].replace(' ', '%20')
94 if (path_info.startswith('/zport/dmd/Reports') and
95 path_info not in template.REQUEST['HTTP_REFERER'] and
96 'adapt=false' not in template.REQUEST['QUERY_STRING']):
97 url = '/zport/dmd/reports#reporttree:'
98 url += path_info.replace('/', '.')
99 template.REQUEST['RESPONSE'].redirect(url)
100 return template.pt_render(extra_context={'options': kwargs})
101
102
107
108
109 - def manage_main(self):
110 """Return the ZMI edit page of our template not ourself
111 """
112 template = self._template.__of__(self)
113 return template.pt_editForm()
114 pt_editForm = manage_main
115
116
117 - def pt_editAction(self, REQUEST, title, text, content_type, expand):
122
123
124 InitializeClass(Report)
125