From b70f7bf79740b859bdb1159233cd9685313b7f7b Mon Sep 17 00:00:00 2001 From: phasefx Date: Thu, 3 Aug 2006 17:40:40 +0000 Subject: [PATCH] group groups for offline mode git-svn-id: svn://svn.open-ils.org/ILS/trunk@5249 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- .../staff_client/chrome/content/OpenILS/data.js | 9 ++++++++ .../staff_client/chrome/content/main/constants.js | 2 +- .../server/main/gen_offline_widgets.xul | 27 +++++++++++++++++++++- 3 files changed, 36 insertions(+), 2 deletions(-) diff --git a/Open-ILS/xul/staff_client/chrome/content/OpenILS/data.js b/Open-ILS/xul/staff_client/chrome/content/OpenILS/data.js index a75db24ad4..db3ee8bd38 100644 --- a/Open-ILS/xul/staff_client/chrome/content/OpenILS/data.js +++ b/Open-ILS/xul/staff_client/chrome/content/OpenILS/data.js @@ -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( diff --git a/Open-ILS/xul/staff_client/chrome/content/main/constants.js b/Open-ILS/xul/staff_client/chrome/content/main/constants.js index 25ea825989..cbe078698a 100644 --- a/Open-ILS/xul/staff_client/chrome/content/main/constants.js +++ b/Open-ILS/xul/staff_client/chrome/content/main/constants.js @@ -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' }, diff --git a/Open-ILS/xul/staff_client/server/main/gen_offline_widgets.xul b/Open-ILS/xul/staff_client/server/main/gen_offline_widgets.xul index 2f06e86084..b23e66d835 100644 --- a/Open-ILS/xul/staff_client/server/main/gen_offline_widgets.xul +++ b/Open-ILS/xul/staff_client/server/main/gen_offline_widgets.xul @@ -111,9 +111,34 @@ } 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() -- 2.11.0