view MoinMoin/macro/ @ 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 <>
date Sat, 07 Jan 2006 15:45:31 +0000
parents 77665d8e2254
children 45924beef130
line wrap: on
line source
# -*- coding: iso-8859-1 -*-
    MoinMoin - System Administration

    Web interface to do MoinMoin system administration tasks.

    @copyright: 2001, 2003 by Jürgen Hermann <>
    @license: GNU GPL, see COPYING for details.

from MoinMoin import wikiutil
from MoinMoin.util import pysupport
from MoinMoin.userform import do_user_browser
from MoinMoin.action.AttachFile import do_admin_browser

Dependencies = ["time"]

def execute(macro, args):
    _ = macro.request.getText
    request = macro.request
    # do not show system admin to users not in superuser list
    if not in request.cfg.superuser:
        return ''

    result = []
    _MENU = {
        'attachments': (("File attachment browser"), do_admin_browser),
        'users': (("User account browser"), do_user_browser),
    choice = request.form.get('sysadm', [None])[0]

    # TODO: unfinished!
    if 0:
        result = wikiutil.link_tag(request, "?action=export", _("Download XML export of this wiki"))
        if pysupport.isImportable('gzip'):
            result += " [%s]" % wikiutil.link_tag(request, "?action=export&compression=gzip", "gzip")

    # create menu
    menuitems = [(label, id) for id, (label, handler) in _MENU.items()]
    for label, id in menuitems:
        if id == choice:
            result.append(wikiutil.link_tag(request, "%s?sysadm=%s" % (, id), label))

    # add chosen content
    if _MENU.has_key(choice):

    return macro.formatter.rawHTML(''.join(result))