aboutsummaryrefslogtreecommitdiffstats
path: root/admin/themes/default/template/picture_modify.tpl
diff options
context:
space:
mode:
authormistic100 <mistic@piwigo.org>2014-05-24 14:18:04 +0000
committermistic100 <mistic@piwigo.org>2014-05-24 14:18:04 +0000
commitfea2a4efd1ad085def7cf84cc444325d0815b62e (patch)
tree892dcb971d34efd7cbff6c31375448a09dfbe73b /admin/themes/default/template/picture_modify.tpl
parent59f418f7986594895a2352e8895250069cff336a (diff)
feature 3077 : improve cache invalidation
- add "lastmodified" automatic field for categories, groups, users, tags and images tables - provide a "server key" to the client cache manager git-svn-id: http://piwigo.org/svn/trunk@28532 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to '')
-rw-r--r--admin/themes/default/template/picture_modify.tpl49
1 files changed, 27 insertions, 22 deletions
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) {