source: trunk/admin/themes/default/template/batch_manager_global.tpl @ 28821

Revision 28821, 32.2 KB checked in by rvelices, 5 years ago (diff)

batch manager move more js from footer to async ; move some inline to external file

Line 
1{include file='include/datepicker.inc.tpl' load_mode='async'}
2{include file='include/colorbox.inc.tpl' load_mode='async'}
3{include file='include/add_album.inc.tpl' load_mode='async'}
4
5{combine_script id='common' load='footer' path='admin/themes/default/js/common.js'}
6
7{combine_script id='jquery.ui.slider' require='jquery.ui' load='footer' path='themes/default/js/ui/minified/jquery.ui.slider.min.js'}
8{combine_css path="themes/default/js/ui/theme/jquery.ui.slider.css"}
9
10{combine_script id='LocalStorageCache' load='footer' path='admin/themes/default/js/LocalStorageCache.js'}
11
12{assign var="selectizeTheme" value=($themeconf.name=='roma')|ternary:'dark':'default'}
13{combine_script id='jquery.selectize' load='footer' path='themes/default/js/plugins/selectize.min.js'}
14{combine_css id='jquery.selectize' path="themes/default/js/plugins/selectize.`$selectizeTheme`.css"}
15
16{combine_script id='jquery.progressBar' load='async' path='themes/default/js/plugins/jquery.progressbar.min.js'}
17{combine_script id='jquery.ajaxmanager' load='async' path='themes/default/js/plugins/jquery.ajaxmanager.js'}
18
19{combine_script id='batchManagerGlobal' load='async' require='jquery,datepicker,jquery.colorbox,addAlbum' path='admin/themes/default/js/batchManagerGlobal.js'}
20
21{footer_script}
22var lang = {
23        Cancel: '{'Cancel'|translate|escape:'javascript'}'
24};
25
26jQuery(document).ready(function() {
27
28  {* <!-- TAGS --> *}
29  var tagsCache = new TagsCache({
30    serverKey: '{$CACHE_KEYS.tags}',
31    serverId: '{$CACHE_KEYS._hash}',
32    rootUrl: '{$ROOT_URL}'
33  });
34
35  tagsCache.selectize(jQuery('[data-selectize=tags]'), { lang: {
36    'Add': '{'Create'|translate}'
37  }});
38
39  {* <!-- CATEGORIES --> *}
40  window.categoriesCache = new CategoriesCache({
41    serverKey: '{$CACHE_KEYS.categories}',
42    serverId: '{$CACHE_KEYS._hash}',
43    rootUrl: '{$ROOT_URL}'
44  });
45
46  categoriesCache.selectize(jQuery('[data-selectize=categories]'), {
47    filter: function(categories, options) {
48      if (this.name == 'dissociate') {
49        var filtered = jQuery.grep(categories, function(cat) {
50          return !cat.dir;
51        });
52
53        if (filtered.length > 0) {
54          jQuery('.albumDissociate').show();
55          options.default = filtered[0].id;
56        }
57
58        return filtered;
59      }
60      else {
61        return categories;
62      }
63    }
64  });
65
66});
67
68var nb_thumbs_page = {$nb_thumbs_page};
69var nb_thumbs_set = {$nb_thumbs_set};
70var are_you_sure = "{'Are you sure?'|@translate|@escape:'javascript'}";
71var applyOnDetails_pattern = "{'on the %d selected photos'|@translate}";
72var all_elements = [{if !empty($all_elements)}{','|@implode:$all_elements}{/if}];
73var derivatives = {ldelim}
74        elements: null,
75        done: 0,
76        total: 0,
77
78        finished: function() {ldelim}
79                return derivatives.done == derivatives.total && derivatives.elements && derivatives.elements.length==0;
80        }
81};
82
83var selectedMessage_pattern = "{'%d of %d photos selected'|@translate}";
84var selectedMessage_none = "{'No photo selected, %d photos in current set'|@translate}";
85var selectedMessage_all = "{'All %d photos are selected'|@translate}";
86
87{literal}
88function progress(success) {
89  jQuery('#progressBar').progressBar(derivatives.done, {
90    max: derivatives.total,
91    textFormat: 'fraction',
92    boxImage: 'themes/default/images/progressbar.gif',
93    barImage: 'themes/default/images/progressbg_orange.gif'
94  });
95        if (success !== undefined) {
96                var type = success ? 'regenerateSuccess': 'regenerateError',
97                        s = jQuery('[name="'+type+'"]').val();
98                jQuery('[name="'+type+'"]').val(++s);
99        }
100
101        if (derivatives.finished()) {
102                jQuery('#applyAction').click();
103        }
104}
105
106$(document).ready(function() {
107  function checkPermitAction() {
108    var nbSelected = 0;
109    if ($("input[name=setSelected]").is(':checked')) {
110      nbSelected = nb_thumbs_set;
111    }
112    else {
113      nbSelected = $(".thumbnails input[type=checkbox]").filter(':checked').length;
114    }
115
116    if (nbSelected == 0) {
117      $("#permitAction").hide();
118      $("#forbidAction").show();
119    }
120    else {
121      $("#permitAction").show();
122      $("#forbidAction").hide();
123    }
124
125    $("#applyOnDetails").text(
126      sprintf(
127        applyOnDetails_pattern,
128        nbSelected
129      )
130    );
131
132    // display the number of currently selected photos in the "Selection" fieldset
133    if (nbSelected == 0) {
134      $("#selectedMessage").text(
135        sprintf(
136          selectedMessage_none,
137          nb_thumbs_set
138        )
139      );
140    }
141    else if (nbSelected == nb_thumbs_set) {
142      $("#selectedMessage").text(
143        sprintf(
144          selectedMessage_all,
145          nb_thumbs_set
146        )
147      );
148    }
149    else {
150      $("#selectedMessage").text(
151        sprintf(
152          selectedMessage_pattern,
153          nbSelected,
154          nb_thumbs_set
155        )
156      );
157    }
158  }
159
160  $('.thumbnails img').tipTip({
161    'delay' : 0,
162    'fadeIn' : 200,
163    'fadeOut' : 200
164  });
165
166  $("[id^=action_]").hide();
167
168  $("select[name=selectAction]").change(function () {
169    $("[id^=action_]").hide();
170    $("#action_"+$(this).prop("value")).show();
171
172    if ($(this).val() != -1) {
173      $("#applyActionBlock").show();
174    }
175    else {
176      $("#applyActionBlock").hide();
177    }
178  });
179
180  $(".wrap1 label").click(function (event) {
181    $("input[name=setSelected]").prop('checked', false);
182
183    var wrap2 = $(this).children(".wrap2");
184    var checkbox = $(this).children("input[type=checkbox]");
185
186    checkbox.triggerHandler("shclick",event);
187
188    if ($(checkbox).is(':checked')) {
189      $(wrap2).addClass("thumbSelected");
190    }
191    else {
192      $(wrap2).removeClass('thumbSelected');
193    }
194
195    checkPermitAction();
196  });
197
198  $("#selectAll").click(function () {
199    $("input[name=setSelected]").prop('checked', false);
200    selectPageThumbnails();
201    checkPermitAction();
202    return false;
203  });
204
205  function selectPageThumbnails() {
206    $(".thumbnails label").each(function() {
207      var wrap2 = $(this).children(".wrap2");
208      var checkbox = $(this).children("input[type=checkbox]");
209
210      $(checkbox).prop('checked', true);
211      $(wrap2).addClass("thumbSelected");
212    });
213  }
214
215  $("#selectNone").click(function () {
216    $("input[name=setSelected]").prop('checked', false);
217
218    $(".thumbnails label").each(function() {
219      var wrap2 = $(this).children(".wrap2");
220      var checkbox = $(this).children("input[type=checkbox]");
221
222      $(checkbox).prop('checked', false);
223      $(wrap2).removeClass("thumbSelected");
224    });
225    checkPermitAction();
226    return false;
227  });
228
229  $("#selectInvert").click(function () {
230    $("input[name=setSelected]").prop('checked', false);
231
232    $(".thumbnails label").each(function() {
233      var wrap2 = $(this).children(".wrap2");
234      var checkbox = $(this).children("input[type=checkbox]");
235
236      $(checkbox).prop('checked', !$(checkbox).is(':checked'));
237
238      if ($(checkbox).is(':checked')) {
239        $(wrap2).addClass("thumbSelected");
240      }
241      else {
242        $(wrap2).removeClass('thumbSelected');
243      }
244    });
245    checkPermitAction();
246    return false;
247  });
248
249  $("#selectSet").click(function () {
250    selectPageThumbnails();
251    $("input[name=setSelected]").prop('checked', true);
252    checkPermitAction();
253    return false;
254  });
255
256
257  jQuery('#applyAction').click(function() {
258                var action = jQuery('[name="selectAction"]').val();
259                if (action == 'delete_derivatives') {
260                        var d_count = $('#action_delete_derivatives input[type=checkbox]').filter(':checked').length
261                                , e_count = $('input[name="setSelected"]').is(':checked') ? nb_thumbs_set : $('.thumbnails input[type=checkbox]').filter(':checked').length;
262                        if (d_count*e_count > 500)
263                                return confirm(are_you_sure);
264                }
265
266                if (action != 'generate_derivatives'
267                        || derivatives.finished() )
268                {
269                        return true;
270                }
271
272                jQuery('.bulkAction').hide();
273
274                var queuedManager = jQuery.manageAjax.create('queued', {
275                        queue: true,
276                        cacheResponse: false,
277                        maxRequests: 1
278                });
279
280                derivatives.elements = [];
281                if (jQuery('input[name="setSelected"]').is(':checked'))
282                        derivatives.elements = all_elements;
283                else
284                        jQuery('.thumbnails input[type=checkbox]').each(function() {
285                                if (jQuery(this).is(':checked')) {
286                                        derivatives.elements.push(jQuery(this).val());
287                                }
288                        });
289
290                jQuery('#applyActionBlock').hide();
291                jQuery('select[name="selectAction"]').hide();
292                jQuery('#regenerationMsg').show();
293
294                progress();
295                getDerivativeUrls();
296                return false;
297  });
298
299        function getDerivativeUrls() {
300                var ids = derivatives.elements.splice(0, 500);
301                var params = {max_urls: 100000, ids: ids, types: []};
302                jQuery("#action_generate_derivatives input").each( function(i, t) {
303                        if ($(t).is(":checked"))
304                                params.types.push( t.value );
305                } );
306
307                jQuery.ajax( {
308                        type: "POST",
309                        url: 'ws.php?format=json&method=pwg.getMissingDerivatives',
310                        data: params,
311                        dataType: "json",
312                        success: function(data) {
313                                if (!data.stat || data.stat != "ok") {
314                                        return;
315                                }
316                                derivatives.total += data.result.urls.length;
317                                progress();
318                                for (var i=0; i < data.result.urls.length; i++) {
319                                        jQuery.manageAjax.add("queued", {
320                                                type: 'GET',
321                                                url: data.result.urls[i] + "&ajaxload=true",
322                                                dataType: 'json',
323                                                success: ( function(data) { derivatives.done++; progress(true) }),
324                                                error: ( function(data) { derivatives.done++; progress(false) })
325                                        });
326                                }
327                                if (derivatives.elements.length)
328                                        setTimeout( getDerivativeUrls, 25 * (derivatives.total-derivatives.done));
329                        }
330                } );
331        }
332
333  checkPermitAction();
334
335  /* dimensions sliders */
336  /**
337   * find the key from a value in the startStopValues array
338   */
339  function getSliderKeyFromValue(value, values) {
340    for (var key in values) {
341      if (values[key] == value) {
342        return key;
343      }
344    }
345
346    return 0;
347  }
348
349{/literal}
350  var dimension_values = {ldelim}
351    'width':[{$dimensions.widths}],
352    'height':[{$dimensions.heights}],
353    'ratio':[{$dimensions.ratios}]
354  };
355
356  $("#filter_dimension_width_slider").slider({ldelim}
357    range: true,
358    min: 0,
359    max: dimension_values['width'].length - 1,
360    values: [
361      getSliderKeyFromValue({$dimensions.selected.min_width}, dimension_values['width']),
362      getSliderKeyFromValue({$dimensions.selected.max_width}, dimension_values['width'])
363    ],
364    slide: function(event, ui) {ldelim}
365      $("input[name='filter_dimension_min_width']").val(dimension_values['width'][ui.values[0]]);
366      $("input[name='filter_dimension_max_width']").val(dimension_values['width'][ui.values[1]]);
367
368      $("#filter_dimension_width_info").html(sprintf(
369        "{'between %d and %d pixels'|@translate}",
370        dimension_values['width'][ui.values[0]],
371        dimension_values['width'][ui.values[1]]
372      ));
373    },
374    change: function(event, ui) {ldelim}
375      $("input[name='filter_dimension_min_width']").val(dimension_values['width'][ui.values[0]]);
376      $("input[name='filter_dimension_max_width']").val(dimension_values['width'][ui.values[1]]);
377
378      $("#filter_dimension_width_info").html(sprintf(
379        "{'between %d and %d pixels'|@translate}",
380        dimension_values['width'][ui.values[0]],
381        dimension_values['width'][ui.values[1]]
382      ));
383    }
384  });
385
386  $("#filter_dimension_height_slider").slider({ldelim}
387    range: true,
388    min: 0,
389    max: dimension_values['height'].length - 1,
390    values: [
391      getSliderKeyFromValue({$dimensions.selected.min_height}, dimension_values['height']),
392      getSliderKeyFromValue({$dimensions.selected.max_height}, dimension_values['height'])
393    ],
394    slide: function(event, ui) {ldelim}
395      $("input[name='filter_dimension_min_height']").val(dimension_values['height'][ui.values[0]]);
396      $("input[name='filter_dimension_max_height']").val(dimension_values['height'][ui.values[1]]);
397
398      $("#filter_dimension_height_info").html(sprintf(
399        "{'between %d and %d pixels'|@translate}",
400        dimension_values['height'][ui.values[0]],
401        dimension_values['height'][ui.values[1]]
402      ));
403    },
404    change: function(event, ui) {ldelim}
405      $("input[name='filter_dimension_min_height']").val(dimension_values['height'][ui.values[0]]);
406      $("input[name='filter_dimension_max_height']").val(dimension_values['height'][ui.values[1]]);
407
408      $("#filter_dimension_height_info").html(sprintf(
409        "{'between %d and %d pixels'|@translate}",
410        dimension_values['height'][ui.values[0]],
411        dimension_values['height'][ui.values[1]]
412      ));
413    }
414  });
415
416  $("#filter_dimension_ratio_slider").slider({ldelim}
417    range: true,
418    min: 0,
419    max: dimension_values['ratio'].length - 1,
420    values: [
421      getSliderKeyFromValue({$dimensions.selected.min_ratio}, dimension_values['ratio']),
422      getSliderKeyFromValue({$dimensions.selected.max_ratio}, dimension_values['ratio'])
423    ],
424    slide: function(event, ui) {ldelim}
425      $("input[name='filter_dimension_min_ratio']").val(dimension_values['ratio'][ui.values[0]]);
426      $("input[name='filter_dimension_max_ratio']").val(dimension_values['ratio'][ui.values[1]]);
427
428      $("#filter_dimension_ratio_info").html(sprintf(
429        "{'between %.2f and %.2f'|@translate}",
430        dimension_values['ratio'][ui.values[0]],
431        dimension_values['ratio'][ui.values[1]]
432      ));
433    },
434    change: function(event, ui) {ldelim}
435      $("input[name='filter_dimension_min_ratio']").val(dimension_values['ratio'][ui.values[0]]);
436      $("input[name='filter_dimension_max_ratio']").val(dimension_values['ratio'][ui.values[1]]);
437
438      $("#filter_dimension_ratio_info").html(sprintf(
439        "{'between %.2f and %.2f'|@translate}",
440        dimension_values['ratio'][ui.values[0]],
441        dimension_values['ratio'][ui.values[1]]
442      ));
443    }
444  });
445
446  $("a.dimensions-choice").click(function() {ldelim}
447    var type = jQuery(this).data("type");
448    var min = jQuery(this).data("min");
449    var max = jQuery(this).data("max");
450
451    $("#filter_dimension_"+ type +"_slider").slider("values", 0,
452      getSliderKeyFromValue(min, dimension_values[type])
453    );
454
455    $("#filter_dimension_"+type+"_slider").slider("values", 1,
456      getSliderKeyFromValue(max, dimension_values[type])
457    );
458  });
459});
460
461{/footer_script}
462
463<div id="batchManagerGlobal">
464
465<h2>{'Batch Manager'|@translate}</h2>
466
467  <form action="{$F_ACTION}" method="post">
468        <input type="hidden" name="start" value="{$START}">
469
470  <fieldset>
471    <legend>{'Filter'|@translate}</legend>
472
473    <ul id="filterList">
474      <li id="filter_prefilter" {if !isset($filter.prefilter)}style="display:none"{/if}>
475        <a href="#" class="removeFilter" title="{'remove this filter'|@translate}"><span>[x]</span></a>
476        <input type="checkbox" name="filter_prefilter_use" class="useFilterCheckbox" {if isset($filter.prefilter)}checked="checked"{/if}>
477        {'Predefined filter'|@translate}
478        <select name="filter_prefilter">
479          {foreach from=$prefilters item=prefilter}
480          <option value="{$prefilter.ID}" {if isset($filter.prefilter) && $filter.prefilter eq $prefilter.ID}selected="selected"{/if}>{$prefilter.NAME}</option>
481          {/foreach}
482        </select>
483      </li>
484
485      <li id="filter_category" {if !isset($filter.category)}style="display:none"{/if}>
486        <a href="#" class="removeFilter" title="remove this filter"><span>[x]</span></a>
487        <input type="checkbox" name="filter_category_use" class="useFilterCheckbox" {if isset($filter.category)}checked="checked"{/if}>
488        {'Album'|@translate}
489        <select data-selectize="categories" data-value="{$filter_category_selected|@json_encode|escape:html}"
490          data-default="first" name="filter_category" style="width:400px"></select>
491        <label><input type="checkbox" name="filter_category_recursive" {if isset($filter.category_recursive)}checked="checked"{/if}> {'include child albums'|@translate}</label>
492      </li>
493
494      <li id="filter_tags" {if !isset($filter.tags)}style="display:none"{/if}>
495        <a href="#" class="removeFilter" title="remove this filter"><span>[x]</span></a>
496        <input type="checkbox" name="filter_tags_use" class="useFilterCheckbox" {if isset($filter.tags)}checked="checked"{/if}>
497        {'Tags'|@translate}
498        <select data-selectize="tags" data-value="{$filter_tags|@json_encode|escape:html}"
499          placeholder="{'Type in a search term'|translate}"
500          name="filter_tags[]" multiple style="width:400px;"></select>
501        <label><span><input type="radio" name="tag_mode" value="AND" {if !isset($filter.tag_mode) or $filter.tag_mode eq 'AND'}checked="checked"{/if}> {'All tags'|@translate}</span></label>
502        <label><span><input type="radio" name="tag_mode" value="OR" {if isset($filter.tag_mode) and $filter.tag_mode eq 'OR'}checked="checked"{/if}> {'Any tag'|@translate}</span></label>
503      </li>
504
505      <li id="filter_level" {if !isset($filter.level)}style="display:none"{/if}>
506        <a href="#" class="removeFilter" title="remove this filter"><span>[x]</span></a>
507        <input type="checkbox" name="filter_level_use" class="useFilterCheckbox" {if isset($filter.level)}checked="checked"{/if}>
508        {'Privacy level'|@translate}
509        <select name="filter_level" size="1">
510          {html_options options=$filter_level_options selected=$filter_level_options_selected}
511        </select>
512        <label><input type="checkbox" name="filter_level_include_lower" {if isset($filter.level_include_lower)}checked="checked"{/if}> {'include photos with lower privacy level'|@translate}</label>
513      </li>
514
515      <li id="filter_dimension" {if !isset($filter.dimension)}style="display:none"{/if}>
516        <a href="#" class="removeFilter" title="remove this filter"><span>[x]</span></a>
517        <input type="checkbox" name="filter_dimension_use" class="useFilterCheckbox" {if isset($filter.dimension)}checked="checked"{/if}>
518        {'Dimensions'|@translate}
519
520        <blockquote>
521          {'Width'|@translate} <span id="filter_dimension_width_info">{'between %d and %d pixels'|@translate:$dimensions.selected.min_width:$dimensions.selected.max_width}</span>
522          | <a class="dimensions-choice" data-type="width" data-min="{$dimensions.bounds.min_width}" data-max="{$dimensions.bounds.max_width}">{'Reset'|@translate}</a>
523          <div id="filter_dimension_width_slider"></div>
524
525          {'Height'|@translate} <span id="filter_dimension_height_info">{'between %d and %d pixels'|@translate:$dimensions.selected.min_height:$dimensions.selected.max_height}</span>
526          | <a class="dimensions-choice" data-type="height" data-min="{$dimensions.bounds.min_height}" data-max="{$dimensions.bounds.max_height}">{'Reset'|@translate}</a>
527          <div id="filter_dimension_height_slider"></div>
528
529          {'Ratio'|@translate} ({'Width'|@translate}/{'Height'|@translate}) <span id="filter_dimension_ratio_info">{'between %.2f and %.2f'|@translate:$dimensions.selected.min_ratio:$dimensions.selected.max_ratio}</span>
530{if isset($dimensions.ratio_portrait)}
531          | <a class="dimensions-choice" data-type="ratio" data-min="{$dimensions.ratio_portrait.min}" data-max="{$dimensions.ratio_portrait.max}">{'Portrait'|@translate}</a>
532{/if}
533{if isset($dimensions.ratio_square)}
534          | <a class="dimensions-choice" data-type="ratio" data-min="{$dimensions.ratio_square.min}" data-max="{$dimensions.ratio_square.max}">{'square'|@translate}</a>
535{/if}
536{if isset($dimensions.ratio_landscape)}
537          | <a class="dimensions-choice" data-type="ratio" data-min="{$dimensions.ratio_landscape.min}" data-max="{$dimensions.ratio_landscape.max}">{'Landscape'|@translate}</a>
538{/if}
539{if isset($dimensions.ratio_panorama)}
540          | <a class="dimensions-choice" data-type="ratio" data-min="{$dimensions.ratio_panorama.min}" data-max="{$dimensions.ratio_panorama.max}">{'Panorama'|@translate}</a>
541{/if}
542          | <a class="dimensions-choice" data-type="ratio" data-min="{$dimensions.bounds.min_ratio}" data-max="{$dimensions.bounds.max_ratio}">{'Reset'|@translate}</a>
543          <div id="filter_dimension_ratio_slider"></div>
544        </blockquote>
545
546        <input type="hidden" name="filter_dimension_min_width" value="{$dimensions.selected.min_width}">
547        <input type="hidden" name="filter_dimension_max_width" value="{$dimensions.selected.max_width}">
548        <input type="hidden" name="filter_dimension_min_height" value="{$dimensions.selected.min_height}">
549        <input type="hidden" name="filter_dimension_max_height" value="{$dimensions.selected.max_height}">
550        <input type="hidden" name="filter_dimension_min_ratio" value="{$dimensions.selected.min_ratio}">
551        <input type="hidden" name="filter_dimension_max_ratio" value="{$dimensions.selected.max_ratio}">
552      </li>
553
554                        <li id="filter_search"{if !isset($filter.search)} style="display:none"{/if}>
555                                <a href="#" class="removeFilter" title="remove this filter"><span>[x]</span></a>
556                                <input type="checkbox" name="filter_search_use" class="useFilterCheckbox"{if isset($filter.search)} checked="checked"{/if}>
557                                {'Search'|@translate}
558                                <input name="q" size=40 value="{$filter.search.q|stripslashes|htmlspecialchars}">
559                                {combine_script id='core.scripts' load='async' path='themes/default/js/scripts.js'}
560                                <a href="admin/popuphelp.php?page=quick_search" onclick="popuphelp(this.href);return false;" title="{'Help'|@translate}"><span class="icon-help-circled"></span></a>
561                        </li>
562    </ul>
563
564    <p class="actionButtons">
565      <select id="addFilter">
566        <option value="-1">{'Add a filter'|@translate}</option>
567        <option disabled="disabled">------------------</option>
568        <option value="filter_prefilter" {if isset($filter.prefilter)}disabled="disabled"{/if}>{'Predefined filter'|@translate}</option>
569        <option value="filter_category" {if isset($filter.category)}disabled="disabled"{/if}>{'Album'|@translate}</option>
570        <option value="filter_tags" {if isset($filter.tags)}disabled="disabled"{/if}>{'Tags'|@translate}</option>
571        <option value="filter_level" {if isset($filter.level)}disabled="disabled"{/if}>{'Privacy level'|@translate}</option>
572        <option value="filter_dimension" {if isset($filter.dimension)}disabled="disabled"{/if}>{'Dimensions'|@translate}</option>
573                                <option value="filter_search"{if isset($filter.search)} disabled="disabled"{/if}>{'Search'|@translate}</option>
574      </select>
575      <a id="removeFilters" href="">{'Remove all filters'|@translate}</a>
576    </p>
577
578    <p class="actionButtons" id="applyFilterBlock">
579      <input id="applyFilter" class="submit" type="submit" value="{'Refresh photo set'|@translate}" name="submitFilter">
580    </p>
581
582  </fieldset>
583
584  <fieldset>
585
586    <legend>{'Selection'|@translate}</legend>
587
588  {if !empty($thumbnails)}
589  <p id="checkActions">
590    {'Select:'|@translate}
591{if $nb_thumbs_set > $nb_thumbs_page}
592    <a href="#" id="selectAll">{'The whole page'|@translate}</a>,
593    <a href="#" id="selectSet">{'The whole set'|@translate}</a>,
594{else}
595    <a href="#" id="selectAll">{'All'|@translate}</a>,
596{/if}
597    <a href="#" id="selectNone">{'None'|@translate}</a>,
598    <a href="#" id="selectInvert">{'Invert'|@translate}</a>
599
600    <span id="selectedMessage"></span>
601
602    <input type="checkbox" name="setSelected" style="display:none" {if count($selection) == $nb_thumbs_set}checked="checked"{/if}>
603  </p>
604
605        <ul class="thumbnails">
606                {html_style}
607UL.thumbnails SPAN.wrap2{ldelim}
608  width: {$thumb_params->max_width()+2}px;
609}
610UL.thumbnails SPAN.wrap2 {ldelim}
611  height: {$thumb_params->max_height()+25}px;
612}
613                {/html_style}
614                {foreach from=$thumbnails item=thumbnail}
615                {assign var='isSelected' value=$thumbnail.id|@in_array:$selection}
616                <li>
617                        <span class="wrap1">
618                                <label>
619                                        <input type="checkbox" name="selection[]" value="{$thumbnail.id}" {if $isSelected}checked="checked"{/if}>
620                                        <span class="wrap2{if $isSelected} thumbSelected{/if}">
621                                        <div class="actions"><a href="{$thumbnail.FILE_SRC}" class="preview-box">{'Zoom'|@translate}</a> &middot; <a href="{$thumbnail.U_EDIT}" target="_blank">{'Edit'|@translate}</a></div>
622                                                {if $thumbnail.level > 0}
623                                                <em class="levelIndicatorB">{'Level %d'|@sprintf:$thumbnail.level|@translate}</em>
624                                                <em class="levelIndicatorF" title="{'Who can see these photos?'|@translate} : ">{'Level %d'|@sprintf:$thumbnail.level|@translate}</em>
625                                                {/if}
626                                                <img src="{$thumbnail.thumb->get_url()}" alt="{$thumbnail.file}" title="{$thumbnail.TITLE|@escape:'html'}" {$thumbnail.thumb->get_size_htm()}>
627                                        </span>
628                                </label>
629                        </span>
630                </li>
631                {/foreach}
632        </ul>
633
634  {if !empty($navbar) }
635  <div style="clear:both;">
636
637    <div style="float:left">
638    {include file='navigation_bar.tpl'|@get_extent:'navbar'}
639    </div>
640
641    <div style="float:right;margin-top:10px;">{'display'|@translate}
642      <a href="{$U_DISPLAY}&amp;display=20">20</a>
643      &middot; <a href="{$U_DISPLAY}&amp;display=50">50</a>
644      &middot; <a href="{$U_DISPLAY}&amp;display=100">100</a>
645      &middot; <a href="{$U_DISPLAY}&amp;display=all">{'all'|@translate}</a>
646      {'photos per page'|@translate}
647    </div>
648  </div>
649  {/if}
650
651  {else}
652  <div>{'No photo in the current set.'|@translate}</div>
653  {/if}
654  </fieldset>
655
656  <fieldset id="action">
657
658    <legend>{'Action'|@translate}</legend>
659      <div id="forbidAction"{if count($selection) != 0} style="display:none"{/if}>{'No photo selected, no action possible.'|@translate}</div>
660      <div id="permitAction"{if count($selection) == 0} style="display:none"{/if}>
661
662    <select name="selectAction">
663      <option value="-1">{'Choose an action'|@translate}</option>
664      <option disabled="disabled">------------------</option>
665      <option value="delete" class="icon-trash">{'Delete selected photos'|@translate}</option>
666      <option value="associate">{'Associate to album'|@translate}</option>
667      <option value="move">{'Move to album'|@translate}</option>
668      <option value="dissociate" class="albumDissociate" style="display:none">{'Dissociate from album'|@translate}</option>
669      <option value="add_tags">{'Add tags'|@translate}</option>
670  {if !empty($associated_tags)}
671      <option value="del_tags">{'remove tags'|@translate}</option>
672  {/if}
673      <option value="author">{'Set author'|@translate}</option>
674      <option value="title">{'Set title'|@translate}</option>
675      <option value="date_creation">{'Set creation date'|@translate}</option>
676      <option value="level" class="icon-lock">{'Who can see these photos?'|@translate}</option>
677      <option value="metadata">{'Synchronize metadata'|@translate}</option>
678  {if ($IN_CADDIE)}
679      <option value="remove_from_caddie">{'Remove from caddie'|@translate}</option>
680  {else}
681      <option value="add_to_caddie">{'Add to caddie'|@translate}</option>
682  {/if}
683                <option value="delete_derivatives">{'Delete multiple size images'|@translate}</option>
684                <option value="generate_derivatives">{'Generate multiple size images'|@translate}</option>
685  {if !empty($element_set_global_plugins_actions)}
686    {foreach from=$element_set_global_plugins_actions item=action}
687      <option value="{$action.ID}">{$action.NAME}</option>
688    {/foreach}
689  {/if}
690    </select>
691
692    <!-- delete -->
693    <div id="action_delete" class="bulkAction">
694    <p><label><input type="checkbox" name="confirm_deletion" value="1"> {'Are you sure?'|@translate}</label></p>
695    </div>
696
697    <!-- associate -->
698    <div id="action_associate" class="bulkAction">
699      <select data-selectize="categories" data-default="first" name="associate" style="width:400px"></select>
700      <br>{'... or '|@translate}
701      <a href="#" data-add-album="associate" title="{'create a new album'|@translate}">{'create a new album'|@translate}</a>
702    </div>
703
704    <!-- move -->
705    <div id="action_move" class="bulkAction">
706      <select data-selectize="categories" data-default="first" name="move" style="width:400px"></select>
707      <br>{'... or '|@translate}
708      <a href="#" data-add-album="move" title="{'create a new album'|@translate}">{'create a new album'|@translate}</a>
709    </div>
710
711
712    <!-- dissociate -->
713    <div id="action_dissociate" class="bulkAction albumDissociate" style="display:none">
714      <select data-selectize="categories" placeholder="{'Type in a search term'|translate}"
715        name="dissociate" style="width:400px"></select>
716    </div>
717
718
719    <!-- add_tags -->
720    <div id="action_add_tags" class="bulkAction">
721      <select data-selectize="tags" data-create="true" placeholder="{'Type in a search term'|translate}"
722        name="add_tags[]" multiple style="width:400px;"></select>
723    </div>
724
725    <!-- del_tags -->
726    <div id="action_del_tags" class="bulkAction">
727{if !empty($associated_tags)}
728      <select data-selectize="tags" name="del_tags[]" multiple style="width:400px;"
729        placeholder="{'Type in a search term'|translate}">
730      {foreach from=$associated_tags item=tag}
731        <option value="{$tag.id}">{$tag.name}</option>
732      {/foreach}
733      </select>
734{/if}
735    </div>
736
737    <!-- author -->
738    <div id="action_author" class="bulkAction">
739    <label><input type="checkbox" name="remove_author"> {'remove author'|@translate}</label><br>
740    {assign var='authorDefaultValue' value='Type here the author name'|@translate}
741<input type="text" class="large" name="author" value="{$authorDefaultValue}" onfocus="this.value=(this.value=='{$authorDefaultValue|@escape:javascript}') ? '' : this.value;" onblur="this.value=(this.value=='') ? '{$authorDefaultValue|@escape:javascript}' : this.value;">
742    </div>
743
744    <!-- title -->
745    <div id="action_title" class="bulkAction">
746    <label><input type="checkbox" name="remove_title"> {'remove title'|@translate}</label><br>
747    {assign var='titleDefaultValue' value='Type here the title'|@translate}
748<input type="text" class="large" name="title" value="{$titleDefaultValue}" onfocus="this.value=(this.value=='{$titleDefaultValue|@escape:javascript}') ? '' : this.value;" onblur="this.value=(this.value=='') ? '{$titleDefaultValue|@escape:javascript}' : this.value;">
749    </div>
750
751    <!-- date_creation -->
752    <div id="action_date_creation" class="bulkAction">
753      <label><input type="checkbox" name="remove_date_creation"> {'remove creation date'|@translate}</label><br>
754      <div id="set_date_creation">
755        <input type="hidden" name="date_creation" value="{$DATE_CREATION}">
756        <label>
757          <i class="icon-calendar"></i>
758          <input type="text" data-datepicker="date_creation" readonly>
759        </label>
760      </div>
761    </div>
762
763    <!-- level -->
764    <div id="action_level" class="bulkAction">
765        <select name="level" size="1">
766          {html_options options=$level_options selected=$level_options_selected}
767        </select>
768    </div>
769
770    <!-- metadata -->
771    <div id="action_metadata" class="bulkAction">
772    </div>
773
774                <!-- generate derivatives -->
775                <div id="action_generate_derivatives" class="bulkAction">
776                        <a href="javascript:selectGenerateDerivAll()">{'All'|@translate}</a>,
777                        <a href="javascript:selectGenerateDerivNone()">{'None'|@translate}</a>
778                        <br>
779                        {foreach from=$generate_derivatives_types key=type item=disp}
780                                <label><input type="checkbox" name="generate_derivatives_type[]" value="{$type}"> {$disp}</label>
781                        {/foreach}
782                        {footer_script}
783                        function selectGenerateDerivAll() {ldelim}
784                                $("#action_generate_derivatives input[type=checkbox]").prop("checked", true);
785                        }
786                        function selectGenerateDerivNone() {ldelim}
787                                $("#action_generate_derivatives input[type=checkbox]").prop("checked", false);
788                        }
789                        {/footer_script}
790                </div>
791
792                <!-- delete derivatives -->
793                <div id="action_delete_derivatives" class="bulkAction">
794                        <a href="javascript:selectDelDerivAll()">{'All'|@translate}</a>,
795                        <a href="javascript:selectDelDerivNone()">{'None'|@translate}</a>
796                        <br>
797                        {foreach from=$del_derivatives_types key=type item=disp}
798                                <label><input type="checkbox" name="del_derivatives_type[]" value="{$type}"> {$disp}</label>
799                        {/foreach}
800                        {footer_script}
801                        function selectDelDerivAll() {ldelim}
802                                $("#action_delete_derivatives input[type=checkbox]").prop("checked", true);
803                        }
804                        function selectDelDerivNone() {ldelim}
805                                $("#action_delete_derivatives input[type=checkbox]").prop("checked", false);
806                        }
807                        {/footer_script}
808                </div>
809
810    <!-- progress bar -->
811    <div id="regenerationMsg" class="bulkAction" style="display:none">
812      <p id="regenerationText" style="margin-bottom:10px;">{'Generate multiple size images'|@translate}</p>
813      <span class="progressBar" id="progressBar"></span>
814      <input type="hidden" name="regenerateSuccess" value="0">
815      <input type="hidden" name="regenerateError" value="0">
816    </div>
817
818    <!-- plugins -->
819{if !empty($element_set_global_plugins_actions)}
820  {foreach from=$element_set_global_plugins_actions item=action}
821    <div id="action_{$action.ID}" class="bulkAction">
822    {if !empty($action.CONTENT)}{$action.CONTENT}{/if}
823    </div>
824  {/foreach}
825{/if}
826
827    <p id="applyActionBlock" style="display:none" class="actionButtons">
828      <input id="applyAction" class="submit" type="submit" value="{'Apply action'|@translate}" name="submit"> <span id="applyOnDetails"></span></p>
829
830    </div> <!-- #permitAction -->
831  </fieldset>
832
833  </form>
834
835</div> <!-- #batchManagerGlobal -->
Note: See TracBrowser for help on using the repository browser.