source: trunk/admin/themes/default/template/thumbnail.tpl @ 11045

Last change on this file since 11045 was 11045, checked in by patdenice, 13 years ago

Remove useless code and small bug correction.

  • Property svn:eol-style set to LF
File size: 6.3 KB
Line 
1{combine_script id='jquery.ajaxmanager' load='footer' path='themes/default/js/plugins/jquery.ajaxmanager.js'}
2
3{footer_script}
4var width_str = '{'Width'|@translate}';
5var height_str = '{'Height'|@translate}';
6var max_width_str = '{'Maximum Width'|@translate}';
7var max_height_str = '{'Maximum Height'|@translate}';
8var remaining = '{'photos without thumbnail (jpeg and png only)'|@translate}';
9var todo = {$TOTAL_NB_REMAINING};
10var done = 0;
11
12{literal}
13var queuedManager = $.manageAjax.create('queued', {
14  queue: true, 
15  cacheResponse: false,
16  maxRequests: 3,
17  complete: function() {
18    jQuery("#thumb_remaining").text(todo-(++done) + ' ' + remaining);
19    if (todo == done) {
20      jQuery('.waiting_bar, #thumb_remaining, .properties').hide();
21    }
22  }
23});
24
25function processThumbs(width,height,crop,follow_orientation) {
26  jQuery('tr.nothumb').each(function() {
27    var image_path = jQuery(this).find('td.filepath').text();
28    var td=this;
29    queuedManager.add({
30      type: 'GET',
31      url: 'ws.php',
32      data: {
33        method: 'pwg.images.resizeThumbnail',
34        image_path: image_path,
35        maxwidth: width,
36        maxheight: height,
37        crop: crop,
38        follow_orientation: follow_orientation,
39        format:'json'
40      },
41      dataType: 'json',
42      success: (function(row) { return function(data) {
43          if (data.stat =='ok') {
44            if (todo < 200)
45              jQuery(row).find('td.thumbpic').html('<img src="'+data.result.destination+'"/>');
46            jQuery(row).find('td.thumbdim').html(""+data.result.width+" x "+data.result.height);
47            jQuery(row).find('td.thumbgentime').html(""+data.result.time);
48            jQuery(row).find('td.thumbsize').html(""+data.result.size);
49            jQuery(row).removeClass("nothumb");
50          } else {
51            jQuery(row).find('td.thumbdim').html('#ERR#'+data.err+"# : "+data.message);
52            jQuery(row).removeClass("nothumb");
53            jQuery(row).addClass("error");
54          }
55        }
56      })(td)
57    });
58  });
59}
60
61function toggleCropFields() {
62  if (jQuery("#thumb_crop").is(':checked')) {
63    jQuery("label[for='thumb_maxwidth']").text(width_str);
64    jQuery("label[for='thumb_maxheight']").text(height_str);
65    jQuery("#thumb_follow_orientation_li").show();
66  }
67  else {
68    jQuery("label[for='thumb_maxwidth']").text(max_width_str);
69    jQuery("label[for='thumb_maxheight']").text(max_height_str);
70    jQuery("#thumb_follow_orientation_li").hide();
71  }
72}
73
74jQuery(document).ready(function(){
75  jQuery('input#proceed').click (function () {
76    var width = jQuery('input[name="thumb_maxwidth"]').val();
77    var height = jQuery('input[name="thumb_maxheight"]').val();
78    var crop = jQuery('#thumb_crop').is(':checked');
79    var follow_orientation = jQuery('#thumb_follow_orientation').is(':checked');
80    jQuery(".waiting_bar").toggle();
81    if (todo < 200)
82      jQuery('.thumbpic').show();
83    jQuery('.thumbgentime, .thumbsize, .thumbdim').show();
84    processThumbs(width,height,crop,follow_orientation);
85  });
86
87  toggleCropFields();
88  jQuery("#thumb_crop").click(function () {toggleCropFields()});
89
90  jQuery('.thumbpic, .thumbgentime, .thumbsize, .thumbdim').hide();
91});
92{/literal}{/footer_script}
93
94<div class="titrePage">
95  <h2>{'Thumbnail creation'|@translate}</h2>
96</div>
97
98{if !empty($remainings) }
99<form method="post" action="{$params.F_ACTION}" class="properties">
100
101  <fieldset>
102    <legend>{'Thumbnail creation'|@translate}</legend>
103
104    <ul>
105      <li>
106        <span class="property"><label for="thumb_crop">{'Crop'|@translate}</label></span>
107        <input type="checkbox" name="thumb_crop" id="thumb_crop" {$values.thumb_crop}>
108      </li>
109      <li id="thumb_follow_orientation_li">
110        <span class="property"><label for="thumb_follow_orientation">{'Follow Orientation'|@translate}</label></span>
111        <input type="checkbox" name="thumb_follow_orientation" id="thumb_follow_orientation" {$values.thumb_follow_orientation}>
112      </li>
113      <li>
114        <span class="property"><label for="thumb_maxwidth">{'Maximum Width'|@translate}</label></span>
115        <input type="text" name="thumb_maxwidth" id="thumb_maxwidth" value="{$values.thumb_maxwidth}" size="4" maxlength="4"> {'pixels'|@translate}
116      </li>
117      <li>
118        <span class="property"><label for="thumb_maxheight">{'Maximum Height'|@translate}</label></span>
119        <input type="text" name="thumb_maxheight" id="thumb_maxheight" value="{$values.thumb_maxheight}" size="4" maxlength="4"> {'pixels'|@translate}
120      </li>
121      <li>
122        <span class="property"><label for="thumb_quality">{'Image Quality'|@translate}</label></span>
123        <input type="text" name="thumb_quality" id="thumb_quality" value="{$values.thumb_quality}" size="3" maxlength="3"> %
124      </li>
125    </ul>
126  </fieldset>
127
128  <p class="waiting_bar"><input type="button" name="submit" id="proceed" value="{'Submit'|@translate}"></p>
129  <p class="waiting_bar" style="display:none;">{'Please wait...'|@translate}<br><img src="admin/themes/default/images/ajax-loader-bar.gif"></p>
130</form>
131
132<div class="admin"><span id="thumb_remaining">{$TOTAL_NB_REMAINING} {'photos without thumbnail (jpeg and png only)'|@translate}</span></div>
133<table style="width:100%;">
134  <tr class="throw">
135    <th>&nbsp;</th>
136    <th style="width:60%;">{'Path'|@translate}</th>
137    <th>{'Filesize'|@translate}</th>
138    <th>{'Dimensions'|@translate}</th>
139    <th class="thumbpic">{'Thumbnail'|@translate}</th>
140    <th class="thumbgentime">{'generated in'|@translate}</th>
141    <th class="thumbsize">{'Filesize'|@translate}</th>
142    <th class="thumbdim">{'Dimensions'|@translate}</th>
143  </tr>
144  {foreach from=$remainings item=elt name=remain_loop}
145  <tr class="{if $smarty.foreach.remain_loop.index is odd}row1{else}row2{/if} nothumb item" id="th_{$smarty.foreach.remain_loop.iteration}">
146    <td>{$smarty.foreach.remain_loop.iteration}</td>
147    <td class="filepath">{$elt.PATH}</td>
148    <td>{$elt.FILESIZE_IMG}</td>
149    <td>{$elt.WIDTH_IMG} x {$elt.HEIGHT_IMG}</td>
150  <td class="thumbpic"><img src="admin/themes/default/images/ajax-loader.gif"></td>
151  <td class="thumbgentime">&nbsp;</td>
152  <td class="thumbsize">&nbsp;</td>
153  <td class="thumbdim">&nbsp;</td>
154  </tr>
155  {/foreach}
156</table>
157{else}
158<p style="text-align:left;margin:20px;">
159<b>{'No missing thumbnail'|@translate}</b><br><br>
160{'If you want to regenerate thumbnails, please go to the <a href="%s">Batch Manager</a>.'|@translate|@sprintf:"admin.php?page=batch_manager"}
161</p>
162{/if}
Note: See TracBrowser for help on using the repository browser.