From cb4db4b71a75475e4afba8fa49d77ea3616578fb Mon Sep 17 00:00:00 2001 From: erickson Date: Fri, 24 Jun 2005 22:14:44 +0000 Subject: [PATCH] fixin and makin purdy git-svn-id: svn://svn.open-ils.org/ILS/trunk@925 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- .../opac/AbstractRecordResultPage.js | 1 + .../src/javascript/opac/AdvancedSearchPage.js | 1 + Open-ILS/src/javascript/opac/GlobalInit.js | 6 +- Open-ILS/src/javascript/opac/LocationTree.js | 5 +- Open-ILS/src/javascript/opac/MyOPACPage.js | 11 +++- Open-ILS/src/javascript/opac/Page.js | 62 +++++++++++++------ Open-ILS/src/javascript/util/webutils.js | 26 +++++++- Open-ILS/src/javascript/widgets/xtree.js | 6 +- 8 files changed, 92 insertions(+), 26 deletions(-) diff --git a/Open-ILS/src/javascript/opac/AbstractRecordResultPage.js b/Open-ILS/src/javascript/opac/AbstractRecordResultPage.js index 85c8533cb4..a7693bab63 100644 --- a/Open-ILS/src/javascript/opac/AbstractRecordResultPage.js +++ b/Open-ILS/src/javascript/opac/AbstractRecordResultPage.js @@ -96,6 +96,7 @@ AbstractRecordResultPage.prototype.resetPage = function() { if(location == null) location = globalLocation.id(); url_redirect(obj.URLRefresh()); + obj = null; } diff --git a/Open-ILS/src/javascript/opac/AdvancedSearchPage.js b/Open-ILS/src/javascript/opac/AdvancedSearchPage.js index 0fbbc017f1..0f4d5a9401 100644 --- a/Open-ILS/src/javascript/opac/AdvancedSearchPage.js +++ b/Open-ILS/src/javascript/opac/AdvancedSearchPage.js @@ -33,6 +33,7 @@ AdvancedSearchPage.prototype.init = function() { this.globalSearchButton.onclick = doGlobalSearch; refinedButton.onclick = doGlobalSearch; + this.buildNavBox(); } /* resets the page */ diff --git a/Open-ILS/src/javascript/opac/GlobalInit.js b/Open-ILS/src/javascript/opac/GlobalInit.js index cbcdf111fd..327478c07b 100644 --- a/Open-ILS/src/javascript/opac/GlobalInit.js +++ b/Open-ILS/src/javascript/opac/GlobalInit.js @@ -76,12 +76,14 @@ function globalInit() { break; case "mr_result": - globalPage = new MRResultPage(); + //globalPage = new MRResultPage(); + globalPage = MRResultPage.instance(); addLocation("mr_result", "Title Group Results"); break; case "record_result": - globalPage = new RecordResultPage(); + //globalPage = new RecordResultPage(); + globalPage = RecordResultPage.instance(); addLocation("record_result", "Title Results"); break; diff --git a/Open-ILS/src/javascript/opac/LocationTree.js b/Open-ILS/src/javascript/opac/LocationTree.js index 3456a7ec3a..d4487740c0 100644 --- a/Open-ILS/src/javascript/opac/LocationTree.js +++ b/Open-ILS/src/javascript/opac/LocationTree.js @@ -86,7 +86,8 @@ LocationTree.prototype.toggle = function(button_div, offsetx, offsety, relative) (!this.treeBox.firstChild)) { debug("location tree has not been rendered... rendering.."); - setTimeout(function() { renderTree(obj); }, 5 ); + //setTimeout(function() { renderTree(obj); }, 5 ); + renderTree(obj); } //alert(this.treeBox.firstChild.nodeType); @@ -158,7 +159,7 @@ LocationTree.prototype.newSpot = function(box_id, container_id) { expand_all.onclick = function() { obj.widget.expandAll(); }; collapse_all.onclick = function() { obj.widget.collapseAll(); - obj.widget.expand(); }; + obj.widget.expand();}; expando.appendChild(expand_all); expando.appendChild(createAppTextNode(" ")); diff --git a/Open-ILS/src/javascript/opac/MyOPACPage.js b/Open-ILS/src/javascript/opac/MyOPACPage.js index 1e0d1e7f9c..e143cea5f1 100644 --- a/Open-ILS/src/javascript/opac/MyOPACPage.js +++ b/Open-ILS/src/javascript/opac/MyOPACPage.js @@ -12,7 +12,16 @@ function MyOPACPage() { MyOPACPage.prototype.redirect = function() { var frame = getById("my_opac_iframe"); - var source = "https://gapines.org/opac/?target=my_opac_secure"; + + var org = globalSelectedLocation; + if(org == null) + org = globalLocation; + org = org.id(); + var depth = globalSearchDepth; + + var source = "https://" + globalRootURL + globalRootPath + + "?target=my_opac_secure" + "&location=" + org + "&depth=" + depth; + source += "&session=" + UserSession.instance().getSessionId(); frame.setAttribute("src",source); return true; diff --git a/Open-ILS/src/javascript/opac/Page.js b/Open-ILS/src/javascript/opac/Page.js index ae5c897a54..3cc7ff2893 100644 --- a/Open-ILS/src/javascript/opac/Page.js +++ b/Open-ILS/src/javascript/opac/Page.js @@ -183,30 +183,38 @@ Page.prototype.buildDivider = function() { return div; } -Page.prototype.buildNavBox = function() { +/* if 'full' add target=_top to break out of the page */ +Page.prototype.buildNavBox = function(full) { Page.navBox = new Box(); - Page.navBox.init("Navigate", false, false); + Page.navBox.init("Navigation", false, false); var table = elem("table"); add_css_class(table, "main_nav_table"); var arr = []; /* location tree */ - var loc = elem("a", - {id:"location_nav_link", href:"javascript:void(0);"}, null, "Change Search Location"); + var loc = null; + try { + if(globalOrgTree) + loc = elem("a", + {id:"location_nav_link", href:"javascript:void(0);"}, null, "Change Search Location"); - loc.onclick = function(evt) { - globalPage.locationTree.toggle(getById("location_nav_link")); - } - arr.push(loc); + loc.onclick = function(evt) { + globalPage.locationTree.toggle(getById("location_nav_link")); + } + arr.push(loc); + } catch(E){} + + if(globalPort == "443") globalPort = "80"; + var prefix = "http://" + globalRootURL + ":" + globalPort + globalRootPath; - arr.push(elem("a", {href:'?target=advanced_search'}, null, "Advanced Search")); - arr.push(elem("a", {href:'?target=my_opac'}, null, "My OPAC")); - arr.push(elem("a", {href:'?target=about'}, null, "About PINES")); - arr.push(this.buildDeepLink()); + arr.push(elem("a", {href: prefix + '?target=advanced_search'}, null, "Advanced Search")); + arr.push(elem("a", {href: prefix + '?target=my_opac'}, null, "My OPAC")); + arr.push(elem("a", {href: prefix + '?target=about'}, null, "About PINES")); + if(loc) arr.push(this.buildDeepLink()); if(UserSession.instance().verifySession()) { - arr.push(elem("a", {href:"?target=logout"}, null, "Logout")); + arr.push(elem("a", {href: prefix + "?target=logout"}, null, "Logout")); } @@ -216,6 +224,8 @@ Page.prototype.buildNavBox = function() { var cell = row.insertCell(row.cells.length); add_css_class(cell, "main_nav_cell"); cell.appendChild(arr[i]); + if(full) + arr[i].setAttribute("target", "_top"); } /* append to the page */ @@ -223,8 +233,9 @@ Page.prototype.buildNavBox = function() { Page.navBox.finalize(); var location = getById("main_page_nav_box"); - if(location) + if(location) location.appendChild(Page.navBox.getNode()); + return Page.navBox.getNode(); } @@ -238,22 +249,31 @@ Page.prototype.buildDeepLink = function() { var org = globalSelectedLocation; if(org == null) org = globalLocation; - org = org.id(); + if(org) org = org.id(); var depth = globalSearchDepth; + if(globalPort == "443") globalPort = "80"; + var prefix = "http://" + globalRootURL + ":" + globalPort + globalRootPath; + var string =globalAppFrame.location.href; if(!string.match(/sub_frame/)) string += "&sub_frame=1" - if(!string.match(/location/)) + + if(org) { + if(!string.match(/location/)) string += "&location=" + org; - if(!string.match(/depth/)) + } + + if(depth) { + if(!string.match(/depth/)) string += "&depth=" + depth; + } debug("Redirecting deep link to " + string ); var a = elem("a", - { href: string }, null, "Link to this page" + { href: prefix + string }, null, "Link to this page" ); a.setAttribute("target", "_blank"); @@ -261,4 +281,10 @@ Page.prototype.buildDeepLink = function() { } +Page.prototype.destroy = function() { + for( var x in this ){ + this[x] = null; + } +} + diff --git a/Open-ILS/src/javascript/util/webutils.js b/Open-ILS/src/javascript/util/webutils.js index b7d49debd2..9f91a9b2cd 100644 --- a/Open-ILS/src/javascript/util/webutils.js +++ b/Open-ILS/src/javascript/util/webutils.js @@ -1,18 +1,41 @@ + function cleanIEMemory() { + +// alert("here"); + var a = [ "a", "div", "span", "select", "option", "img", "body", "iframe", "frame"]; for( var index in a ) { var nodes = getDocument().getElementsByTagName(a[index]); + var nodes2 = document.getElementsByTagName(a[index]); + for( var n = 0; n!= nodes.length; n++ ) { var node = nodes[n]; node.onclick = null; node.onchange = null; node.onselect = null; + node.oncontextmenu = null; + } + + for( var n = 0; n!= nodes2.length; n++ ) { + var node = nodes2[n]; + node.onclick = null; + node.onchange = null; + node.onselect = null; + node.oncontextmenu = null; } + nodes = null; + nodes2 = null; } -} + globalPage = null; + globalMenuManager = null; + if(IE) { + window.CollectGarbage(); + getWindow().CollectGarbage(); + } +} @@ -485,6 +508,7 @@ function eventPoll(name) { function swapClass(obj, class1, class2 ) { + if(obj == null) return; if( obj.className.indexOf(class1) != -1 ) { remove_css_class(obj, class1); add_css_class(obj,class2); diff --git a/Open-ILS/src/javascript/widgets/xtree.js b/Open-ILS/src/javascript/widgets/xtree.js index f0f054eb3a..31ad82221b 100644 --- a/Open-ILS/src/javascript/widgets/xtree.js +++ b/Open-ILS/src/javascript/widgets/xtree.js @@ -200,11 +200,13 @@ WebFXTreeAbstractNode.prototype.toggle = function() { } } WebFXTreeAbstractNode.prototype.select = function() { - getById(this.id + '-anchor').focus(); + var a = getById(this.id + '-anchor'); + if(a) a.focus(); } WebFXTreeAbstractNode.prototype.deSelect = function() { - getById(this.id + '-anchor').className = ''; + var a = getById(this.id + '-anchor'); + if(a) a.className = ''; webFXTreeHandler.selected = null; } -- 2.43.2