From 4fb6df0a766acbcad5c1f1ff6d88bbf90e720bf9 Mon Sep 17 00:00:00 2001 From: quix0r Date: Tue, 16 Aug 2011 20:46:22 +0000 Subject: [PATCH] Admin menu prepared for AJAX requests: - Admin menu system prepared for later updates (e.g. AJAX-driven) by adding ids to li-tags - 2 internal TODOs closed to rewrite to SQL_FETCHARRAY() - TODOs.txt updated --- DOCS/TODOs.txt | 8 ++- inc/modules/admin.php | 10 ++-- inc/modules/admin/admin-inc.php | 89 +++++++++++++++++---------------- 3 files changed, 56 insertions(+), 51 deletions(-) diff --git a/DOCS/TODOs.txt b/DOCS/TODOs.txt index 5d45fbe32b..26b1617efc 100644 --- a/DOCS/TODOs.txt +++ b/DOCS/TODOs.txt @@ -89,12 +89,10 @@ ./inc/mails/doubler_mails.php:53:// @TODO Can this be rewritten to a filter? ./inc/module-functions.php:267: // @TODO Nothing helped??? ./inc/module-functions.php:308: // @TODO Rewrite this to a filter -./inc/modules/admin/admin-inc.php:1423: // @TODO If we can rewrite the EL sub-system to support more than one parameter, this call_user_func_array() can be avoided +./inc/modules/admin/admin-inc.php:1426: // @TODO If we can rewrite the EL sub-system to support more than one parameter, this call_user_func_array() can be avoided ./inc/modules/admin/admin-inc.php:171: // @TODO This and the next getCurrentAdminId() call might be moved into the templates? ./inc/modules/admin/admin-inc.php:242: // @TODO This can be rewritten into a filter -./inc/modules/admin/admin-inc.php:274: // @TODO Rewrite this to $content = SQL_FETCHARRAY() -./inc/modules/admin/admin-inc.php:342: // @TODO Rewrite this to $content = SQL_FETCHARRAY() -./inc/modules/admin/admin-inc.php:487:// @TODO Try to rewrite this to adminAddMenuSelectionBox() +./inc/modules/admin/admin-inc.php:490:// @TODO Try to rewrite this to adminAddMenuSelectionBox() ./inc/modules/admin/overview-inc.php:162: // @TODO Rewrite this to a filter ./inc/modules/admin/overview-inc.php:275: // @TODO Rewrite this to something with include files and/or filter ./inc/modules/admin/overview-inc.php:309: // @TODO This may also be rewritten to include files @@ -232,7 +230,7 @@ ./inc/loader/load_cache-revision.php:2:// @DEPRECATED ./inc/loader/load_cache-them.php:2:// @DEPRECATED ./inc/loader/load-extensions.php:2:// @DEPRECATED -./inc/modules/admin/admin-inc.php:488:// @DEPRECATED +./inc/modules/admin/admin-inc.php:491:// @DEPRECATED ./inc/modules/admin/what-chk_regs.php:2:// @DEPRECATED ./inc/modules/admin/what-config_admins.php:2:// @DEPRECATED ./inc/modules/admin/what-config_email.php:2:// @DEPRECATED diff --git a/inc/modules/admin.php b/inc/modules/admin.php index 518ed79838..2aa70e1b6b 100644 --- a/inc/modules/admin.php +++ b/inc/modules/admin.php @@ -361,7 +361,9 @@ if (!isAdminRegistered()) { $area = 'entrance'; // Check for similar URL variable - if (isGetRequestElementSet('area')) $area = getRequestElement('area'); + if (isGetRequestElementSet('area')) { + $area = getRequestElement('area'); + } // END - if // Load logical-area menu-system file loadIncludeOnce('inc/modules/admin/lasys-inc.php'); @@ -369,8 +371,10 @@ if (!isAdminRegistered()) { // Create new-style menu system will logical areas doAdminLogicalArea($area, $action, getWhat()); } else { - // This little call constructs the whole default old and lacky menu system - // on left side. It also renders the content on right side + /* + * This little call constructs the whole default old and lacky menu system + * on left side. It also renders the content on right side + */ doAdminAction(); } break; diff --git a/inc/modules/admin/admin-inc.php b/inc/modules/admin/admin-inc.php index bcc4c3c163..44bd7de7ab 100644 --- a/inc/modules/admin/admin-inc.php +++ b/inc/modules/admin/admin-inc.php @@ -248,18 +248,20 @@ function isAdminAllowedAccessMenu ($action, $what = NULL) { } // Adds an admin menu -function addAdminMenu ($action, $what, $return = false) { +function addAdminMenu ($action, $what) { // Init variables $SUB = false; $OUT = ''; // Menu descriptions $GLOBALS['menu']['description'] = array(); - $GLOBALS['menu']['title'] = array(); + $GLOBALS['menu']['title'] = array(); // Build main menu $result_main = SQL_QUERY("SELECT - `action`,`title`,`descr` + `action` AS `main_action`, + `title` AS `main_title`, + `descr` AS `main_descr` FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE @@ -271,38 +273,39 @@ ORDER BY // Do we have entries? if (!SQL_HASZERONUMS($result_main)) { $OUT .= ''; } // END - if - // Is there a cache instance again? - // Return or output content? - if ($return === true) { - return $OUT; - } else { - outputHtml($OUT); - } + // Return content + return $OUT; } // Create an admin selection box form -- 2.39.2