From cd00dffa7210a16063ab8e8f7811929b75f9a8e8 Mon Sep 17 00:00:00 2001 From: plegall Date: Wed, 17 Mar 2010 23:50:53 +0000 Subject: feature 1515: the new admin menu organization implies to tell the accordion menu which section to open on page load. I've moved the single function in functions_themes.inc.php to function.php to avoid misunderstanding with theme manager. Ability to preset the active menu (in the future, a plugin may add its admin page anywhere in the menu, this features needs other change to be possible) git-svn-id: http://piwigo.org/svn/trunk@5173 68402e56-0260-453c-a942-63ccdbb3a9ee --- admin/include/functions.php | 76 +++++++++++++++++++++++++++++++++ admin/include/functions_themes.inc.php | 58 ------------------------- admin/themes/clear/themeconf.inc.php | 5 --- admin/themes/default/template/admin.tpl | 2 +- admin/themes/roma/themeconf.inc.php | 5 --- 5 files changed, 77 insertions(+), 69 deletions(-) delete mode 100644 admin/include/functions_themes.inc.php (limited to 'admin') diff --git a/admin/include/functions.php b/admin/include/functions.php index 14e975b12..eb6a4181b 100644 --- a/admin/include/functions.php +++ b/admin/include/functions.php @@ -1905,4 +1905,80 @@ function get_newsletter_subscribe_base_url($language) { return 'http://'.$subscribe_domain.'/announcement/subscribe/'; } + +/** + * Accordion menus need to know which section to open by default when + * loading the page + */ +function get_active_menu($menu_page) +{ + global $page; + + if (isset($page['active_menu'])) + { + return $page['active_menu']; + } + + // specific cases + if ('element_set' == $menu_page) + { + if (isset($_GET['cat']) and is_numeric($_GET['cat'])) + { + return 1; + } + else + { + return 0; + } + } + + switch ($menu_page) + { + case 'photos_add': + case 'upload': + case 'comments': // really needs to be moved somewhere else + case 'rating': + case 'tags': + case 'picture_modify': + return 0; + + case 'site_manager': + case 'site_update': + case 'cat_list': + case 'cat_modify': + case 'cat_move': + case 'cat_options': + case 'cat_perm': + case 'permalinks': + return 1; + + case 'user_list': + case 'user_perm': + case 'group_list': + case 'group_perm': + case 'notification_by_mail': + return 2; + + case 'plugins_list': + case 'plugins_update': + case 'plugins_new': + case 'plugin': + return 3; + + case 'stats': + case 'history': + case 'maintenance': + case 'advanced_feature': + case 'thumbnail': + return 4; + + case 'configuration': + case 'extend_for_templates': + case 'menubar': + case 'themes_new': + case 'themes_installed': + return 5; + } + return 0; +} ?> \ No newline at end of file diff --git a/admin/include/functions_themes.inc.php b/admin/include/functions_themes.inc.php deleted file mode 100644 index 364bd1f3a..000000000 --- a/admin/include/functions_themes.inc.php +++ /dev/null @@ -1,58 +0,0 @@ - \ No newline at end of file diff --git a/admin/themes/clear/themeconf.inc.php b/admin/themes/clear/themeconf.inc.php index de1d34209..e007a971d 100644 --- a/admin/themes/clear/themeconf.inc.php +++ b/admin/themes/clear/themeconf.inc.php @@ -1,12 +1,7 @@ 'clear', 'parent' => 'default', 'admin_icon_dir' => 'admin/themes/clear/icon', - 'selected_admin_menu' => selected_admin_menu(), ); ?> diff --git a/admin/themes/default/template/admin.tpl b/admin/themes/default/template/admin.tpl index 0c029031d..bd63518a9 100644 --- a/admin/themes/default/template/admin.tpl +++ b/admin/themes/default/template/admin.tpl @@ -7,7 +7,7 @@ jQuery().ready(function(){ldelim} jQuery('#menubar').accordion({ldelim} header: "dt.rdion", event: "click", - active: {$U_ACTIVE_MENU|default:$themeconf.selected_admin_menu} + active: {$ACTIVE_MENU} }); }); diff --git a/admin/themes/roma/themeconf.inc.php b/admin/themes/roma/themeconf.inc.php index 1260576ab..886ed60db 100644 --- a/admin/themes/roma/themeconf.inc.php +++ b/admin/themes/roma/themeconf.inc.php @@ -1,11 +1,6 @@ 'roma', 'parent' => 'default', - 'selected_admin_menu' => selected_admin_menu(), ); ?> -- cgit v1.2.3