[open-ils-commits] r9684 - trunk/Open-ILS/web/js/dojo/fieldmapper
svn at svn.open-ils.org
svn at svn.open-ils.org
Thu May 22 22:20:43 EDT 2008
Author: miker
Date: 2008-05-22 22:20:41 -0400 (Thu, 22 May 2008)
New Revision: 9684
Modified:
trunk/Open-ILS/web/js/dojo/fieldmapper/OrgUtils.js
trunk/Open-ILS/web/js/dojo/fieldmapper/dojoData.js
Log:
Stop being Dan's problem
Modified: trunk/Open-ILS/web/js/dojo/fieldmapper/OrgUtils.js
===================================================================
--- trunk/Open-ILS/web/js/dojo/fieldmapper/OrgUtils.js 2008-05-23 02:18:07 UTC (rev 9683)
+++ trunk/Open-ILS/web/js/dojo/fieldmapper/OrgUtils.js 2008-05-23 02:20:41 UTC (rev 9684)
@@ -24,6 +24,7 @@
dojo.require("fieldmapper.OrgTree", true);
dojo.require("fieldmapper.OrgLasso", true);
+ fieldmapper.aou.slim_ok = true;
fieldmapper.aou.globalOrgTree = {};
fieldmapper.aou.OrgCache = {};
fieldmapper.aou.OrgCacheSN = {};
@@ -45,12 +46,14 @@
}
fieldmapper.aou.LoadOrg = function (id, slim_ok) {
+ if (slim_ok == null) slim_ok = fieldmapper.aou.slim_ok;
var slim_o = fieldmapper.aou.OrgCache[id];
if (slim_o && (slim_ok || slim_o.loaded))
return fieldmapper.aou.OrgCache[id].org;
var o = fieldmapper.standardRequest(['open-ils.actor','open-ils.actor.org_unit.retrieve'],[null,id]);
+ o.children = fieldmapper.aou.OrgCache[o.id()].children;
fieldmapper.aou.OrgCache[o.id()] = { loaded : true, org : o };
return o;
}
@@ -126,21 +129,25 @@
return null;
}
- fieldmapper.aou.findOrgUnitSN = function (sn) {
+ fieldmapper.aou.findOrgUnitSN = function (sn, slim_ok) {
+ if (slim_ok == null) slim_ok = fieldmapper.aou.slim_ok;
var org = fieldmapper.aou.OrgCacheSN[sn];
if (!org) {
for (var i in fieldmapper.aou.OrgCache) {
var o = fieldmapper.aou.OrgCache[i];
- if (o.loaded && o.org.shortname() == sn) {
+ if (o.org.shortname() == sn) {
fieldmapper.aou.OrgCacheSN[o.org.shortname()] = o;
- return o.org;
+ org = o;
}
}
- org = fieldmapper.standardRequest(fieldmapper.OpenSRF.methods.FETCH_ORG_BY_SHORTNAME, sn);
+ if (!slim_ok && !fieldmapper.aou.OrgCache[org.id()].loaded) {
+ org = fieldmapper.standardRequest(fieldmapper.OpenSRF.methods.FETCH_ORG_BY_SHORTNAME, sn);
- fieldmapper.aou.OrgCache[org.id()] = { loaded : true, org : org };
- fieldmapper.aou.OrgCacheSN[org.shortname()] = { loaded : true, org : org };
+ org.children = fieldmapper.aou.OrgCache[org.id()].children;
+ fieldmapper.aou.OrgCache[org.id()] = { loaded : true, org : org };
+ fieldmapper.aou.OrgCacheSN[org.shortname()] = { loaded : true, org : org };
+ }
}
Modified: trunk/Open-ILS/web/js/dojo/fieldmapper/dojoData.js
===================================================================
--- trunk/Open-ILS/web/js/dojo/fieldmapper/dojoData.js 2008-05-23 02:18:07 UTC (rev 9683)
+++ trunk/Open-ILS/web/js/dojo/fieldmapper/dojoData.js 2008-05-23 02:20:41 UTC (rev 9684)
@@ -42,7 +42,7 @@
if (!list) list = {};
// a sane default
- if (!params.identifier) params.identifier = fieldmapper[this.classname].Identifier;
+ if (!params.identifier) params.identifier = this.Identifier;
if (!label) label = params.label;
if (!label) label = params.identifier;
@@ -96,17 +96,17 @@
fieldmapper.aou.toStoreData = function (list, label) {
if (!label) label = 'shortname';
- return _toStoreData(list, label, { 'parent' : 'parent_ou', 'children' : 'children' });
+ return _toStoreData.call(this, list, label, { 'parent' : 'parent_ou', 'children' : 'children' });
}
fieldmapper.aout.toStoreData = function (list, label) {
if (!label) label = 'name';
- return _toStoreData(list, label, { 'parent' : 'parent', 'children' : 'children' });
+ return _toStoreData.call(this, list, label, { 'parent' : 'parent', 'children' : 'children' });
}
fieldmapper.pgt.toStoreData = function (list, label) {
if (!label) label = 'name';
- return _toStoreData(list, label, { 'parent' : 'parent', 'children' : 'children' });
+ return _toStoreData.call(this, list, label, { 'parent' : 'parent', 'children' : 'children' });
}
/*
More information about the open-ils-commits
mailing list