update
authorerickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 10 May 2005 16:00:41 +0000 (16:00 +0000)
committererickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 10 May 2005 16:00:41 +0000 (16:00 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@693 dcc99617-32d9-48b4-a31d-7c20da2025e4

12 files changed:
Open-ILS/src/javascript/opac/AbstractRecordResultPage.js
Open-ILS/src/javascript/opac/LocationTree.js
Open-ILS/src/javascript/opac/MRResultPage.js
Open-ILS/src/javascript/opac/OPACStartPage.js
Open-ILS/src/javascript/opac/RecordResultPage.js
Open-ILS/src/javascript/opac/SearchBarChunk.js
Open-ILS/src/javascript/opac/XULEvents.js
Open-ILS/src/javascript/util/UserSession.js
Open-ILS/src/javascript/util/ils_utils.js
Open-ILS/src/templates/opac/pages/chunks/opac_search_bar.ttk
Open-ILS/src/templates/opac/pages/chunks/search_bar_form.ttk
Open-ILS/src/templates/opac/pages/opac_start.ttk

index 6c582a4..1b81700 100644 (file)
@@ -128,6 +128,11 @@ AbstractRecordResultPage.prototype.displayRecord =
 
        if(record == null) return;
 
+       if(!instanceOf(record, Fieldmapper)) {
+               debug(" * Received bogus record " + js2JSON(record));
+               return;
+       }
+
        if(page_id == 0)
                this.buildNextLinks();
 
@@ -309,8 +314,9 @@ AbstractRecordResultPage.prototype.finalizePage = function() {
        }
 
 
-       if(this.hitCount < 1)
+       if(this.hitCount < 1) {
                if(this.progressBar) this.progressBar.stop();
+       }
 
        /* in case we're hidden */
        showMe(this.bigOlBox);
@@ -349,6 +355,8 @@ AbstractRecordResultPage.prototype.displayCopyCounts =
 
        if(page_id  == (parseInt(this.hitsPerPage) - 1) ) {
                if(this.progressBar) this.progressBar.stop();
+               if(this.hitCount < 1)
+                       this.noHits();
        }
 
        if( (page_id  == ((parseInt(this.hitCount) - 1 ) - parseInt(this.searchOffset))) ||
@@ -358,14 +366,19 @@ AbstractRecordResultPage.prototype.displayCopyCounts =
 
 
 
+AbstractRecordResultPage.prototype.noHits = function() {
+       var hcell = getById("hit_count_cell");
+       hcell.appendChild(createAppElement("br"));
+       hcell.appendChild(createAppTextNode("0 hits were returned for you search"));
+}
+
+
 AbstractRecordResultPage.prototype.buildNextLinks = function() {
 
        if(this.builtLinks)
                return;
        this.builtLinks = true;
 
-
-
        var obj = this;
        var next;
        var prev;
index d81d3dd..835c3a0 100644 (file)
@@ -4,22 +4,32 @@ function LocationTree( tree ) {
        this.orgTree = tree;
 }
 
-LocationTree.prototype.buildOrgTreeWidget = function(org_node) {
+LocationTree.prototype.buildOrgTreeWidget = function() {
+
+       this.widget = buildOrgTreeWidget();
+}
+
+
+function buildOrgTreeWidget(org_node) {
 
        var item;
 
+       globalPage.treeWidgetElements = new Array();
+
        if(org_node == null) {
-               org_node = this.orgTree;
+               org_node = globalOrgTree;
                item = new WebFXTree(org_node.name());
-               this.widget = item;
                item.setBehavior('classic');
        } else {
                item = new WebFXTreeItem(org_node.name());
        }
 
+       /* make org tree re-submit search on click */
        item.action = 
                "javascript:globalPage.updateSelectedLocation('" + org_node.id() + "');" +
-               "globalPage.locationTree.hide();";
+               "globalPage.locationTree.hide();"; 
+
+       globalPage.treeWidgetElements[item.id] = org_node;
 
        for( var index in org_node.children()) {
                var childorg = org_node.children()[index];
@@ -29,6 +39,8 @@ LocationTree.prototype.buildOrgTreeWidget = function(org_node) {
                                item.add(tree_node);
                }
        }
+
+       return item;
 }
 
 
index d67d337..204fb46 100644 (file)
@@ -128,13 +128,13 @@ MRResultPage.prototype.doSearch = function() {
        debug("mr search params string " + string + " stype " + stype +
                        " location " + location + " depth " + depth );
 
-       if(depth == null)
+       if(depth == null || depth == "undefined")
                depth = globalSearchDepth;
 
        if(depth == null)
                depth = findOrgDepth(globalLocation.ou_type());
 
-       if(location == null)
+       if(location == null || location == "undefined")
                location = globalLocation.id();
 
        if(!stype || !string) return;
@@ -211,7 +211,9 @@ MRResultPage.prototype.doSearch = function() {
                                        else throw E;
                                }
 
-                               obj.buildNextLinks();
+                               if(obj.hitCount > 0) obj.buildNextLinks();
+                               else obj.noHits();
+
                                obj.doMRSearch();       
                                debug("Kicking off the record id's request");
                                                        }
@@ -225,7 +227,7 @@ MRResultPage.prototype.doMRSearch = function() {
 
        var obj = this;
        var method = "open-ils.search.biblio.class";
-       if( this.hitCount > 1000 )
+       if( this.hitCount > 5000 )
                method = method + ".unordered";
 
        debug("Search method is " + method);
index 1f5ceb7..ec498ae 100644 (file)
@@ -39,3 +39,5 @@ OPACStartPage.prototype.init = function() {
                */
 }
 
+OPACStartPage.prototype.doSearch = function() {
+}
index bf5b9c5..7e490ab 100644 (file)
@@ -54,7 +54,8 @@ RecordResultPage.prototype.addMenuItems = function(menu, record) {
        }
 
        menu.addItem("View MARC", func);
-       xulEvtRecordResultDisplayed( menu, record );
+       if(isXUL())
+               xulEvtRecordResultDisplayed( menu, record );
 
 }
 
@@ -127,6 +128,10 @@ RecordResultPage.prototype.doSearch = function() {
        debug( "Key Value Array \n" + js2JSON( paramObj ) );
 
        this.page                       = parseInt(paramObj.__page);
+
+       if(this.page == null)
+               this.page = 0;
+
        this.searchOffset = this.page * this.hitsPerPage;
 
 
index f2b2533..5d08dde 100644 (file)
@@ -25,11 +25,17 @@ function SearchBarChunk() {
        else
                this.session = globalSearchBarChunk.session;
 
+       debug("^^^^^^^^^^^^");
+       this.reset();
+
        globalSearchBarChunk = this;
 }
 
+
 SearchBarChunk.prototype.reset = function() {
        
+       debug("  -- reset on SearchBarChunk");
+
        if( this.session.connected ) {
                debug(" ****** session is connected");
                hideMe(this.login_div);
@@ -39,6 +45,13 @@ SearchBarChunk.prototype.reset = function() {
                debug(" ****** session is not connected");
                showMe(this.login_div);
                hideMe(this.logout_div);
+       }
 
+       if(isXUL()) {
+               debug("Hiding search bar links since we're XUL");
+               hideMe(this.login_div);
+               hideMe(this.logout_div);
+               hideMe(this.my_opac_link_div);
+               hideMe(this.about_link_div);
        }
 }
index 5cb0c4d..88758b0 100644 (file)
@@ -1,5 +1,12 @@
+/*
+var XUL = new Object();
+
 var xulEvtMRResultDisplayed = function( menu, record ) {
 }
 
 var xulEvtRecordResultDisplayed = function( menu, record ) {
 }
+
+var xulEvtPageLoaded = function(window) {
+}
+*/
index d748369..0fb7faa 100644 (file)
@@ -37,10 +37,16 @@ UserSession.prototype.persist = function() {
 
 
 
-UserSession.prototype.verifySession = function() {
+UserSession.prototype.verifySession = function(ses) {
 
        debug("Verifying session...");
-       this.session_id = this.cookie.fields[UserSession.SES];
+       if(ses)
+               debug("Session key passed in from XUL[" + ses + "], verifying...");
+
+       if(ses != null)
+               this.session_id = ses;
+       else
+               this.session_id = this.cookie.fields[UserSession.SES];
 
        if(this.session_id) {
                debug("Retrieveing user info for session " + this.session_id);
index be0d894..c5549dc 100644 (file)
@@ -50,45 +50,6 @@ function findOrgUnit(org_id, branch) {
 }
 
 
-function buildOrgTreeWidget(org_node) {
-
-       var item;
-
-       globalPage.treeWidgetElements = new Array();
-
-       if(org_node == null) {
-               org_node = globalOrgTree;
-               item = new WebFXTree(org_node.name());
-               item.setBehavior('classic');
-       } else {
-               item = new WebFXTreeItem(org_node.name());
-       }
-
-       item.action = 
-               "javascript:globalPage.updateSelectedLocation('" + org_node.id() + "');" +
-               "globalPage.locationTree.hide();";
-
-       /*
-       item.action = function() {
-               globalPage.updateSelectedLocation(org_node.id());
-               globalPage.globalMenuManager.hideAll();
-       }
-       */
-
-
-       globalPage.treeWidgetElements[item.id] = org_node;
-
-       for( var index in org_node.children()) {
-               var childorg = org_node.children()[index];
-               if( childorg != null ) {
-                       var tree_node = buildOrgTreeWidget(childorg);
-                       if(tree_node != null)
-                               item.add(tree_node);
-               }
-       }
-
-       return item;
-}
 
 function getOrgById(id, node) {
        if(node == null) node = globalOrgTree;
index 7b14c8f..8588223 100644 (file)
                                END;
 
 
-                               WRAPPER html/cell  align='center';
-                                       WRAPPER html/div class="text_link_div" id='adv_search_link_div';
-                                               anchor( id='adv_search_link',  href='?target=advanced_search', text = tm.advanced );
-                                       END;
-                               END;
 
                                WRAPPER html/cell  align='center';
 
                                END;
 
                                WRAPPER html/cell  align='center';
+                                       WRAPPER html/div class="text_link_div" id='adv_search_link_div';
+                                               anchor( id='adv_search_link',  href='?target=advanced_search', text = tm.advanced );
+                                       END;
+                               END;
+
+
+                               WRAPPER html/cell  align='center';
                                        WRAPPER html/div class='text_link_div' id='my_opac_link_div';
                                                anchor( id='my_opac_link',  href='?target=my_opac', text = tm.my_opac );
                                        END;
@@ -52,6 +54,7 @@
                                        END;
                                END;
 
+                       
 
                                WRAPPER html/cell valign='bottom' align='right';
                                        WRAPPER html/div id='small_logo_div';
index e26d71d..832ffe4 100644 (file)
@@ -18,6 +18,7 @@
                        option(value='author',  content=tm.author);
                        option(value='subject', content=tm.subject);
                        option(value='keyword', content=tm.keyword);
+                       option(value='series',  content="Series");
                END;
        
                space(1);
index 90997c2..6f9c441 100644 (file)
@@ -68,6 +68,7 @@
                        option(value='author',  content='Author');
                        option(value='subject', content='Subject');
                        option(value='keyword', content='Keyword');
+                       option(value='series', content='Series');
                END;
        END;