source: trunk/admin/themes/default/template/picture_modify.tpl @ 28496

Last change on this file since 28496 was 28496, checked in by mistic100, 10 years ago

feature 3077 : use Selectize with AJAX load/cache on cat_perm and batch_manager_unit

  • Property svn:eol-style set to LF
File size: 6.2 KB
Line 
1{include file='include/autosize.inc.tpl'}
2{include file='include/dbselect.inc.tpl'}
3{include file='include/datepicker.inc.tpl'}
4
5{combine_script id='LocalStorageCache' load='footer' path='admin/themes/default/js/LocalStorageCache.js'}
6
7{combine_script id='jquery.selectize' load='footer' path='themes/default/js/plugins/selectize.min.js'}
8{combine_css id='jquery.selectize' path="themes/default/js/plugins/selectize.default.css"}
9
10{footer_script}
11(function(){
12{* <!-- CATEGORIES --> *}
13var categoriesCache = new LocalStorageCache('categoriesAdminList', 5*60, function(callback) {
14  jQuery.getJSON('{$ROOT_URL}ws.php?format=json&method=pwg.categories.getAdminList', function(data) {
15    callback(data.result.categories);
16  });
17});
18
19jQuery('[data-selectize=categories]').selectize({
20  valueField: 'id',
21  labelField: 'fullname',
22  searchField: ['fullname'],
23  plugins: ['remove_button']
24});
25
26categoriesCache.get(function(categories) {
27  jQuery('[data-selectize=categories]').each(function() {
28    this.selectize.load(function(callback) {
29      callback(categories);
30    });
31
32    jQuery.each(jQuery(this).data('value'), jQuery.proxy(function(i, id) {
33      this.selectize.addItem(id);
34    }, this));
35  });
36});
37
38{* <!-- TAGS --> *}
39var tagsCache = new LocalStorageCache('tagsAdminList', 5*60, function(callback) {
40  jQuery.getJSON('{$ROOT_URL}ws.php?format=json&method=pwg.tags.getAdminList', function(data) {
41    var tags = data.result.tags;
42   
43    for (var i=0, l=tags.length; i<l; i++) {
44      tags[i].id = '~~' + tags[i].id + '~~';
45    }
46   
47    callback(tags);
48  });
49});
50
51jQuery('[data-selectize=tags]').selectize({
52  valueField: 'id',
53  labelField: 'name',
54  searchField: ['name'],
55  plugins: ['remove_button'],
56  create: function(input, callback) {
57    tagsCache.clear();
58   
59    callback({
60      id: input,
61      name: input
62    });
63  }
64});
65
66tagsCache.get(function(tags) {
67  jQuery('[data-selectize=tags]').each(function() {
68    this.selectize.load(function(callback) {
69      callback(tags);
70    });
71
72    jQuery.each(jQuery(this).data('value'), jQuery.proxy(function(i, tag) {
73      this.selectize.addItem(tag.id);
74    }, this));
75  });
76});
77
78{* <!-- DATEPICKER --> *}
79pwg_initialization_datepicker("#date_creation_day", "#date_creation_month", "#date_creation_year", "#date_creation_linked_date", "#date_creation_action_set");
80}());
81{/footer_script}
82
83<h2>{$TITLE} &#8250; {'Edit photo'|@translate} {$TABSHEET_TITLE}</h2>
84
85<form action="{$F_ACTION}" method="post" id="catModify">
86
87  <fieldset>
88    <legend>{'Informations'|@translate}</legend>
89
90    <table>
91
92      <tr>
93        <td id="albumThumbnail">
94          <img src="{$TN_SRC}" alt="{'Thumbnail'|@translate}" class="Thumbnail">
95        </td>
96        <td id="albumLinks" style="width:400px;vertical-align:top;">
97          <ul style="padding-left:15px;margin:0;">
98            <li>{$INTRO.file}</li>
99            <li>{$INTRO.add_date}</li>
100            <li>{$INTRO.added_by}</li>
101            <li>{$INTRO.size}</li>
102            <li>{$INTRO.stats}</li>
103            <li>{$INTRO.id}</li>
104          </ul>
105        </td>
106        <td class="photoLinks">
107          <ul>
108          {if isset($U_JUMPTO) }
109            <li><a class="icon-eye" href="{$U_JUMPTO}">{'jump to photo'|@translate} →</a></li>
110          {/if}
111          {if !url_is_remote($PATH)}
112            <li><a class="icon-arrows-cw" href="{$U_SYNC}">{'Synchronize metadata'|@translate}</a></li>
113
114            <li><a class="icon-trash" href="{$U_DELETE}" onclick="return confirm('{'Are you sure?'|@translate|@escape:javascript}');">{'delete photo'|@translate}</a></li>
115          {/if}
116          </ul>
117        </td>
118      </tr>
119    </table>
120
121  </fieldset>
122
123  <fieldset>
124    <legend>{'Properties'|@translate}</legend>
125
126    <p>
127      <strong>{'Title'|@translate}</strong>
128      <br>
129      <input type="text" class="large" name="name" value="{$NAME|@escape}">
130    </p>
131
132    <p>
133      <strong>{'Author'|@translate}</strong>
134      <br>
135      <input type="text" class="large" name="author" value="{$AUTHOR}">
136    </p>
137
138    <p>
139      <strong>{'Creation date'|@translate}</strong>
140      <br>
141      <select id="date_creation_day" name="date_creation_day">
142        <option value="0">--</option>
143{section name=day start=1 loop=32}
144        <option value="{$smarty.section.day.index}" {if $smarty.section.day.index==$DATE_CREATION_DAY_VALUE}selected="selected"{/if}>{$smarty.section.day.index}</option>
145{/section}
146      </select>
147
148      <select id="date_creation_month" name="date_creation_month">
149        {html_options options=$month_list selected=$DATE_CREATION_MONTH_VALUE}
150      </select>
151
152      <input id="date_creation_year" name="date_creation_year" type="text" size="4" maxlength="4" value="{$DATE_CREATION_YEAR_VALUE}">
153      <input id="date_creation_linked_date" name="date_creation_linked_date" type="hidden" size="10" disabled="disabled">
154      <input name="date_creation_time" type="hidden" value="{$DATE_CREATION_TIME_VALUE}">
155      <a href="#" id="unset_date_creation" style="display:none">unset</a>
156    </p>
157
158    <p>
159      <strong>{'Linked albums'|@translate}</strong>
160      <br>
161      <select data-selectize="categories" data-value="{$associate_options_selected|@json_encode|escape:html}"
162        name="associate[]" multiple style="width:600px;" ></select>
163    </p>
164
165    <p>
166      <strong>{'Representation of albums'|@translate}</strong>
167      <br>
168      <select data-selectize="categories" data-value="{$represent_options_selected|@json_encode|escape:html}"
169        name="represent[]" multiple style="width:600px;" ></select>
170    </p>
171
172    <p>
173      <strong>{'Tags'|@translate}</strong>
174      <br>
175      <select data-selectize="tags" data-value="{$tag_selection|@json_encode|escape:html}"
176        name="tags[]" multiple style="width:600px;" ></select>
177    </p>
178
179    <p>
180      <strong>{'Description'|@translate}</strong>
181      <br>
182      <textarea name="description" id="description" class="description">{$DESCRIPTION}</textarea>
183    </p>
184
185    <p>
186      <strong>{'Who can see this photo?'|@translate}</strong>
187      <br>
188      <select name="level" size="1">
189        {html_options options=$level_options selected=$level_options_selected}
190      </select>
191   </p>
192
193  <p style="margin:40px 0 0 0">
194    <input class="submit" type="submit" value="{'Save Settings'|@translate}" name="submit">
195  </p>
196</fieldset>
197
198</form>
Note: See TracBrowser for help on using the repository browser.