[open-ils-commits] r9402 - trunk/Open-ILS/web/js/dojo/openils

svn at svn.open-ils.org svn at svn.open-ils.org
Mon Apr 21 14:15:37 EDT 2008


Author: erickson
Date: 2008-04-21 13:36:38 -0400 (Mon, 21 Apr 2008)
New Revision: 9402

Modified:
   trunk/Open-ILS/web/js/dojo/openils/User.js
Log:
added function to flesh out an OrgUnitFilteringSelect based on user perm orgs

Modified: trunk/Open-ILS/web/js/dojo/openils/User.js
===================================================================
--- trunk/Open-ILS/web/js/dojo/openils/User.js	2008-04-21 17:32:00 UTC (rev 9401)
+++ trunk/Open-ILS/web/js/dojo/openils/User.js	2008-04-21 17:36:38 UTC (rev 9402)
@@ -137,13 +137,37 @@
 
         fieldmapper.standardRequest(
             ['open-ils.actor', 'open-ils.actor.user.work_perm.org_unit_list'],
-            {
-                params: [openils.User.authtoken, perm],
+            {   params: [openils.User.authtoken, perm],
                 oncomplete: buildTreePicker,
                 async: true
             }
         )
     }
+
+    /**
+     * Sets the store for an existing openils.widget.OrgUnitFilteringSelect 
+     * using the orgs where the user has the requested permission.
+     * @param perm The permission to check
+     * @param selector The pre-created dijit.form.FilteringSelect object.  
+     */
+    openils.User.buildPermOrgSelector = function(perm, selector) {
+
+        function buildTreePicker(r) {
+            var orgList = r.recv().content();
+            var store = new dojo.data.ItemFileReadStore({data:aou.toStoreData(orgList)});
+            selector.store = store;
+            selector.startup();
+            selector.setValue(openils.User.user.ws_ou());
+        }
+
+        fieldmapper.standardRequest(
+            ['open-ils.actor', 'open-ils.actor.user.work_perm.org_unit_list'],
+            {   params: [openils.User.authtoken, perm],
+                oncomplete: buildTreePicker,
+                async: true
+            }
+        )
+    }
 }
 
 



More information about the open-ils-commits mailing list