From e68bf62084b0a90097b3b65d3ef12c2605e09289 Mon Sep 17 00:00:00 2001 From: brettp Date: Fri, 11 Mar 2011 23:14:09 +0000 Subject: Refs #2991. First round at rearranging and grouping admin menu based upon tasks. git-svn-id: http://code.elgg.org/elgg/trunk@8654 36083f99-b078-4883-b0ff-0f9b5a30f544 --- engine/handlers/page_handler.php | 2 + engine/lib/admin.php | 69 +++++++++++----------- engine/lib/widgets.php | 2 +- languages/en.php | 23 ++++---- mod/developers/languages/en.php | 2 +- mod/developers/start.php | 5 +- mod/diagnostics/start.php | 2 +- mod/externalpages/start.php | 2 +- mod/logbrowser/start.php | 2 +- mod/reportedcontent/start.php | 3 +- mod/uservalidationbyemail/start.php | 2 +- views/default/admin/appearance/default_widgets.php | 65 -------------------- views/default/admin/appearance/menu_items.php | 10 ---- views/default/admin/appearance/profile_fields.php | 18 ------ .../admin/appearance/profile_fields/list.php | 56 ------------------ views/default/admin/settings/advanced.php | 9 +++ views/default/admin/settings/basic.php | 9 +++ views/default/admin/settings/default_widgets.php | 65 ++++++++++++++++++++ views/default/admin/settings/menu_items.php | 10 ++++ views/default/admin/settings/profile_fields.php | 18 ++++++ .../default/admin/settings/profile_fields/list.php | 56 ++++++++++++++++++ views/default/admin/sidebar.php | 15 ++++- views/default/admin/site/advanced.php | 9 --- views/default/admin/site/basic.php | 9 --- views/default/css/admin.php | 16 ++--- views/default/js/admin.php | 3 + 26 files changed, 251 insertions(+), 231 deletions(-) delete mode 100644 views/default/admin/appearance/default_widgets.php delete mode 100644 views/default/admin/appearance/menu_items.php delete mode 100644 views/default/admin/appearance/profile_fields.php delete mode 100644 views/default/admin/appearance/profile_fields/list.php create mode 100644 views/default/admin/settings/advanced.php create mode 100644 views/default/admin/settings/basic.php create mode 100644 views/default/admin/settings/default_widgets.php create mode 100644 views/default/admin/settings/menu_items.php create mode 100644 views/default/admin/settings/profile_fields.php create mode 100644 views/default/admin/settings/profile_fields/list.php delete mode 100644 views/default/admin/site/advanced.php delete mode 100644 views/default/admin/site/basic.php diff --git a/engine/handlers/page_handler.php b/engine/handlers/page_handler.php index bfdb0cee3..7b1b95459 100644 --- a/engine/handlers/page_handler.php +++ b/engine/handlers/page_handler.php @@ -32,7 +32,9 @@ require_once(dirname(dirname(__FILE__)) . "/start.php"); $url = current_page_url(); $new_url = preg_replace('#/pg/#', '/', $url); + if ($url !== $new_url) { + die('site'); header("HTTP/1.1 301 Moved Permanently"); header("Location: $new_url"); } diff --git a/engine/lib/admin.php b/engine/lib/admin.php index 7774f78e0..39ba07ad3 100644 --- a/engine/lib/admin.php +++ b/engine/lib/admin.php @@ -117,18 +117,20 @@ function elgg_admin_notice_exists($id) { * * This function handles registering the parent if it has not been registered. * + * @param string $section The menu section to add to * @param string $menu_id The Unique ID of section - * @param string $parent_id If a child section, the parent section id. - * @param int $priority The menu item priority + * @param string $parent_id If a child section, the parent section id + * @param int $priority The menu item priority * * @return bool * @since 1.8.0 */ -function elgg_register_admin_menu_item($menu_id, $parent_id = NULL, $priority = 100) { +function elgg_register_admin_menu_item($section, $menu_id, $parent_id = NULL, $priority = 100) { + $menu_name = "admin-$section"; // make sure parent is registered - if ($parent_id && !elgg_is_menu_item_registered('page', $parent_id)) { - elgg_register_admin_menu_item($parent_id); + if ($parent_id && !elgg_is_menu_item_registered($menu_name, $parent_id)) { + elgg_register_admin_menu_item($section, $parent_id); } // in the admin section parents never have links @@ -143,7 +145,7 @@ function elgg_register_admin_menu_item($menu_id, $parent_id = NULL, $priority = $name = "$parent_id:$name"; } - return elgg_register_menu_item('page', array( + return elgg_register_menu_item($menu_name, array( 'name' => $name, 'href' => $href, 'text' => elgg_echo("admin:$name"), @@ -181,39 +183,38 @@ function admin_init() { elgg_register_simplecache_view('js/admin'); - // statistics - elgg_register_admin_menu_item('statistics', null, 60); - elgg_register_admin_menu_item('overview', 'statistics'); - - // site - elgg_register_admin_menu_item('site', null, 20); - elgg_register_admin_menu_item('basic', 'site', 10); - elgg_register_admin_menu_item('advanced', 'site', 20); - - // appearance - elgg_register_admin_menu_item('appearance', null, 30); - elgg_register_admin_menu_item('menu_items', 'appearance', 10); - elgg_register_admin_menu_item('profile_fields', 'appearance', 20); - - // users - elgg_register_admin_menu_item('users', null, 40); - elgg_register_admin_menu_item('add', 'users', 10); - elgg_register_admin_menu_item('online', 'users', 20); - elgg_register_admin_menu_item('newest', 'users', 30); - - // plugins - elgg_register_admin_menu_item('plugins', null, 50); - elgg_register_admin_menu_item('simple', 'plugins', 10); - elgg_register_admin_menu_item('advanced', 'plugins', 20); - + // administer // dashboard - elgg_register_menu_item('page', array( + elgg_register_menu_item('admin-administer', array( 'name' => 'dashboard', 'href' => 'admin/dashboard', 'text' => elgg_echo('admin:dashboard'), 'context' => 'admin', 'priority' => 10, )); + // statistics + elgg_register_admin_menu_item('administer', 'statistics', null, 20); + elgg_register_admin_menu_item('administer', 'overview', 'statistics'); + + // users + elgg_register_admin_menu_item('administer', 'users', null, 20); + elgg_register_admin_menu_item('administer', 'online', 'users', 10); + elgg_register_admin_menu_item('administer', 'newest', 'users', 20); + elgg_register_admin_menu_item('administer', 'add', 'users', 30); + + // configure + // plugins + elgg_register_admin_menu_item('configure', 'plugins', null, 10); + elgg_register_admin_menu_item('configure', 'simple', 'plugins', 10); + elgg_register_admin_menu_item('configure', 'advanced', 'plugins', 20); + + // settings + elgg_register_admin_menu_item('configure', 'basic', 'settings', 10); + elgg_register_admin_menu_item('configure', 'advanced', 'settings', 20); + elgg_register_admin_menu_item('configure', 'menu_items', 'settings', 30); + elgg_register_admin_menu_item('configure', 'profile_fields', 'settings', 40); + // default widgets is added via an event handler elgg_default_widgets_init() because it + // requires additional setup. elgg_register_menu_item('topbar', array( 'name' => 'administration', @@ -255,12 +256,12 @@ function elgg_admin_add_plugin_settings_menu() { return FALSE; } - elgg_register_admin_menu_item('plugin_settings', null, 51); + elgg_register_admin_menu_item('configure', 'plugin_settings', null, 51); foreach ($active_plugins as $plugin) { $plugin_id = $plugin->getID(); if (elgg_view_exists("settings/$plugin_id/edit")) { - elgg_register_menu_item('page', array( + elgg_register_menu_item('admin-configure', array( 'name' => $plugin_id, 'href' => "admin/plugin_settings/$plugin_id", 'text' => $plugin->manifest->getName(), diff --git a/engine/lib/widgets.php b/engine/lib/widgets.php index 53b4a3309..71f0c3ce9 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_register_admin_menu_item('default_widgets', 'appearance', 30); + elgg_register_admin_menu_item('configure', 'default_widgets', 'settings'); // 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/languages/en.php b/languages/en.php index 2084137b3..290fa9dcf 100644 --- a/languages/en.php +++ b/languages/en.php @@ -372,7 +372,7 @@ $english = array( 'profile:twitter' => "Twitter username", 'profile:saved' => "Your profile was successfully saved.", - 'admin:appearance:profile_fields' => 'Edit profile fields', + 'admin:settings:profile_fields' => 'Edit profile fields', 'profile:edit:default' => 'Edit profile fields', 'profile:label' => "Profile label", 'profile:type' => "Profile type", @@ -511,6 +511,9 @@ $english = array( /** * Administration */ + 'admin:administer' => 'Administer', + 'admin:configure' => 'Configure', + 'admin:develop' => 'Develop', 'admin:view_site' => 'View site', 'admin:loggedin' => 'Logged in as %s', @@ -533,16 +536,16 @@ $english = array( 'admin:users' => "Users", 'admin:users:online' => 'Currently Online', 'admin:users:newest' => 'Newest', - 'admin:users:add' => 'Add', + 'admin:users:add' => 'Add New User', 'admin:users:description' => "This admin panel allows you to control user settings for your site. Choose an option below to get started.", 'admin:users:adduser:label' => "Click here to add a new user...", 'admin:users:opt:linktext' => "Configure users...", 'admin:users:opt:description' => "Configure users and account information. ", 'admin:users:find' => 'Find', - 'admin:site' => "Site", - 'admin:site:basic' => 'Basic Settings', - 'admin:site:advanced' => 'Advanced Settings', + 'admin:settings' => 'Settings', + 'admin:settings:basic' => 'Basic Settings', + 'admin:settings:advanced' => 'Advanced Settings', 'admin:site:description' => "This admin panel allows you to control global settings for your site. Choose an option below to get started.", 'admin:site:opt:linktext' => "Configure site...", 'admin:site:access:warning' => "Changing the access setting only affects the permissions on content created in the future.", @@ -668,7 +671,7 @@ $english = array( 'admin:user:ban:yes' => "User banned.", 'admin:user:self:ban:no' => "You cannot ban yourself", 'admin:user:unban:no' => "Can not unban user", - 'admin:user:unban:yes' => "User un-banned.", + 'admin:user:unban:yes' => "User unbanned.", 'admin:user:delete:no' => "Can not delete user", 'admin:user:delete:yes' => "The user %s has been deleted", 'admin:user:self:delete:no' => "You cannot delete yourself", @@ -683,7 +686,7 @@ $english = array( 'admin:user:removeadmin:no' => "We could not remove administrator privileges from this user.", 'admin:user:self:removeadmin:no' => "You cannot remove your own administrator privileges.", - 'admin:appearance:menu_items' => 'Menu Items', + 'admin:settings:menu_items' => 'Menu Items', 'admin:menu_items:configure' => 'Configure main menu items', 'admin:menu_items:description' => 'Select which menu items you want to show as featured links. Unused items will be added as "More" at the end of the list.', 'admin:menu_items:hide_toolbar_entries' => 'Remove links from tool bar menu?', @@ -691,9 +694,9 @@ $english = array( 'admin:add_menu_item' => 'Add a custom menu item', 'admin:add_menu_item:description' => 'Fill out the Display name and URL to add custom items to your navigation menu.', - 'admin:appearance:default_widgets' => 'Default Widgets', - 'admin:appearance:default_widgets:unknown_type' => 'Unknown widget type', - 'admin:appearance:default_widgets:instructions' => 'Add, remove, position, and configure default widgets for the selected widget page.' + 'admin:settings:default_widgets' => 'Default Widgets', + 'admin:default_widgets:unknown_type' => 'Unknown widget type', + 'admin:default_widgets:instructions' => 'Add, remove, position, and configure default widgets for the selected widget page.' . ' These changes will apply only to new content on the site.', /** diff --git a/mod/developers/languages/en.php b/mod/developers/languages/en.php index 7c9ec93d3..8bc1f596a 100644 --- a/mod/developers/languages/en.php +++ b/mod/developers/languages/en.php @@ -7,7 +7,7 @@ $english = array( // menu 'admin:developers' => 'Developers', - 'admin:developers:settings' => 'Settings', + 'admin:developers:settings' => 'Developer Settings', 'admin:developers:preview' => 'Theming Preview', // settings diff --git a/mod/developers/start.php b/mod/developers/start.php index ff33f3e91..3c2f6bd5f 100644 --- a/mod/developers/start.php +++ b/mod/developers/start.php @@ -18,9 +18,8 @@ function developers_init() { function developers_setup_menu() { if (elgg_in_context('admin')) { - elgg_register_admin_menu_item('developers'); - elgg_register_admin_menu_item('settings', 'developers'); - elgg_register_admin_menu_item('preview', 'developers'); + elgg_register_admin_menu_item('develop', 'settings', 'developers'); + elgg_register_admin_menu_item('develop', 'preview', 'developers'); } } diff --git a/mod/diagnostics/start.php b/mod/diagnostics/start.php index 74c53e2f6..d310684ba 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('diagnostics', 'utilities'); + elgg_register_admin_menu_item('develop', '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 533d71104..9ec7c174e 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_register_admin_menu_item('expages', 'site'); + elgg_register_admin_menu_item('configure', 'expages', 'site'); // add footer links expages_setup_footer_menu(); diff --git a/mod/logbrowser/start.php b/mod/logbrowser/start.php index 5b4e0541e..eedc9d8ad 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('logbrowser', 'utilities'); + elgg_register_admin_menu_item('administer', 'logbrowser', 'utilities'); } /** diff --git a/mod/reportedcontent/start.php b/mod/reportedcontent/start.php index a7e3afe19..406624e50 100644 --- a/mod/reportedcontent/start.php +++ b/mod/reportedcontent/start.php @@ -37,7 +37,8 @@ function reportedcontent_init() { elgg_register_plugin_hook_handler('register', 'menu:user_hover', 'reportedcontent_user_hover_menu'); // Add admin menu item - elgg_register_admin_menu_item('reportedcontent', 'utilities'); + // @todo Might want to move this to a 'feedback' section. something other than utils + elgg_register_admin_menu_item('administer', 'reportedcontent', 'utilities'); elgg_register_widget_type( 'reportedcontent', diff --git a/mod/uservalidationbyemail/start.php b/mod/uservalidationbyemail/start.php index 175905d1d..d3d0c3488 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_register_admin_menu_item('unvalidated', 'users'); + elgg_register_admin_menu_item('administer', 'unvalidated', 'users'); elgg_extend_view('js/elgg', 'uservalidationbyemail/js'); diff --git a/views/default/admin/appearance/default_widgets.php b/views/default/admin/appearance/default_widgets.php deleted file mode 100644 index 7462dfa7c..000000000 --- a/views/default/admin/appearance/default_widgets.php +++ /dev/null @@ -1,65 +0,0 @@ - $info['name'], - 'url' => $url, - 'selected' => $selected - ); -} - -$tabs_vars = array( - 'tabs' => $tabs -); - -echo elgg_view('navigation/tabs', $tabs_vars); - -echo elgg_view('output/longtext', array('value' => elgg_echo('admin:appearance:default_widgets:instructions'))); - -if (!$current_info) { - $content = elgg_echo('admin:appearance:default_widgets:unknown_type'); -} else { - // default widgets are owned and saved to the site. - elgg_set_page_owner_guid(elgg_get_config('site_guid')); - elgg_push_context($current_info['widget_context']); - - $default_widgets_input = elgg_view('input/hidden', array( - 'name' => 'default_widgets', - 'value' => 1 - )); - - $params = array( - 'content' => $default_widgets_input, - 'num_columns' => $current_info['widget_columns'], - ); - - $content = elgg_view_layout('widgets', $params); - elgg_pop_context(); -} -elgg_pop_context(); - -echo $content; \ No newline at end of file diff --git a/views/default/admin/appearance/menu_items.php b/views/default/admin/appearance/menu_items.php deleted file mode 100644 index 4e35e032f..000000000 --- a/views/default/admin/appearance/menu_items.php +++ /dev/null @@ -1,10 +0,0 @@ - - $reset - -__HTML; - -echo $body; diff --git a/views/default/admin/appearance/profile_fields/list.php b/views/default/admin/appearance/profile_fields/list.php deleted file mode 100644 index 493129583..000000000 --- a/views/default/admin/appearance/profile_fields/list.php +++ /dev/null @@ -1,56 +0,0 @@ -translation = $translation; - $item->shortname = $listitem; - $item->name = "admin_defined_profile_{$listitem}"; - $item->type = elgg_get_config("admin_defined_profile_type_{$listitem}"); - $items[] = $item; - } - } -} -?> -
- -
-
- - \ No newline at end of file diff --git a/views/default/admin/settings/advanced.php b/views/default/admin/settings/advanced.php new file mode 100644 index 000000000..12e4303e7 --- /dev/null +++ b/views/default/admin/settings/advanced.php @@ -0,0 +1,9 @@ + $info['name'], + 'url' => $url, + 'selected' => $selected + ); +} + +$tabs_vars = array( + 'tabs' => $tabs +); + +echo elgg_view('navigation/tabs', $tabs_vars); + +echo elgg_view('output/longtext', array('value' => elgg_echo('admin:default_widgets:instructions'))); + +if (!$current_info) { + $content = elgg_echo('admin:default_widgets:unknown_type'); +} else { + // default widgets are owned and saved to the site. + elgg_set_page_owner_guid(elgg_get_config('site_guid')); + elgg_push_context($current_info['widget_context']); + + $default_widgets_input = elgg_view('input/hidden', array( + 'name' => 'default_widgets', + 'value' => 1 + )); + + $params = array( + 'content' => $default_widgets_input, + 'num_columns' => $current_info['widget_columns'], + ); + + $content = elgg_view_layout('widgets', $params); + elgg_pop_context(); +} +elgg_pop_context(); + +echo $content; diff --git a/views/default/admin/settings/menu_items.php b/views/default/admin/settings/menu_items.php new file mode 100644 index 000000000..4e35e032f --- /dev/null +++ b/views/default/admin/settings/menu_items.php @@ -0,0 +1,10 @@ + + $reset + +__HTML; + +echo $body; diff --git a/views/default/admin/settings/profile_fields/list.php b/views/default/admin/settings/profile_fields/list.php new file mode 100644 index 000000000..493129583 --- /dev/null +++ b/views/default/admin/settings/profile_fields/list.php @@ -0,0 +1,56 @@ +translation = $translation; + $item->shortname = $listitem; + $item->name = "admin_defined_profile_{$listitem}"; + $item->type = elgg_get_config("admin_defined_profile_type_{$listitem}"); + $items[] = $item; + } + } +} +?> +
+ +
+
+ + \ No newline at end of file diff --git a/views/default/admin/sidebar.php b/views/default/admin/sidebar.php index b2c520705..a6c16c758 100644 --- a/views/default/admin/sidebar.php +++ b/views/default/admin/sidebar.php @@ -1,8 +1,17 @@ 'priority')); +foreach ($sections as $section) { + $section_content = elgg_view_menu("admin-$section", array('sort_by' => 'priority', 'class' => 'mbl mts')); + + if ($section_content) { + $content .= '

' . elgg_echo("admin:$section") . '

'; + $content .= $section_content; + } +} -echo elgg_view_module('main', '', $content); \ No newline at end of file +echo elgg_view_module('main', '', $content, array('class' => 'elgg-admin-sidebar-menu')); \ No newline at end of file diff --git a/views/default/admin/site/advanced.php b/views/default/admin/site/advanced.php deleted file mode 100644 index 12e4303e7..000000000 --- a/views/default/admin/site/advanced.php +++ /dev/null @@ -1,9 +0,0 @@ - a { +.elgg-admin-sidebar-menu li.elgg-state-selected > a { background-color: #BBB; } -.elgg-menu-page .elgg-menu-closed:before { +.elgg-admin-sidebar-menu .elgg-menu-closed:before { content: "\25B8"; padding-right: 4px; } -.elgg-menu-page .elgg-menu-opened:before { +.elgg-admin-sidebar-menu .elgg-menu-opened:before { content: "\25BE"; padding-right: 4px; } -.elgg-menu-page .elgg-child-menu { +.elgg-admin-sidebar-menu .elgg-child-menu { display: none; padding-left: 30px; } -.elgg-menu-page li.elgg-state-selected > ul { +.elgg-admin-sidebar-menu li.elgg-state-selected > ul { display: block; } diff --git a/views/default/js/admin.php b/views/default/js/admin.php index 15c74d4de..d37dc7a81 100644 --- a/views/default/js/admin.php +++ b/views/default/js/admin.php @@ -16,6 +16,9 @@ elgg.admin.init = function () { $(this).stop().slideUp('medium'); }); + // semi-custom menus + $('.elgg-admin-sidebar-menu .elgg-menu-parent').live('click', elgg.ui.toggleMenu); + // plugin screenshot modal $('.elgg-plugin-screenshot a').click(elgg.admin.displayPluginScreenshot); -- cgit v1.2.3