Changeset 16929


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

Location:
branches/2.4
Files:
19 edited
1 copied

Legend:

Unmodified
Added
Removed
  • branches/2.4/admin.php

    r15230 r16929  
    3232include_once(PHPWG_ROOT_PATH.'admin/include/functions.php');
    3333include_once(PHPWG_ROOT_PATH.'admin/include/functions_plugins.inc.php');
     34include_once(PHPWG_ROOT_PATH.'admin/include/add_core_tabs.inc.php');
    3435
    3536trigger_action('loc_begin_admin');
  • branches/2.4/admin/album.php

    r16926 r16929  
    6464$tabsheet = new tabsheet();
    6565$tabsheet->set_id('album');
    66 $tabsheet->add('properties', l10n('Properties'), $admin_album_base_url.'-properties');
    67 $tabsheet->add('sort_order', l10n('Manage photo ranks'), $admin_album_base_url.'-sort_order');
    68 $tabsheet->add('permissions', l10n('Permissions'), $admin_album_base_url.'-permissions');
    69 $tabsheet->add('notification', l10n('Notification'), $admin_album_base_url.'-notification');
    7066$tabsheet->select($page['tab']);
    7167$tabsheet->assign();
  • branches/2.4/admin/batch_manager.php

    r16926 r16929  
    351351// |                                 Tabs                                  |
    352352// +-----------------------------------------------------------------------+
    353 
    354 $tabs = array(
    355   array(
    356     'code' => 'global',
    357     'label' => l10n('global mode'),
    358     ),
    359   array(
    360     'code' => 'unit',
    361     'label' => l10n('unit mode'),
    362     ),
    363   );
    364 
    365 $tab_codes = array_map(
    366   create_function('$a', 'return $a["code"];'),
    367   $tabs
    368   );
     353$manager_link = get_root_url().'admin.php?page=batch_manager&mode=';
    369354
    370355if (isset($_GET['mode']))
     
    374359else
    375360{
    376   $page['tab'] = $tabs[0]['code'];
    377 }
    378 
    379 if (in_array($page['tab'], $tab_codes))
    380 {
    381   $tabsheet = new tabsheet();
    382   $tabsheet->set_id('batch_manager');
    383   foreach ($tabs as $tab)
    384   {
    385     $tabsheet->add(
    386       $tab['code'],
    387       $tab['label'],
    388       get_root_url().'admin.php?page='.$_GET['page'].'&mode='.$tab['code']
    389       );
    390   }
    391   $tabsheet->select($page['tab']);
    392   $tabsheet->assign();
     361  $page['tab'] = 'global';
     362}
     363
     364$tabsheet = new tabsheet();
     365$tabsheet->set_id('batch_manager');
     366$tabsheet->select($page['tab']);
     367$tabsheet->assign();
    393368
    394369// +-----------------------------------------------------------------------+
     
    406381// +-----------------------------------------------------------------------+
    407382
    408   include(PHPWG_ROOT_PATH.'admin/batch_manager_'.$page['tab'].'.php');
    409 }
     383include(PHPWG_ROOT_PATH.'admin/batch_manager_'.$page['tab'].'.php');
    410384?>
  • branches/2.4/admin/cat_options.php

    r16926 r16929  
    140140$tabsheet = new tabsheet();
    141141$tabsheet->set_id('cat_options');
    142 // TabSheet initialization
    143 $opt_link = $link_start.'cat_options&section=';
    144 $tabsheet->add('status', l10n('Public / Private'), $opt_link.'status');
    145 $tabsheet->add('visible', l10n('Lock'), $opt_link.'visible');
    146 if ($conf['activate_comments'])
    147 {
    148   $tabsheet->add('comments', l10n('Comments'), $opt_link.'comments');
    149 }
    150 if ($conf['allow_random_representative'])
    151 {
    152   $tabsheet->add('representative', l10n('Representative'), $opt_link.'representative');
    153 }
    154 // TabSheet selection
    155142$tabsheet->select($page['section']);
    156 // Assign tabsheet to template
    157143$tabsheet->assign();
    158144
  • branches/2.4/admin/comments.php

    r16926 r16929  
    100100$tabsheet = new tabsheet();
    101101$tabsheet->set_id('comments');
    102 $tabsheet->add('', l10n('User comments validation'), '');
    103102$tabsheet->select('');
    104103$tabsheet->assign();
  • branches/2.4/admin/configuration.php

    r16926 r16929  
    288288$tabsheet = new tabsheet();
    289289$tabsheet->set_id('configuration');
    290 // TabSheet initialization
    291 $tabsheet->add('main', l10n('Main'), $conf_link.'main');
    292 $tabsheet->add('sizes', l10n('Photo sizes'), $conf_link.'sizes');
    293 $tabsheet->add('watermark', l10n('Watermark'), $conf_link.'watermark');
    294 $tabsheet->add('display', l10n('Display'), $conf_link.'display');
    295 $tabsheet->add('comments', l10n('Comments'), $conf_link.'comments');
    296 $tabsheet->add('default', l10n('Guest Settings'), $conf_link.'default');
    297 // TabSheet selection
    298290$tabsheet->select($page['section']);
    299 // Assign tabsheet to template
    300291$tabsheet->assign();
    301292
  • 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  );
  • branches/2.4/admin/include/albums_tab.inc.php

    r16926 r16929  
    2727
    2828$tabsheet = new tabsheet();
    29 $tabsheet->set_id('cat_list');
    30 $tabsheet->add('list', l10n('List'), $my_base_url.'cat_list');
    31 $tabsheet->add('move', l10n('Move'), $my_base_url.'cat_move');
    32 $tabsheet->add('permalinks', l10n('Permalinks'), $my_base_url.'permalinks');
     29$tabsheet->set_id('albums');
    3330$tabsheet->select($page['tab']);
    3431$tabsheet->assign();
  • branches/2.4/admin/include/functions_history.inc.php

    r16926 r16929  
    3131  $tabsheet = new tabsheet();
    3232  $tabsheet->set_id('history');
    33   // TabSheet initialization
    34   $tabsheet->add('stats', l10n('Statistics'), $link_start.'stats');
    35   $tabsheet->add('history', l10n('Search'), $link_start.'history');
    36   // TabSheet selection
    3733  $tabsheet->select($page['page']);
    38   // Assign tabsheet to template
    3934  $tabsheet->assign();
    4035}
  • branches/2.4/admin/include/tabsheet.class.php

    r16926 r16929  
    9090  {
    9191    $this->sheets = trigger_event('tabsheet_before_select', $this->sheets, $this->uniqid);
     92    if (!array_key_exists($name, $this->sheets))
     93    {
     94      $keys = array_keys($this->sheets);
     95      $name = $keys[0];
     96    }
    9297    $this->selected = $name;
    9398  }
  • branches/2.4/admin/languages.php

    r16926 r16929  
    3636  $page['tab'] = 'installed';
    3737
    38 $tabsheet = new tabsheet();
    39 $tabsheet->set_id('languages');
    40 $tabsheet->add('installed', l10n('Installed Languages'), $my_base_url.'&tab=installed');
    41 $tabsheet->add('update', l10n('Check for updates'), $my_base_url.'&tab=update');
    42 $tabsheet->add('new', l10n('Add New Language'), $my_base_url.'&tab=new');
     38$tabsheet = new tabsheet('languages');
    4339$tabsheet->select($page['tab']);
    4440$tabsheet->assign();
  • branches/2.4/admin/notification_by_mail.php

    r16926 r16929  
    590590  $tabsheet = new tabsheet();
    591591  $tabsheet->set_id('nbm');
    592   // TabSheet initialization
    593   $tabsheet->add('param', l10n('Parameter'),
    594     add_url_params($base_url.get_query_string_diff(array('mode', 'select')),
    595         array('mode' => 'param')));
    596   $tabsheet->add('subscribe', l10n('Subscribe'),
    597     add_url_params($base_url.get_query_string_diff(array('mode', 'select')),
    598       array('mode' => 'subscribe')));
    599   $tabsheet->add('send', l10n('Send'),
    600     add_url_params($base_url.get_query_string_diff(array('mode', 'select')),
    601       array('mode' => 'send')));
    602   // TabSheet selection
    603592  $tabsheet->select($page['mode']);
    604   // Assign tabsheet to template
    605593  $tabsheet->assign();
    606594}
  • branches/2.4/admin/photo.php

    r16926 r16929  
    6363$tabsheet = new tabsheet();
    6464$tabsheet->set_id('photo');
    65 $tabsheet->add('properties', l10n('Properties'), $admin_photo_base_url.'-properties');
    66 $tabsheet->add('coi', l10n('Center of interest'), $admin_photo_base_url.'-coi');
    67 
    6865$tabsheet->select($page['tab']);
    6966$tabsheet->assign();
  • branches/2.4/admin/photos_add.php

    r16926 r16929  
    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();
  • branches/2.4/admin/plugins.php

    r16926 r16929  
    3838$tabsheet = new tabsheet();
    3939$tabsheet->set_id('plugins');
    40 $tabsheet->add('installed', l10n('Plugin list'), $my_base_url.'&tab=installed');
    41 $tabsheet->add('update', l10n('Check for updates'), $my_base_url.'&tab=update');
    42 $tabsheet->add('new', l10n('Other plugins'), $my_base_url.'&tab=new');
    4340$tabsheet->select($page['tab']);
    4441$tabsheet->assign();
  • branches/2.4/admin/rating.php

    r16926 r16929  
    3838$tabsheet = new tabsheet();
    3939$tabsheet->set_id('rating');
    40 $tabsheet->add('rating', l10n('Photos'), get_root_url().'admin.php?page=rating');
    41 $tabsheet->add('rating_user', l10n('Users'), get_root_url().'admin.php?page=rating_user');
    4240$tabsheet->select('rating');
    4341$tabsheet->assign();
  • branches/2.4/admin/rating_user.php

    r16926 r16929  
    2727$tabsheet = new tabsheet();
    2828$tabsheet->set_id('rating');
    29 $tabsheet->add('rating', l10n('Photos'), get_root_url().'admin.php?page=rating');
    30 $tabsheet->add('rating_user', l10n('Users'), get_root_url().'admin.php?page=rating_user');
    3129$tabsheet->select('rating_user');
    3230$tabsheet->assign();
  • branches/2.4/admin/themes.php

    r16926 r16929  
    3838$tabsheet = new tabsheet();
    3939$tabsheet->set_id('themes');
    40 $tabsheet->add('installed', l10n('Installed Themes'), $my_base_url.'&tab=installed');
    41 $tabsheet->add('update', l10n('Check for updates'), $my_base_url.'&tab=update');
    42 $tabsheet->add('new', l10n('Add New Theme'), $my_base_url.'&tab=new');
    4340$tabsheet->select($page['tab']);
    4441$tabsheet->assign();
  • branches/2.4/admin/updates.php

    r16926 r16929  
    3636$tabsheet = new tabsheet();
    3737$tabsheet->set_id('updates');
    38 $tabsheet->add('pwg', l10n('Piwigo Update'), $my_base_url);
    39 $tabsheet->add('ext', l10n('Extensions Update'), $my_base_url.'&tab=ext');
    4038$tabsheet->select($page['tab']);
    4139$tabsheet->assign();
Note: See TracChangeset for help on using the changeset viewer.