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

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

feature 2089: add the "not_linked" feature as "with no virtual album" in the
new Batch Manager.

File size: 20.1 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(admin/themes/default/icon/remove_filter.png) no-repeat top left;width:7px;height:7px;display:inline-block}
330a.removeFilter:hover {background: url(admin/themes/default/icon/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{if $ENABLE_SYNCHRONIZATION}
357          <option value="with no virtual album" {if $filter.prefilter eq 'with no virtual album'}selected="selected"{/if}>with no virtual album</option>
358{/if}
359<!--          <option value="with no album">with no album</option> -->
360<!--          <option value="with no virtual album">with no virtual album</option> -->
361<!--          <option value="with no tag">with no tag</option> -->
362        </select>
363      </li>
364      <li id="filter_category" {if !isset($filter.category)}style="display:none"{/if}>
365        <a href="#" class="removeFilter" title="remove this filter"><span>[x]</span></a>
366        <input type="checkbox" name="filter_category_use" class="useFilterCheckbox" {if isset($filter.category)}checked="checked"{/if}>
367        album
368        <select style="width:400px" name="filter_category" size="1">
369          {html_options options=$filter_category_options selected=$filter_category_options_selected}
370        </select>
371        <label><input type="checkbox" name="filter_category_recursive" {if isset($filter.category_recursive)}checked="checked"{/if}> {'include child albums'|@translate}</label>
372      </li>
373      <li id="filter_level" {if !isset($filter.level)}style="display:none"{/if}>
374        <a href="#" class="removeFilter" title="remove this filter"><span>[x]</span></a>
375        <input type="checkbox" name="filter_level_use" class="useFilterCheckbox" {if isset($filter.level)}checked="checked"{/if}>
376        {'Who can see these photos?'|@translate}
377        <select name="filter_level" size="1">
378          {html_options options=$filter_level_options selected=$filter_level_options_selected}
379        </select>
380      </li>
381    </ul>
382
383    <p class="actionButtons" style="">
384      <select id="addFilter">
385        <option value="-1">Add a filter</option>
386        <option disabled="disabled">------------------</option>
387        <option value="filter_prefilter">predefined filter</option>
388        <option value="filter_category">album</option>
389        <option value="filter_level">{'Who can see these photos?'|@translate}</option>
390      </select>
391<!--      <input id="removeFilters" class="submit" type="submit" value="Remove all filters" name="removeFilters"> -->
392      <a id="removeFilters" href="">Remove all filters</a>
393    </p>
394
395    <p class="actionButtons" id="applyFilterBlock">
396      <input id="applyFilter" class="submit" type="submit" value="Refresh photo set" name="submitFilter">
397    </p>
398
399  </fieldset>
400
401  <fieldset>
402
403    <legend>{'Selection'|@translate}</legend>
404
405  {if !empty($thumbnails)}
406  <p id="checkActions">
407    {'Select:'|@translate}
408    <a href="#" id="selectAll">{'All'|@translate}</a>
409    (<a href="#" id="selectSet">or the whole set</a>),
410    <a href="#" id="selectNone">{'None'|@translate}</a>,
411    <a href="#" id="selectInvert">{'Invert'|@translate}</a>
412
413    <span id="selectedMessage"></span>
414
415    <input type="checkbox" name="setSelected" style="display:none" {if count($selection) == $nb_thumbs_set}checked="checked"{/if}>
416  </p>
417
418    <ul class="thumbnails">
419      {foreach from=$thumbnails item=thumbnail}
420        {if in_array($thumbnail.ID, $selection)}
421          {assign var='isSelected' value=true}
422        {else}
423          {assign var='isSelected' value=false}
424        {/if}
425
426      <li><span class="wrap1">
427          <label>
428            <span class="wrap2{if $isSelected} thumbSelected{/if}">
429        {if $thumbnail.LEVEL > 0}
430        <em class="levelIndicatorB">{$pwg->l10n($pwg->sprintf('Level %d',$thumbnail.LEVEL))}</em>
431        <em class="levelIndicatorF" title="{'Who can see these photos?'|@translate} : ">{$pwg->l10n($pwg->sprintf('Level %d',$thumbnail.LEVEL))}</em>
432        {/if}
433            <span>
434              <img src="{$thumbnail.TN_SRC}"
435                 alt="{$thumbnail.FILE}"
436                 title="{$thumbnail.TITLE|@escape:'html'}"
437                 class="thumbnail">
438            </span></span>
439            <input type="checkbox" name="selection[]" value="{$thumbnail.ID}" {if $isSelected}checked="checked"{/if}>
440          </label>
441          </span>
442      </li>
443      {/foreach}
444    </ul>
445
446  {if !empty($navbar) }
447  <div style="clear:both;">
448
449    <div style="float:left">
450    {include file='navigation_bar.tpl'|@get_extent:'navbar'}
451    </div>
452
453    <div style="float:right;margin-top:10px;">{'display'|@translate}
454      <a href="{$U_DISPLAY}&amp;display=20">20</a>
455      &middot; <a href="{$U_DISPLAY}&amp;display=50">50</a>
456      &middot; <a href="{$U_DISPLAY}&amp;display=100">100</a>
457      &middot; <a href="{$U_DISPLAY}&amp;display=all">{'all'|@translate}</a>
458      thumbnails per page
459    </div>
460  </div>
461  {/if}
462
463  {else}
464  <div>No photo in the current set.</div>
465  {/if}
466  </fieldset>
467
468  <fieldset id="action">
469
470    <legend>{'Action'|@translate}</legend>
471      <div id="forbidAction"{if count($selection) != 0}style="display:none"{/if}>No photo selected, no action possible.</div>
472      <div id="permitAction"{if count($selection) == 0}style="display:none"{/if}>
473
474    <select name="selectAction">
475      <option value="-1">Choose an action</option>
476      <option disabled="disabled">------------------</option>
477  {if isset($show_delete_form) }
478      <option value="delete">{'Delete selected photos'|@translate}</option>
479  {/if}
480      <option value="associate">{'associate to category'|@translate}</option>
481  {if !empty($dissociate_options)}
482      <option value="dissociate">{'dissociate from category'|@translate}</option>
483  {/if}
484      <option value="add_tags">{'add tags'|@translate}</option>
485  {if !empty($DEL_TAG_SELECTION)}
486      <option value="del_tags">{'remove tags'|@translate}</option>
487  {/if}
488      <option value="author">{'Set author'|@translate}</option>
489      <option value="name">{'Set title'|@translate}</option>
490      <option value="date_creation">{'Set creation date'|@translate}</option>
491      <option value="level">{'Who can see these photos?'|@translate}</option>
492  {if ($IN_CADDIE)}
493      <option value="remove_from_caddie">{'Remove from caddie'|@translate}</option>
494  {else}
495      <option value="add_to_caddie">{'Add to caddie'|@translate}</option>
496  {/if}
497    </select>
498
499    <!-- delete -->
500    <div id="action_delete" class="bulkAction">
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.