[open-ils-commits] r18806 - branches/rel_1_6/Open-ILS/web/opac/common/js (phasefx)
svn at svn.open-ils.org
svn at svn.open-ils.org
Fri Nov 19 11:34:31 EST 2010
Author: phasefx
Date: 2010-11-19 11:34:28 -0500 (Fri, 19 Nov 2010)
New Revision: 18806
Modified:
branches/rel_1_6/Open-ILS/web/opac/common/js/opac_utils.js
Log:
merge r18716 from rel_2_0 to cache this setting. Thanks to James Fournie for https://bugs.launchpad.net/evergreen/+bug/677311 We should probably do this as a cookie instead for even fewer network calls. I can't see the setting changing all that frequently
Modified: branches/rel_1_6/Open-ILS/web/opac/common/js/opac_utils.js
===================================================================
--- branches/rel_1_6/Open-ILS/web/opac/common/js/opac_utils.js 2010-11-19 16:08:06 UTC (rev 18805)
+++ branches/rel_1_6/Open-ILS/web/opac/common/js/opac_utils.js 2010-11-19 16:34:28 UTC (rev 18806)
@@ -796,17 +796,34 @@
//setTimeout( 'buildOrgSelector(G.ui.common.org_tree, orgTreeSelector);', 10 );
setTimeout( 'buildOrgSelector(G.ui.common.org_tree, orgTreeSelector);', 1 );
}
-
+
+var checkOrgHiding_cached = false;
+var checkOrgHiding_cached_context_org;
+var checkOrgHiding_cached_depth;
function checkOrgHiding() {
- var context_org = getOrigLocation() || globalOrgTree.id();
- var depth = fetchOrgSettingDefault( context_org, 'opac.org_unit_hiding.depth');
- if (isXUL()) {
- return false; // disable org hiding for staff client
- }
- if ( findOrgDepth( context_org ) < depth ) {
- return false; // disable org hiding if Original Location doesn't make sense with setting depth (avoids disjointed org selectors)
- }
- return { 'org' : findOrgUnit(context_org), 'depth' : depth };
+ if (isXUL()) {
+ return false; // disable org hiding for staff client
+ }
+ var context_org = getOrigLocation() || globalOrgTree.id();
+ var depth;
+ if (checkOrgHiding_cached) {
+ if (checkOrgHiding_cached_context_org != context_org) {
+ checkOrgHiding_cached_context_org = context_org;
+ checkOrgHiding_cached_depth = undefined;
+ checkOrgHiding_cached = false;
+ } else {
+ depth = checkOrgHiding_cached_depth;
+ }
+ } else {
+ depth = fetchOrgSettingDefault( context_org, 'opac.org_unit_hiding.depth');
+ checkOrgHiding_cached_depth = depth;
+ checkOrgHiding_cached_context_org = context_org;
+ checkOrgHiding_cached = true;
+ }
+ if ( findOrgDepth( context_org ) < depth ) {
+ return false; // disable org hiding if Original Location doesn't make sense with setting depth (avoids disjointed org selectors)
+ }
+ return { 'org' : findOrgUnit(context_org), 'depth' : depth };
}
var orgTreeSelector;
More information about the open-ils-commits
mailing list