source: extensions/SmartAlbums/template/cat_modify.tpl @ 10871

Last change on this file since 10871 was 10871, checked in by mistic100, 13 years ago

repository for SmartAlbums

File size: 5.0 KB
Line 
1{combine_css path=$SMART_PATH|@cat:"template/style.css"}
2{include file='include/datepicker.inc.tpl'}
3{combine_script id='jquery.fcbkcomplete' load='async' require='jquery' path='themes/default/js/plugins/jquery.fcbkcomplete.js'}
4
5{footer_script require='jquery,jquery.fcbkcomplete'}
6var lang = new Array();
7lang['tags filter'] = "{'tags filter'|@translate}";
8lang['date filter'] = "{'date filter'|@translate}";
9lang['limit filter'] = "{'limit filter'|@translate}";
10lang['remove this filter'] = "{'remove this filter'|@translate}";
11
12var options = new Array();
13{capture assign="options_tags"}{html_options options=$options.tags}{/capture}
14{capture assign="options_date"}{html_options options=$options.date}{/capture}
15{capture assign="options_limit"}{html_options options=$options.limit}{/capture}
16options['tags'] = "{$options_tags|escape:javascript}";
17options['date'] = "{$options_date|escape:javascript}";
18options['limit'] = "{$options_limit|escape:javascript}";
19
20{literal}
21jQuery(document).ready(function() {
22  $('#addFilter').change(function() {
23    add_filter($(this).attr('value'));
24    $(this).attr('value', '-1');
25  });
26   
27  $('#removeFilters').click(function() {
28    $('#filterList li').each(function() {
29      $(this).remove();
30    });
31    return false;
32  });
33 
34  $('input[name="is_smart"]').change(function() {
35    $('#SmartAlbum_options').toggle();
36    $('input[name="count_images"]').toggle();
37  });
38 
39  $('input[name="count_images"]').click(function() {
40    count_images($(this).closest('form'));
41    return false;
42  });
43 
44  function add_filter(type) {
45    $('<li class="filter_'+ type +'" id="filter_'+ i +'"></li>').appendTo('#filterList');
46   
47    $('#filter_'+ i).html(
48      '<a href="#" class="removeFilter" title="'+ lang['remove this filter'] +'"><span>[x]</span></a>'+
49      '<input type="hidden" name="filters['+ i +'][type]" value="'+ type +'"/>'+
50      ' '+ lang[type +' filter'] +
51     
52      ' <select name="filters['+ i +'][cond]">'+ options[type] +'</select>'+
53      ' <input type="text" name="filters['+ i +'][value]"/>'
54    );
55   
56    // reinit handler
57    init_jquery_handlers();
58    i++;
59  }
60 
61  function init_jquery_handlers() { 
62    $('.removeFilter').click(function() {
63      $(this).parent('li').remove();
64      return false;
65    });
66 
67    $('.filter_date input[type="text"]').each(function() {
68      $(this).datepicker({dateFormat:'yy-mm-dd', firstDay:1});
69    });
70   
71    $('.filter_tags input[type="text"]').each(function() {
72      if ($(this).hasClass('fcbk_initialized') == false) {
73        $(this).fcbkcomplete({
74          json_url: "admin.php?fckb_tags=1",
75          cache: false,
76          filter_case: false,
77          filter_hide: true,
78          firstselected: true,
79          filter_selected: true,
80          maxitems: 100,
81          newel: false
82        });
83        $(this).addClass('fcbk_initialized');
84      }
85    });
86  }
87 
88  function count_images(form) {
89{/literal}
90                jQuery.post("{$COUNT_SCRIPT_URL}", 'cat_id={$CAT_ID}&'+form.serialize(),
91{literal}
92                        function success(data) {
93                                jQuery('.count_images_display').html(data);
94                        }
95                );
96        }
97 
98  init_jquery_handlers();
99});
100{/literal}
101{/footer_script}
102
103<div id="batchManagerGlobal">
104<form action="{$F_ACTION}" method="POST" id="smart">
105<fieldset>
106
107  <legend>{'SmartAlbums'|@translate}</legend>
108 
109  <label><input type="checkbox" name="is_smart" {if isset($filters)}checked="checked"{/if}/> {'This album is a SmartAlbum'|@translate}</label>
110 
111<div id="SmartAlbum_options" style="margin-top:1em;{if !isset($filters)}display:none;{/if}">
112  <ul id="filterList">
113    {counter start=0 assign=i}
114    {foreach from=$filters item=filter}
115      <li class="filter_{$filter.TYPE}" id="filter_{$i}">
116        <a href="#" class="removeFilter" title="{'remove this filter'|@translate}"><span>[x]</span></a>
117        <input type="hidden" name="filters[{$i}][type]" value="{$filter.TYPE}"/>
118        {$filter.TYPE|cat:' filter'|@translate}
119       
120        <select name="filters[{$i}][cond]">
121          {html_options options=$options[$filter.TYPE] selected=$filter.COND}
122        </select>
123       
124        <input type="text" name="filters[{$i}][value]" value="{$filter.VALUE}"/>
125      </li>
126                        {counter}
127                {/foreach}
128   
129    {footer_script}var i={$i};{/footer_script}
130  </ul>
131
132  <p class="actionButtons">
133      <select id="addFilter">
134        <option value="-1">{'Add a filter'|@translate}</option>
135        <option disabled="disabled">------------------</option>
136        <option value="tags">{'tags filter'|@translate}</option>
137        <option value="date">{'date filter'|@translate}</option>
138        <option value="limit">{'limit filter'|@translate}</option>
139      </select>
140      <a id="removeFilters">{'Remove all filters'|@translate}</a>
141  </p>
142</div>
143   
144  <p class="actionButtons" id="applyFilterBlock">
145    <input class="submit" type="submit" value="{'Submit'|@translate}" name="submitFilters"/>
146    <input class="submit" type="submit" value="{'Count'|@translate}" name="count_images" {if !isset($filters)}style="display:none;"{/if}/>
147    <span class="count_images_display">{$IMAGE_COUNT}</span>
148  </p>
149
150</fieldset>
151</form>
152</div>
Note: See TracBrowser for help on using the repository browser.