Changeset 9922


Ignore:
Timestamp:
Mar 29, 2011, 8:48:13 PM (10 years ago)
Author:
patdenice
Message:

Add tab to thumbnail page.

Location:
extensions/regenerateThumbnails
Files:
2 added
4 edited

Legend:

Unmodified
Added
Removed
  • extensions/regenerateThumbnails/element_set_global_action.tpl

    r9917 r9922  
    1515jQuery(document).ready(function() {
    1616  jQuery('#applyAction').click(function() {
    17     if (jQuery('select[name="selectAction"]').val() == 'regenerateThumbnails') {
     17    if (jQuery('[name="selectAction"]').val() == 'regenerateThumbnails') {
    1818      elements = new Array();
    1919      if (jQuery('input[name="setSelected"]').attr('checked'))
     
    2525          }
    2626        });
     27
    2728      maxwidth = jQuery('input[name="thumb_maxwidth"]').val();
    2829      maxheight = jQuery('input[name="thumb_maxheight"]').val();
     
    5859              });
    5960            if (todo == progressBar_max)
    60               window.location = redirect+'&regeneratedThumbnail='+todo;
     61              window.location = redirect;
    6162          })
    6263        });
     
    7475  <td><input type="checkbox" name="square" id="square" {if $SQUARE}checked="checked"{/if}></td>
    7576</tr>
     77{footer_script require='jquery'}{literal}
     78jQuery().ready(function(){
     79  jQuery("input[name^='thumb_max']").keyup(function(){
     80    if(jQuery("#square").attr("checked")){
     81      if (this.name == "thumb_maxwidth"){
     82        jQuery("input[name='thumb_maxheight']").attr("value", this.value);
     83      }else{
     84        jQuery("input[name='thumb_maxwidth']").attr("value", this.value);
     85      }
     86    }
     87  });
     88  jQuery("#square").click(function(){
     89    if (this.checked)
     90      jQuery("input[name^='thumb_maxheight']").attr("value", jQuery("input[name^='thumb_maxwidth']").attr("value"));
     91  });
     92});
     93{/literal}{/footer_script}
    7694{else}
    7795<tr><td><input type="checkbox" name="square" id="square" style="display:none;"></td></tr>
  • extensions/regenerateThumbnails/language/en_UK/plugin.lang.php

    r9917 r9922  
    33$lang['Regenerate Thumbnails'] = 'Regenerate Thumbnails';
    44$lang['Thumbnails generation in progress...'] = 'Thumbnails generation in progress...';
    5 $lang['%s thumbnails have been regenerated'] = '%s thumbnails have been regenerated';
     5$lang['Thumbnails have been regenerated'] = 'Thumbnails have been regenerated';
    66
    77?>
  • extensions/regenerateThumbnails/language/fr_FR/plugin.lang.php

    r9917 r9922  
    33$lang['Regenerate Thumbnails'] = 'Régénérer les miniatures';
    44$lang['Thumbnails generation in progress...'] = 'Génération des miniatures en cours...';
    5 $lang['%s thumbnails have been regenerated'] = '%s miniatures ont été régénérées.';
     5$lang['Thumbnails have been regenerated'] = 'Les miniatures ont été régénérées.';
    66
    77?>
  • extensions/regenerateThumbnails/main.inc.php

    r9918 r9922  
    1010define('REGENERATE_THUMBNAILS_PATH' , PHPWG_PLUGINS_PATH . basename(dirname(__FILE__)) . '/');
    1111
     12add_event_handler('loc_begin_admin', 'rg_add_thumbnails_tab');
    1213add_event_handler('loc_begin_element_set_global', 'rg_element_set_global_add_action');
    1314add_event_handler('ws_add_methods', 'add_regenerate_thumbnails_method');
     15
     16function rg_add_thumbnails_tab()
     17{
     18  global $page;
     19
     20  if (isset($_GET['page']) and in_array($_GET['page'], array('thumbnail', 'plugin-regenerateThumbnails')))
     21  {
     22    load_language('plugin.lang', REGENERATE_THUMBNAILS_PATH);
     23    include_once(PHPWG_ROOT_PATH.'admin/include/tabsheet.class.php');
     24
     25    if ($_GET['page'] == 'plugin-regenerateThumbnails')
     26      $page['tab'] = 'regenerateThumbnails';
     27    else
     28      $page['tab'] = 'thumbnail';
     29
     30    $tabsheet = new tabsheet();
     31    $tabsheet->add('thumbnail', l10n('Thumbnail creation'), get_root_url().'admin.php?page=thumbnail');
     32    $tabsheet->add('regenerateThumbnails', l10n('Regenerate Thumbnails'), get_root_url().'admin.php?page=plugin-'.basename(dirname(__FILE__)));
     33    $tabsheet->select($page['tab']);
     34    $tabsheet->assign();
     35  }
     36}
    1437
    1538function rg_element_set_global_add_action()
     
    2245  $template->set_filename('regenerateThumbnails', realpath(REGENERATE_THUMBNAILS_PATH.'element_set_global_action.tpl'));
    2346
    24   if (isset($_GET['regeneratedThumbnail']))
     47  if (isset($_SESSION['regeneratedThumbnail']))
    2548  {
    2649    $template->delete_compiled_templates();
    27     array_push($page['infos'], sprintf(l10n('%s thumbnails have been regenerated'), $_GET['regeneratedThumbnail']));
     50    array_push($page['infos'], l10n('Thumbnails have been regenerated'));
     51    unset($_SESSION['regeneratedThumbnail']);
    2852  }
    2953
     
    4064  }
    4165
     66  $redirect_url = get_root_url().'admin.php?page='.$_GET['page'];
     67  if ($_GET['page'] == 'plugin')
     68    $redirect_url .= '-regenerateThumbnails';
     69 
    4270  $template->assign(array(
    4371    'upload_form_settings' => $form_values,
    4472    'all_elements' => $page['cat_elements_id'],
    45     'redirect_url' => get_root_url().'admin.php?page='.$_GET['page'],
     73    'redirect_url' => $redirect_url,
    4674    )
    4775  );
     76
     77  if ($template->get_template_vars('redirect_url') == null)
     78    $template->assign('redirect_url', get_root_url().'admin.php?page='.$_GET['page']);
    4879
    4980  $template->append('element_set_global_plugins_actions', array(
     
    111142    );
    112143
     144  $_SESSION['regeneratedThumbnail'] = true;
     145
    113146  return true;
    114147}
Note: See TracChangeset for help on using the changeset viewer.