From df80e299c015a9d6d661b4705f65cdbcaad5aaba Mon Sep 17 00:00:00 2001 From: Cash Costello Date: Sat, 10 Sep 2011 09:43:25 -0400 Subject: Fixes #3775 updated admin area for logbrowser to utilities --- mod/logbrowser/start.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'mod/logbrowser/start.php') diff --git a/mod/logbrowser/start.php b/mod/logbrowser/start.php index eedc9d8ad..71b6115a5 100644 --- a/mod/logbrowser/start.php +++ b/mod/logbrowser/start.php @@ -23,7 +23,7 @@ function logbrowser_init() { function logbrowser_user_hover_menu($hook, $type, $return, $params) { $user = $params['entity']; - $url = "admin/overview/logbrowser?user_guid={$user->guid}"; + $url = "admin/utilities/logbrowser?user_guid={$user->guid}"; $item = new ElggMenuItem('logbrowser', elgg_echo('logbrowser:explore'), $url); $item->setSection('admin'); $return[] = $item; -- cgit v1.2.3 From 710b17aa37dd5c90db695219defdfef7a889f29a Mon Sep 17 00:00:00 2001 From: Cash Costello Date: Wed, 14 Sep 2011 21:09:48 -0400 Subject: Fixes #3681 fixed Utilities menu collisions in admin section and added documentation about registering more than one menu item with the same name to a menu --- engine/lib/navigation.php | 3 ++ languages/en.php | 3 +- mod/diagnostics/languages/en.php | 2 +- mod/diagnostics/start.php | 2 +- .../admin/develop_utilities/diagnostics.php | 30 +++++++++++ .../views/default/admin/utilities/diagnostics.php | 30 ----------- mod/logbrowser/languages/en.php | 2 +- mod/logbrowser/start.php | 2 +- .../admin/administer_utilities/logbrowser.php | 63 ++++++++++++++++++++++ .../views/default/admin/utilities/logbrowser.php | 63 ---------------------- mod/reportedcontent/languages/en.php | 2 +- mod/reportedcontent/start.php | 2 +- .../admin/administer_utilities/reportedcontent.php | 13 +++++ .../default/admin/utilities/reportedcontent.php | 13 ----- 14 files changed, 117 insertions(+), 113 deletions(-) create mode 100644 mod/diagnostics/views/default/admin/develop_utilities/diagnostics.php delete mode 100644 mod/diagnostics/views/default/admin/utilities/diagnostics.php create mode 100644 mod/logbrowser/views/default/admin/administer_utilities/logbrowser.php delete mode 100644 mod/logbrowser/views/default/admin/utilities/logbrowser.php create mode 100644 mod/reportedcontent/views/default/admin/administer_utilities/reportedcontent.php delete mode 100644 mod/reportedcontent/views/default/admin/utilities/reportedcontent.php (limited to 'mod/logbrowser/start.php') diff --git a/engine/lib/navigation.php b/engine/lib/navigation.php index cefe40ecf..0e9ec1c17 100644 --- a/engine/lib/navigation.php +++ b/engine/lib/navigation.php @@ -53,6 +53,9 @@ * 'register', 'menu:'. If you do, you may end up with many incorrect * links on a context-sensitive menu. * + * @warning A menu item's name must be unique per menu. If more than one menu + * item with the same name are registered, the last menu item takes priority. + * * @see elgg_view_menu() for the plugin hooks available for modifying a menu as * it is being rendered. * diff --git a/languages/en.php b/languages/en.php index 6e07b256b..3a922b889 100644 --- a/languages/en.php +++ b/languages/en.php @@ -544,7 +544,8 @@ $english = array( 'admin:statistics:overview' => 'Overview', 'admin:appearance' => 'Appearance', - 'admin:utilities' => 'Utilities', + 'admin:administer_utilities' => 'Utilities', + 'admin:develop_utilities' => 'Utilities', 'admin:users' => "Users", 'admin:users:online' => 'Currently Online', diff --git a/mod/diagnostics/languages/en.php b/mod/diagnostics/languages/en.php index 6d71945e3..c4e337b50 100644 --- a/mod/diagnostics/languages/en.php +++ b/mod/diagnostics/languages/en.php @@ -7,7 +7,7 @@ $english = array( - 'admin:utilities:diagnostics' => 'System Diagnostics', + 'admin:develop_utilities:diagnostics' => 'System Diagnostics', 'diagnostics' => 'System diagnostics', 'diagnostics:report' => 'Diagnostics Report', 'diagnostics:unittester' => 'Unit Tests', diff --git a/mod/diagnostics/start.php b/mod/diagnostics/start.php index c55b10483..735e15042 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_register_admin_menu_item('develop', 'diagnostics', 'utilities'); + elgg_register_admin_menu_item('develop', 'diagnostics', 'develop_utilities'); // Register some actions $file = elgg_get_plugins_path() . "diagnostics/actions/download.php"; diff --git a/mod/diagnostics/views/default/admin/develop_utilities/diagnostics.php b/mod/diagnostics/views/default/admin/develop_utilities/diagnostics.php new file mode 100644 index 000000000..76f12b0ae --- /dev/null +++ b/mod/diagnostics/views/default/admin/develop_utilities/diagnostics.php @@ -0,0 +1,30 @@ +' . elgg_echo('diagnostics:unittester:description') . '

'; +$unit_tests .= '

' . elgg_echo('diagnostics:unittester:warning') . '

'; + +if (elgg_get_config('debug')) { + // create a button to run tests + $params = array( + 'text' => elgg_echo('diagnostics:test:executeall'), + 'href' => 'engine/tests/suite.php', + 'class' => 'elgg-button elgg-button-submit', + ); + $unit_tests .= '

' . elgg_view('output/url', $params) . '

'; +} else { + // no tests when not in debug mode + $unit_tests .= elgg_echo('diagnostics:unittester:debug'); +} + +// display admin body +echo elgg_view_module('inline', $diagnostics_title, $diagnostics); +echo elgg_view_module('inline', $unit_tests_title, $unit_tests); diff --git a/mod/diagnostics/views/default/admin/utilities/diagnostics.php b/mod/diagnostics/views/default/admin/utilities/diagnostics.php deleted file mode 100644 index 76f12b0ae..000000000 --- a/mod/diagnostics/views/default/admin/utilities/diagnostics.php +++ /dev/null @@ -1,30 +0,0 @@ -' . elgg_echo('diagnostics:unittester:description') . '

'; -$unit_tests .= '

' . elgg_echo('diagnostics:unittester:warning') . '

'; - -if (elgg_get_config('debug')) { - // create a button to run tests - $params = array( - 'text' => elgg_echo('diagnostics:test:executeall'), - 'href' => 'engine/tests/suite.php', - 'class' => 'elgg-button elgg-button-submit', - ); - $unit_tests .= '

' . elgg_view('output/url', $params) . '

'; -} else { - // no tests when not in debug mode - $unit_tests .= elgg_echo('diagnostics:unittester:debug'); -} - -// display admin body -echo elgg_view_module('inline', $diagnostics_title, $diagnostics); -echo elgg_view_module('inline', $unit_tests_title, $unit_tests); diff --git a/mod/logbrowser/languages/en.php b/mod/logbrowser/languages/en.php index 90689a1b0..3b6ead272 100644 --- a/mod/logbrowser/languages/en.php +++ b/mod/logbrowser/languages/en.php @@ -6,7 +6,7 @@ */ $english = array( - 'admin:utilities:logbrowser' => 'Log browser', + 'admin:administer_utilities:logbrowser' => 'Log browser', 'logbrowser' => 'Log browser', 'logbrowser:browse' => 'Browse system log', 'logbrowser:search' => 'Refine results', diff --git a/mod/logbrowser/start.php b/mod/logbrowser/start.php index 71b6115a5..3bffe800a 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_register_admin_menu_item('administer', 'logbrowser', 'utilities'); + elgg_register_admin_menu_item('administer', 'logbrowser', 'administer_utilities'); } /** diff --git a/mod/logbrowser/views/default/admin/administer_utilities/logbrowser.php b/mod/logbrowser/views/default/admin/administer_utilities/logbrowser.php new file mode 100644 index 000000000..dadc6cda3 --- /dev/null +++ b/mod/logbrowser/views/default/admin/administer_utilities/logbrowser.php @@ -0,0 +1,63 @@ +guid; + } +} else { + $user_guid = get_input('user_guid',0); + if ($user_guid) { + $user = (int) $user_guid; + } else { + $user = ""; + } +} + +$timelower = get_input('timelower'); +if ($timelower) { + $timelower = strtotime($timelower); +} + +$timeupper = get_input('timeupper'); +if ($timeupper) { + $timeupper = strtotime($timeupper); +} + +$form = elgg_view('logbrowser/form', array( + 'user_guid' => $user, + 'timeupper' => $timeupper, + 'timelower' => $timelower, +)); + +// Get log entries +$log = get_system_log($user, "", "", "","", $limit, $offset, false, $timeupper, $timelower); +$count = get_system_log($user, "", "", "","", $limit, $offset, true, $timeupper, $timelower); + +$table = elgg_view('logbrowser/table', array('log_entries' => $log)); + +$nav = elgg_view('navigation/pagination',array( + 'offset' => $offset, + 'count' => $count, + 'limit' => $limit, +)); + +// display admin body +$body = <<<__HTML +$form +$nav +$table +$nav +__HTML; + +echo $body; diff --git a/mod/logbrowser/views/default/admin/utilities/logbrowser.php b/mod/logbrowser/views/default/admin/utilities/logbrowser.php deleted file mode 100644 index dadc6cda3..000000000 --- a/mod/logbrowser/views/default/admin/utilities/logbrowser.php +++ /dev/null @@ -1,63 +0,0 @@ -guid; - } -} else { - $user_guid = get_input('user_guid',0); - if ($user_guid) { - $user = (int) $user_guid; - } else { - $user = ""; - } -} - -$timelower = get_input('timelower'); -if ($timelower) { - $timelower = strtotime($timelower); -} - -$timeupper = get_input('timeupper'); -if ($timeupper) { - $timeupper = strtotime($timeupper); -} - -$form = elgg_view('logbrowser/form', array( - 'user_guid' => $user, - 'timeupper' => $timeupper, - 'timelower' => $timelower, -)); - -// Get log entries -$log = get_system_log($user, "", "", "","", $limit, $offset, false, $timeupper, $timelower); -$count = get_system_log($user, "", "", "","", $limit, $offset, true, $timeupper, $timelower); - -$table = elgg_view('logbrowser/table', array('log_entries' => $log)); - -$nav = elgg_view('navigation/pagination',array( - 'offset' => $offset, - 'count' => $count, - 'limit' => $limit, -)); - -// display admin body -$body = <<<__HTML -$form -$nav -$table -$nav -__HTML; - -echo $body; diff --git a/mod/reportedcontent/languages/en.php b/mod/reportedcontent/languages/en.php index c047644e3..c2e197879 100644 --- a/mod/reportedcontent/languages/en.php +++ b/mod/reportedcontent/languages/en.php @@ -8,7 +8,7 @@ $english = array( 'item:object:reported_content' => 'Reported items', - 'admin:utilities:reportedcontent' => 'Reported content', + 'admin:administer_utilities:reportedcontent' => 'Reported content', 'reportedcontent' => 'Reported content', 'reportedcontent:this' => 'Report this', 'reportedcontent:this:tooltip' => 'Report this page to an administrator', diff --git a/mod/reportedcontent/start.php b/mod/reportedcontent/start.php index 87b4b3c7b..66a1248d9 100644 --- a/mod/reportedcontent/start.php +++ b/mod/reportedcontent/start.php @@ -39,7 +39,7 @@ function reportedcontent_init() { // Add admin menu item // @todo Might want to move this to a 'feedback' section. something other than utils - elgg_register_admin_menu_item('administer', 'reportedcontent', 'utilities'); + elgg_register_admin_menu_item('administer', 'reportedcontent', 'administer_utilities'); elgg_register_widget_type( 'reportedcontent', diff --git a/mod/reportedcontent/views/default/admin/administer_utilities/reportedcontent.php b/mod/reportedcontent/views/default/admin/administer_utilities/reportedcontent.php new file mode 100644 index 000000000..32f108312 --- /dev/null +++ b/mod/reportedcontent/views/default/admin/administer_utilities/reportedcontent.php @@ -0,0 +1,13 @@ + 'object', 'subtypes' => 'reported_content')); +if (!$list) { + $list = '

' . elgg_echo('reportedcontent:none') . '

'; +} + +echo $list; \ No newline at end of file diff --git a/mod/reportedcontent/views/default/admin/utilities/reportedcontent.php b/mod/reportedcontent/views/default/admin/utilities/reportedcontent.php deleted file mode 100644 index 32f108312..000000000 --- a/mod/reportedcontent/views/default/admin/utilities/reportedcontent.php +++ /dev/null @@ -1,13 +0,0 @@ - 'object', 'subtypes' => 'reported_content')); -if (!$list) { - $list = '

' . elgg_echo('reportedcontent:none') . '

'; -} - -echo $list; \ No newline at end of file -- cgit v1.2.3