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

Last change on this file since 8394 was 8394, checked in by plg, 13 years ago

feature 2089: implement the "Bulk Manager" plugin as the new "Batch Manager".
The new "Batch Manager" offers as many features as the old "Bulk Manager" and
more to come.

The old Batch Manager (Caddie/Recent Pictures) is not removed yet and changes
that occured since last summer are not reported yet in the Batch Manager:
category/album, photo order for a given album, deletion of synchronized photos.

File size: 20.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      $("#permitAction").hide();
97      $("#forbidAction").show();
98    }
99    else {
100      $("#permitAction").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  $("[id^=action_]").hide();
146
147  $("select[name=selectAction]").click(function () {
148    $("[id^=action_]").hide();
149    $("#action_"+$(this).attr("value")).show();
150  });
151
152  $(".wrap1 label").click(function () {
153    $("input[name=setSelected]").attr('checked', false);
154
155    var wrap2 = $(this).children(".wrap2");
156    var checkbox = $(this).children("input[type=checkbox]");
157
158    if ($(checkbox).is(':checked')) {
159      $(wrap2).addClass("thumbSelected");
160    }
161    else {
162      $(wrap2).removeClass('thumbSelected');
163    }
164
165    checkPermitAction();
166  });
167
168  $("#selectAll").click(function () {
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    if (nb_thumbs_page < nb_thumbs_set) {
178      $("#selectSetMessage").show();
179    }
180
181    checkPermitAction();
182
183    return false;
184  });
185
186  $("#selectNone").click(function () {
187    $("input[name=setSelected]").attr('checked', false);
188
189    $(".thumbnails label").each(function() {
190      var wrap2 = $(this).children(".wrap2");
191      var checkbox = $(this).children("input[type=checkbox]");
192
193      $(checkbox).attr('checked', false);
194      $(wrap2).removeClass("thumbSelected");
195    });
196    checkPermitAction();
197    return false;
198  });
199
200  $("#selectInvert").click(function () {
201    $("#selectSetMessage").hide();
202    $("input[name=setSelected]").attr('checked', false);
203
204    $(".thumbnails label").each(function() {
205      var wrap2 = $(this).children(".wrap2");
206      var checkbox = $(this).children("input[type=checkbox]");
207
208      $(checkbox).attr('checked', !$(checkbox).is(':checked'));
209
210      if ($(checkbox).is(':checked')) {
211        $(wrap2).addClass("thumbSelected");
212      }
213      else {
214        $(wrap2).removeClass('thumbSelected');
215      }
216    });
217    checkPermitAction();
218    return false;
219  });
220
221  $("#selectSet").click(function () {
222    $("input[name=setSelected]").attr('checked', true);
223    checkPermitAction();
224    return false;
225  });
226
227  $("input[name=remove_author]").click(function () {
228    if ($(this).is(':checked')) {
229      $("input[name=author]").hide();
230    }
231    else {
232      $("input[name=author]").show();
233    }
234  });
235
236  $("input[name=remove_name]").click(function () {
237    if ($(this).is(':checked')) {
238      $("input[name=name]").hide();
239    }
240    else {
241      $("input[name=name]").show();
242    }
243  });
244
245  $("input[name=remove_date_creation]").click(function () {
246    if ($(this).is(':checked')) {
247      $("#set_date_creation").hide();
248    }
249    else {
250      $("#set_date_creation").show();
251    }
252  });
253
254  $("select[name=selectAction]").change(function() {
255    if ($(this).val() != -1) {
256      $("#applyActionBlock").show();
257    }
258    else {
259      $("#applyActionBlock").hide();
260    }
261  });
262
263  $(".removeFilter").click(function () {
264    var filter = $(this).parent('li').attr("id");
265    filter_disable(filter);
266
267    return false;
268  });
269
270  function filter_enable(filter) {
271    /* show the filter*/
272    $("#"+filter).show();
273
274    /* check the checkbox to declare we use this filter */
275    $("input[type=checkbox][name="+filter+"_use]").attr("checked", true);
276
277    /* forbid to select this filter in the addFilter list */
278    $("#addFilter").children("option[value="+filter+"]").attr("disabled", "disabled");
279  }
280
281  $("#addFilter").change(function () {
282    var filter = $(this).attr("value");
283    filter_enable(filter);
284    $(this).attr("value", -1);
285  });
286
287  function filter_disable(filter) {
288    /* hide the filter line */
289    $("#"+filter).hide();
290
291    /* uncheck the checkbox to declare we do not use this filter */
292    $("input[name="+filter+"_use]").removeAttr("checked");
293
294    /* give the possibility to show it again */
295    $("#addFilter").children("option[value="+filter+"]").removeAttr("disabled");
296  }
297
298  $("#removeFilters").click(function() {
299    $("#filterList li").each(function() {
300      var filter = $(this).attr("id");
301      filter_disable(filter);
302    });
303    return false;
304  });
305
306  checkPermitAction()
307});
308{/literal}{/footer_script}
309
310{literal}
311<style>
312#action p {text-align:left;}
313.bulkAction {text-align:left;margin:15px 0;padding:0;}
314#action_del_tags ul.tagSelection {margin:0 !important; width:620px;}
315#selectAction {}
316#checkActions {text-align:left; margin:0 0 20px 0;}
317.content ul.thumbnails span.wrap1 {margin:5px}
318.content ul.thumbnails span.wrap2 {border:0;background-color:#ddd;}
319.content ul.thumbnails span.wrap2:hover {background-color:#7CBA0F;}
320.thumbSelected {background-color:#C2F5C2 !important}
321
322#selectedMessage {background-color:#C2F5C2; padding:5px; -moz-border-radius:5px;}
323#selectSet a {border-bottom:1px dotted}
324#applyOnDetails {font-style:italic;}
325
326.actionButtons {text-align:left;}
327#filterList {padding-left:5px;}
328#filterList li {margin-bottom:5px; list-style-type:none;}
329a.removeFilter {background: url(plugins/bulk_manager/remove_filter.png) no-repeat top left;width:7px;height:7px;display:inline-block}
330a.removeFilter:hover {background: url(plugins/bulk_manager/remove_filter_hover.png); border:none;}
331.removeFilter span {display:none}
332#applyFilterBlock {margin-top:20px;}
333.useFilterCheckbox {display:none}
334</style>
335{/literal}
336
337  <p style="float:left; font-size:90%;margin:5px 0 0 0;padding:0;">
338    <a href="{$U_UNIT_MODE}">Switch to unit mode</a>
339  </p>
340
341<h2>{'Batch manager'|@translate}</h2>
342
343  <form action="{$F_ACTION}" method="post">
344
345  <fieldset>
346    <legend>{'Filter'|@translate}</legend>
347
348    <ul id="filterList">
349      <li id="filter_prefilter" {if !isset($filter.prefilter)}style="display:none"{/if}>
350        <a href="#" class="removeFilter" title="remove this filter"><span>[x]</span></a>
351        <input type="checkbox" name="filter_prefilter_use" class="useFilterCheckbox" {if isset($filter.prefilter)}checked="checked"{/if}>
352        predefined filter
353        <select name="filter_prefilter">
354          <option value="caddie" {if $filter.prefilter eq 'caddie'}selected="selected"{/if}>caddie</option>
355          <option value="last import" {if $filter.prefilter eq 'last import'}selected="selected"{/if}>last import</option>
356<!--          <option value="with no album">with no album</option> -->
357<!--          <option value="with no virtual album">with no virtual album</option> -->
358<!--          <option value="with no tag">with no tag</option> -->
359        </select>
360      </li>
361      <li id="filter_category" {if !isset($filter.category)}style="display:none"{/if}>
362        <a href="#" class="removeFilter" title="remove this filter"><span>[x]</span></a>
363        <input type="checkbox" name="filter_category_use" class="useFilterCheckbox" {if isset($filter.category)}checked="checked"{/if}>
364        album
365        <select style="width:400px" name="filter_category" size="1">
366          {html_options options=$filter_category_options selected=$filter_category_options_selected}
367        </select>
368        <label><input type="checkbox" name="filter_category_recursive" {if isset($filter.category_recursive)}checked="checked"{/if}> {'include child albums'|@translate}</label>
369      </li>
370      <li id="filter_level" {if !isset($filter.level)}style="display:none"{/if}>
371        <a href="#" class="removeFilter" title="remove this filter"><span>[x]</span></a>
372        <input type="checkbox" name="filter_level_use" class="useFilterCheckbox" {if isset($filter.level)}checked="checked"{/if}>
373        {'Who can see these photos?'|@translate}
374        <select name="filter_level" size="1">
375          {html_options options=$filter_level_options selected=$filter_level_options_selected}
376        </select>
377      </li>
378    </ul>
379
380    <p class="actionButtons" style="">
381      <select id="addFilter">
382        <option value="-1">Add a filter</option>
383        <option disabled="disabled">------------------</option>
384        <option value="filter_prefilter">predefined filter</option>
385        <option value="filter_category">album</option>
386        <option value="filter_level">{'Who can see these photos?'|@translate}</option>
387      </select>
388<!--      <input id="removeFilters" class="submit" type="submit" value="Remove all filters" name="removeFilters"> -->
389      <a id="removeFilters" href="">Remove all filters</a>
390    </p>
391
392    <p class="actionButtons" id="applyFilterBlock">
393      <input id="applyFilter" class="submit" type="submit" value="Refresh photo set" name="submitFilter">
394    </p>
395
396  </fieldset>
397
398  <fieldset>
399
400    <legend>{'Selection'|@translate}</legend>
401
402  {if !empty($thumbnails)}
403  <p id="checkActions">
404    {'Select:'|@translate}
405    <a href="#" id="selectAll">{'All'|@translate}</a>
406    (<a href="#" id="selectSet">or the whole set</a>),
407    <a href="#" id="selectNone">{'None'|@translate}</a>,
408    <a href="#" id="selectInvert">{'Invert'|@translate}</a>
409
410    <span id="selectedMessage"></span>
411
412    <input type="checkbox" name="setSelected" style="display:none" {if count($selection) == $nb_thumbs_set}checked="checked"{/if}>
413  </p>
414
415    <ul class="thumbnails">
416      {foreach from=$thumbnails item=thumbnail}
417        {if in_array($thumbnail.ID, $selection)}
418          {assign var='isSelected' value=true}
419        {else}
420          {assign var='isSelected' value=false}
421        {/if}
422
423      <li><span class="wrap1">
424          <label>
425            <span class="wrap2{if $isSelected} thumbSelected{/if}">
426        {if $thumbnail.LEVEL > 0}
427        <em class="levelIndicatorB">{$pwg->l10n($pwg->sprintf('Level %d',$thumbnail.LEVEL))}</em>
428        <em class="levelIndicatorF" title="{'Who can see these photos?'|@translate} : ">{$pwg->l10n($pwg->sprintf('Level %d',$thumbnail.LEVEL))}</em>
429        {/if}
430            <span>
431              <img src="{$thumbnail.TN_SRC}"
432                 alt="{$thumbnail.FILE}"
433                 title="{$thumbnail.TITLE|@escape:'html'}"
434                 class="thumbnail">
435            </span></span>
436            <input type="checkbox" name="selection[]" value="{$thumbnail.ID}" {if $isSelected}checked="checked"{/if}>
437          </label>
438          </span>
439      </li>
440      {/foreach}
441    </ul>
442
443  {if !empty($navbar) }
444  <div style="clear:both;">
445
446    <div style="float:left">
447    {include file='navigation_bar.tpl'|@get_extent:'navbar'}
448    </div>
449
450    <div style="float:right;margin-top:10px;">{'display'|@translate}
451      <a href="{$U_DISPLAY}&amp;display=20">20</a>
452      &middot; <a href="{$U_DISPLAY}&amp;display=50">50</a>
453      &middot; <a href="{$U_DISPLAY}&amp;display=100">100</a>
454      &middot; <a href="{$U_DISPLAY}&amp;display=all">{'all'|@translate}</a>
455      thumbnails per page
456    </div>
457  </div>
458  {/if}
459
460  {else}
461  <div>No photo in the current set.</div>
462  {/if}
463  </fieldset>
464
465  <fieldset id="action">
466
467    <legend>{'Action'|@translate}</legend>
468      <div id="forbidAction"{if count($selection) != 0}style="display:none"{/if}>No photo selected, no action possible.</div>
469      <div id="permitAction"{if count($selection) == 0}style="display:none"{/if}>
470
471    <select name="selectAction">
472      <option value="-1">Choose an action</option>
473      <option disabled="disabled">------------------</option>
474  {if isset($show_delete_form) }
475      <option value="delete">{'Delete selected photos'|@translate}</option>
476  {/if}
477      <option value="associate">{'associate to category'|@translate}</option>
478  {if !empty($dissociate_options)}
479      <option value="dissociate">{'dissociate from category'|@translate}</option>
480  {/if}
481      <option value="add_tags">{'add tags'|@translate}</option>
482  {if !empty($DEL_TAG_SELECTION)}
483      <option value="del_tags">{'remove tags'|@translate}</option>
484  {/if}
485      <option value="author">{'Set author'|@translate}</option>
486      <option value="name">{'Set title'|@translate}</option>
487      <option value="date_creation">{'Set creation date'|@translate}</option>
488      <option value="level">{'Who can see these photos?'|@translate}</option>
489  {if ($IN_CADDIE)}
490      <option value="remove_from_caddie">{'Remove from caddie'|@translate}</option>
491  {else}
492      <option value="add_to_caddie">{'Add to caddie'|@translate}</option>
493  {/if}
494    </select>
495
496    <!-- delete -->
497    <div id="action_delete" class="bulkAction">
498{if $ENABLE_SYNCHRONIZATION}
499    <p style="font-style:italic;width:500px;">{'Note: photo deletion does not apply to photos added by synchronization. For photos added by synchronization, remove them from the filesystem and then perform another synchronization.'|@translate}</p>
500{/if}
501    <p><label><input type="checkbox" name="confirm_deletion" value="1"> {'Are you sure?'|@translate}</label></p>
502    </div>
503
504    <!-- associate -->
505    <div id="action_associate" class="bulkAction">
506          <select style="width:400px" name="associate" size="1">
507            {html_options options=$associate_options }
508         </select>
509    </div>
510
511    <!-- dissociate -->
512    <div id="action_dissociate" class="bulkAction">
513          <select style="width:400px" name="dissociate" size="1">
514            {if !empty($dissociate_options)}{html_options options=$dissociate_options }{/if}
515          </select>
516    </div>
517
518
519    <!-- add_tags -->
520    <div id="action_add_tags" class="bulkAction">
521<select id="tags" name="add_tags">
522</select>
523    </div>
524
525    <!-- del_tags -->
526    <div id="action_del_tags" class="bulkAction">
527{$DEL_TAG_SELECTION}
528    </div>
529
530    <!-- author -->
531    <div id="action_author" class="bulkAction">
532    <label><input type="checkbox" name="remove_author"> remove author</label><br>
533    {assign var='authorDefaultValue' value='Type here the author name'}
534<input type="text" class="large" name="author" value="{$authorDefaultValue}" onfocus="this.value=(this.value=='{$authorDefaultValue}') ? '' : this.value;" onblur="this.value=(this.value=='') ? '{$authorDefaultValue}' : this.value;">
535    </div>   
536
537    <!-- name -->
538    <div id="action_name" class="bulkAction">
539    <label><input type="checkbox" name="remove_name"> remove name</label><br>
540    {assign var='nameDefaultValue' value='Type here the name name'}
541<input type="text" class="large" name="name" value="{$nameDefaultValue}" onfocus="this.value=(this.value=='{$nameDefaultValue}') ? '' : this.value;" onblur="this.value=(this.value=='') ? '{$nameDefaultValue}' : this.value;">
542    </div>
543
544    <!-- date_creation -->
545    <div id="action_date_creation" class="bulkAction">
546      <label><input type="checkbox" name="remove_date_creation"> remove creation date</label><br>
547      <div id="set_date_creation">
548          <select id="date_creation_day" name="date_creation_day">
549             <option value="0">--</option>
550            {section name=day start=1 loop=32}
551              <option value="{$smarty.section.day.index}" {if $smarty.section.day.index==$DATE_CREATION_DAY}selected="selected"{/if}>{$smarty.section.day.index}</option>
552            {/section}
553          </select>
554          <select id="date_creation_month" name="date_creation_month">
555            {html_options options=$month_list selected=$DATE_CREATION_MONTH}
556          </select>
557          <input id="date_creation_year"
558                 name="date_creation_year"
559                 type="text"
560                 size="4"
561                 maxlength="4"
562                 value="{$DATE_CREATION_YEAR}">
563          <input id="date_creation_linked_date" name="date_creation_linked_date" type="hidden" size="10" disabled="disabled">
564      </div>
565    </div>
566
567    <!-- level -->
568    <div id="action_level" class="bulkAction">
569        <select name="level" size="1">
570          {html_options options=$level_options selected=$level_options_selected}
571        </select>
572    </div>
573
574    <p id="applyActionBlock" style="display:none" class="actionButtons">
575      <input id="applyAction" class="submit" type="submit" value="{'Apply action'|@translate}" name="submit" {$TAG_INPUT_ENABLED}> <span id="applyOnDetails"></span></p>
576
577    </div> <!-- #permitAction -->
578  </fieldset>
579
580  </form>
Note: See TracBrowser for help on using the repository browser.