source: extensions/regenerateThumbnails/regenerate_thumbnails.tpl @ 9959

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

Bug corrected on resize

File size: 15.5 KB
Line 
1{include file='include/tag_selection.inc.tpl'}
2{include file='include/datepicker.inc.tpl'}
3
4{footer_script}{literal}
5  pwg_initialization_datepicker("#date_creation_day", "#date_creation_month", "#date_creation_year", "#date_creation_linked_date", "#date_creation_action_set");
6{/literal}{/footer_script}
7
8{combine_script id='jquery.fcbkcomplete' load='footer' require='jquery' path='themes/default/js/plugins/jquery.fcbkcomplete.js'}
9
10{footer_script require='jquery.fcbkcomplete'}{literal}
11jQuery(document).ready(function() {
12  jQuery("#tags").fcbkcomplete({
13    json_url: "admin.php?fckb_tags=1",
14    cache: false,
15    filter_case: false,
16    filter_hide: true,
17    firstselected: true,
18    filter_selected: true,
19    maxitems: 100,
20    newel: true
21  });
22});
23{/literal}{/footer_script}
24
25{footer_script}
26var nb_thumbs_page = {$nb_thumbs_page};
27var nb_thumbs_set = {$nb_thumbs_set};
28var applyOnDetails_pattern = "{'on the %d selected photos'|@translate}";
29
30var selectedMessage_pattern = "{'%d of %d photos selected'|@translate}";
31var selectedMessage_none = "{'No photo selected, %d photos in current set'|@translate}";
32var selectedMessage_all = "{'All %d photos are selected'|@translate}";
33{literal}
34function str_repeat(i, m) {
35        for (var o = []; m > 0; o[--m] = i);
36        return o.join('');
37}
38
39function sprintf() {
40        var i = 0, a, f = arguments[i++], o = [], m, p, c, x, s = '';
41        while (f) {
42                if (m = /^[^\x25]+/.exec(f)) {
43                        o.push(m[0]);
44                }
45                else if (m = /^\x25{2}/.exec(f)) {
46                        o.push('%');
47                }
48                else if (m = /^\x25(?:(\d+)\$)?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-fosuxX])/.exec(f)) {
49                        if (((a = arguments[m[1] || i++]) == null) || (a == undefined)) {
50                                throw('Too few arguments.');
51                        }
52                        if (/[^s]/.test(m[7]) && (typeof(a) != 'number')) {
53                                throw('Expecting number but found ' + typeof(a));
54                        }
55                        switch (m[7]) {
56                                case 'b': a = a.toString(2); break;
57                                case 'c': a = String.fromCharCode(a); break;
58                                case 'd': a = parseInt(a); break;
59                                case 'e': a = m[6] ? a.toExponential(m[6]) : a.toExponential(); break;
60                                case 'f': a = m[6] ? parseFloat(a).toFixed(m[6]) : parseFloat(a); break;
61                                case 'o': a = a.toString(8); break;
62                                case 's': a = ((a = String(a)) && m[6] ? a.substring(0, m[6]) : a); break;
63                                case 'u': a = Math.abs(a); break;
64                                case 'x': a = a.toString(16); break;
65                                case 'X': a = a.toString(16).toUpperCase(); break;
66                        }
67                        a = (/[def]/.test(m[7]) && m[2] && a >= 0 ? '+'+ a : a);
68                        c = m[3] ? m[3] == '0' ? '0' : m[3].charAt(1) : ' ';
69                        x = m[5] - String(a).length - s.length;
70                        p = m[5] ? str_repeat(c, x) : '';
71                        o.push(s + (m[4] ? a + p : p + a));
72                }
73                else {
74                        throw('Huh ?!');
75                }
76                f = f.substring(m[0].length);
77        }
78        return o.join('');
79}
80
81$(document).ready(function() {
82  function checkPermitAction() {
83    var nbSelected = 0;
84    if ($("input[name=setSelected]").is(':checked')) {
85      nbSelected = nb_thumbs_set;
86    }
87    else {
88      $(".thumbnails input[type=checkbox]").each(function() {
89         if ($(this).is(':checked')) {
90           nbSelected++;
91         }
92      });
93    }
94
95    if (nbSelected == 0) {
96      $("#applyActionBlock").hide();
97      $("#forbidAction").show();
98    }
99    else {
100      $("#applyActionBlock").show();
101      $("#forbidAction").hide();
102    }
103
104    $("#applyOnDetails").text(
105      sprintf(
106        applyOnDetails_pattern,
107        nbSelected
108      )
109    );
110
111    // display the number of currently selected photos in the "Selection" fieldset
112    if (nbSelected == 0) {
113      $("#selectedMessage").text(
114        sprintf(
115          selectedMessage_none,
116          nb_thumbs_set
117        )
118      );
119    }
120    else if (nbSelected == nb_thumbs_set) {
121      $("#selectedMessage").text(
122        sprintf(
123          selectedMessage_all,
124          nb_thumbs_set
125        )
126      );
127    }
128    else {
129      $("#selectedMessage").text(
130        sprintf(
131          selectedMessage_pattern,
132          nbSelected,
133          nb_thumbs_set
134        )
135      );
136    }
137  }
138
139  $('img.thumbnail').tipTip({
140    'delay' : 0,
141    'fadeIn' : 200,
142    'fadeOut' : 200
143  });
144
145  $(".wrap1 label").click(function () {
146    $("input[name=setSelected]").attr('checked', false);
147
148    var wrap2 = $(this).children(".wrap2");
149    var checkbox = $(this).children("input[type=checkbox]");
150
151    if ($(checkbox).is(':checked')) {
152      $(wrap2).addClass("thumbSelected");
153    }
154    else {
155      $(wrap2).removeClass('thumbSelected');
156    }
157
158    checkPermitAction();
159  });
160
161  $("#selectAll").click(function () {
162    $("input[name=setSelected]").attr('checked', false);
163    selectPageThumbnails();
164    checkPermitAction();
165    return false;
166  });
167
168  function selectPageThumbnails() {
169    $(".thumbnails label").each(function() {
170      var wrap2 = $(this).children(".wrap2");
171      var checkbox = $(this).children("input[type=checkbox]");
172
173      $(checkbox).attr('checked', true);
174      $(wrap2).addClass("thumbSelected");
175    });
176  }
177
178  $("#selectNone").click(function () {
179    $("input[name=setSelected]").attr('checked', false);
180
181    $(".thumbnails label").each(function() {
182      var wrap2 = $(this).children(".wrap2");
183      var checkbox = $(this).children("input[type=checkbox]");
184
185      $(checkbox).attr('checked', false);
186      $(wrap2).removeClass("thumbSelected");
187    });
188    checkPermitAction();
189    return false;
190  });
191
192  $("#selectInvert").click(function () {
193    $("input[name=setSelected]").attr('checked', false);
194
195    $(".thumbnails label").each(function() {
196      var wrap2 = $(this).children(".wrap2");
197      var checkbox = $(this).children("input[type=checkbox]");
198
199      $(checkbox).attr('checked', !$(checkbox).is(':checked'));
200
201      if ($(checkbox).is(':checked')) {
202        $(wrap2).addClass("thumbSelected");
203      }
204      else {
205        $(wrap2).removeClass('thumbSelected');
206      }
207    });
208    checkPermitAction();
209    return false;
210  });
211
212  $("#selectSet").click(function () {
213    selectPageThumbnails();
214    $("input[name=setSelected]").attr('checked', true);
215    checkPermitAction();
216    return false;
217  });
218
219  $("input[name=remove_author]").click(function () {
220    if ($(this).is(':checked')) {
221      $("input[name=author]").hide();
222    }
223    else {
224      $("input[name=author]").show();
225    }
226  });
227
228  $("input[name=remove_title]").click(function () {
229    if ($(this).is(':checked')) {
230      $("input[name=title]").hide();
231    }
232    else {
233      $("input[name=title]").show();
234    }
235  });
236
237  $("input[name=remove_date_creation]").click(function () {
238    if ($(this).is(':checked')) {
239      $("#set_date_creation").hide();
240    }
241    else {
242      $("#set_date_creation").show();
243    }
244  });
245
246  $(".removeFilter").click(function () {
247    var filter = $(this).parent('li').attr("id");
248    filter_disable(filter);
249
250    return false;
251  });
252
253  function filter_enable(filter) {
254    /* show the filter*/
255    $("#"+filter).show();
256
257    /* check the checkbox to declare we use this filter */
258    $("input[type=checkbox][name="+filter+"_use]").attr("checked", true);
259
260    /* forbid to select this filter in the addFilter list */
261    $("#addFilter").children("option[value="+filter+"]").attr("disabled", "disabled");
262  }
263
264  $("#addFilter").change(function () {
265    var filter = $(this).attr("value");
266    filter_enable(filter);
267    $(this).attr("value", -1);
268  });
269
270  function filter_disable(filter) {
271    /* hide the filter line */
272    $("#"+filter).hide();
273
274    /* uncheck the checkbox to declare we do not use this filter */
275    $("input[name="+filter+"_use]").removeAttr("checked");
276
277    /* give the possibility to show it again */
278    $("#addFilter").children("option[value="+filter+"]").removeAttr("disabled");
279  }
280
281  $("#removeFilters").click(function() {
282    $("#filterList li").each(function() {
283      var filter = $(this).attr("id");
284      filter_disable(filter);
285    });
286    return false;
287  });
288
289  var max_dim = 0;
290  $(".thumbnails img").each(function () {
291    if ($(this).height() > max_dim)
292      max_dim = $(this).height() + 20;
293    if ($(this).width() > max_dim)
294      max_dim = $(this).width() + 20;
295    $("ul.thumbnails span, ul.thumbnails label").css('width', max_dim+'px').css('height', max_dim+'px');
296  });
297
298  checkPermitAction()
299});
300{/literal}{/footer_script}
301
302<div id="batchManagerGlobal">
303
304<h2>{'Regenerate Thumbnails'|@translate}</h2>
305
306  <form action="{$F_ACTION}" method="post">
307
308  <fieldset>
309    <legend>{'Filter'|@translate}</legend>
310
311    <ul id="filterList">
312      <li id="filter_prefilter" {if !isset($filter.prefilter)}style="display:none"{/if}>
313        <a href="#" class="removeFilter" title="{'remove this filter'|@translate}"><span>[x]</span></a>
314        <input type="checkbox" name="filter_prefilter_use" class="useFilterCheckbox" {if isset($filter.prefilter)}checked="checked"{/if}>
315        {'predefined filter'|@translate}
316        <select name="filter_prefilter">
317          <option value="caddie" {if $filter.prefilter eq 'caddie'}selected="selected"{/if}>{'caddie'|@translate}</option>
318          <option value="last import" {if $filter.prefilter eq 'last import'}selected="selected"{/if}>{'last import'|@translate}</option>
319          <option value="with no album" {if $filter.prefilter eq 'with no album'}selected="selected"{/if}>{'with no album'|@translate}</option>
320{if $ENABLE_SYNCHRONIZATION}
321          <option value="with no virtual album" {if $filter.prefilter eq 'with no virtual album'}selected="selected"{/if}>{'with no virtual album'|@translate}</option>
322{/if}
323          <option value="with no tag" {if $filter.prefilter eq 'with no tag'}selected="selected"{/if}>{'with no tag'|@translate}</option>
324          <option value="duplicates" {if $filter.prefilter eq 'duplicates'}selected="selected"{/if}>{'duplicates'|@translate}</option>
325          <option value="all photos" {if $filter.prefilter eq 'all photos'}selected="selected"{/if}>{'All'|@translate}</option>
326        </select>
327      </li>
328      <li id="filter_category" {if !isset($filter.category)}style="display:none"{/if}>
329        <a href="#" class="removeFilter" title="remove this filter"><span>[x]</span></a>
330        <input type="checkbox" name="filter_category_use" class="useFilterCheckbox" {if isset($filter.category)}checked="checked"{/if}>
331        {'album'|@translate}
332        <select style="width:400px" name="filter_category" size="1">
333          {html_options options=$filter_category_options selected=$filter_category_options_selected}
334        </select>
335        <label><input type="checkbox" name="filter_category_recursive" {if isset($filter.category_recursive)}checked="checked"{/if}> {'include child albums'|@translate}</label>
336      </li>
337      <li id="filter_level" {if !isset($filter.level)}style="display:none"{/if}>
338        <a href="#" class="removeFilter" title="remove this filter"><span>[x]</span></a>
339        <input type="checkbox" name="filter_level_use" class="useFilterCheckbox" {if isset($filter.level)}checked="checked"{/if}>
340        {'Who can see these photos?'|@translate}
341        <select name="filter_level" size="1">
342          {html_options options=$filter_level_options selected=$filter_level_options_selected}
343        </select>
344      </li>
345    </ul>
346
347    <p class="actionButtons" style="">
348      <select id="addFilter">
349        <option value="-1">{'Add a filter'|@translate}</option>
350        <option disabled="disabled">------------------</option>
351        <option value="filter_prefilter">{'predefined filter'|@translate}</option>
352        <option value="filter_category">{'album'|@translate}</option>
353        <option value="filter_level">{'Who can see these photos?'|@translate}</option>
354      </select>
355<!--      <input id="removeFilters" class="submit" type="submit" value="Remove all filters" name="removeFilters"> -->
356      <a id="removeFilters" href="">{'Remove all filters'|@translate}</a>
357    </p>
358
359    <p class="actionButtons" id="applyFilterBlock">
360      <input id="applyFilter" class="submit" type="submit" value="{'Refresh photo set'|@translate}" name="submitFilter">
361    </p>
362
363  </fieldset>
364
365  <fieldset>
366
367    <legend>{'Selection'|@translate}</legend>
368
369  {if !empty($thumbnails)}
370  <p id="checkActions">
371    {'Select:'|@translate}
372{if $nb_thumbs_set > $nb_thumbs_page}
373    <a href="#" id="selectAll">{'The whole page'|@translate}</a>,
374    <a href="#" id="selectSet">{'The whole set'|@translate}</a>,
375{else}
376    <a href="#" id="selectAll">{'All'|@translate}</a>,
377{/if}
378    <a href="#" id="selectNone">{'None'|@translate}</a>,
379    <a href="#" id="selectInvert">{'Invert'|@translate}</a>
380
381    <span id="selectedMessage"></span>
382
383    <input type="checkbox" name="setSelected" style="display:none" {if count($selection) == $nb_thumbs_set}checked="checked"{/if}>
384  </p>
385
386    <ul class="thumbnails">
387      {foreach from=$thumbnails item=thumbnail}
388        {if in_array($thumbnail.ID, $selection)}
389          {assign var='isSelected' value=true}
390        {else}
391          {assign var='isSelected' value=false}
392        {/if}
393
394      <li><span class="wrap1">
395          <label>
396            <span class="wrap2{if $isSelected} thumbSelected{/if}">
397        {if $thumbnail.LEVEL > 0}
398        <em class="levelIndicatorB">{$pwg->l10n($pwg->sprintf('Level %d',$thumbnail.LEVEL))}</em>
399        <em class="levelIndicatorF" title="{'Who can see these photos?'|@translate} : ">{$pwg->l10n($pwg->sprintf('Level %d',$thumbnail.LEVEL))}</em>
400        {/if}
401            <span>
402              <img src="{$thumbnail.TN_SRC}"
403                 alt="{$thumbnail.FILE}"
404                 title="{$thumbnail.TITLE|@escape:'html'}"
405                 class="thumbnail">
406            </span></span>
407            <input type="checkbox" name="selection[]" value="{$thumbnail.ID}" {if $isSelected}checked="checked"{/if}>
408          </label>
409          </span>
410      </li>
411      {/foreach}
412    </ul>
413
414  {if !empty($navbar) }
415  <div style="clear:both;">
416
417    <div style="float:left">
418    {include file='navigation_bar.tpl'|@get_extent:'navbar'}
419    </div>
420
421    <div style="float:right;margin-top:10px;">{'display'|@translate}
422      <a href="{$U_DISPLAY}&amp;display=20">20</a>
423      &middot; <a href="{$U_DISPLAY}&amp;display=50">50</a>
424      &middot; <a href="{$U_DISPLAY}&amp;display=100">100</a>
425      &middot; <a href="{$U_DISPLAY}&amp;display=all">{'all'|@translate}</a>
426      {'photos per page'|@translate}
427    </div>
428  </div>
429  {/if}
430
431  {else}
432  <div>{'No photo in the current set.'|@translate}</div>
433  {/if}
434  </fieldset>
435
436  <fieldset id="action">
437
438    <legend>{'Miniaturization parameters'|@translate}</legend>
439
440{if !empty($element_set_global_plugins_actions)}
441  {foreach from=$element_set_global_plugins_actions item=action}
442    {if $action.ID == 'regenerateThumbnails'}
443    <div id="action_{$action.ID}" class="bulkAction">{$action.CONTENT}</div>
444    {/if}
445  {/foreach}
446{/if}
447
448    <p id="applyActionBlock" class="actionButtons">
449      <input type="hidden" name="selectAction" value="regenerateThumbnails">
450      <input id="applyAction" class="submit" type="submit" value="{'Regenerate Thumbnails'|@translate}" name="submit"> <span id="applyOnDetails"></span></p>
451    <p id="forbidAction">{'No photo selected, no action possible.'|@translate}</p>
452
453  </fieldset>
454
455  </form>
456
457</div> <!-- #batchManagerGlobal -->
Note: See TracBrowser for help on using the repository browser.