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

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
  • trunk/admin/photos_add.php

    r16925 r16928  
    5050// |                                 Tabs                                  |
    5151// +-----------------------------------------------------------------------+
    52 
    53 $tabs = array(
    54   array(
    55     'code' => 'direct',
    56     'label' => l10n('Web Form'),
    57     ),
    58   array(
    59     'code' => 'applications',
    60     'label' => l10n('Applications'),
    61     ),
    62   );
    63 
    64 if ($conf['enable_synchronization'])
    65 {
    66   array_push(
    67     $tabs,
    68     array(
    69       'code' => 'ftp',
    70       'label' => l10n('FTP + Synchronization'),
    71       )
    72     );
    73 }
    74 
    75 $tab_codes = array_map(
    76   create_function('$a', 'return $a["code"];'),
    77   $tabs
    78   );
    79 
    80 if (isset($_GET['section']) and in_array($_GET['section'], $tab_codes))
     52if (isset($_GET['section']))
    8153{
    8254  $page['tab'] = $_GET['section'];
     
    8456else
    8557{
    86   $page['tab'] = $tabs[0]['code'];
     58  $page['tab'] = 'direct';
    8759}
    8860
    8961$tabsheet = new tabsheet();
    9062$tabsheet->set_id('photos_add');
    91 foreach ($tabs as $tab)
    92 {
    93   $tabsheet->add(
    94     $tab['code'],
    95     $tab['label'],
    96     PHOTOS_ADD_BASE_URL.'&section='.$tab['code']
    97     );
    98 }
    9963$tabsheet->select($page['tab']);
    10064$tabsheet->assign();
Note: See TracChangeset for help on using the changeset viewer.