-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path_admin.py
More file actions
57 lines (47 loc) · 1.75 KB
/
_admin.py
File metadata and controls
57 lines (47 loc) · 1.75 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
"""CGIWrapper main admin script."""
from time import time, localtime, gmtime, asctime
from WebUtils.Funcs import urlEncode
from AdminPage import AdminPage
class Page(AdminPage):
"""CGIWrapper main administration page."""
def title(self):
return 'Admin'
def writeBody(self):
curTime = time()
self.writeln('''
<table align="center" cellspacing="2" cellpadding="2" border="0">
<tr><th>Version:</th><td>%s</td></tr>
<tr><th>Local time:</th><td>%s</td></tr>
<tr><th>Global time:</th><td>%s</td></tr>
</table>''' % (self._wrapper.version(),
asctime(localtime(curTime)), asctime(gmtime(curTime))))
self.startMenu()
self.menuItem('Script log contents', '_dumpCSV?filename=%s'
% urlEncode(self._wrapper.setting('ScriptLogFilename')))
self.menuItem('Error log contents', '_dumpErrors?filename=%s'
% urlEncode(self._wrapper.setting('ErrorLogFilename')))
self.menuItem('Show config', '_showConfig')
self.endMenu()
self.writeln('''
<!--
begin-parse
{
'Version': %r,
'LocalTime': %r,
'GlobalTime': %r
}
end-parse
-->''' % (self._wrapper.version(), localtime(curTime), gmtime(curTime)))
def startMenu(self):
self.write('''
<div style="font-size:12pt;font-family:Arial,Helvetica,sans-serif">
<table align="center" border="0" cellspacing="2" cellpadding="2" bgcolor="#E8E8F0">
<tr bgcolor="#101040"><th align="center" style="color:white">Menu</th></tr>''')
def menuItem(self, title, url):
self.write('''
<tr><td align="center"><a href="%s">%s</a></td></tr>'''
% (url, title))
def endMenu(self):
self.writeln('''
</table>
</div>''')