aboutsummaryrefslogtreecommitdiff
path: root/engine
diff options
context:
space:
mode:
authorbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2011-03-11 23:14:09 +0000
committerbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2011-03-11 23:14:09 +0000
commite68bf62084b0a90097b3b65d3ef12c2605e09289 (patch)
treea08e06ca7e3ec0301e318342caeb79155d56a80b /engine
parentadae1958a95d7e801de91d673e927cac348236d9 (diff)
downloadelgg-e68bf62084b0a90097b3b65d3ef12c2605e09289.tar.gz
elgg-e68bf62084b0a90097b3b65d3ef12c2605e09289.tar.bz2
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
Diffstat (limited to 'engine')
-rw-r--r--engine/handlers/page_handler.php2
-rw-r--r--engine/lib/admin.php69
-rw-r--r--engine/lib/widgets.php2
3 files changed, 38 insertions, 35 deletions
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');