From ef00110fe75a3036908602d3f4c8e54df43dd72d Mon Sep 17 00:00:00 2001 From: patdenice Date: Fri, 22 Apr 2011 14:22:50 +0000 Subject: feature:2274 Bug corrected with crop option. Clean code. Add sentence in thumbnails page for regeneration. git-svn-id: http://piwigo.org/svn/trunk@10571 68402e56-0260-453c-a942-63ccdbb3a9ee --- admin/themes/default/template/thumbnail.tpl | 65 +++++++++++++++-------------- admin/thumbnail.php | 13 +++--- language/en_UK/admin.lang.php | 1 + language/fr_FR/admin.lang.php | 3 +- 4 files changed, 42 insertions(+), 40 deletions(-) diff --git a/admin/themes/default/template/thumbnail.tpl b/admin/themes/default/template/thumbnail.tpl index 3c46b2c2e..5e981c3ef 100644 --- a/admin/themes/default/template/thumbnail.tpl +++ b/admin/themes/default/template/thumbnail.tpl @@ -11,9 +11,9 @@ var done = 0; {literal} var queuedManager = $.manageAjax.create('queued', { - queue: true, - cacheResponse: false, - maxRequests: 3, + queue: true, + cacheResponse: false, + maxRequests: 3, complete: function() { jQuery("#thumb_remaining").text(todo-(++done) + ' ' + remaining); if (todo == done) { @@ -23,13 +23,13 @@ var queuedManager = $.manageAjax.create('queued', { }); function processThumbs(width,height,crop,follow_orientation) { - jQuery('tr.nothumb').each(function() { - var image_path = jQuery(this).find('td.filepath').text(); - var td=this; - queuedManager.add({ - type: 'GET', - url: 'ws.php', - data: { + jQuery('tr.nothumb').each(function() { + var image_path = jQuery(this).find('td.filepath').text(); + var td=this; + queuedManager.add({ + type: 'GET', + url: 'ws.php', + data: { method: 'pwg.images.resize', image_path: image_path, type: 'thumbnail', @@ -39,24 +39,24 @@ function processThumbs(width,height,crop,follow_orientation) { follow_orientation: follow_orientation, format:'json' }, - dataType: 'json', - success: (function(row) { return function(data) { - if (data.stat =='ok') { + dataType: 'json', + success: (function(row) { return function(data) { + if (data.stat =='ok') { if (todo < 200) jQuery(row).find('td.thumbpic').html(''); jQuery(row).find('td.thumbdim').html(""+data.result.width+" x "+data.result.height); jQuery(row).find('td.thumbgentime').html(""+data.result.time); jQuery(row).find('td.thumbsize').html(""+data.result.size); jQuery(row).removeClass("nothumb"); - } else { - jQuery(row).find('td.thumbpic').html('#ERR#'+data.err+"# : "+data.message); + } else { + jQuery(row).find('td.thumbdim').html('#ERR#'+data.err+"# : "+data.message); jQuery(row).removeClass("nothumb"); jQuery(row).addClass("error"); - } - } + } + } })(td) - }); - }); + }); + }); } function toggleCropFields() { @@ -76,8 +76,8 @@ jQuery(document).ready(function(){ jQuery('input#proceed').click (function () { var width = jQuery('input[name="thumb_maxwidth"]').val(); var height = jQuery('input[name="thumb_maxheight"]').val(); - var crop = jQuery('#crop').is(':checked'); - var follow_orientation = jQuery('#follow_orientation').is(':checked'); + var crop = jQuery('#thumb_crop').is(':checked'); + var follow_orientation = jQuery('#thumb_follow_orientation').is(':checked'); jQuery(".waiting_bar").toggle(); if (todo < 200) jQuery('.thumbpic').show(); @@ -113,23 +113,23 @@ jQuery(document).ready(function(){ @@ -156,13 +156,16 @@ jQuery(document).ready(function(){ {$elt.PATH} {$elt.FILESIZE_IMG} {$elt.WIDTH_IMG} x {$elt.HEIGHT_IMG} - -   -   -   + +   +   +   {/foreach} {else} -
[ {'No missing thumbnail'|@translate} ]
+

+{'No missing thumbnail'|@translate}

+{'If you want to regenerate thumbnails, please go to the Batch Manager.'|@translate|@sprintf:"admin.php?page=batch_manager"} +

{/if} \ No newline at end of file diff --git a/admin/thumbnail.php b/admin/thumbnail.php index 461b11425..a59a931b5 100644 --- a/admin/thumbnail.php +++ b/admin/thumbnail.php @@ -100,6 +100,8 @@ while ( $row=pwg_db_fetch_assoc($result) ) // +-----------------------------------------------------------------------+ // | form & pictures without thumbnails display | // +-----------------------------------------------------------------------+ +$template->set_filenames( array('thumbnail'=>'thumbnail.tpl') ); + if (count($wo_thumbnails) > 0) { foreach ($wo_thumbnails as $path) @@ -114,7 +116,8 @@ if (count($wo_thumbnails) > 0) 'FILESIZE_IMG'=>$size, 'WIDTH_IMG'=>$width, 'HEIGHT_IMG'=>$height, - )); + ) + ); } } @@ -131,15 +134,9 @@ $template->assign( 'F_ACTION' => get_root_url().'admin.php?page=thumbnail', 'values' => $form_values, 'TOTAL_NB_REMAINING' => count($wo_thumbnails), + 'U_HELP' => get_root_url().'admin/popuphelp.php?page=thumbnail', ) ); -// +-----------------------------------------------------------------------+ -// | return to admin | -// +-----------------------------------------------------------------------+ -$template->set_filenames( array('thumbnail'=>'thumbnail.tpl') ); - -$template->assign('U_HELP', get_root_url().'admin/popuphelp.php?page=thumbnail'); - $template->assign_var_from_handle('ADMIN_CONTENT', 'thumbnail'); ?> diff --git a/language/en_UK/admin.lang.php b/language/en_UK/admin.lang.php index f79d3e052..842b29c33 100644 --- a/language/en_UK/admin.lang.php +++ b/language/en_UK/admin.lang.php @@ -829,4 +829,5 @@ $lang['Crop'] = 'Crop'; $lang['Width'] = 'Width'; $lang['Height'] = 'Height'; $lang['Follow Orientation'] = 'Follow Orientation'; +$lang['If you want to regenerate thumbnails, please go to the Batch Manager.'] = 'If you want to regenerate thumbnails, please go to the Batch Manager.'; ?> \ No newline at end of file diff --git a/language/fr_FR/admin.lang.php b/language/fr_FR/admin.lang.php index 84b524f1e..ed139318a 100644 --- a/language/fr_FR/admin.lang.php +++ b/language/fr_FR/admin.lang.php @@ -840,4 +840,5 @@ $lang['Crop'] = 'Retailler'; $lang['Width'] = 'Largeur'; $lang['Height'] = 'Hauteur'; $lang['Follow Orientation'] = "Respecter l'orientation"; -?> +$lang['If you want to regenerate thumbnails, please go to the Batch Manager.'] = 'Si vous voulez régénérer des miniatures, merci de vous rendre dans la Gestion par lot.'; +?> \ No newline at end of file -- cgit v1.2.3