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

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

test version

File size: 5.5 KB
Line 
1{combine_css path=$SMART_PATH|@cat:"template/style.css"}
2{include file='include/datepicker.inc.tpl'}
3{combine_script id='jquery.tokeninput' load='async' require='jquery' path='themes/default/js/plugins/jquery.tokeninput.js'}
4
5{footer_script require='jquery.tokeninput'}
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="countImages"]').toggle();
37  });
38 
39  $('input[name="countImages"]').click(function() {
40    countImages($(this).closest('form'));
41    return false;
42  });
43 
44  function add_filter(type) {
45    // add line
46    $('<li class="filter_'+ type +'" id="filter_'+ i +'"></li>').appendTo('#filterList');
47   
48    //set content
49    content = '<a href="#" class="removeFilter" title="'+ lang['remove this filter'] +'"><span>[x]</span></a>'+
50    '<input type="hidden" name="filters['+ i +'][type]" value="'+ type +'"/>&nbsp;'+ lang[type +' filter'] +
51    '&nbsp;<select name="filters['+ i +'][cond]">'+ options[type] +'</select>';
52   
53    if (type == 'tags') {
54      content += '&nbsp;<select name="filters['+ i +'][value]" class="tagSelect"></select>';
55    } else {
56      content += '&nbsp;<input type="text" name="filters['+ i +'][value]"/>';
57    }
58   
59    $('#filter_'+ i).html(content);
60   
61    // reinit handlers
62    init_jquery_handlers();
63    i++;
64  }
65 
66  function init_jquery_handlers() { 
67    $('.removeFilter').click(function() {
68      $(this).parent('li').remove();
69      return false;
70    });
71 
72    $('.filter_date input[type="text"]').each(function() {
73      $(this).datepicker({dateFormat:'yy-mm-dd', firstDay:1});
74    });
75   
76    jQuery.getJSON('admin.php?fckb_tags=1', function(data) {
77      jQuery(".tagSelect").tokenInput(
78        data,
79        {
80      {/literal}
81          hintText: '{'Type in a search term'|@translate}',
82          noResultsText: '{'No results'|@translate}',
83          searchingText: '{'Searching...'|@translate}',
84          animateDropdown: false,
85          preventDuplicates: true,
86          allowCreation: true
87      {literal}
88        }
89      );
90    });
91  }
92 
93  function countImages(form) {
94{/literal}
95                jQuery.post("{$COUNT_SCRIPT_URL}", 'cat_id={$CAT_ID}&'+form.serialize(),
96{literal}
97                        function success(data) {
98                                jQuery('.count_images_display').html(data);
99                        }
100                );
101        }
102 
103  init_jquery_handlers();
104});
105{/literal}
106{/footer_script}
107
108<div id="batchManagerGlobal">
109<form action="{$F_ACTION}" method="POST" id="smart">
110<fieldset>
111
112  <legend>{'SmartAlbums'|@translate}</legend>
113 
114  <label><input type="checkbox" name="is_smart" {if isset($filters)}checked="checked"{/if}/> {'This album is a SmartAlbum'|@translate}</label>
115 
116<div id="SmartAlbum_options" style="margin-top:1em;{if !isset($filters)}display:none;{/if}">
117  <ul id="filterList">
118    {counter start=0 assign=i}
119    {foreach from=$filters item=filter}
120      <li class="filter_{$filter.TYPE}" id="filter_{$i}">
121        <a href="#" class="removeFilter" title="{'remove this filter'|@translate}"><span>[x]</span></a>
122        <input type="hidden" name="filters[{$i}][type]" value="{$filter.TYPE}"/>
123        {$filter.TYPE|cat:' filter'|@translate}
124       
125        <select name="filters[{$i}][cond]">
126          {html_options options=$options[$filter.TYPE] selected=$filter.COND}
127        </select>
128       
129      {if $filter.TYPE == 'tags'}
130        <select name="filters[{$i}][value]" class="tagSelect">
131        {foreach from=$filter.VALUE item=tag}
132          <option value="{$tag.id}" class="selected">{$tag.name}</option>
133        {/foreach}
134        </select>
135      {else}
136        <input type="text" name="filters[{$i}][value]" value="{$filter.VALUE}"/>
137      {/if}
138      </li>
139                        {counter}
140                {/foreach}
141   
142    {footer_script}var i={$i};{/footer_script}
143  </ul>
144
145  <p class="actionButtons">
146      <select id="addFilter">
147        <option value="-1">{'Add a filter'|@translate}</option>
148        <option disabled="disabled">------------------</option>
149        <option value="tags">{'tags filter'|@translate}</option>
150        <option value="date">{'date filter'|@translate}</option>
151        <option value="limit">{'limit filter'|@translate}</option>
152      </select>
153      <a id="removeFilters">{'Remove all filters'|@translate}</a>
154  </p>
155</div>
156   
157  <p class="actionButtons" id="applyFilterBlock">
158    <input class="submit" type="submit" value="{'Submit'|@translate}" name="submitFilters"/>
159    <input class="submit" type="submit" value="{'Count'|@translate}" name="countImages" {if !isset($filters)}style="display:none;"{/if}/>
160    <span class="count_images_display">{$IMAGE_COUNT}</span>
161  </p>
162
163</fieldset>
164</form>
165</div>
Note: See TracBrowser for help on using the repository browser.