diff options
Diffstat (limited to '')
-rw-r--r-- | admin/themes/default/template/batch_manager_global.tpl | 35 | ||||
-rw-r--r-- | admin/themes/default/template/batch_manager_unit.tpl | 35 | ||||
-rw-r--r-- | admin/themes/default/template/cat_perm.tpl | 84 | ||||
-rw-r--r-- | admin/themes/default/template/picture_modify.tpl | 49 |
4 files changed, 122 insertions, 81 deletions
diff --git a/admin/themes/default/template/batch_manager_global.tpl b/admin/themes/default/template/batch_manager_global.tpl index 3e22edb02..087f9916a 100644 --- a/admin/themes/default/template/batch_manager_global.tpl +++ b/admin/themes/default/template/batch_manager_global.tpl @@ -68,16 +68,22 @@ jQuery(document).ready(function() {ldelim} jQuery("a.preview-box").colorbox(); {* <!-- TAGS --> *} - var tagsCache = new LocalStorageCache('tagsAdminList', 5*60, function(callback) { - jQuery.getJSON('{$ROOT_URL}ws.php?format=json&method=pwg.tags.getAdminList', function(data) { - var tags = data.result.tags; - - for (var i=0, l=tags.length; i<l; i++) { - tags[i].id = '~~' + tags[i].id + '~~'; - } - - callback(tags); - }); + var tagsCache = new LocalStorageCache({ + key: 'tagsAdminList', + serverKey: '{$CACHE_KEYS.tags}', + serverId: '{$CACHE_KEYS._hash}', + + loader: function(callback) { + jQuery.getJSON('{$ROOT_URL}ws.php?format=json&method=pwg.tags.getAdminList', function(data) { + var tags = data.result.tags; + + for (var i=0, l=tags.length; i<l; i++) { + tags[i].id = '~~' + tags[i].id + '~~'; + } + + callback(tags); + }); + } }); jQuery('[data-selectize=tags]').selectize({ @@ -92,14 +98,7 @@ jQuery(document).ready(function() {ldelim} labelField: 'name', searchField: ['name'], plugins: ['remove_button'], - create: function(input, callback) { - tagsCache.clear(); - - callback({ - id: input, - name: input - }); - } + create: true }); tagsCache.get(function(tags) { diff --git a/admin/themes/default/template/batch_manager_unit.tpl b/admin/themes/default/template/batch_manager_unit.tpl index d0d06e11d..6d5a90ddd 100644 --- a/admin/themes/default/template/batch_manager_unit.tpl +++ b/admin/themes/default/template/batch_manager_unit.tpl @@ -10,16 +10,22 @@ {footer_script} (function(){ {* <!-- TAGS --> *} -var tagsCache = new LocalStorageCache('tagsAdminList', 5*60, function(callback) { - jQuery.getJSON('{$ROOT_URL}ws.php?format=json&method=pwg.tags.getAdminList', function(data) { - var tags = data.result.tags; - - for (var i=0, l=tags.length; i<l; i++) { - tags[i].id = '~~' + tags[i].id + '~~'; - } - - callback(tags); - }); +var tagsCache = new LocalStorageCache({ + key: 'tagsAdminList', + serverKey: '{$CACHE_KEYS.tags}', + serverId: '{$CACHE_KEYS._hash}', + + loader: function(callback) { + jQuery.getJSON('{$ROOT_URL}ws.php?format=json&method=pwg.tags.getAdminList', function(data) { + var tags = data.result.tags; + + for (var i=0, l=tags.length; i<l; i++) { + tags[i].id = '~~' + tags[i].id + '~~'; + } + + callback(tags); + }); + } }); jQuery('[data-selectize=tags]').selectize({ @@ -27,14 +33,7 @@ jQuery('[data-selectize=tags]').selectize({ labelField: 'name', searchField: ['name'], plugins: ['remove_button'], - create: function(input, callback) { - tagsCache.clear(); - - callback({ - id: input, - name: input - }); - } + create: true }); tagsCache.get(function(tags) { diff --git a/admin/themes/default/template/cat_perm.tpl b/admin/themes/default/template/cat_perm.tpl index ba0813014..d810475b2 100644 --- a/admin/themes/default/template/cat_perm.tpl +++ b/admin/themes/default/template/cat_perm.tpl @@ -6,10 +6,16 @@ {footer_script} (function(){ {* <!-- GROUPS --> *} -var groupsCache = new LocalStorageCache('groupsAdminList', 5*60, function(callback) { - jQuery.getJSON('{$ROOT_URL}ws.php?format=json&method=pwg.groups.getList&per_page=99999', function(data) { - callback(data.result.groups); - }); +var groupsCache = new LocalStorageCache({ + key: 'groupsAdminList', + serverKey: '{$CACHE_KEYS.groups}', + serverId: '{$CACHE_KEYS._hash}', + + loader: function(callback) { + jQuery.getJSON('{$ROOT_URL}ws.php?format=json&method=pwg.groups.getList&per_page=99999', function(data) { + callback(data.result.groups); + }); + } }); jQuery('[data-selectize=groups]').selectize({ @@ -32,22 +38,28 @@ groupsCache.get(function(groups) { }); {* <!-- USERS --> *} -var usersCache = new LocalStorageCache('usersAdminList', 5*60, function(callback) { - var page = 0, - users = []; - - (function load(page){ - jQuery.getJSON('{$ROOT_URL}ws.php?format=json&method=pwg.users.getList&display=username&per_page=99999&page='+ page, function(data) { - users = users.concat(data.result.users); - - if (data.result.paging.count == data.result.paging.per_page) { - load(++page); - } - else { - callback(users); - } - }); - }(page)); +var usersCache = new LocalStorageCache({ + key: 'usersAdminList', + serverKey: '{$CACHE_KEYS.users}', + serverId: '{$CACHE_KEYS._hash}', + + loader: function(callback) { + var users = []; + + // recursive loader + (function load(page){ + jQuery.getJSON('{$ROOT_URL}ws.php?format=json&method=pwg.users.getList&display=username&per_page=99999&page='+ page, function(data) { + users = users.concat(data.result.users); + + if (data.result.paging.count == data.result.paging.per_page) { + load(++page); + } + else { + callback(users); + } + }); + }(0)); + } }); jQuery('[data-selectize=users]').selectize({ @@ -68,6 +80,29 @@ usersCache.get(function(users) { }, this)); }); }); + +{* <!-- TOGGLES --> *} +function checkStatusOptions() { + if (jQuery("input[name=status]:checked").val() == "private") { + jQuery("#privateOptions, #applytoSubAction").show(); + } + else { + jQuery("#privateOptions, #applytoSubAction").hide(); + } +} + +checkStatusOptions(); +jQuery("#selectStatus").change(function() { + checkStatusOptions(); +}); + +{if isset($nb_users_granted_indirect) && $nb_users_granted_indirect>0} + jQuery(".toggle-indirectPermissions").click(function(e){ + jQuery(".toggle-indirectPermissions").toggle(); + jQuery("#indirectPermissionsDetails").toggle(); + e.preventDefault(); + }); +{/if} }()); {/footer_script} @@ -111,8 +146,8 @@ usersCache.get(function(users) { {if isset($nb_users_granted_indirect) && $nb_users_granted_indirect>0} <p> {'%u users have automatic permission because they belong to a granted group.'|@translate:$nb_users_granted_indirect} - <a href="#" id="indirectPermissionsDetailsHide" style="display:none">{'hide details'|@translate}</a> - <a href="#" id="indirectPermissionsDetailsShow">{'show details'|@translate}</a> + <a href="#" class="toggle-indirectPermissions" style="display:none">{'hide details'|@translate}</a> + <a href="#" class="toggle-indirectPermissions">{'show details'|@translate}</a> <ul id="indirectPermissionsDetails" style="display:none"> {foreach from=$user_granted_indirect_groups item=group_details} @@ -184,7 +219,10 @@ usersCache.get(function(users) { <p style="margin:12px;text-align:left;"> <input class="submit" type="submit" value="{'Save Settings'|@translate}" name="submit"> - <label id="applytoSubAction" style="display:none;"><input type="checkbox" name="apply_on_sub" {if $INHERIT}checked="checked"{/if}>{'Apply to sub-albums'|@translate}</label> + <label id="applytoSubAction" style="display:none;"> + <input type="checkbox" name="apply_on_sub" {if $INHERIT}checked="checked"{/if}> + {'Apply to sub-albums'|@translate} + </label> </p> <input type="hidden" name="pwg_token" value="{$PWG_TOKEN}"> diff --git a/admin/themes/default/template/picture_modify.tpl b/admin/themes/default/template/picture_modify.tpl index f48a152d6..602b9b126 100644 --- a/admin/themes/default/template/picture_modify.tpl +++ b/admin/themes/default/template/picture_modify.tpl @@ -10,10 +10,16 @@ {footer_script} (function(){ {* <!-- CATEGORIES --> *} -var categoriesCache = new LocalStorageCache('categoriesAdminList', 5*60, function(callback) { - jQuery.getJSON('{$ROOT_URL}ws.php?format=json&method=pwg.categories.getAdminList', function(data) { - callback(data.result.categories); - }); +var categoriesCache = new LocalStorageCache({ + key: 'categoriesAdminList', + serverKey: '{$CACHE_KEYS.categories}', + serverId: '{$CACHE_KEYS._hash}', + + loader: function(callback) { + jQuery.getJSON('{$ROOT_URL}ws.php?format=json&method=pwg.categories.getAdminList', function(data) { + callback(data.result.categories); + }); + } }); jQuery('[data-selectize=categories]').selectize({ @@ -36,16 +42,22 @@ categoriesCache.get(function(categories) { }); {* <!-- TAGS --> *} -var tagsCache = new LocalStorageCache('tagsAdminList', 5*60, function(callback) { - jQuery.getJSON('{$ROOT_URL}ws.php?format=json&method=pwg.tags.getAdminList', function(data) { - var tags = data.result.tags; - - for (var i=0, l=tags.length; i<l; i++) { - tags[i].id = '~~' + tags[i].id + '~~'; - } - - callback(tags); - }); +var tagsCache = new LocalStorageCache({ + key: 'tagsAdminList', + serverKey: '{$CACHE_KEYS.tags}', + serverId: '{$CACHE_KEYS._hash}', + + loader: function(callback) { + jQuery.getJSON('{$ROOT_URL}ws.php?format=json&method=pwg.tags.getAdminList', function(data) { + var tags = data.result.tags; + + for (var i=0, l=tags.length; i<l; i++) { + tags[i].id = '~~' + tags[i].id + '~~'; + } + + callback(tags); + }); + } }); jQuery('[data-selectize=tags]').selectize({ @@ -53,14 +65,7 @@ jQuery('[data-selectize=tags]').selectize({ labelField: 'name', searchField: ['name'], plugins: ['remove_button'], - create: function(input, callback) { - tagsCache.clear(); - - callback({ - id: input, - name: input - }); - } + create: true }); tagsCache.get(function(tags) { |