source: trunk/admin/themes/default/template/cat_modify.tpl @ 28533

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

feature 3077 : use selectize on batch_manager_global, cat_modify and photos_add_direct
+ rewrite "add album" popup (more flexible and working with selectize)

  • Property svn:eol-style set to LF
File size: 4.9 KB
Line 
1{combine_script id='LocalStorageCache' load='footer' path='admin/themes/default/js/LocalStorageCache.js'}
2
3{combine_script id='jquery.selectize' load='footer' path='themes/default/js/plugins/selectize.min.js'}
4{combine_css id='jquery.selectize' path="themes/default/js/plugins/selectize.default.css"}
5
6{footer_script}
7{* <!-- CATEGORIES --> *}
8var categoriesCache = new LocalStorageCache({
9  key: 'categoriesAdminList',
10  serverKey: '{$CACHE_KEYS.categories}',
11  serverId: '{$CACHE_KEYS._hash}',
12
13  loader: 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});
19
20jQuery('[data-selectize=categories]').selectize({
21  valueField: 'id',
22  labelField: 'fullname',
23  sortField: 'fullname',
24  searchField: ['fullname'],
25  plugins: ['remove_button']
26});
27
28categoriesCache.get(function(categories) {
29  categories.push({
30    id: 0,
31    fullname: '------------'
32  });
33 
34  // remove itself and children
35  categories = jQuery.grep(categories, function(cat) {
36    return !(/\b{$CAT_ID}\b/.test(cat.uppercats));
37  });
38 
39  categories.sort(function(a, b) {
40    return a.fullname.localeCompare(b.fullname);
41  });
42 
43  jQuery('[data-selectize=categories]').each(function() {
44    this.selectize.load(function(callback) {
45      callback(categories);
46    });
47
48    if (jQuery(this).data('value')) {
49      this.selectize.setValue(jQuery(this).data('value')[0]);
50    }
51   
52    // prevent empty value
53    if (this.selectize.getValue() == '') {
54      this.selectize.setValue(categories[0].id);
55    }
56    this.selectize.on('dropdown_close', function() {
57      if (this.getValue() == '') {
58        this.setValue(categories[0].id);
59      }
60    });
61  });
62});
63{/footer_script}
64
65
66<div class="titrePage">
67  <h2><span style="letter-spacing:0">{$CATEGORIES_NAV}</span> &#8250; {'Edit album'|@translate} {$TABSHEET_TITLE}</h2>
68</div>
69
70<form action="{$F_ACTION}" method="POST" id="catModify">
71
72<fieldset>
73  <legend>{'Informations'|@translate}</legend>
74
75  <table style="width:100%">
76    <tr>
77      <td id="albumThumbnail">
78{if isset($representant) }
79  {if isset($representant.picture) }
80        <a href="{$representant.picture.URL}"><img src="{$representant.picture.SRC}" alt=""></a>
81  {else}
82        <img src="{$ROOT_URL}{$themeconf.admin_icon_dir}/category_representant_random.png" alt="{'Random photo'|@translate}">
83  {/if}
84
85  {if $representant.ALLOW_SET_RANDOM }
86        <p style="text-align:center;"><input class="submit" type="submit" name="set_random_representant" value="{'Refresh'|@translate}" title="{'Find a new representant by random'|@translate}"></p>
87  {/if}
88
89  {if isset($representant.ALLOW_DELETE) }
90        <p><input class="submit" type="submit" name="delete_representant" value="{'Delete Representant'|@translate}"></p>
91  {/if}
92{/if}
93      </td>
94
95      <td id="albumLinks">
96<p>{$INTRO}</p>
97<ul>
98{if cat_admin_access($CAT_ID)}
99  <li><a class="icon-eye" href="{$U_JUMPTO}">{'jump to album'|@translate} →</a></li>
100{/if}
101
102{if isset($U_MANAGE_ELEMENTS) }
103  <li><a class="icon-picture" href="{$U_MANAGE_ELEMENTS}">{'manage album photos'|@translate}</a></li>
104{/if}
105
106  <li style="text-transform:lowercase;"><a class="icon-plus-circled" href="{$U_ADD_PHOTOS_ALBUM}">{'Add Photos'|translate}</a></li>
107
108  <li><a class="icon-sitemap" href="{$U_CHILDREN}">{'manage sub-albums'|@translate}</a></li>
109
110{if isset($U_SYNC) }
111  <li><a class="icon-exchange" href="{$U_SYNC}">{'Synchronize'|@translate}</a> ({'Directory'|@translate} = {$CAT_FULL_DIR})</li>
112{/if}
113
114{if isset($U_DELETE) }
115  <li><a class="icon-trash" href="{$U_DELETE}" onclick="return confirm('{'Are you sure?'|@translate|@escape:javascript}');">{'delete album'|@translate}</a></li>
116{/if}
117
118</ul>
119      </td>
120    </tr>
121  </table>
122
123</fieldset>
124
125<fieldset>
126  <legend>{'Properties'|@translate}</legend>
127  <p>
128    <strong>{'Name'|@translate}</strong>
129    <br>
130    <input type="text" class="large" name="name" value="{$CAT_NAME}" maxlength="255">
131  </p>
132
133  <p>
134    <strong>{'Description'|@translate}</strong>
135    <br>
136    <textarea cols="50" rows="5" name="comment" id="comment" class="description">{$CAT_COMMENT}</textarea>
137  </p>
138
139{if isset($parent_category) }
140  <p>
141    <strong>{'Parent album'|@translate}</strong>
142    <br>
143    <select data-selectize="categories" data-value="{$parent_category|@json_encode|escape:html}"
144        name="parent" style="width:400px"></select>
145  </p>
146{/if}
147
148  <p>
149    <strong>{'Lock'|@translate}</strong>
150    <br>
151                {html_radios name='visible' values=['true','false'] output=['No'|translate,'Yes'|translate] selected=$CAT_VISIBLE}
152  </p>
153
154  {if isset($CAT_COMMENTABLE)}
155  <p>
156    <strong>{'Comments'|@translate}</strong>
157    <br>
158                {html_radios name='commentable' values=['false','true'] output=['No'|translate,'Yes'|translate] selected=$CAT_COMMENTABLE}
159  </p>
160  {/if}
161
162  <p style="margin:0">
163    <input class="submit" type="submit" value="{'Save Settings'|@translate}" name="submit">
164  </p>
165</fieldset>
166
167</form>
Note: See TracBrowser for help on using the repository browser.