Changeset 5173


Ignore:
Timestamp:
Mar 18, 2010, 12:50:53 AM (11 years ago)
Author:
plg
Message:

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)

Location:
trunk
Files:
1 deleted
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/admin.php

    r5153 r5173  
    165165// +-----------------------------------------------------------------------+
    166166
     167$template->assign('ACTIVE_MENU', get_active_menu($page['page']));
     168
    167169if (count($page['errors']) != 0)
    168170{
  • trunk/admin/include/functions.php

    r5036 r5173  
    19061906  return 'http://'.$subscribe_domain.'/announcement/subscribe/';
    19071907}
     1908
     1909/**
     1910 * Accordion menus need to know which section to open by default when
     1911 * loading the page
     1912 */
     1913function get_active_menu($menu_page)
     1914{
     1915  global $page;
     1916
     1917  if (isset($page['active_menu']))
     1918  {
     1919    return $page['active_menu'];
     1920  }
     1921
     1922  // specific cases
     1923  if ('element_set' == $menu_page)
     1924  {
     1925    if (isset($_GET['cat']) and is_numeric($_GET['cat']))
     1926    {
     1927      return 1;
     1928    }
     1929    else
     1930    {
     1931      return 0;
     1932    }
     1933  }
     1934 
     1935  switch ($menu_page)
     1936  {
     1937    case 'photos_add':
     1938    case 'upload':
     1939    case 'comments': // really needs to be moved somewhere else
     1940    case 'rating':
     1941    case 'tags':
     1942    case 'picture_modify':
     1943      return 0;
     1944
     1945    case 'site_manager':
     1946    case 'site_update':
     1947    case 'cat_list':
     1948    case 'cat_modify':
     1949    case 'cat_move':
     1950    case 'cat_options':
     1951    case 'cat_perm':
     1952    case 'permalinks':
     1953      return 1;
     1954     
     1955    case 'user_list':
     1956    case 'user_perm':
     1957    case 'group_list':
     1958    case 'group_perm':
     1959    case 'notification_by_mail':
     1960      return 2;
     1961
     1962    case 'plugins_list':
     1963    case 'plugins_update':
     1964    case 'plugins_new':
     1965    case 'plugin':
     1966      return 3;
     1967     
     1968    case 'stats':
     1969    case 'history':
     1970    case 'maintenance':
     1971    case 'advanced_feature':
     1972    case 'thumbnail':
     1973      return 4;
     1974
     1975    case 'configuration':
     1976    case 'extend_for_templates':
     1977    case 'menubar':
     1978    case 'themes_new':
     1979    case 'themes_installed':
     1980      return 5;
     1981  }
     1982  return 0;
     1983}
    19081984?>
  • trunk/admin/themes/clear/themeconf.inc.php

    r5123 r5173  
    11<?php
    2 if (!function_exists('selected_admin_menu'))
    3 {
    4   include_once(PHPWG_ROOT_PATH.'admin/include/functions_themes.inc.php');
    5 }
    62$themeconf = array(
    73  'theme'    => 'clear',
    84  'parent'   => 'default',
    95  'admin_icon_dir' => 'admin/themes/clear/icon',
    10   'selected_admin_menu' => selected_admin_menu(),
    116);
    127?>
  • trunk/admin/themes/default/template/admin.tpl

    r5170 r5173  
    88    header: "dt.rdion",
    99    event: "click",
    10     active: {$U_ACTIVE_MENU|default:$themeconf.selected_admin_menu}
     10    active: {$ACTIVE_MENU}
    1111  });
    1212});
  • trunk/admin/themes/roma/themeconf.inc.php

    r5123 r5173  
    11<?php
    2 if (!function_exists('selected_admin_menu'))
    3 {
    4   include_once(PHPWG_ROOT_PATH.'admin/include/functions_themes.inc.php');
    5 }
    62$themeconf = array(
    73  'theme'  => 'roma',
    84  'parent' => 'default',
    9   'selected_admin_menu' => selected_admin_menu(),
    105);
    116?>
Note: See TracChangeset for help on using the changeset viewer.