Changeset 25818


Ignore:
Timestamp:
Dec 7, 2013, 8:40:29 PM (7 years ago)
Author:
mistic100
Message:

better control over session cache for multiview data

Location:
extensions/AdminTools
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • extensions/AdminTools/include/MultiView.class.php

    r25817 r25818  
    214214 
    215215  /**
     216   * Mark browser session cache for deletion
     217   */
     218  public static function invalidate_cache()
     219  {
     220    global $conf;
     221    conf_update_param('multiview_invalidate_cache', true);
     222    $conf['multiview_invalidate_cache'] = true;
     223  }
     224 
     225  /**
    216226   * Register custom API methods
    217227   */
     
    268278    }
    269279   
     280    conf_delete_param('multiview_invalidate_cache');
     281   
    270282    return $out;
    271283  }
  • extensions/AdminTools/include/events.inc.php

    r25817 r25818  
    2424    'CURRENT_USERNAME' => $user['id']==$conf['guest_id'] ? l10n('guest') : $user['username'],
    2525    'PWG_TOKEN' =>        get_pwg_token(),
     26    'DELETE_CACHE' =>     isset($conf['multiview_invalidate_cache']),
    2627    );
    2728
  • extensions/AdminTools/main.inc.php

    r25817 r25818  
    3636
    3737add_event_handler('ws_add_methods', array('MultiView', 'register_ws'));
     38add_event_handler('delete_user', array('MultiView', 'invalidate_cache'));
     39add_event_handler('register_user', array('MultiView', 'invalidate_cache'));
    3840
    3941
  • extensions/AdminTools/template/public_controller.js

    r25817 r25818  
    8080  }
    8181
     82  // delete session cache
     83  this.deleteCache = function() {
     84    if ('sessionStorage' in window) {
     85      window.sessionStorage.removeItem('multiView');
     86    }
     87  };
     88
    8289  // move close button to smartpocket toolbar
    8390  this.initMobile = function() {
  • extensions/AdminTools/template/public_controller.tpl

    r25817 r25818  
    3434AdminTools.urlWS = '{$ROOT_URL}ws.php?format=json&method=';
    3535AdminTools.multiView = {
    36   'view_as': "{$ato.MULTIVIEW.view_as}",
    37   'theme': "{$ato.MULTIVIEW.theme}",
    38   'lang': "{$ato.MULTIVIEW.lang}"
     36  view_as: {$ato.MULTIVIEW.view_as},
     37  theme: '{$ato.MULTIVIEW.theme}',
     38  lang: '{$ato.MULTIVIEW.lang}'
    3939};
    4040
    41 AdminTools.init();
     41{if $ato.DELETE_CACHE}
     42  AdminTools.deleteCache();
     43{/if}
     44  AdminTools.init();
    4245{if $themeconf.mobile}
    4346  AdminTools.initMobile();
     
    5154{if isset($ato.QUICK_EDIT)}
    5255  AdminTools.initQuickEdit({intval(isset($ato.IS_PICTURE))}, {
    53     hintText: '{'Type in a search term'|@translate}',
    54     noResultsText: '{'No results'|@translate}',
    55     searchingText: '{'Searching...'|@translate}',
    56     newText: ' ({'new'|@translate})'
     56    hintText: '{'Type in a search term'|translate|escape:javascript}',
     57    noResultsText: '{'No results'|translate|escape:javascript}',
     58    searchingText: '{'Searching...'|translate|escape:javascript}',
     59    newText: ' ({'new'|translate|escape:javascript})'
    5760  });
    5861{/if}
Note: See TracChangeset for help on using the changeset viewer.