[open-ils-commits] r9390 - trunk/Open-ILS/web/js/dojo/openils
svn at svn.open-ils.org
svn at svn.open-ils.org
Sun Apr 20 09:41:21 EDT 2008
Author: erickson
Date: 2008-04-20 09:02:32 -0400 (Sun, 20 Apr 2008)
New Revision: 9390
Modified:
trunk/Open-ILS/web/js/dojo/openils/User.js
Log:
added a method to build a Tree based on perm orgs.
Modified: trunk/Open-ILS/web/js/dojo/openils/User.js
===================================================================
--- trunk/Open-ILS/web/js/dojo/openils/User.js 2008-04-20 03:26:38 UTC (rev 9389)
+++ trunk/Open-ILS/web/js/dojo/openils/User.js 2008-04-20 13:02:32 UTC (rev 9390)
@@ -19,7 +19,7 @@
dojo._hasResource["openils.User"] = true;
dojo.provide("openils.User");
dojo.require('openils.Event');
- dojo.require('DojoSRF');
+ dojo.require('fieldmapper.Fieldmapper');
dojo.declare('openils.User', null, {});
@@ -109,6 +109,41 @@
req.send();
}
+
+ /**
+ * Builds a dijit.Tree using the orgs where the user has the requested permission
+ * @param perm The permission to check
+ * @param domId The DOM node where the tree widget should live
+ * @param onClick If defined, this will be connected to the tree widget for
+ * onClick events
+ */
+ openils.User.buildPermOrgTreePicker = function(perm, domId, onClick) {
+
+ function buildTreePicker(r) {
+ var orgList = r.recv().content();
+ var store = new dojo.data.ItemFileReadStore({data:aou.toStoreData(orgList)});
+ var model = new dijit.tree.ForestStoreModel({
+ store: store,
+ query: {_top:'true'},
+ childrenAttrs: ["children"],
+ rootLabel : "Location" /* XXX i18n */
+ });
+
+ var tree = new dijit.Tree({model : model}, dojo.byId(domId));
+ if(onClick)
+ dojo.connect(tree, 'onClick', onClick);
+ tree.startup()
+ }
+
+ fieldmapper.standardRequest(
+ ['open-ils.actor', 'open-ils.actor.user.work_perm.org_unit_list'],
+ {
+ params: [openils.User.authtoken, 'ADMIN_FUNDING_SOURCE'],
+ oncomplete: buildTreePicker,
+ async: true
+ }
+ )
+ }
}
More information about the open-ils-commits
mailing list