3 var globalPage = null; /* the current top level page object */
4 var globalUser = null; /* the user session */
5 var globalOrgTreeWidget = null;
6 var globalLocation = null;
7 var globalOrgTreeWidgetBox = null;
8 var globalSelectedLocation = null;
9 var globalSearchDepth = null;
10 var globalMenuManager = null;
11 var locationStack = new Array();
13 var lastSearchString = null;
14 var lastSearchType = null;
29 function addLocation(type, title) {
32 var obj = new Object();
33 obj.location = globalAppFrame.location.href;
35 locationStack[type] = obj;
42 function globalInit() {
44 debug(" --- XUL IS " + isXUL() );
47 if( isXUL() && globalAppFrame )
48 globalAppFrame.document.body.style.background = "#FFF";
50 var page_name = globalPageTarget;
53 throw new EXArg("globalInit requires globalPageTarget to be set");
55 debug("globalInit init-ing page: " + page_name );
60 globalPage = new OPACStartPage();
61 addLocation("start", "Home");
62 locationStack["advanced_search"] = null;
65 case "advanced_search":
66 globalPage = new AdvancedSearchPage();
67 addLocation("advanced_search", "Advanced Search");
68 locationStack["start"] = null;
72 globalPage = new MRResultPage();
73 addLocation("mr_result", "Title Group Results");
77 globalPage = new RecordResultPage();
78 addLocation("record_result", "Title Results");
82 globalPage = new LoginPage();
86 globalPage = new LogoutPage();
90 globalPage = new MyOPACPage();
94 globalPage = new RecordDetailPage();
95 addLocation("record_detail", "Title Details");
99 globalPage = new AboutPage();
106 "globalInit requires a valid page target: " + page_name );
108 if(!loaded) { loaded = true; GlobalInitLoad(); }
110 globalMenuManager = new ContextMenuManager();
112 /* hide all context menus on body click */
113 getDocument().body.onclick = function() {
114 globalMenuManager.hideAll();
118 globalPage.setLocDisplay();
119 globalPage.locationTree = globalOrgTreeWidget;
120 globalPage.setPageTrail();
122 if(globalSearchBarChunk)
123 globalSearchBarChunk.reset();
125 if( globalSearchBarFormChunk != null)
126 globalSearchBarFormChunk.resetPage();
131 /* we only do this on loading of the outer frame (i.e. only once) */
132 function GlobalInitLoad() {
134 debug("Global Init is doing its primary load");
135 globalOrgTreeWidget = new LocationTree(globalOrgTree);
136 globalUser = UserSession.instance();
142 ses = G['auth_ses'][0]; /* G is shoved in by XUL */
143 org = G['user_ou']; /* the desired location of the user */
146 if(globalUser.verifySession(ses)) {
147 globalUser.grabOrgUnit(org);
151 globalLocation = globalOrgTree;
152 globalSearchDepth = findOrgDepth(globalOrgTree.ou_type());