comparison MoinMoin/macro/SystemAdmin.py @ 363:89d0a178964a 1.5.0

1.5.0 release final changes: updated docs, i18n, underlay, interwiki. fixed SystemAdmin macro to use cfg.superuser. imported from: moin--main--1.5--patch-367
author Thomas Waldmann <tw@waldmann-edv.de>
date Sat, 07 Jan 2006 15:45:31 +0000
parents 77665d8e2254
children 45924beef130
comparison
equal deleted inserted replaced
362:a0a8f3a499fd 363:89d0a178964a
15 15
16 Dependencies = ["time"] 16 Dependencies = ["time"]
17 17
18 def execute(macro, args): 18 def execute(macro, args):
19 _ = macro.request.getText 19 _ = macro.request.getText
20 20 request = macro.request
21 # do not show system admin to not admin users 21
22 if not macro.request.user.may.admin(macro.formatter.page.page_name): 22 # do not show system admin to users not in superuser list
23 if not request.user.name in request.cfg.superuser:
23 return '' 24 return ''
24 25
25 result = [] 26 result = []
26 _MENU = { 27 _MENU = {
27 'attachments': (("File attachment browser"), do_admin_browser), 28 'attachments': (("File attachment browser"), do_admin_browser),
28 'users': (("User account browser"), do_user_browser), 29 'users': (("User account browser"), do_user_browser),
29 } 30 }
30 choice = macro.request.form.get('sysadm', [None])[0] 31 choice = request.form.get('sysadm', [None])[0]
31 32
32 # TODO: unfinished! 33 # TODO: unfinished!
33 if 0: 34 if 0:
34 result = wikiutil.link_tag(macro.request, 35 result = wikiutil.link_tag(request, "?action=export", _("Download XML export of this wiki"))
35 "?action=export", _("Download XML export of this wiki"))
36 if pysupport.isImportable('gzip'): 36 if pysupport.isImportable('gzip'):
37 result += " [%s]" % wikiutil.link_tag(macro.request, 37 result += " [%s]" % wikiutil.link_tag(request, "?action=export&compression=gzip", "gzip")
38 "?action=export&compression=gzip", "gzip")
39 38
40 # create menu 39 # create menu
41 menuitems = [(label, id) for id, (label, handler) in _MENU.items()] 40 menuitems = [(label, id) for id, (label, handler) in _MENU.items()]
42 menuitems.sort() 41 menuitems.sort()
43 for label, id in menuitems: 42 for label, id in menuitems:
44 if id == choice: 43 if id == choice:
45 result.append(macro.formatter.strong(1)) 44 result.append(macro.formatter.strong(1))
46 result.append(macro.formatter.text(label)) 45 result.append(macro.formatter.text(label))
47 result.append(macro.formatter.strong(0)) 46 result.append(macro.formatter.strong(0))
48 else: 47 else:
49 result.append(wikiutil.link_tag(macro.request, 48 result.append(wikiutil.link_tag(request, "%s?sysadm=%s" % (macro.formatter.page.page_name, id), label))
50 "%s?sysadm=%s" % (macro.formatter.page.page_name, id), label))
51 result.append('<br>') 49 result.append('<br>')
52 result.append('<br>') 50 result.append('<br>')
53 51
54 # add chosen content 52 # add chosen content
55 if _MENU.has_key(choice): 53 if _MENU.has_key(choice):
56 result.append(_MENU[choice][1](macro.request)) 54 result.append(_MENU[choice][1](request))
57 55
58 return macro.formatter.rawHTML(''.join(result)) 56 return macro.formatter.rawHTML(''.join(result))
59 57