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

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

feature 3077 : factorize code for categories cache (TODO for other collections) + fix incorrect categories list for dissociation

  • Property svn:eol-style set to LF
File size: 5.3 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 CategoriesCache({
14  serverKey: '{$CACHE_KEYS.categories}',
15  serverId: '{$CACHE_KEYS._hash}',
16  rootUrl: '{$ROOT_URL}'
17});
18
19categoriesCache.selectize(jQuery('[data-selectize=categories]'), { {if $STORAGE_ALBUM}
20  filter: function(categories, options) {
21    options.default = (this.name == 'associate[]') ? {$STORAGE_ALBUM} : undefined;
22    return categories;
23  }
24{/if} });
25
26{* <!-- TAGS --> *}
27var tagsCache = new LocalStorageCache({
28  key: 'tagsAdminList',
29  serverKey: '{$CACHE_KEYS.tags}',
30  serverId: '{$CACHE_KEYS._hash}',
31
32  loader: function(callback) {
33    jQuery.getJSON('{$ROOT_URL}ws.php?format=json&method=pwg.tags.getAdminList', function(data) {
34      var tags = data.result.tags;
35     
36      for (var i=0, l=tags.length; i<l; i++) {
37        tags[i].id = '~~' + tags[i].id + '~~';
38      }
39     
40      callback(tags);
41    });
42  }
43});
44
45jQuery('[data-selectize=tags]').selectize({
46  valueField: 'id',
47  labelField: 'name',
48  searchField: ['name'],
49  plugins: ['remove_button'],
50  create: true
51});
52
53tagsCache.get(function(tags) {
54  jQuery('[data-selectize=tags]').each(function() {
55    this.selectize.load(function(callback) {
56      callback(tags);
57    });
58
59    jQuery.each(jQuery(this).data('value'), jQuery.proxy(function(i, tag) {
60      this.selectize.addItem(tag.id);
61    }, this));
62  });
63});
64
65{* <!-- DATEPICKER --> *}
66jQuery(function(){ {* <!-- onLoad needed to wait localization loads --> *}
67  jQuery('[data-datepicker]').pwgDatepicker({ showTimepicker: true });
68});
69}());
70{/footer_script}
71
72<h2>{$TITLE} &#8250; {'Edit photo'|@translate} {$TABSHEET_TITLE}</h2>
73
74<form action="{$F_ACTION}" method="post" id="catModify">
75
76  <fieldset>
77    <legend>{'Informations'|@translate}</legend>
78
79    <table>
80
81      <tr>
82        <td id="albumThumbnail">
83          <img src="{$TN_SRC}" alt="{'Thumbnail'|@translate}" class="Thumbnail">
84        </td>
85        <td id="albumLinks" style="width:400px;vertical-align:top;">
86          <ul style="padding-left:15px;margin:0;">
87            <li>{$INTRO.file}</li>
88            <li>{$INTRO.add_date}</li>
89            <li>{$INTRO.added_by}</li>
90            <li>{$INTRO.size}</li>
91            <li>{$INTRO.stats}</li>
92            <li>{$INTRO.id}</li>
93          </ul>
94        </td>
95        <td class="photoLinks">
96          <ul>
97          {if isset($U_JUMPTO) }
98            <li><a class="icon-eye" href="{$U_JUMPTO}">{'jump to photo'|@translate} →</a></li>
99          {/if}
100          {if !url_is_remote($PATH)}
101            <li><a class="icon-arrows-cw" href="{$U_SYNC}">{'Synchronize metadata'|@translate}</a></li>
102
103            <li><a class="icon-trash" href="{$U_DELETE}" onclick="return confirm('{'Are you sure?'|@translate|@escape:javascript}');">{'delete photo'|@translate}</a></li>
104          {/if}
105          </ul>
106        </td>
107      </tr>
108    </table>
109
110  </fieldset>
111
112  <fieldset>
113    <legend>{'Properties'|@translate}</legend>
114
115    <p>
116      <strong>{'Title'|@translate}</strong>
117      <br>
118      <input type="text" class="large" name="name" value="{$NAME|@escape}">
119    </p>
120
121    <p>
122      <strong>{'Author'|@translate}</strong>
123      <br>
124      <input type="text" class="large" name="author" value="{$AUTHOR}">
125    </p>
126
127    <p>
128      <strong>{'Creation date'|@translate}</strong>
129      <br>
130      <input type="hidden" name="date_creation" value="{$DATE_CREATION}">
131      <label>
132        <i class="icon-calendar"></i>
133        <input type="text" data-datepicker="date_creation" data-datepicker-unset="date_creation_unset" readonly>
134      </label>
135      <a href="#" class="icon-cancel-circled" id="date_creation_unset">{'unset'|translate}</a>
136    </p>
137
138    <p>
139      <strong>{'Linked albums'|@translate}</strong>
140      <br>
141      <select data-selectize="categories" data-value="{$associated_albums|@json_encode|escape:html}"
142        name="associate[]" multiple style="width:600px;" ></select>
143    </p>
144
145    <p>
146      <strong>{'Representation of albums'|@translate}</strong>
147      <br>
148      <select data-selectize="categories" data-value="{$represented_albums|@json_encode|escape:html}"
149        name="represent[]" multiple style="width:600px;" ></select>
150    </p>
151
152    <p>
153      <strong>{'Tags'|@translate}</strong>
154      <br>
155      <select data-selectize="tags" data-value="{$tag_selection|@json_encode|escape:html}"
156        name="tags[]" multiple style="width:600px;" ></select>
157    </p>
158
159    <p>
160      <strong>{'Description'|@translate}</strong>
161      <br>
162      <textarea name="description" id="description" class="description">{$DESCRIPTION}</textarea>
163    </p>
164
165    <p>
166      <strong>{'Who can see this photo?'|@translate}</strong>
167      <br>
168      <select name="level" size="1">
169        {html_options options=$level_options selected=$level_options_selected}
170      </select>
171   </p>
172
173  <p style="margin:40px 0 0 0">
174    <input class="submit" type="submit" value="{'Save Settings'|@translate}" name="submit">
175  </p>
176</fieldset>
177
178</form>
Note: See TracBrowser for help on using the repository browser.