From f0d5c6c010ebf651ca6db8c35ef7124b8ca95369 Mon Sep 17 00:00:00 2001 From: rvelices Date: Tue, 13 Mar 2012 21:13:17 +0000 Subject: git-svn-id: http://piwigo.org/svn/trunk@13544 68402e56-0260-453c-a942-63ccdbb3a9ee --- admin/batch_manager_global.php | 58 ++-- .../default/template/batch_manager_global.tpl | 348 ++++++++++----------- admin/themes/default/template/maintenance.tpl | 2 +- 3 files changed, 190 insertions(+), 218 deletions(-) (limited to 'admin') diff --git a/admin/batch_manager_global.php b/admin/batch_manager_global.php index c2a9fdc53..6242a2dc9 100644 --- a/admin/batch_manager_global.php +++ b/admin/batch_manager_global.php @@ -411,39 +411,28 @@ DELETE ); } - if ('regenerateThumbnails' == $action) + if ('delete_derivatives' == $action) { - if ($_POST['regenerateSuccess'] != '0') - array_push($page['infos'], sprintf(l10n('%s thumbnails have been regenerated'), $_POST['regenerateSuccess'])); - - if ($_POST['regenerateError'] != '0') - array_push($page['warnings'], sprintf(l10n('%s thumbnails can not be regenerated'), $_POST['regenerateError'])); - - $update_fields = array('thumb_maxwidth', 'thumb_maxheight', 'thumb_quality', 'thumb_crop', 'thumb_follow_orientation'); + $query='SELECT path,representative_ext FROM '.IMAGES_TABLE.' + WHERE id IN ('.implode(',', $collection).')'; + $result = pwg_query($query); + while ($info = pwg_db_fetch_assoc($result)) + { + foreach( $_POST['del_derivatives_type'] as $type) + { + delete_element_derivatives($info, $type); + } + } } - if ('regenerateWebsize' == $action) + if ('generate_derivatives' == $action) { if ($_POST['regenerateSuccess'] != '0') - array_push($page['infos'], sprintf(l10n('%s photos have been regenerated'), $_POST['regenerateSuccess'])); + array_push($page['infos'], sprintf(l10n('%s photos were generated'), $_POST['regenerateSuccess'])); if ($_POST['regenerateError'] != '0') - array_push($page['warnings'], sprintf(l10n('%s photos can not be regenerated'), $_POST['regenerateError'])); - - $update_fields = array('websize_maxwidth', 'websize_maxheight', 'websize_quality'); - } + array_push($page['warnings'], sprintf(l10n('%s photos were not generated'), $_POST['regenerateError'])); - if (!empty($update_fields)) - { - // Update upload configuration - $updates = array(); - foreach ($update_fields as $field) - { - $value = !empty($_POST[$field]) ? $_POST[$field] : null; - $form_values[$field] = $value; - $updates[$field] = $value; - } - save_upload_form_config($updates); } trigger_action('element_set_global_action', $action, $collection); @@ -672,6 +661,19 @@ $template->assign( ) ); +//derivatives +$del_deriv_map = array(); +foreach(ImageStdParams::get_defined_type_map() as $params) +{ + $del_deriv_map[$params->type] = l10n($params->type); +} +$template->assign( + array( + 'del_derivatives_types' => $del_deriv_map, + 'generate_derivatives_types' => $del_deriv_map, + ) + ); + // +-----------------------------------------------------------------------+ // | global mode thumbnails | // +-----------------------------------------------------------------------+ @@ -756,7 +758,7 @@ SELECT id,path,representative_ext,file,filesize,level,name while ($row = pwg_db_fetch_assoc($result)) { $nb_thumbs_page++; - $src = DerivativeImage::thumb_url($row); + $src_image = new SrcImage($row); $title = render_element_name($row); if ($title != get_name_from_file($row['file'])) @@ -768,11 +770,11 @@ SELECT id,path,representative_ext,file,filesize,level,name 'thumbnails', array( 'ID' => $row['id'], - 'TN_SRC' => $src, + 'TN_SRC' => DerivativeImage::url(IMG_THUMB, $src_image), 'FILE' => $row['file'], 'TITLE' => $title, 'LEVEL' => $row['level'], - 'FILE_SRC' => $row['path'], + 'FILE_SRC' => DerivativeImage::url(IMG_LARGE, $src_image), 'U_EDIT' => get_root_url().'admin.php?page=photo-'.$row['id'], ) ); diff --git a/admin/themes/default/template/batch_manager_global.tpl b/admin/themes/default/template/batch_manager_global.tpl index d368591c2..8dfd08cb1 100644 --- a/admin/themes/default/template/batch_manager_global.tpl +++ b/admin/themes/default/template/batch_manager_global.tpl @@ -94,14 +94,13 @@ jQuery(document).ready(function() {ldelim} var nb_thumbs_page = {$nb_thumbs_page}; var nb_thumbs_set = {$nb_thumbs_set}; var applyOnDetails_pattern = "{'on the %d selected photos'|@translate}"; -var elements = new Array(); +var elements = []; var all_elements = [{if !empty($all_elements)}{','|@implode:$all_elements}{/if}]; +var generate_derivatives_done=false; var selectedMessage_pattern = "{'%d of %d photos selected'|@translate}"; var selectedMessage_none = "{'No photo selected, %d photos in current set'|@translate}"; var selectedMessage_all = "{'All %d photos are selected'|@translate}"; -var regenerateThumbnailsMessage = "{'Thumbnails generation in progress...'|@translate}"; -var regenerateWebsizeMessage = "{'Photos generation in progress...'|@translate}"; var width_str = '{'Width'|@translate}'; var height_str = '{'Height'|@translate}'; @@ -162,12 +161,16 @@ function progress(val, max, success) { boxImage: 'themes/default/images/progressbar.gif', barImage: 'themes/default/images/progressbg_orange.gif' }); - type = success ? 'regenerateSuccess': 'regenerateError' - s = jQuery('[name="'+type+'"]').val(); - jQuery('[name="'+type+'"]').val(++s); - - if (val == max) - jQuery('#applyAction').click(); + if (success !== undefined) { + var type = success ? 'regenerateSuccess': 'regenerateError', + s = jQuery('[name="'+type+'"]').val(); + jQuery('[name="'+type+'"]').val(++s); + } + + if (val == max) { + generate_derivatives_done = true; + jQuery('#applyAction').click(); + } } $(document).ready(function() { @@ -402,112 +405,97 @@ $(document).ready(function() { }); jQuery('#applyAction').click(function() { - if (elements.length != 0) - { - return true; - } - else if (jQuery('[name="selectAction"]').val() == 'regenerateThumbnails') - { - resizeMethod = 'pwg.images.resizeThumbnail'; - maxRequests = 3; - maxwidth = jQuery('input[name="thumb_maxwidth"]').val(); - maxheight = jQuery('input[name="thumb_maxheight"]').val(); - regenerationText = regenerateThumbnailsMessage; - crop = jQuery('input[name="thumb_crop"]').is(':checked'); - follow_orientation = jQuery('input[name="thumb_follow_orientation"]').is(':checked'); - } - else if(jQuery('[name="selectAction"]').val() == 'regenerateWebsize') - { - resizeMethod = 'pwg.images.resizeWebsize'; - maxRequests = 1; - maxwidth = jQuery('input[name="websize_maxwidth"]').val(); - maxheight = jQuery('input[name="websize_maxheight"]').val(); - regenerationText = regenerateWebsizeMessage; - crop = false; - follow_orientation = false; - } - else return true; - - jQuery('.bulkAction').hide(); - jQuery('#regenerationText').html(regenerationText); - - var queuedManager = jQuery.manageAjax.create('queued', { - queue: true, - cacheResponse: false, - maxRequests: maxRequests - }); - - if (jQuery('input[name="setSelected"]').attr('checked')) - elements = all_elements; - else - jQuery('input[name="selection[]"]').each(function() { - if (jQuery(this).attr('checked')) { - elements.push(jQuery(this).val()); - } - }); - - progressBar_max = elements.length; - todo = 0; - - jQuery('#applyActionBlock').hide(); - jQuery('select[name="selectAction"]').hide(); - jQuery('#regenerationMsg').show(); - - jQuery('#progressBar').progressBar(0, { - max: progressBar_max, - textFormat: 'fraction', - boxImage: 'themes/default/images/progressbar.gif', - barImage: 'themes/default/images/progressbg_orange.gif' - }); - - for (i=0;i @@ -686,8 +670,8 @@ jQuery(window).load(function() { {else} {/if} - - + + {if !empty($element_set_global_plugins_actions)} {foreach from=$element_set_global_plugins_actions item=action} @@ -784,59 +768,45 @@ jQuery(window).load(function() {
- -
- - - - - - - - - - - - - - - - - - - - - -
{'Maximum Width'|@translate} {'pixels'|@translate}
{'Maximum Height'|@translate} {'pixels'|@translate}
{'Image Quality'|@translate} %
-
- - -
-

- ! - {'By default, Piwigo will create a new websize from the HD (high definition) version of your photo.'|@translate} - {'If no HD is available and if the current websize is bigger than resize dimensions, Piwigo will move it as HD and create a downsized websize photo from it.'|@translate} -

- - - - - - - - - - - - - - -
{'Maximum Width'|@translate} {'pixels'|@translate}
{'Maximum Height'|@translate} {'pixels'|@translate}
{'Image Quality'|@translate} %
-
- + +
+ {'All'|@translate}, + {'None'|@translate} +
+ {foreach from=$generate_derivatives_types key=type item=disp} + + {/foreach} + {footer_script} + function selectGenerateDerivAll() {ldelim} + $("#action_generate_derivatives input[type=checkbox]").attr("checked", true); + } + function selectGenerateDerivNone() {ldelim} + $("#action_generate_derivatives input[type=checkbox]").attr("checked", false); + } + {/footer_script} +
+ + +
+ {'All'|@translate}, + {'None'|@translate} +
+ {foreach from=$del_derivatives_types key=type item=disp} + + {/foreach} + {footer_script} + function selectDelDerivAll() {ldelim} + $("#action_delete_derivatives input[type=checkbox]").attr("checked", true); + } + function selectDelDerivNone() {ldelim} + $("#action_delete_derivatives input[type=checkbox]").attr("checked", false); + } + {/footer_script} +
+ -
-

+