Changeset 9931


Ignore:
Timestamp:
Mar 29, 2011, 11:35:00 PM (10 years ago)
Author:
patdenice
Message:

Update configuration after regeneration.

Location:
extensions/regenerateThumbnails
Files:
1 added
5 edited

Legend:

Unmodified
Added
Removed
  • extensions/regenerateThumbnails/admin.php

    r9922 r9931  
    291291
    292292$template->assign('element_set_global_action_tpl', dirname(__FILE__).'\element_set_global_action.tpl');
    293 $template->assign('redirect_url', get_root_url().'admin.php?page=plugin-'.basename(dirname(__FILE__)));
    294293$template->set_extent(dirname(__FILE__).'/regenerate_thumbnails.tpl', 'batch_manager_global');
    295294include(PHPWG_ROOT_PATH.'admin/batch_manager_global.php');
  • extensions/regenerateThumbnails/element_set_global_action.tpl

    r9922 r9931  
    33
    44{footer_script require='jquery.progressBar,jquery.ajaxmanager'}
     5var elements = new Array();
    56var all_elements = [{','|@implode:$all_elements}];
    67var redirect = '{$redirect_url}';
     
    1314});
    1415
     16function progress(val, max, success) {
     17  jQuery('#progressBar').progressBar(val, {
     18    max: max,
     19    textFormat: 'fraction',
     20    boxImage: 'plugins/regenerateThumbnails/images/progressbar.gif',
     21    barImage: 'plugins/regenerateThumbnails/images/progressbg_orange.gif'
     22  });
     23  type = success ? 'regenerateThumbnailsSuccess': 'regenerateThumbnailsError'
     24  s = jQuery('[name="'+type+'"]').val();
     25  jQuery('[name="'+type+'"]').val(++s);
     26
     27  if (val == max)
     28    jQuery('#applyAction').click();
     29}
     30
    1531jQuery(document).ready(function() {
    1632  jQuery('#applyAction').click(function() {
    1733    if (jQuery('[name="selectAction"]').val() == 'regenerateThumbnails') {
    18       elements = new Array();
     34      if (elements.length != 0)
     35        return true;
     36
    1937      if (jQuery('input[name="setSelected"]').attr('checked'))
    2038        elements = all_elements;
     
    5068          },
    5169          dataType: 'json',
    52           success: ( function(data) {
    53             if (data.stat =='ok')
    54               jQuery('#progressBar').progressBar(++todo, {
    55                 max: progressBar_max,
    56                 textFormat: 'fraction',
    57                 boxImage: 'plugins/regenerateThumbnails/images/progressbar.gif',
    58                 barImage: 'plugins/regenerateThumbnails/images/progressbg_orange.gif'
    59               });
    60             if (todo == progressBar_max)
    61               window.location = redirect;
    62           })
     70          success: ( function(data) { progress(++todo, progressBar_max, true) }),
     71          error: ( function(data) { progress(++todo, progressBar_max, false) })
    6372        });
    6473      }
     
    112121<span class="progressBar" id="progressBar"></span>
    113122</div>
     123
     124<input type="hidden" name="regenerateThumbnailsSuccess" value="0">
     125<input type="hidden" name="regenerateThumbnailsError" value="0">
  • extensions/regenerateThumbnails/language/en_UK/plugin.lang.php

    r9922 r9931  
    33$lang['Regenerate Thumbnails'] = 'Regenerate Thumbnails';
    44$lang['Thumbnails generation in progress...'] = 'Thumbnails generation in progress...';
    5 $lang['Thumbnails have been regenerated'] = 'Thumbnails have been regenerated';
     5$lang['%s thumbnails have been regenerated'] = '%s thumbnails have been regenerated';
     6$lang['%s thumbnails can not be regenerated'] = '%s thumbnails can not be regenerated';
    67
    78?>
  • extensions/regenerateThumbnails/language/fr_FR/plugin.lang.php

    r9922 r9931  
    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['Thumbnails have been regenerated'] = 'Les miniatures ont été régénérées.';
     5$lang['%s thumbnails have been regenerated'] = '%s miniatures ont été régénérées.';
     6$lang['%s thumbnails can not be regenerated'] = '%s miniatures ne peuvent pas être régénérées';
    67
    78?>
  • extensions/regenerateThumbnails/main.inc.php

    r9922 r9931  
    3838function rg_element_set_global_add_action()
    3939{
    40   global $template, $conf, $page, $pwg_loaded_plugins;
    41 
    42   load_language('plugin.lang', REGENERATE_THUMBNAILS_PATH);
    43   include_once(PHPWG_ROOT_PATH.'admin/include/functions_upload.inc.php');
    44 
    45   $template->set_filename('regenerateThumbnails', realpath(REGENERATE_THUMBNAILS_PATH.'element_set_global_action.tpl'));
    46 
    47   if (isset($_SESSION['regeneratedThumbnail']))
    48   {
    49     $template->delete_compiled_templates();
    50     array_push($page['infos'], l10n('Thumbnails have been regenerated'));
    51     unset($_SESSION['regeneratedThumbnail']);
    52   }
    53 
    54   foreach (get_upload_form_config() as $param_shortname => $param)
    55   {
    56     $param_name = 'upload_form_'.$param_shortname;
    57     $form_values[$param_shortname] = $conf[$param_name];
    58   }
    59 
    60   if (isset($pwg_loaded_plugins['square_thumbnails']))
    61   {
    62     load_language('plugin.lang', SQUARE_THUMB_PATH);
    63     $template->assign(array('SQUARE' => @$conf['upload_form_thumb_square']));
    64   }
    65 
    66   $redirect_url = get_root_url().'admin.php?page='.$_GET['page'];
    67   if ($_GET['page'] == 'plugin')
    68     $redirect_url .= '-regenerateThumbnails';
    69  
    70   $template->assign(array(
    71     'upload_form_settings' => $form_values,
    72     'all_elements' => $page['cat_elements_id'],
    73     'redirect_url' => $redirect_url,
    74     )
    75   );
    76 
    77   if ($template->get_template_vars('redirect_url') == null)
    78     $template->assign('redirect_url', get_root_url().'admin.php?page='.$_GET['page']);
    79 
    80   $template->append('element_set_global_plugins_actions', array(
    81     'ID' => 'regenerateThumbnails',
    82     'NAME' => l10n('Regenerate Thumbnails'),
    83     'CONTENT' => $template->parse('regenerateThumbnails', true),
    84     )
    85   );
    86 
    87   $template->set_prefilter('batch_manager_global', 'regenerate_prefilter');
     40  include(REGENERATE_THUMBNAILS_PATH.'element_set_global_action.php');
    8841}
    8942
     
    14295    );
    14396
    144   $_SESSION['regeneratedThumbnail'] = true;
    145 
    14697  return true;
    14798}
Note: See TracChangeset for help on using the changeset viewer.