From 6b5a3b2dfd0a20da1dfb46f42a7bc79dfe9377fc Mon Sep 17 00:00:00 2001 From: nickw Date: Mon, 24 May 2010 21:44:07 +0000 Subject: 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 --- mod/logbrowser/index.php | 2 +- mod/logbrowser/start.php | 98 ++++++++++++++++++++++-------------------------- 2 files changed, 45 insertions(+), 55 deletions(-) (limited to 'mod/logbrowser') 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 @@ 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'); -- cgit v1.2.3