diff options
author | cash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2011-02-26 23:36:49 +0000 |
---|---|---|
committer | cash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2011-02-26 23:36:49 +0000 |
commit | 09acb61949e1051fc25e8fcf5936068415281802 (patch) | |
tree | 41006f6633590b7bf1718403590e0f2f3118d078 | |
parent | 10682a7e334c5f5e0d805c974007fc5518023986 (diff) | |
download | elgg-09acb61949e1051fc25e8fcf5936068415281802.tar.gz elgg-09acb61949e1051fc25e8fcf5936068415281802.tar.bz2 |
simplified admin menu registration function in preparation for adding sections
git-svn-id: http://code.elgg.org/elgg/trunk@8500 36083f99-b078-4883-b0ff-0f9b5a30f544
-rw-r--r-- | engine/lib/admin.php | 61 | ||||
-rw-r--r-- | engine/lib/widgets.php | 2 | ||||
-rw-r--r-- | mod/developers/start.php | 6 | ||||
-rw-r--r-- | mod/diagnostics/start.php | 2 | ||||
-rw-r--r-- | mod/externalpages/start.php | 2 | ||||
-rw-r--r-- | mod/logbrowser/start.php | 2 | ||||
-rw-r--r-- | mod/reportedcontent/start.php | 2 | ||||
-rw-r--r-- | mod/uservalidationbyemail/start.php | 2 |
8 files changed, 43 insertions, 36 deletions
diff --git a/engine/lib/admin.php b/engine/lib/admin.php index 1e4b63cdd..be01a150c 100644 --- a/engine/lib/admin.php +++ b/engine/lib/admin.php @@ -113,32 +113,33 @@ function elgg_admin_notice_exists($id) { * Used in conjuction with http://elgg.org/admin/section_id/child_section style * page handler. * - * @param string $section_id The Unique ID of section - * @param string $section_title Human readable section title. - * @param string $parent_id If a child section, the parent section id. - * @param int $weight The menu item weight + * The text of the menu item is obtained from elgg_echo(admin:$parent_id:$menu_id) + * + * @param string $menu_id The Unique ID of section + * @param string $parent_id If a child section, the parent section id. + * @param int $weight The menu item weight * * @return bool * @since 1.8.0 */ -function elgg_add_admin_menu_item($section_id, $section_title, $parent_id = NULL, $weight = 100) { +function elgg_add_admin_menu_item($menu_id, $parent_id = NULL, $weight = 100) { // in the admin section parents never have links if ($parent_id) { - $href = "pg/admin/$parent_id/$section_id"; + $href = "pg/admin/$parent_id/$menu_id"; } else { $href = NULL; } - $name = $section_id; + $name = $menu_id; if ($parent_id) { - $name = "$name:$parent_id"; + $name = "$parent_id:$name"; } return elgg_register_menu_item('page', array( 'name' => $name, 'href' => $href, - 'text' => $section_title, + 'text' => elgg_echo("admin:$name"), 'context' => 'admin', 'parent_name' => $parent_id, 'weight' => $weight, @@ -174,32 +175,32 @@ function admin_init() { elgg_register_simplecache_view('js/admin'); // statistics - elgg_add_admin_menu_item('statistics', elgg_echo('admin:statistics'), null, 60); - elgg_add_admin_menu_item('overview', elgg_echo('admin:statistics:overview'), 'statistics'); + elgg_add_admin_menu_item('statistics', null, 60); + elgg_add_admin_menu_item('overview', 'statistics'); // site - elgg_add_admin_menu_item('site', elgg_echo('admin:site'), null, 20); - elgg_add_admin_menu_item('basic', elgg_echo('admin:site:basic'), 'site', 10); - elgg_add_admin_menu_item('advanced', elgg_echo('admin:site:advanced'), 'site', 20); + elgg_add_admin_menu_item('site', null, 20); + elgg_add_admin_menu_item('basic', 'site', 10); + elgg_add_admin_menu_item('advanced', 'site', 20); // appearance - elgg_add_admin_menu_item('appearance', elgg_echo('admin:appearance'), null, 30); - elgg_add_admin_menu_item('menu_items', elgg_echo('admin:appearance:menu_items'), 'appearance', 10); - elgg_add_admin_menu_item('profile_fields', elgg_echo('admin:appearance:profile_fields'), 'appearance', 20); + elgg_add_admin_menu_item('appearance', null, 30); + elgg_add_admin_menu_item('menu_items', 'appearance', 10); + elgg_add_admin_menu_item('profile_fields', 'appearance', 20); // users - elgg_add_admin_menu_item('users', elgg_echo('admin:users'), null, 40); - elgg_add_admin_menu_item('add', elgg_echo('admin:users:add'), 'users', 10); - elgg_add_admin_menu_item('online', elgg_echo('admin:users:online'), 'users', 20); - elgg_add_admin_menu_item('newest', elgg_echo('admin:users:newest'), 'users', 30); + elgg_add_admin_menu_item('users', null, 40); + elgg_add_admin_menu_item('add', 'users', 10); + elgg_add_admin_menu_item('online', 'users', 20); + elgg_add_admin_menu_item('newest', 'users', 30); // plugins - elgg_add_admin_menu_item('plugins', elgg_echo('admin:plugins'), null, 50); - elgg_add_admin_menu_item('simple', elgg_echo('admin:plugins:simple'), 'plugins', 10); - elgg_add_admin_menu_item('advanced', elgg_echo('admin:plugins:advanced'), 'plugins', 20); + elgg_add_admin_menu_item('plugins', null, 50); + elgg_add_admin_menu_item('simple', 'plugins', 10); + elgg_add_admin_menu_item('advanced', 'plugins', 20); // utilities - elgg_add_admin_menu_item('utilities', elgg_echo('admin:utilities'), null, 70); + elgg_add_admin_menu_item('utilities', null, 70); // dashboard elgg_register_menu_item('page', array( @@ -250,12 +251,18 @@ function elgg_admin_add_plugin_settings_menu() { return FALSE; } - elgg_add_admin_menu_item('plugin_settings', elgg_echo('admin:plugin_settings'), null, 51); + elgg_add_admin_menu_item('plugin_settings', null, 51); foreach ($active_plugins as $plugin) { $plugin_id = $plugin->getID(); if (elgg_view_exists("settings/$plugin_id/edit")) { - elgg_add_admin_menu_item($plugin_id, $plugin->manifest->getName(), 'plugin_settings'); + elgg_register_menu_item('page', array( + 'name' => $plugin_id, + 'href' => "pg/admin/plugin_settings/$plugin_id", + 'text' => $plugin->manifest->getName(), + 'parent_name' => 'plugin_settings', + 'context' => 'admin', + )); } } } diff --git a/engine/lib/widgets.php b/engine/lib/widgets.php index 7c0867548..cd8b657f3 100644 --- a/engine/lib/widgets.php +++ b/engine/lib/widgets.php @@ -288,7 +288,7 @@ function elgg_default_widgets_init() { $CONFIG->default_widget_info = $default_widgets; if ($default_widgets) { - elgg_add_admin_menu_item('default_widgets', elgg_echo('admin:appearance:default_widgets'), 'appearance', 30); + elgg_add_admin_menu_item('default_widgets', 'appearance', 30); // override permissions for creating widget on logged out / just created entities elgg_register_plugin_hook_handler('container_permissions_check', 'object', 'elgg_default_widgets_permissions_override'); diff --git a/mod/developers/start.php b/mod/developers/start.php index dd74493f4..5dc4cb2b8 100644 --- a/mod/developers/start.php +++ b/mod/developers/start.php @@ -18,9 +18,9 @@ function developers_init() { function developers_setup_menu() { if (elgg_in_context('admin')) { - elgg_add_admin_menu_item('developers', elgg_echo('admin:developers')); - elgg_add_admin_menu_item('settings', elgg_echo('admin:developers:settings'), 'developers'); - elgg_add_admin_menu_item('preview', elgg_echo('admin:developers:preview'), 'developers'); + elgg_add_admin_menu_item('developers'); + elgg_add_admin_menu_item('settings', 'developers'); + elgg_add_admin_menu_item('preview', 'developers'); } } diff --git a/mod/diagnostics/start.php b/mod/diagnostics/start.php index a79306b25..21ee6207d 100644 --- a/mod/diagnostics/start.php +++ b/mod/diagnostics/start.php @@ -16,7 +16,7 @@ function diagnostics_init() { elgg_register_page_handler('diagnostics','diagnostics_page_handler'); // Add admin menu item - elgg_add_admin_menu_item('diagnostics', elgg_echo('diagnostics'), 'utilities'); + elgg_add_admin_menu_item('diagnostics', 'utilities'); // Register some actions $file = elgg_get_plugins_path() . "diagnostics/actions/download.php"; diff --git a/mod/externalpages/start.php b/mod/externalpages/start.php index 41df8750d..16f46326f 100644 --- a/mod/externalpages/start.php +++ b/mod/externalpages/start.php @@ -11,7 +11,7 @@ function expages_init() { elgg_register_page_handler('expages', 'expages_page_handler'); // add a menu item for the admin edit page - elgg_add_admin_menu_item('expages', elgg_echo('expages'), 'site'); + elgg_add_admin_menu_item('expages', 'site'); // add footer links expages_setup_footer_menu(); diff --git a/mod/logbrowser/start.php b/mod/logbrowser/start.php index dace1a68e..f0f4070db 100644 --- a/mod/logbrowser/start.php +++ b/mod/logbrowser/start.php @@ -14,7 +14,7 @@ function logbrowser_init() { elgg_register_plugin_hook_handler('register', 'menu:user_hover', 'logbrowser_user_hover_menu'); - elgg_add_admin_menu_item('logbrowser', elgg_echo('logbrowser'), 'utilities'); + elgg_add_admin_menu_item('logbrowser', 'utilities'); } /** diff --git a/mod/reportedcontent/start.php b/mod/reportedcontent/start.php index f89b01f2b..fe7173958 100644 --- a/mod/reportedcontent/start.php +++ b/mod/reportedcontent/start.php @@ -38,7 +38,7 @@ function reportedcontent_init() { elgg_register_plugin_hook_handler('register', 'menu:user_hover', 'reportedcontent_user_hover_menu'); // Add admin menu item - elgg_add_admin_menu_item('reportedcontent', elgg_echo('reportedcontent'), 'utilities'); + elgg_add_admin_menu_item('reportedcontent', 'utilities'); elgg_register_widget_type( 'reportedcontent', diff --git a/mod/uservalidationbyemail/start.php b/mod/uservalidationbyemail/start.php index 03f204511..ce9a9cd2c 100644 --- a/mod/uservalidationbyemail/start.php +++ b/mod/uservalidationbyemail/start.php @@ -39,7 +39,7 @@ function uservalidationbyemail_init() { elgg_register_plugin_hook_handler('public_pages', 'walled_garden', 'uservalidationbyemail_public_pages'); // admin interface to manually validate users - elgg_add_admin_menu_item('unvalidated', elgg_echo('uservalidationbyemail:admin:unvalidated'), 'users'); + elgg_add_admin_menu_item('unvalidated', 'users'); elgg_extend_view('js/elgg', 'uservalidationbyemail/js'); |