fixin and makin purdy
authorerickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Fri, 24 Jun 2005 22:14:44 +0000 (22:14 +0000)
committererickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Fri, 24 Jun 2005 22:14:44 +0000 (22:14 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@925 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/src/javascript/opac/AbstractRecordResultPage.js
Open-ILS/src/javascript/opac/AdvancedSearchPage.js
Open-ILS/src/javascript/opac/GlobalInit.js
Open-ILS/src/javascript/opac/LocationTree.js
Open-ILS/src/javascript/opac/MyOPACPage.js
Open-ILS/src/javascript/opac/Page.js
Open-ILS/src/javascript/util/webutils.js
Open-ILS/src/javascript/widgets/xtree.js

index 85c8533..a7693ba 100644 (file)
@@ -96,6 +96,7 @@ AbstractRecordResultPage.prototype.resetPage = function() {
                if(location == null) location = globalLocation.id();
 
                url_redirect(obj.URLRefresh());
+               obj = null;
        }
 
 
index 0fbbc01..0f4d5a9 100644 (file)
@@ -33,6 +33,7 @@ AdvancedSearchPage.prototype.init = function() {
 
        this.globalSearchButton.onclick = doGlobalSearch;
        refinedButton.onclick = doGlobalSearch;
+       this.buildNavBox();
 }
 
 /* resets the page */
index cbcdf11..327478c 100644 (file)
@@ -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;
 
index 3456a7e..d448774 100644 (file)
@@ -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(" "));
index 1e0d1e7..e143cea 100644 (file)
@@ -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;
index ae5c897..3cc7ff2 100644 (file)
@@ -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;
+       }
+}
+
 
index b7d49de..9f91a9b 100644 (file)
@@ -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);
index f0f054e..31ad822 100644 (file)
@@ -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;
 }