Ignore:
Timestamp:
Jul 23, 2012, 1:52:18 PM (12 years ago)
Author:
mistic100
Message:

Merged revision(s) 16928 from trunk:
feature 2703: make it easy for plugins to add tabs in admin screens
centralize all core tabs in one file

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2.4/admin/help.php

    r16926 r16929  
    3030check_status(ACCESS_ADMINISTRATOR);
    3131
    32 $link = get_root_url().'admin.php?page=help&section=';
     32$help_link = get_root_url().'admin.php?page=help&section=';
    3333$selected = null;
    34 $help_section_title = null;
    35 
    36 $tabs = array();
    37 $tabs[] = array(
    38   'code' => 'add_photos',
    39   'label' => l10n('Add Photos'),
    40   );
    41 $tabs[] = array(
    42   'code' => 'permissions',
    43   'label' => l10n('Permissions'),
    44   );
    45 $tabs[] = array(
    46   'code' => 'groups',
    47   'label' => l10n('Groups'),
    48   );
    49 $tabs[] = array(
    50   'code' => 'virtual_links',
    51   'label' => l10n('Virtual Links'),
    52   );
    53 $tabs[] = array(
    54   'code' => 'misc',
    55   'label' => l10n('Miscellaneous'),
    56   );
    5734
    5835if (!isset($_GET['section']))
    5936{
    60   $section = $tabs[0]['code'];
     37  $selected = 'add_photos';
    6138}
    6239else
    6340{
    64   $section = $_GET['section'];
     41  $selected = $_GET['section'];
    6542}
    6643
    6744$tabsheet = new tabsheet();
    6845$tabsheet->set_id('help');
    69 foreach ($tabs as $tab)
    70 {
    71   if ($tab['code'] == $section)
    72   {
    73     $selected_tab = $tab['code'];
    74     $help_section_title = $tab['label'];
    75   }
    76  
    77   $tabsheet->add($tab['code'], $tab['label'], $link.$tab['code']);
    78 }
    79 $tabsheet->select($selected_tab);
    8046$tabsheet->assign();
    8147
     
    8551  array(
    8652    'HELP_CONTENT' => load_language(
    87       'help/help_'.$selected_tab.'.html',
     53      'help/help_'.$tabsheet->selected.'.html',
    8854      '',
    8955      array('return'=>true)
    9056      ),
    91     'HELP_SECTION_TITLE' => $help_section_title,
     57    'HELP_SECTION_TITLE' => $tabsheet->sheets[ $tabsheet->selected ]['caption'],
    9258    )
    9359  );
Note: See TracChangeset for help on using the changeset viewer.