From fe0d0beca8d488c107e9d3cdde813194875654c3 Mon Sep 17 00:00:00 2001 From: erickson Date: Tue, 23 Aug 2005 16:00:34 +0000 Subject: [PATCH] org tree now adds children and leaves parents as ID's git-svn-id: svn://svn.open-ils.org/ILS/trunk@1704 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- Open-ILS/web/opac/common/js/OrgTree.js | 13 +++++++------ Open-ILS/web/opac/common/js/opac_utils.js | 4 +++- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/Open-ILS/web/opac/common/js/OrgTree.js b/Open-ILS/web/opac/common/js/OrgTree.js index 0a51e0055f..a672baf73e 100644 --- a/Open-ILS/web/opac/common/js/OrgTree.js +++ b/Open-ILS/web/opac/common/js/OrgTree.js @@ -14,14 +14,13 @@ for (var i in orgArraySearcher) { if (x.parent_ou() == null || x.parent_ou() == '') { globalOrgTree = x; continue; - } else { - x.parent_ou(orgArraySearcher[x.parent_ou()]); - } - if (!x.parent_ou().children()) - x.parent_ou().children(new Array()); + } - x.parent_ou().children().push(x.id()); + var parent = findOrgUnit(x.parent_ou()); + if (!parent.children()) parent.children(new Array()); + parent.children().push(x); } + function _tree_killer () { for (var i in orgArraySearcher) { x=orgArraySearcher[i]; @@ -35,3 +34,5 @@ function _tree_killer () { } var globalOrgTypes = JSON2js("[/*--S aout--*/[null,null,null,null,0,0,0,1,\"Consortium\",\"Everywhere in PINES\"]/*--E aout--*/,/*--S aout--*/[null,null,null,null,0,0,1,2,\"System\",\"Local Library System\",1]/*--E aout--*/,/*--S aout--*/[null,null,null,null,1,1,2,3,\"Branch\",\"This Branch\",2]/*--E aout--*/,/*--S aout--*/[null,null,null,null,1,1,3,5,\"Bookmobile\",\"Your Bookmobile\",3]/*--E aout--*/,/*--S aout--*/[null,null,null,null,1,1,3,4,\"Sub-lib\",\"This Specialized Library\",3]/*--E aout--*/]"); + +alert(js2JSON(globalOrgTree)); diff --git a/Open-ILS/web/opac/common/js/opac_utils.js b/Open-ILS/web/opac/common/js/opac_utils.js index 9ca852c143..87d53ca087 100644 --- a/Open-ILS/web/opac/common/js/opac_utils.js +++ b/Open-ILS/web/opac/common/js/opac_utils.js @@ -169,6 +169,7 @@ function _appendParam( fieldVar, fieldName, overrideArgs, getFunc, string ) { } +/* function EX(message) { this.init(message); } EX.prototype.init = function(message) { this.message = message; } EX.prototype.toString = function() { return "\n *** Exception Occured \n" + this.message; } @@ -176,6 +177,7 @@ EXCommunication.prototype = new EX(); EXCommunication.prototype.constructor = EXCommunication; EXCommunication.baseClass = EX.prototype.constructor; function EXCommunication(message) { this.init("EXCommunication: " + message); } +*/ /* ----------------------------------------------------------------------- */ function cleanISBN(isbn) { @@ -361,7 +363,7 @@ function buildOrgSelector() { tree.add(node.id(), -1, node.name(), "javascript:orgSelect(" + node.id() + ");", node.name()); else { - tree.add(node.id(), node.parent_ou().id(), node.name(), + tree.add(node.id(), findOrgUnit(node.parent_ou()).id(), node.name(), "javascript:orgSelect(" + node.id() + ");", node.name()); } } -- 2.43.2