Ignore:
Timestamp:
Mar 18, 2010, 12:50:53 AM (14 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)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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?>
Note: See TracChangeset for help on using the changeset viewer.