[open-ils-commits] r11339 - in trunk/Open-ILS/web/js: dojo/openils ui/default/conify/global/permission
svn at svn.open-ils.org
svn at svn.open-ils.org
Tue Nov 25 10:47:22 EST 2008
Author: erickson
Date: 2008-11-25 10:47:19 -0500 (Tue, 25 Nov 2008)
New Revision: 11339
Added:
trunk/Open-ILS/web/js/dojo/openils/PermGrp.js
Modified:
trunk/Open-ILS/web/js/ui/default/conify/global/permission/grp_penalty_threshold.js
Log:
created general perm group object and using that in the perm filtering select
Added: trunk/Open-ILS/web/js/dojo/openils/PermGrp.js
===================================================================
--- trunk/Open-ILS/web/js/dojo/openils/PermGrp.js (rev 0)
+++ trunk/Open-ILS/web/js/dojo/openils/PermGrp.js 2008-11-25 15:47:19 UTC (rev 11339)
@@ -0,0 +1,34 @@
+if(!dojo._hasResource["openils.PermGrp"]){
+ dojo.provide("openils.PermGrp");
+ dojo.require('openils.Util');
+
+ dojo.declare( "openils.PermGrp", null, {});
+
+ openils.PermGrp.groupTree = null;
+ openils.PermGrp.groupIdMap = {};
+
+ openils.PermGrp.fetchGroupTree = function(onload) {
+ if(openils.PermGrp.groupTree)
+ return onload();
+ fieldmapper.standardRequest(
+ ['open-ils.actor', 'open-ils.actor.groups.tree.retrieve'],
+ { async: true,
+ oncomplete: function(r) {
+ openils.PermGrp.groupTree = openils.Util.readResponse(r);
+ onload();
+ }
+ }
+ );
+ };
+
+ /**
+ * Flatten the group tree into a id => object map for easy access
+ */
+ openils.PermGrp.flatten = function(node) {
+ if(!node) node =
+ openils.PermGrp.groupTree;
+ openils.PermGrp.groupIdMap[node.id()] = node;
+ for(var idx in node.children())
+ openils.PermGrp.flatten(node.children()[idx]);
+ };
+}
Modified: trunk/Open-ILS/web/js/ui/default/conify/global/permission/grp_penalty_threshold.js
===================================================================
--- trunk/Open-ILS/web/js/ui/default/conify/global/permission/grp_penalty_threshold.js 2008-11-25 15:43:56 UTC (rev 11338)
+++ trunk/Open-ILS/web/js/ui/default/conify/global/permission/grp_penalty_threshold.js 2008-11-25 15:47:19 UTC (rev 11339)
@@ -2,6 +2,7 @@
dojo.require('dojo.data.ItemFileReadStore');
dojo.require('dijit.form.NumberTextBox');
dojo.require('dijit.form.FilteringSelect');
+dojo.require('openils.PermGrp');
dojo.require('openils.widget.OrgUnitFilteringSelect');
dojo.require('openils.widget.PermGrpFilteringSelect');
@@ -23,9 +24,9 @@
},
buildGrid : function() {
- GPT.grpSelector.fetchGroups(
+ openils.PermGrp.fetchGroupTree(
function() {
- GPT.grpSelector.flatten();
+ openils.PermGrp.flatten();
fieldmapper.standardRequest(
['open-ils.permacrud', 'open-ils.permacrud.search.pgpt.atomic'],
{ async: true,
@@ -63,7 +64,7 @@
getGroupName : function(rowIdx, item) {
if(!item) return '';
var grpId = this.grid.store.getValue(item, this.field);
- return GPT.grpSelector.groupMap[grpId].name();
+ return openils.PermGrp.groupIdMap[grpId].name();
},
_loadCspComplete : function(r) {
More information about the open-ils-commits
mailing list