group groups for offline mode
authorphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 3 Aug 2006 17:40:40 +0000 (17:40 +0000)
committerphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 3 Aug 2006 17:40:40 +0000 (17:40 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@5249 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/xul/staff_client/chrome/content/OpenILS/data.js
Open-ILS/xul/staff_client/chrome/content/main/constants.js
Open-ILS/xul/staff_client/server/main/gen_offline_widgets.xul

index a75db24..db3ee8b 100644 (file)
@@ -390,6 +390,15 @@ OpenILS.data.prototype = {
                        }
                );
 
+               // The previous pgt call returned a tree, not a list or hash.
+               this.chain.push(
+                       function () {
+                               obj.tree.pgt = obj.list.pgt;
+                               obj.list.pgt = util.fm_utils.flatten_ou_branch( obj.tree.pgt );
+                               obj.hash.pgt = util.functional.convert_object_list_to_hash( obj.list.pgt );
+                       }
+               );
+
                // Do this after we get the user object
                this.chain.push(
 
index 25ea825..cbe0786 100644 (file)
@@ -106,7 +106,7 @@ const api = {
        'FM_MOBTS_OPEN' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.transactions' },
        'FM_MOBTS_TOTAL_OPEN' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.transactions.total' },
        'FM_MOBTS_COUNT_OPEN' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.transactions.count' },
-       'FM_PGT_RETRIEVE' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.groups.retrieve' },
+       'FM_PGT_RETRIEVE' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.groups.tree.retrieve' },
        'MARC_HTML_RETRIEVE' : { 'app' : 'open-ils.search', 'method' : 'open-ils.search.biblio.record.html' },
        'FM_BLOB_RETRIEVE_VIA_Z3950_SEARCH' : { 'app' : 'open-ils.search', 'method' : 'open-ils.search.z3950.search_class' },
        'FM_BLOB_RETRIEVE_VIA_Z3950_RAW_SEARCH' : { 'app' : 'open-ils.search', 'method' : 'open-ils.search.z3950.search_service' },
index 2f06e86..b23e66d 100644 (file)
                }
 
                function build_pgt_list() {
+                       var list = []; var added = {};
+
+                       function walk(n) {
+                               if (
+                                       (n.application_perm() == 'group_application.user.patron') ||
+                                       (n.application_perm() == null) ||
+                                       (n.application_perm() == '')
+                               ) {
+                                       if (typeof added[n.id()] == 'undefined') {
+                                               list.push(n); added[n.id()] = true;
+                                               var children = n.children();
+                                               if (children) for (var i = 0; i < children.length; i++) {
+                                                       walk(children[i]);
+                                               }
+                                       }
+                               } else if (n.parent() == null) {
+                                       var children = n.children();
+                                       if (children) for (var i = 0; i < children.length; i++) {
+                                               walk(children[i]);
+                                       }
+                               }
+                       }
+
+                       walk(g.data.tree.pgt);
+
                        return [
                                util.functional.map_list( 
-                                       g.data.list.pgt,
+                                       list,
                                        function(obj) { return [ 
                                                obj.description() ? obj.name() + ' : ' + obj.description() : obj.name(), 
                                                obj.id()