diff options
author | nickw <nickw@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2010-05-24 21:44:07 +0000 |
---|---|---|
committer | nickw <nickw@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2010-05-24 21:44:07 +0000 |
commit | 6b5a3b2dfd0a20da1dfb46f42a7bc79dfe9377fc (patch) | |
tree | e2f5b3cf9c799790fcc57b9e2c31c03cc70cb270 | |
parent | 07727717f2341edc80ba9dc47e78649d1133b29b (diff) | |
download | elgg-6b5a3b2dfd0a20da1dfb46f42a7bc79dfe9377fc.tar.gz elgg-6b5a3b2dfd0a20da1dfb46f42a7bc79dfe9377fc.tar.bz2 |
Updating multiple plugins to no longer register admin menus with an event hook.
git-svn-id: http://code.elgg.org/elgg/trunk@6191 36083f99-b078-4883-b0ff-0f9b5a30f544
-rw-r--r-- | mod/logbrowser/index.php | 2 | ||||
-rw-r--r-- | mod/logbrowser/start.php | 98 | ||||
-rw-r--r-- | mod/profile/start.php | 10 | ||||
-rw-r--r-- | mod/reportedcontent/start.php | 18 | ||||
-rw-r--r-- | mod/sitepages/start.php | 16 |
5 files changed, 62 insertions, 82 deletions
diff --git a/mod/logbrowser/index.php b/mod/logbrowser/index.php index 3629b94d5..c72e9fc23 100644 --- a/mod/logbrowser/index.php +++ b/mod/logbrowser/index.php @@ -59,6 +59,6 @@ set_context('admin'); // Display main admin menu - page_draw(elgg_echo('logbrowser'),elgg_view_layout("one_column_with_sidebar", $title . $form . $result)); + page_draw(elgg_echo('logbrowser'),elgg_view_layout('administration', $title . $form . $result)); ?> diff --git a/mod/logbrowser/start.php b/mod/logbrowser/start.php index 86c75c7c5..c8c830f00 100644 --- a/mod/logbrowser/start.php +++ b/mod/logbrowser/start.php @@ -1,61 +1,51 @@ <?php - /** - * Elgg log browser. - * - * @package ElggLogBrowser - * @author Curverider Ltd - * @link http://elgg.com/ - */ +/** + * Elgg log browser. + * + * @package ElggLogBrowser + * @author Curverider Ltd + * @link http://elgg.com/ + */ - /** - * Initialise the log browser and set up the menus. - * - */ - function logbrowser_init() - { - global $CONFIG; - - // Register a page handler, so we can have nice URLs - register_page_handler('logbrowser','logbrowser_page_handler'); - - // Extend CSS - elgg_extend_view('css','logbrowser/css'); - - // Extend context menu with admin logbrowsre link - if (isadminloggedin()) - { - elgg_extend_view('profile/menu/adminlinks','logbrowser/adminlinks',10000); - } - } +/** + * Initialise the log browser and set up the menus. + * + */ +function logbrowser_init() +{ + global $CONFIG; - /** - * Adding the log browser to the admin menu - * - */ - function logbrowser_pagesetup() - { - if (get_context() == 'admin' && isadminloggedin()) { - global $CONFIG; - add_submenu_item(elgg_echo('logbrowser'), $CONFIG->wwwroot . 'pg/logbrowser/'); - } - } + // Register a page handler, so we can have nice URLs + register_page_handler('logbrowser','logbrowser_page_handler'); - /** - * Log browser page handler - * - * @param array $page Array of page elements, forwarded by the page handling mechanism - */ - function logbrowser_page_handler($page) - { - global $CONFIG; - - // only interested in one page for now - include($CONFIG->pluginspath . "logbrowser/index.php"); - } + // Extend CSS + elgg_extend_view('css','logbrowser/css'); + // Extend context menu with admin logbrowsre link + if (isadminloggedin()) { + elgg_extend_view('profile/menu/adminlinks','logbrowser/adminlinks',10000); + } + elgg_add_submenu_item(array( + 'text' => elgg_echo('logbrowser'), + 'href' => "{$CONFIG->wwwroot}pg/logbrowser", + 'parent_id' => 'overview', + ), 'admin', 'default'); +} + +/** + * Log browser page handler + * + * @param array $page Array of page elements, forwarded by the page handling mechanism + */ +function logbrowser_page_handler($page) +{ + global $CONFIG; - // Initialise log browser - register_elgg_event_handler('init','system','logbrowser_init'); - register_elgg_event_handler('pagesetup','system','logbrowser_pagesetup'); -?>
\ No newline at end of file + // only interested in one page for now + include($CONFIG->pluginspath . "logbrowser/index.php"); +} + + +// Initialise log browser +register_elgg_event_handler('init','system','logbrowser_init'); diff --git a/mod/profile/start.php b/mod/profile/start.php index f83f10869..6263f4a54 100644 --- a/mod/profile/start.php +++ b/mod/profile/start.php @@ -51,7 +51,12 @@ function profile_init() { // Now override icons register_plugin_hook('entity:icon:url', 'user', 'profile_usericon_hook'); - + + elgg_add_submenu_item(array( + 'text' => elgg_echo('profile:edit:default'), + 'href' => "{$CONFIG->wwwroot}pg/defaultprofile/edit", + 'parent_id' => 'appearance', + ), 'admin', 'default'); } /** @@ -189,9 +194,6 @@ function profileedit_page_handler($page) { function profile_pagesetup() { global $CONFIG; - if (get_context() == 'admin' && isadminloggedin()) { - add_submenu_item(elgg_echo('profile:edit:default'), $CONFIG->wwwroot . 'pg/defaultprofile/edit/'); - } //add submenu options if (get_context() == "profile") { diff --git a/mod/reportedcontent/start.php b/mod/reportedcontent/start.php index ad75f06f0..22d93dbe1 100644 --- a/mod/reportedcontent/start.php +++ b/mod/reportedcontent/start.php @@ -27,17 +27,12 @@ function reportedcontent_init() { elgg_extend_view('profile/menu/links', 'reportedcontent/user_report'); elgg_extend_view('footer/links', 'reportedcontent/footer_link'); } -} - -/** - * Adding the reported content to the admin menu - * - */ -function reportedcontent_pagesetup() { - if (get_context() == 'admin' && isadminloggedin()) { - global $CONFIG; - add_submenu_item(elgg_echo('reportedcontent'), $CONFIG->wwwroot . 'pg/reportedcontent/'); - } + + elgg_add_submenu_item(array( + 'text' => elgg_echo('reportedcontent'), + 'href' => "{$CONFIG->wwwroot}pg/reportedcontent", + 'parent_id' => 'overview', + ), 'admin', 'default'); } /** @@ -54,7 +49,6 @@ function reportedcontent_page_handler($page) { // Initialise Reported Content register_elgg_event_handler('init','system','reportedcontent_init'); -register_elgg_event_handler('pagesetup','system','reportedcontent_pagesetup'); //register action register_action('reportedcontent/add',false,$CONFIG->pluginspath . "reportedcontent/actions/add.php"); diff --git a/mod/sitepages/start.php b/mod/sitepages/start.php index 457ed583c..180739cca 100644 --- a/mod/sitepages/start.php +++ b/mod/sitepages/start.php @@ -57,6 +57,11 @@ function sitepages_init() { register_action("sitepages/edit", FALSE, $CONFIG->pluginspath . "sitepages/actions/edit.php"); register_action("sitepages/delete", FALSE, $CONFIG->pluginspath . "sitepages/actions/delete.php"); + elgg_add_submenu_item(array( + 'text' => elgg_echo('sitepages'), + 'href' => "{$CONFIG->wwwroot}pg/sitepages/edit/front", + 'parent_id' => 'site', + ), 'admin', 'default'); } /** @@ -97,16 +102,6 @@ function sitepages_custom_index() { } /** - * Page setup. Adds admin controls to the admin panel. - */ -function sitepages_pagesetup(){ - if (get_context() == 'admin' && isadminloggedin()) { - global $CONFIG; - add_submenu_item(elgg_echo('sitepages'), $CONFIG->wwwroot . 'pg/sitepages/edit/front'); - } -} - -/** * * @param unknown_type $expage * @return unknown_type @@ -234,4 +229,3 @@ function sitepages_public_pages($hook, $type, $return_value, $params) { } register_elgg_event_handler('init', 'system', 'sitepages_init'); -register_elgg_event_handler('pagesetup', 'system', 'sitepages_pagesetup');
\ No newline at end of file |