3 function findOrgDepth(type_id) {
5 if(type_id == null || globalOrgTypes == null)
8 var t = findOrgType(type_id);
14 function findOrgType(type_id) {
16 if(type_id == null || globalOrgTypes == null)
19 if(typeof type_id == 'object')
22 for(var type in globalOrgTypes) {
23 var t =globalOrgTypes[type];
24 if( t.id() == type_id )
31 /* locates a specific org unit */
32 function findOrgUnit(org_id, branch) {
33 if(org_id == null) return null;
34 if(globalOrgTree == null)
35 throw new EXArg("Need globalOrgTree");
38 branch = globalOrgTree;
40 if( org_id == branch.id() )
44 for( var child in branch.children() ) {
45 org = findOrgUnit(org_id, branch.children()[child]);
53 function buildOrgTreeWidget(org_node) {
57 globalPage.treeWidgetElements = new Array();
59 if(org_node == null) {
60 org_node = globalOrgTree;
61 item = new WebFXTree(org_node.name());
62 item.setBehavior('classic');
64 item = new WebFXTreeItem(org_node.name());
68 "javascript:globalPage.updateSelectedLocation('" + org_node.id() + "');" +
69 "globalPage.locationTree.hide();";
72 item.action = function() {
73 globalPage.updateSelectedLocation(org_node.id());
74 globalPage.globalMenuManager.hideAll();
79 globalPage.treeWidgetElements[item.id] = org_node;
81 for( var index in org_node.children()) {
82 var childorg = org_node.children()[index];
83 if( childorg != null ) {
84 var tree_node = buildOrgTreeWidget(childorg);
93 function getOrgById(id, node) {
94 if(node == null) node = globalOrgTree;
95 if( node.id() == id) return node;
96 for( var ind in node.children() ) {
97 var ret = getOrgById(id, node.children()[ind] );
106 function orgNodeTrail(node) {
107 var nodeArray = new Array();
109 debug("pushing " + node.name() );
110 nodeArray.push(node);
111 node = findOrgUnit(node.parent_ou());
113 nodeArray = nodeArray.reverse();