update
authorerickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Wed, 11 May 2005 16:39:28 +0000 (16:39 +0000)
committererickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Wed, 11 May 2005 16:39:28 +0000 (16:39 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@705 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/src/javascript/opac/AbstractRecordResultPage.js
Open-ILS/src/javascript/opac/MRResultPage.js
Open-ILS/src/javascript/opac/SearchBarChunk.js
Open-ILS/src/javascript/util/webutils.js

index 1b81700..372e9f1 100644 (file)
@@ -27,6 +27,10 @@ AbstractRecordResultPage.prototype.init = function() {
        this.subjectBox.init("Relevant Subjects", true, true, 15);
        this.subjectBox.sortByCount();
 
+       this.seriesBox = new Box();
+       this.seriesBox.init("Relevant Series", true, true, 15);
+       this.seriesBox.sortByCount();
+
        this.sidebarBox         = getById("record_sidebar_box");
 
 
@@ -242,6 +246,13 @@ AbstractRecordResultPage.prototype.displayRecord =
                }
        }
 
+       var series = record.series();
+       for( var s in  series ) {
+               debug("Found series entry: " + series[s] );
+               this.seriesBox.addItem(
+                       this.mkSeriesLink(series[s]), series[s] );
+       }
+
        /* requestBatch will only have one request in it when the current
                record is the last record requested */
        if( this.requestBatch.pending() < 2  )
@@ -262,6 +273,20 @@ AbstractRecordResultPage.prototype.mkAuthorLink = function(auth) {
        return href;
 }
 
+AbstractRecordResultPage.prototype.mkSeriesLink = function(series) {
+       var href = createAppElement("a");
+       add_css_class(href,"record_result_sidebar_link");
+
+       href.setAttribute("href",
+               "?target=mr_result&mr_search_type=series&page=0&mr_search_query=" +
+               encodeURIComponent(series) +
+               "&mr_search_depth=" + this.searchDepth +
+               "&mr_search_location=" + this.searchLocation);
+
+       href.appendChild(createAppTextNode(series));
+       return href;
+}
+
 AbstractRecordResultPage.prototype.mkSubjectLink = function(sub) {
        var href = createAppElement("a");
        add_css_class(href,"record_result_sidebar_link");
@@ -282,12 +307,17 @@ AbstractRecordResultPage.prototype.finalizePage = function() {
 
        this.subjectBox.finalize();
        this.authorBox.finalize();
+       this.seriesBox.finalize();
 
        this.sidebarBox.appendChild(this.subjectBox.getNode());
        this.sidebarBox.appendChild(createAppElement("br"));
+
        this.sidebarBox.appendChild(this.authorBox.getNode());
        this.sidebarBox.appendChild(createAppElement("br"));
 
+       this.sidebarBox.appendChild(this.seriesBox.getNode());
+       this.sidebarBox.appendChild(createAppElement("br"));
+
 //     showMe(this.buttonsBox);
 
        var ses = UserSession.instance().getSessionId();
index 204fb46..7f80e23 100644 (file)
@@ -190,8 +190,14 @@ MRResultPage.prototype.doSearch = function() {
 
        } else {
 
+               var method = "open-ils.search.biblio.class.count";
+               if(isXUL()) 
+                       method = method + ".staff";
+
+               debug("Method: " + method);
+               
                var creq = new RemoteRequest(
-                       "open-ils.search", "open-ils.search.biblio.class.count",
+                       "open-ils.search", method,
                        this.stype, this.string, this.searchLocation, this.searchDepth );
        
                /* this request grabs the search count.  When the counts come back
@@ -230,6 +236,9 @@ MRResultPage.prototype.doMRSearch = function() {
        if( this.hitCount > 5000 )
                method = method + ".unordered";
 
+       if(isXUL())
+               method = method + ".staff";
+
        debug("Search method is " + method);
 
        var request = new RemoteRequest( 
@@ -296,9 +305,12 @@ MRResultPage.prototype.doCopyCount = function( record, search_id, page_id ) {
        var orgunit = globalSelectedLocation;
        if(!orgunit) orgunit = globalLocation;
 
+       var method = "open-ils.search.biblio.metarecord.copy_count";
+       if(isXUL())
+               method = method + ".staff";
+
        var copy_request = new RemoteRequest( 
-               "open-ils.search",
-               "open-ils.search.biblio.metarecord.copy_count",
+               "open-ils.search", method,
                this.searchLocation, record.doc_id() );
 
        copy_request.search_id = search_id;
index 5d08dde..bdab641 100644 (file)
@@ -25,7 +25,6 @@ function SearchBarChunk() {
        else
                this.session = globalSearchBarChunk.session;
 
-       debug("^^^^^^^^^^^^");
        this.reset();
 
        globalSearchBarChunk = this;
@@ -34,15 +33,13 @@ function SearchBarChunk() {
 
 SearchBarChunk.prototype.reset = function() {
        
-       debug("  -- reset on SearchBarChunk");
-
        if( this.session.connected ) {
-               debug(" ****** session is connected");
+               debug("session is connected");
                hideMe(this.login_div);
                showMe(this.logout_div);
 
        } else { 
-               debug(" ****** session is not connected");
+               debug("session is not connected");
                showMe(this.login_div);
                hideMe(this.logout_div);
        }
index d8b9020..7f30c83 100644 (file)
@@ -83,15 +83,29 @@ if(reg.exec(navigator.userAgent))
        ismoz = true;
 
 var DEBUG = true;
+var WIN_DEBUG = false;
 
+
+var debugWindow;
 function debug(message) {
        if(DEBUG) {
                try {
                        dump(" -|*|- Debug: " + message + "\n");
                } catch(E) {}
        }
+       if(WIN_DEBUG) {
+               if(!debugWindow) {
+                       debugWindow = window.open(null,"Debug",
+                               "location=0,menubar=0,status=0,resizeable,resize," +
+                               "outerHeight=900,outerWidth=700,height=900," +
+                               "width=700,scrollbars=1,screenX=100," +
+                               "screenY=100,top=100,left=100,alwaysraised" )
+               }
+               debugWindow.document.write("<br/>" + message);
+       }
 }
 
+
 /* finds or builds the requested row id, adding any intermediate rows along the way */
 function table_row_find_or_create( table, index ) {
 
@@ -113,14 +127,6 @@ function table_row_find_or_create( table, index ) {
        for( var x = 0; x <= index; x++ ) {
                if(table.rows[x] == null) {
                        row = tbody.appendChild(createAppElement("tr"));
-                       //row = table.appendChild(document.createElement("tr"));
-                       //row = document.createElement("tr");
-                       //var tbody = table.getElementsByTagName("tbody")[0];
-                       //debug(tbody);
-                       //tbody.appendChild(row);
-                       //table.childNodes[x] = row;
-                       //table.rows[x] = row;
-                       //row = table.insertRow(x);
                }
        }
        return row;