]> git.evergreen-ils.org Git - Evergreen.git/blob - Open-ILS/src/javascript/opac/Page.js
0a18f71128ae88ea7061897fa5ede75dd4ca8bd9
[Evergreen.git] / Open-ILS / src / javascript / opac / Page.js
1 /* Top level page object.  All pages descend from this class */
2
3 function Page() {}
4
5 Page.prototype.init = function() {
6         debug("Falling back to Page.init()");
7 }
8
9 /* override me */
10 Page.prototype.instance = function() {
11         throw new EXAbstract(
12                         "instance() must be overridden by all Page subclasses");
13 }
14
15
16 /* XXX move me to the status bar */
17 Page.prototype.updateSelectedLocation = function(org) {
18         var node;
19         if( typeof org == 'object' ) node = org;
20         else node = getOrgById(org);
21         globalSelectedLocation = node;
22         this.setLocDisplay();
23 }
24
25
26 /* tells the user where he is searching */
27 Page.prototype.setLocDisplay = function(name) {
28
29         debug("Setting loc display on the status bar");
30         this.searchingCell = getById("now_searching_cell");
31         this.searchRange        = getById("search_range_select");
32
33         if( this.searchingCell == null ) return;
34         var name;
35         
36         var orgunit;
37         if( globalSelectedLocation )
38                 orgunit = globalSelectedLocation;
39         else { orgunit = globalLocation; }
40
41         var arr = orgNodeTrail(orgunit);
42
43         this.searchingCell.innerHTML = "";
44         var names = new Array()
45         for( var i in arr) 
46                 names.push(arr[i].name());
47
48         this.searchingCell.innerHTML = 
49                 "<span class='breadcrumb_label'>" + 
50                 names.join("</span> / <span class='breadcrumb_label'>") + 
51                 "</span>";
52
53         /*
54         if(globalSearchBarFormChunk)
55                 globalSearchBarFormChunk.resetPage();
56                 */
57
58 }
59
60 Page.prototype.updateCurrentLocation = function(org) {
61         if( typeof org == 'object' ) node = org;
62         else node = getOrgById(orgid);
63         globalLocation = node;
64         this.setLocDisplay();
65 }
66                 
67
68
69