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

Revision 28806, 34.3 KB checked in by rvelices, 5 years ago (diff)

moved around 100k of javascript from synchronous loading to async... (a lot more could be done...)

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