Changeset 2272 for trunk


Ignore:
Timestamp:
Mar 10, 2008, 7:01:17 PM (17 years ago)
Author:
patdenice
Message:

Corrections in plugins management.
Add "Last revisions" sort order.

Location:
trunk
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • trunk/admin/include/functions_plugins.inc.php

    r2263 r2272  
    4747  return $url;
    4848}
     49
     50/**
     51 * Set tabsheet for plugins pages.
     52 * @param string selected page.
     53 */
     54function set_plugins_tabsheet($selected)
     55{
     56  include_once(PHPWG_ROOT_PATH.'admin/include/tabsheet.class.php');
     57
     58  $link = get_root_url().'admin.php?page=';
     59
     60  $tabsheet = new tabsheet();
     61  $tabsheet->add('plugins_list', l10n('plugins_tab_list'), $link.'plugins_list');
     62  $tabsheet->add('plugins_update', l10n('plugins_tab_update'), $link.'plugins_update');
     63  $tabsheet->add('plugins_new', l10n('plugins_tab_new'), $link.'plugins_new');
     64  $tabsheet->select($selected);
     65  $tabsheet->assign();
     66}
    4967?>
  • trunk/admin/include/plugins.class.php

    r2264 r2272  
    2929  var $fs_plugins = array();
    3030  var $db_plugins_by_id = array();
    31   var $server_plugins = array();
     31  var $server_plugins;
    3232
    3333  /**
     
    5050  * @param array - errors
    5151  */
    52   function perform_action($action, $plugin_id, $errors=array())
     52  function perform_action($action, $plugin_id)
    5353  {
    5454    if (isset($this->db_plugins_by_id[$plugin_id]))
     
    5757    }
    5858    $file_to_include = PHPWG_PLUGINS_PATH . $plugin_id . '/maintain.inc.php';
     59
     60    $errors = array();
    5961
    6062    switch ($action)
     
    280282      $this->server_plugins = @unserialize($source);
    281283    }
    282     else
    283     {
    284       $this->server_plugins = false;
    285     }
    286284  }
    287285 
     
    295293      case 'date':
    296294        krsort($this->server_plugins);
     295        break;
     296      case 'revision':
     297        usort($this->server_plugins, array($this, 'extension_revision_compare'));
    297298        break;
    298299      case 'name':
     
    428429  function plugin_version_compare($a, $b)
    429430  {
    430     $r = version_compare($a['version'], $b['version']);
    431     if ($r == 0) return strcasecmp($a['version'], $b['version']);
    432     else return $r;
     431    $pattern = array('/([a-z])/ei', '/\.+/', '/\.\Z|\A\./');
     432    $replacement = array( "'.'.intval('\\1', 36).'.'", '.', '');
     433
     434    $array = preg_replace($pattern, $replacement, array($a['version'], $b['version']));
     435
     436    return version_compare($array[0], $array[1], '>=');
     437  }
     438
     439  function extension_revision_compare($a, $b)
     440  {
     441    if ($a['date'] < $b['date']) return 1;
     442    else return -1;
    433443  }
    434444
  • trunk/admin/plugins_list.php

    r2264 r2272  
    4242{
    4343  $page['errors'] =
    44     $plugins->perform_action($_GET['action'], $_GET['plugin'], $page['errors']);
     44    $plugins->perform_action($_GET['action'], $_GET['plugin']);
    4545
    4646  if (empty($page['errors'])) redirect($base_url);
     
    4848
    4949//--------------------------------------------------------------------Tabsheet
    50 include_once(PHPWG_ROOT_PATH.'admin/include/tabsheet.class.php');
    51 $link = get_root_url().'admin.php?page=';
    52 $tabsheet = new tabsheet();
    53 $tabsheet->add('plugins_list', l10n('plugins_tab_list'), $link.'plugins_list');
    54 $tabsheet->add('plugins_update', l10n('plugins_tab_update'), $link.'plugins_update');
    55 $tabsheet->add('plugins_new', l10n('plugins_tab_new'), $link.'plugins_new');
    56 $tabsheet->select($page['page']);
    57 $tabsheet->assign();
     50set_plugins_tabsheet($page['page']);
    5851
    5952//---------------------------------------------------------------Order options
    60 $link .= $page['page'].'&amp;order=';
     53$link = get_root_url().'admin.php?page='.$page['page'].'&amp;order=';
    6154$template->assign('order_options',
    6255  array(
  • trunk/admin/plugins_new.php

    r2264 r2272  
    7878
    7979//--------------------------------------------------------------------Tabsheet
    80 include_once(PHPWG_ROOT_PATH.'admin/include/tabsheet.class.php');
    81 $link = get_root_url().'admin.php?page=';
    82 $tabsheet = new tabsheet();
    83 $tabsheet->add('plugins_list', l10n('plugins_tab_list'), $link.'plugins_list');
    84 $tabsheet->add('plugins_update', l10n('plugins_tab_update'), $link.'plugins_update');
    85 $tabsheet->add('plugins_new', l10n('plugins_tab_new'), $link.'plugins_new');
    86 $tabsheet->select($page['page']);
    87 $tabsheet->assign();
     80set_plugins_tabsheet($page['page']);
    8881
    8982//---------------------------------------------------------------Order options
    90 $link .= $page['page'].'&amp;order=';
     83$link = get_root_url().'admin.php?page='.$page['page'].'&amp;order=';
    9184$template->assign('order_options',
    9285  array(
    9386    $link.'date' => l10n('Post date'),
     87    $link.'revision' => l10n('plugins_revisions'),
    9488    $link.'name' => l10n('Name'),
    9589    $link.'author' => l10n('Author')));
     
    10094// +-----------------------------------------------------------------------+
    10195$plugins->get_server_plugins(true);
    102 $plugins->sort_server_plugins($order);
    10396
    104 if ($plugins->server_plugins !== false)
     97if (is_array($plugins->server_plugins))
    10598{
     99  $plugins->sort_server_plugins($order);
     100
    106101  foreach($plugins->server_plugins as $plugin)
    107102  {
     
    131126          'VERSION' => $plugin['version'],
    132127          'VERSION_URL' => PEM_URL.'/revision_view.php?rid='.$plugin['id_revision'],
     128          'DATE' => date('Y-m-d', $plugin['date']),
    133129          'VER_DESC' => $ver_desc,
    134130          'AUTHOR' => $plugin['author'],
  • trunk/admin/plugins_update.php

    r2264 r2272  
    9595
    9696//--------------------------------------------------------------------Tabsheet
    97 include_once(PHPWG_ROOT_PATH.'admin/include/tabsheet.class.php');
    98 $link = get_root_url().'admin.php?page=';
    99 $tabsheet = new tabsheet();
    100 $tabsheet->add('plugins_list', l10n('plugins_tab_list'), $link.'plugins_list');
    101 $tabsheet->add('plugins_update', l10n('plugins_tab_update'), $link.'plugins_update');
    102 $tabsheet->add('plugins_new', l10n('plugins_tab_new'), $link.'plugins_new');
    103 $tabsheet->select($page['page']);
    104 $tabsheet->assign();
     97set_plugins_tabsheet($page['page']);
    10598
    10699// +-----------------------------------------------------------------------+
     
    109102$plugins->get_server_plugins();
    110103
    111 if ($plugins->server_plugins !== false)
     104if (is_array($plugins->server_plugins))
    112105{
    113106  foreach($plugins->fs_plugins as $plugin_id => $fs_plugin)
     
    127120              utf8_encode($plugin_info['description'])))));
    128121
    129       if ($plugins->plugin_version_compare($fs_plugin, $plugin_info) >= 0)
     122      if ($plugins->plugin_version_compare($fs_plugin, $plugin_info))
    130123      {
    131124        // Plugin is up to date
  • trunk/language/en_UK/admin.lang.php

    r2268 r2272  
    231231$lang['config'] = 'Configuration';
    232232$lang['confirm'] = 'confirm';
    233 $lang['date'] = 'date';
     233$lang['Date'] = 'Date';
    234234$lang['delete category'] = 'delete category';
    235235$lang['description'] = 'description';
     
    627627$lang['plugins_tab_update'] = 'Check for updates';
    628628$lang['plugins_tab_new'] = 'Other plugins';
     629$lang['plugins_revisions'] = 'Last revisions';
    629630$lang['plugins_delete'] = 'Delete';
    630631$lang['plugins_confirm_delete'] = 'Are you sure you want to delete this plugin?';
  • trunk/language/es_ES/admin.lang.php

    r2268 r2272  
    230230$lang['config'] = 'Configuración';
    231231$lang['confirm'] = 'Confirmar';
    232 $lang['date'] = 'Fecha';
     232$lang['Date'] = 'Fecha';
    233233$lang['delete category'] = 'Suprimir la categoría';
    234234$lang['description'] = 'Descripción';
     
    619619$lang['c13y_anomalies_ignored_count'] = '%d anomalías han sido ignoradas.';
    620620
     621/* TODO */ $lang['plugins_need_update'] = 'Plugins which need upgrade';
     622/* TODO */ $lang['plugins_dontneed_update'] = 'Plugins up to date';
     623/* TODO */ $lang['plugins_cant_check'] = 'Plugin versions can\'t be checked';
     624/* TODO */ $lang['plugins_actual_version'] = 'Current<br>version';
     625/* TODO */ $lang['plugins_new_version'] = 'Available<br>version';
     626/* TODO */ $lang['plugins_auto_update'] = 'Automatic upgrade';
     627/* TODO */ $lang['plugins_auto_install'] = 'Automatic installation';
     628/* TODO */ $lang['plugins_download'] = 'Download file';
     629/* TODO */ $lang['plugins_description'] = '<b>Version:</b> %s<br><br><b>Date:</b> %s<br><br>%s';
     630/* TODO */ $lang['plugins_tab_list'] = 'Plugin list';
     631/* TODO */ $lang['plugins_tab_update'] = 'Check for updates';
     632/* TODO */ $lang['plugins_tab_new'] = 'Other plugins';
     633/* TODO */ $lang['plugins_revisions'] = 'Last revisions';
     634/* TODO */ $lang['plugins_delete'] = 'Delete';
     635/* TODO */ $lang['plugins_confirm_delete'] = 'Are you sure you want to delete this plugin?';
     636/* TODO */ $lang['plugins_confirm_install'] = 'Are you sure you want to install this plugin?';
     637/* TODO */ $lang['plugins_confirm_upgrade'] = 'Are you sur to install this upgrade? You must verify if this version does not need uninstallation.';
     638/* TODO */ $lang['plugins_upgrade_ok'] = '%s has been successfully upgraded.';
     639/* TODO */ $lang['plugins_install_ok'] = 'Plugin has been successfully copied';
     640/* TODO */ $lang['plugins_install_need_activate'] = 'You might go to plugin list to install and activate it.';
     641/* TODO */ $lang['plugins_temp_path_error'] = 'Can\'t create temporary file.';
     642/* TODO */ $lang['plugins_dl_archive_error'] = 'Can\'t download archive.';
     643/* TODO */ $lang['plugins_archive_error'] = 'Can\'t read or extract archive.';
     644/* TODO */ $lang['plugins_extract_error'] = 'An error occured during extraction (%s).';
     645/* TODO */ $lang['plugins_check_chmod'] = 'Please check "plugins" folder and sub-folders permissions (CHMOD).';
     646/* TODO */ $lang['plugins_server_error'] = 'Can\'t connect to server.';
     647
    621648/* TODO */ $lang['Purge compiled templates'] = 'Purge compiled templates';
    622649?>
  • trunk/language/fr_FR/admin.lang.php

    r2268 r2272  
    231231$lang['config'] = 'Configuration';
    232232$lang['confirm'] = 'confirmer';
    233 $lang['date'] = 'date';
     233$lang['Date'] = 'Date';
    234234$lang['delete category'] = 'supprimer la catégorie';
    235235$lang['description'] = 'description';
     
    627627$lang['plugins_tab_update'] = 'Vérifier les mises à jour';
    628628$lang['plugins_tab_new'] = 'Autres plugins disponibles';
     629$lang['plugins_revisions'] = 'Dernières révisions';
    629630$lang['plugins_delete'] = 'Supprimer';
    630631$lang['plugins_confirm_install'] = 'Etes-vous sûr de vouloir installer ce plugin?';
  • trunk/language/nl_NL/admin.lang.php

    r2268 r2272  
    231231$lang['config'] = 'Configuratie';
    232232$lang['confirm'] = 'bevestig';
    233 $lang['date'] = 'datum';
     233$lang['Date'] = 'Datum';
    234234$lang['delete category'] = 'verwijder categorie';
    235235$lang['description'] = 'omschrijving';
     
    621621/* TODO */ $lang['c13y_anomalies_ignored_count'] = '%d anomalies has been ignored.';
    622622
     623/* TODO */ $lang['plugins_need_update'] = 'Plugins which need upgrade';
     624/* TODO */ $lang['plugins_dontneed_update'] = 'Plugins up to date';
     625/* TODO */ $lang['plugins_cant_check'] = 'Plugin versions can\'t be checked';
     626/* TODO */ $lang['plugins_actual_version'] = 'Current<br>version';
     627/* TODO */ $lang['plugins_new_version'] = 'Available<br>version';
     628/* TODO */ $lang['plugins_auto_update'] = 'Automatic upgrade';
     629/* TODO */ $lang['plugins_auto_install'] = 'Automatic installation';
     630/* TODO */ $lang['plugins_download'] = 'Download file';
     631/* TODO */ $lang['plugins_description'] = '<b>Version:</b> %s<br><br><b>Date:</b> %s<br><br>%s';
     632/* TODO */ $lang['plugins_tab_list'] = 'Plugin list';
     633/* TODO */ $lang['plugins_tab_update'] = 'Check for updates';
     634/* TODO */ $lang['plugins_tab_new'] = 'Other plugins';
     635/* TODO */ $lang['plugins_revisions'] = 'Last revisions';
     636/* TODO */ $lang['plugins_delete'] = 'Delete';
     637/* TODO */ $lang['plugins_confirm_delete'] = 'Are you sure you want to delete this plugin?';
     638/* TODO */ $lang['plugins_confirm_install'] = 'Are you sure you want to install this plugin?';
     639/* TODO */ $lang['plugins_confirm_upgrade'] = 'Are you sur to install this upgrade? You must verify if this version does not need uninstallation.';
     640/* TODO */ $lang['plugins_upgrade_ok'] = '%s has been successfully upgraded.';
     641/* TODO */ $lang['plugins_install_ok'] = 'Plugin has been successfully copied';
     642/* TODO */ $lang['plugins_install_need_activate'] = 'You might go to plugin list to install and activate it.';
     643/* TODO */ $lang['plugins_temp_path_error'] = 'Can\'t create temporary file.';
     644/* TODO */ $lang['plugins_dl_archive_error'] = 'Can\'t download archive.';
     645/* TODO */ $lang['plugins_archive_error'] = 'Can\'t read or extract archive.';
     646/* TODO */ $lang['plugins_extract_error'] = 'An error occured during extraction (%s).';
     647/* TODO */ $lang['plugins_check_chmod'] = 'Please check "plugins" folder and sub-folders permissions (CHMOD).';
     648/* TODO */ $lang['plugins_server_error'] = 'Can\'t connect to server.';
     649
    623650/* TODO */ $lang['Purge compiled templates'] = 'Purge compiled templates';
    624651?>
  • trunk/template/yoga/admin/history.tpl

    r2245 r2272  
    117117<table class="table2" id="detailedStats">
    118118<tr class="throw">
    119         <th>{'date'|@translate}</th>
     119        <th>{'Date'|@translate}</th>
    120120        <th>{'time'|@translate}</th>
    121121        <th>{'user'|@translate}</th>
  • trunk/template/yoga/admin/plugins_new.tpl

    r2263 r2272  
    55
    66{'Sort order'|@translate} :
    7   <select onchange="document.location = this.options[this.selectedIndex].value;" style="width:120px">
     7  <select onchange="document.location = this.options[this.selectedIndex].value;" style="width:150px">
    88        {html_options options=$order_options selected=$order_selected}
    99  </select>
     
    1616    <td>{'Name'|@translate}</td>
    1717    <td>{'Version'|@translate}</td>
     18    <td>{'Date'|@translate}</td>
    1819    <td>{'Author'|@translate}</td>
    1920    <td>{'Actions'|@translate}</td>
     
    2627    <td style="text-align:center;"><a href="{$plugin.VERSION_URL}" onclick="window.open(this.href); return false;" class="tooltip">{$plugin.VERSION}
    2728      <span>{$plugin.VER_DESC}</span></a></td>
     29    <td>{$plugin.DATE}</td>
    2830    <td>{$plugin.AUTHOR}</td>
    2931    <td style="text-align:center;"><a href="{$plugin.URL_INSTALL}" onclick="return confirm('{'plugins_confirm_install'|@translate|@escape:javascript}');">{'plugins_auto_install'|@translate}</a>
  • trunk/template/yoga/admin/plugins_update.tpl

    r2263 r2272  
    6464{foreach from=$plugins_cant_check item=plugin name=plugins_loop}
    6565  <tr class="{if $smarty.foreach.plugins_loop.index is odd}row1{else}row2{/if}">
    66     <td>&nbsp;{$plugin.NAME}&nbsp;</td>
     66    <td>{$plugin.NAME}</td>
    6767    <td style="text-align:center;">{$plugin.VERSION}</td>
    6868  </tr>
  • trunk/template/yoga/admin/upload.tpl

    r2260 r2272  
    1111    <tr class="throw">
    1212      <th style="width:20%;">{'category'|@translate}</th>
    13       <th style="width:20%;">{'date'|@translate}</th>
     13      <th style="width:20%;">{'Date'|@translate}</th>
    1414      <th style="width:20%;">{'file'|@translate}</th>
    1515      <th style="width:20%;">{'thumbnail'|@translate}</th>
Note: See TracChangeset for help on using the changeset viewer.