source: extensions/regenerateThumbnails/regenerate_thumbnails.tpl @ 9937

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

Remove "all photos" language key.
Move prefilter to element_set_global_action.php file.

File size: 15.2 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  checkPermitAction()
290});
291{/literal}{/footer_script}
292
293<div id="batchManagerGlobal">
294
295<h2>{'Regenerate Thumbnails'|@translate}</h2>
296
297  <form action="{$F_ACTION}" method="post">
298
299  <fieldset>
300    <legend>{'Filter'|@translate}</legend>
301
302    <ul id="filterList">
303      <li id="filter_prefilter" {if !isset($filter.prefilter)}style="display:none"{/if}>
304        <a href="#" class="removeFilter" title="{'remove this filter'|@translate}"><span>[x]</span></a>
305        <input type="checkbox" name="filter_prefilter_use" class="useFilterCheckbox" {if isset($filter.prefilter)}checked="checked"{/if}>
306        {'predefined filter'|@translate}
307        <select name="filter_prefilter">
308          <option value="caddie" {if $filter.prefilter eq 'caddie'}selected="selected"{/if}>{'caddie'|@translate}</option>
309          <option value="last import" {if $filter.prefilter eq 'last import'}selected="selected"{/if}>{'last import'|@translate}</option>
310          <option value="with no album" {if $filter.prefilter eq 'with no album'}selected="selected"{/if}>{'with no album'|@translate}</option>
311{if $ENABLE_SYNCHRONIZATION}
312          <option value="with no virtual album" {if $filter.prefilter eq 'with no virtual album'}selected="selected"{/if}>{'with no virtual album'|@translate}</option>
313{/if}
314          <option value="with no tag" {if $filter.prefilter eq 'with no tag'}selected="selected"{/if}>{'with no tag'|@translate}</option>
315          <option value="duplicates" {if $filter.prefilter eq 'duplicates'}selected="selected"{/if}>{'duplicates'|@translate}</option>
316          <option value="all photos" {if $filter.prefilter eq 'all photos'}selected="selected"{/if}>{'All'|@translate}</option>
317        </select>
318      </li>
319      <li id="filter_category" {if !isset($filter.category)}style="display:none"{/if}>
320        <a href="#" class="removeFilter" title="remove this filter"><span>[x]</span></a>
321        <input type="checkbox" name="filter_category_use" class="useFilterCheckbox" {if isset($filter.category)}checked="checked"{/if}>
322        {'album'|@translate}
323        <select style="width:400px" name="filter_category" size="1">
324          {html_options options=$filter_category_options selected=$filter_category_options_selected}
325        </select>
326        <label><input type="checkbox" name="filter_category_recursive" {if isset($filter.category_recursive)}checked="checked"{/if}> {'include child albums'|@translate}</label>
327      </li>
328      <li id="filter_level" {if !isset($filter.level)}style="display:none"{/if}>
329        <a href="#" class="removeFilter" title="remove this filter"><span>[x]</span></a>
330        <input type="checkbox" name="filter_level_use" class="useFilterCheckbox" {if isset($filter.level)}checked="checked"{/if}>
331        {'Who can see these photos?'|@translate}
332        <select name="filter_level" size="1">
333          {html_options options=$filter_level_options selected=$filter_level_options_selected}
334        </select>
335      </li>
336    </ul>
337
338    <p class="actionButtons" style="">
339      <select id="addFilter">
340        <option value="-1">{'Add a filter'|@translate}</option>
341        <option disabled="disabled">------------------</option>
342        <option value="filter_prefilter">{'predefined filter'|@translate}</option>
343        <option value="filter_category">{'album'|@translate}</option>
344        <option value="filter_level">{'Who can see these photos?'|@translate}</option>
345      </select>
346<!--      <input id="removeFilters" class="submit" type="submit" value="Remove all filters" name="removeFilters"> -->
347      <a id="removeFilters" href="">{'Remove all filters'|@translate}</a>
348    </p>
349
350    <p class="actionButtons" id="applyFilterBlock">
351      <input id="applyFilter" class="submit" type="submit" value="{'Refresh photo set'|@translate}" name="submitFilter">
352    </p>
353
354  </fieldset>
355
356  <fieldset>
357
358    <legend>{'Selection'|@translate}</legend>
359
360  {if !empty($thumbnails)}
361  <p id="checkActions">
362    {'Select:'|@translate}
363{if $nb_thumbs_set > $nb_thumbs_page}
364    <a href="#" id="selectAll">{'The whole page'|@translate}</a>,
365    <a href="#" id="selectSet">{'The whole set'|@translate}</a>,
366{else}
367    <a href="#" id="selectAll">{'All'|@translate}</a>,
368{/if}
369    <a href="#" id="selectNone">{'None'|@translate}</a>,
370    <a href="#" id="selectInvert">{'Invert'|@translate}</a>
371
372    <span id="selectedMessage"></span>
373
374    <input type="checkbox" name="setSelected" style="display:none" {if count($selection) == $nb_thumbs_set}checked="checked"{/if}>
375  </p>
376
377    <ul class="thumbnails">
378      {foreach from=$thumbnails item=thumbnail}
379        {if in_array($thumbnail.ID, $selection)}
380          {assign var='isSelected' value=true}
381        {else}
382          {assign var='isSelected' value=false}
383        {/if}
384
385      <li><span class="wrap1">
386          <label>
387            <span class="wrap2{if $isSelected} thumbSelected{/if}">
388        {if $thumbnail.LEVEL > 0}
389        <em class="levelIndicatorB">{$pwg->l10n($pwg->sprintf('Level %d',$thumbnail.LEVEL))}</em>
390        <em class="levelIndicatorF" title="{'Who can see these photos?'|@translate} : ">{$pwg->l10n($pwg->sprintf('Level %d',$thumbnail.LEVEL))}</em>
391        {/if}
392            <span>
393              <img src="{$thumbnail.TN_SRC}"
394                 alt="{$thumbnail.FILE}"
395                 title="{$thumbnail.TITLE|@escape:'html'}"
396                 class="thumbnail">
397            </span></span>
398            <input type="checkbox" name="selection[]" value="{$thumbnail.ID}" {if $isSelected}checked="checked"{/if}>
399          </label>
400          </span>
401      </li>
402      {/foreach}
403    </ul>
404
405  {if !empty($navbar) }
406  <div style="clear:both;">
407
408    <div style="float:left">
409    {include file='navigation_bar.tpl'|@get_extent:'navbar'}
410    </div>
411
412    <div style="float:right;margin-top:10px;">{'display'|@translate}
413      <a href="{$U_DISPLAY}&amp;display=20">20</a>
414      &middot; <a href="{$U_DISPLAY}&amp;display=50">50</a>
415      &middot; <a href="{$U_DISPLAY}&amp;display=100">100</a>
416      &middot; <a href="{$U_DISPLAY}&amp;display=all">{'all'|@translate}</a>
417      {'photos per page'|@translate}
418    </div>
419  </div>
420  {/if}
421
422  {else}
423  <div>{'No photo in the current set.'|@translate}</div>
424  {/if}
425  </fieldset>
426
427  <fieldset id="action">
428
429    <legend>{'Miniaturization parameters'|@translate}</legend>
430
431{if !empty($element_set_global_plugins_actions)}
432  {foreach from=$element_set_global_plugins_actions item=action}
433    {if $action.ID == 'regenerateThumbnails'}
434    <div id="action_{$action.ID}" class="bulkAction">{$action.CONTENT}</div>
435    {/if}
436  {/foreach}
437{/if}
438
439    <p id="applyActionBlock" class="actionButtons">
440      <input type="hidden" name="selectAction" value="regenerateThumbnails">
441      <input id="applyAction" class="submit" type="submit" value="{'Regenerate Thumbnails'|@translate}" name="submit"> <span id="applyOnDetails"></span></p>
442    <p id="forbidAction">{'No photo selected, no action possible.'|@translate}</p>
443
444  </fieldset>
445
446  </form>
447
448</div> <!-- #batchManagerGlobal -->
Note: See TracBrowser for help on using the repository browser.