comparison MoinMoin/macro/SystemAdmin.py @ 0:77665d8e2254

tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0 (automatically generated log message) imported from: moin--main--1.5--base-0
author Thomas Waldmann <tw-public@gmx.de>
date Thu, 22 Sep 2005 15:09:50 +0000
parents
children 89d0a178964a
comparison
equal deleted inserted replaced
-1:000000000000 0:77665d8e2254
1 # -*- coding: iso-8859-1 -*-
2 """
3 MoinMoin - System Administration
4
5 Web interface to do MoinMoin system administration tasks.
6
7 @copyright: 2001, 2003 by Jürgen Hermann <jh@web.de>
8 @license: GNU GPL, see COPYING for details.
9 """
10
11 from MoinMoin import wikiutil
12 from MoinMoin.util import pysupport
13 from MoinMoin.userform import do_user_browser
14 from MoinMoin.action.AttachFile import do_admin_browser
15
16 Dependencies = ["time"]
17
18 def execute(macro, args):
19 _ = macro.request.getText
20
21 # do not show system admin to not admin users
22 if not macro.request.user.may.admin(macro.formatter.page.page_name):
23 return ''
24
25 result = []
26 _MENU = {
27 'attachments': (("File attachment browser"), do_admin_browser),
28 'users': (("User account browser"), do_user_browser),
29 }
30 choice = macro.request.form.get('sysadm', [None])[0]
31
32 # TODO: unfinished!
33 if 0:
34 result = wikiutil.link_tag(macro.request,
35 "?action=export", _("Download XML export of this wiki"))
36 if pysupport.isImportable('gzip'):
37 result += " [%s]" % wikiutil.link_tag(macro.request,
38 "?action=export&compression=gzip", "gzip")
39
40 # create menu
41 menuitems = [(label, id) for id, (label, handler) in _MENU.items()]
42 menuitems.sort()
43 for label, id in menuitems:
44 if id == choice:
45 result.append(macro.formatter.strong(1))
46 result.append(macro.formatter.text(label))
47 result.append(macro.formatter.strong(0))
48 else:
49 result.append(wikiutil.link_tag(macro.request,
50 "%s?sysadm=%s" % (macro.formatter.page.page_name, id), label))
51 result.append('<br>')
52 result.append('<br>')
53
54 # add chosen content
55 if _MENU.has_key(choice):
56 result.append(_MENU[choice][1](macro.request))
57
58 return macro.formatter.rawHTML(''.join(result))
59