Ignore:
Timestamp:
May 24, 2014, 4:18:04 PM (10 years ago)
Author:
mistic100
Message:

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
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/admin/themes/default/template/cat_perm.tpl

    r28496 r28532  
    77(function(){
    88{* <!-- GROUPS --> *}
    9 var groupsCache = new LocalStorageCache('groupsAdminList', 5*60, function(callback) {
    10   jQuery.getJSON('{$ROOT_URL}ws.php?format=json&method=pwg.groups.getList&per_page=99999', function(data) {
    11     callback(data.result.groups);
    12   });
     9var groupsCache = new LocalStorageCache({
     10  key: 'groupsAdminList',
     11  serverKey: '{$CACHE_KEYS.groups}',
     12  serverId: '{$CACHE_KEYS._hash}',
     13
     14  loader: function(callback) {
     15    jQuery.getJSON('{$ROOT_URL}ws.php?format=json&method=pwg.groups.getList&per_page=99999', function(data) {
     16      callback(data.result.groups);
     17    });
     18  }
    1319});
    1420
     
    3339
    3440{* <!-- USERS --> *}
    35 var usersCache = new LocalStorageCache('usersAdminList', 5*60, function(callback) {
    36   var page = 0,
    37       users = [];
    38    
    39   (function load(page){
    40     jQuery.getJSON('{$ROOT_URL}ws.php?format=json&method=pwg.users.getList&display=username&per_page=99999&page='+ page, function(data) {
    41       users = users.concat(data.result.users);
    42      
    43       if (data.result.paging.count == data.result.paging.per_page) {
    44         load(++page);
    45       }
    46       else {
    47         callback(users);
    48       }
    49     });
    50   }(page));
     41var usersCache = new LocalStorageCache({
     42  key: 'usersAdminList',
     43  serverKey: '{$CACHE_KEYS.users}',
     44  serverId: '{$CACHE_KEYS._hash}',
     45
     46  loader: function(callback) {
     47    var users = [];
     48   
     49    // recursive loader
     50    (function load(page){
     51      jQuery.getJSON('{$ROOT_URL}ws.php?format=json&method=pwg.users.getList&display=username&per_page=99999&page='+ page, function(data) {
     52        users = users.concat(data.result.users);
     53       
     54        if (data.result.paging.count == data.result.paging.per_page) {
     55          load(++page);
     56        }
     57        else {
     58          callback(users);
     59        }
     60      });
     61    }(0));
     62  }
    5163});
    5264
     
    6981  });
    7082});
     83
     84{* <!-- TOGGLES --> *}
     85function checkStatusOptions() {
     86  if (jQuery("input[name=status]:checked").val() == "private") {
     87    jQuery("#privateOptions, #applytoSubAction").show();
     88  }
     89  else {
     90    jQuery("#privateOptions, #applytoSubAction").hide();
     91  }
     92}
     93
     94checkStatusOptions();
     95jQuery("#selectStatus").change(function() {
     96  checkStatusOptions();
     97});
     98
     99{if isset($nb_users_granted_indirect) && $nb_users_granted_indirect>0}
     100  jQuery(".toggle-indirectPermissions").click(function(e){
     101    jQuery(".toggle-indirectPermissions").toggle();
     102    jQuery("#indirectPermissionsDetails").toggle();
     103    e.preventDefault();
     104  });
     105{/if}
    71106}());
    72107{/footer_script}
     
    112147  <p>
    113148    {'%u users have automatic permission because they belong to a granted group.'|@translate:$nb_users_granted_indirect}
    114     <a href="#" id="indirectPermissionsDetailsHide" style="display:none">{'hide details'|@translate}</a>
    115     <a href="#" id="indirectPermissionsDetailsShow">{'show details'|@translate}</a>
     149    <a href="#" class="toggle-indirectPermissions" style="display:none">{'hide details'|@translate}</a>
     150    <a href="#" class="toggle-indirectPermissions">{'show details'|@translate}</a>
    116151
    117152    <ul id="indirectPermissionsDetails" style="display:none">
     
    185220  <p style="margin:12px;text-align:left;">
    186221    <input class="submit" type="submit" value="{'Save Settings'|@translate}" name="submit">
    187     <label id="applytoSubAction" style="display:none;"><input type="checkbox" name="apply_on_sub" {if $INHERIT}checked="checked"{/if}>{'Apply to sub-albums'|@translate}</label>
     222    <label id="applytoSubAction" style="display:none;">
     223      <input type="checkbox" name="apply_on_sub" {if $INHERIT}checked="checked"{/if}>
     224      {'Apply to sub-albums'|@translate}
     225    </label>
    188226  </p>
    189227
Note: See TracChangeset for help on using the changeset viewer.