1 /* Top level page object. All pages descend from this class */
5 Page.prototype.init = function() {
6 debug("Falling back to Page.init()");
10 Page.prototype.instance = function() {
12 "instance() must be overridden by all Page subclasses");
16 /* XXX move me to the status bar */
17 Page.prototype.updateSelectedLocation = function(org) {
19 if( typeof org == 'object' ) node = org;
20 else node = getOrgById(org);
21 globalSelectedLocation = node;
22 globalSearchDepth = findOrgType(node.ou_type()).depth();
26 Page.prototype.updateCurrentLocation = function(org) {
27 if( typeof org == 'object' ) node = org;
28 else node = getOrgById(orgid);
29 globalLocation = node;
34 /* tells the user where he is searching */
35 Page.prototype.setLocDisplay = function(name) {
37 debug("Setting loc display on the status bar");
38 this.searchingCell = getById("now_searching_cell");
40 if( this.searchingCell == null ) return;
44 if( globalSelectedLocation )
45 orgunit = globalSelectedLocation;
46 else { orgunit = globalLocation; }
48 var arr = orgNodeTrail(orgunit);
50 this.searchingCell.innerHTML = "";
51 var names = new Array()
53 names.push(arr[i].name());
55 this.searchingCell.innerHTML =
56 "<span class='breadcrumb_label'>" +
57 names.join("</span> / <span class='breadcrumb_label'>") +
64 Page.prototype.resetRange = function() {
66 this.searchRange = getById("search_range_select");
68 while( this.searchRange.options.length ) {
69 this.searchRange.options[0] = null;
72 var orgunit = globalSelectedLocation;
74 orgunit = globalLocation;
76 debug("Reseting search range with search location " + orgunit);
77 debug("Resetting search range with search depth " + globalSearchDepth );
79 var selectedOption = null;
81 if(this.searchRange) {
83 for( var index in globalOrgTypes ) {
84 var otype = globalOrgTypes[index];
86 if( otype.depth() > findOrgType(orgunit.ou_type()).depth() )
89 var select = new Option(otype.name(), otype.depth());
91 this.searchRange.options[this.searchRange.options.length] = select;
93 if( otype.depth() == globalSearchDepth ) {
94 selectedOption = index;
99 this.searchRange.selectedIndex = selectedOption;
100 this.searchRange.options[selectedOption].selected = true;
102 if(this.searchRange.options.length == 1 )
103 hideMe(this.searchRange.parentNode);
105 this.searchRange.parentNode.style.visibility = "visible";
106 this.searchRange.parentNode.style.display = "inline";
109 if( instanceOf(this, AbstractRecordResultPage) ) {
111 /* submit the search when the search range is selected */
114 debug("Setting onclick for selector");
115 this.searchRange.onchange = function() {
117 var location = globalSelectedLocation;
118 if(location == null) location = globalLocation.id();
119 else location = location.id();
120 globalSearchDepth = obj.searchRange.options[obj.searchRange.selectedIndex].value;
123 "target", "mr_result",
124 "mr_search_type", obj.stype,
125 "mr_search_query", obj.string,
126 "mr_search_location", location,
127 "mr_search_depth", globalSearchDepth,