diff options
Diffstat (limited to 'inc')
-rw-r--r-- | inc/actions.php | 17 | ||||
-rw-r--r-- | inc/html.php | 39 | ||||
-rw-r--r-- | inc/template.php | 32 |
3 files changed, 73 insertions, 15 deletions
diff --git a/inc/actions.php b/inc/actions.php index 3322a81aa..97374578c 100644 --- a/inc/actions.php +++ b/inc/actions.php @@ -70,10 +70,21 @@ function act_dispatch(){ //handle admin tasks if($ACT == 'admin'){ - if($_REQUEST['page'] == 'acl'){ - require_once(DOKU_INC.'inc/admin_acl.php'); - admin_acl_handler(); + // retrieve admin plugin name from $_REQUEST['page'] + if ($_REQUEST['page']) { + $pluginlist = plugin_list('admin'); + if (in_array($_REQUEST['page'], $pluginlist)) { + // attempt to load the plugin + if ($plugin =& plugin_load('admin',$_REQUEST['page']) !== NULL) + $plugin->handle(); + } + } +/* + if($_REQUEST['page'] == 'acl'){ + require_once(DOKU_INC.'inc/admin_acl.php'); + admin_acl_handler(); } +*/ } //call template FIXME: all needed vars available? diff --git a/inc/html.php b/inc/html.php index 478770d3b..8ec445248 100644 --- a/inc/html.php +++ b/inc/html.php @@ -1065,11 +1065,6 @@ function html_debug(){ print '</body></html>'; } -/** - * Print the admin overview page - * - * @author Andreas Gohr <andi@splitbrain.org> - */ function html_admin(){ global $ID; global $lang; @@ -1077,15 +1072,45 @@ function html_admin(){ print p_locale_xhtml('admin'); - ptln('<ul class="admin">'); + // build menu of admin functions from the plugins that handle them + $pluginlist = plugin_list('admin'); + $menu = array(); + foreach ($pluginlist as $p) { + if($obj =& plugin_load('admin',$p) === NULL) continue; + $menu[] = array('plugin' => $p, + 'prompt' => $obj->getMenuText($conf['lang']), + 'sort' => $obj->getMenuSort() + ); + } + + usort($menu, p_sort_modes); + + // output the menu + ptln('<ul>'); + + foreach ($menu as $item) { + if (!$item['prompt']) continue; + ptln(' <li><a href="'.wl($ID, 'do=admin&page='.$item['plugin']).'">'.$item['prompt'].'</a></li>'); + } + + // add in non-plugin functions + if (!$conf['openregister']){ + ptln('<li><a href="'.wl($ID,'do=register').'">'.$lang['admin_register'].'</a></li>'); + } + + ptln('</ul>'); + +/* + ptln('<ul>'); ptln('<ul class="admin">'); // currently ACL only - more to come ptln('<li><a href="'.wl($ID,'do=admin&page=acl').'">'.$lang['admin_acl'].'</a></li>'); if (!$conf['openregister']){ ptln('<li><a href="'.wl($ID,'do=register').'">'.$lang['admin_register'].'</a></li>'); } - + ptln('</ul>'); +*/ } diff --git a/inc/template.php b/inc/template.php index 518087e50..b033a82e0 100644 --- a/inc/template.php +++ b/inc/template.php @@ -129,13 +129,35 @@ function tpl_content(){ * @author Andreas Gohr <andi@splitbrain.org> */ function tpl_admin(){ + + $plugin = NULL; + if ($_REQUEST['page']) { + $pluginlist = plugin_list('admin'); + + if (in_array($_REQUEST['page'], $pluginlist)) { + + // attempt to load the plugin + $plugin =& plugin_load('admin',$_REQUEST['page']); + } + } + + if ($plugin !== NULL) + $plugin->html(); + else + html_admin(); +/* switch($_REQUEST['page']){ - case 'acl': - admin_acl_html(); - break; + case 'acl': + admin_acl_html(); + break; + case 'plugin': + require_once(DOKU_INC.'inc/admin_plugin.php'); + admin_plugin_html(); + break; default: - html_admin(); - } + html_admin(); + } +*/ } /** |