quicker login+ssl-jump handling by showing immediately instaed of waiting on page...
authorerickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 30 Nov 2010 21:00:01 +0000 (21:00 +0000)
committererickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 30 Nov 2010 21:00:01 +0000 (21:00 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@18889 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/web/opac/common/js/config.js
Open-ILS/web/opac/skin/default/js/mresult.js
Open-ILS/web/opac/skin/default/js/rdetail.js
Open-ILS/web/opac/skin/default/js/result_common.js
Open-ILS/web/opac/skin/default/js/rresult.js
Open-ILS/web/opac/skin/default/js/sidebar.js

index 098720c..054e56a 100644 (file)
@@ -433,6 +433,7 @@ createEvt("result", "allRecordsReceived");  /* f(mvrsArray) : add other page stuf
 createEvt("rdetail", "recordDrawn");                   /* f() : the record has been drawn */
 
 createEvt("common", "loggedIn");                                       /* f() : user has just logged in */
+createEvt("common", "loginCanceled");                                  /* f() : user has just logged in */
 createEvt('result', 'zeroHits');
 createEvt('result', 'lowHits');
 createEvt('rdetail', 'recordRetrieved');                       /* we are about to draw the rdetail page */
index c6a2e47..c6c548b 100644 (file)
@@ -24,6 +24,13 @@ function mresultDoSearch() {
        swapCanvas($('loading_alt'));
        table = G.ui.result.main_table;
 
+    var holdTarget = new CGI().param('hold_target');
+    if(holdTarget != null) {
+        mresultHandlePlaceHold(holdTarget);
+        return;
+    }
+
+
        while( table.parentNode.rows.length <= (getDisplayCount() + 1) )  
                table.appendChild(G.ui.result.row_template.cloneNode(true));
 
@@ -121,5 +128,14 @@ function mresultHandleMods(r) {
 }
 
 
+function mresultHandlePlaceHold(target) {
+    function reload() {
+        location.href = location.href.replace(/&hold_target=\d+/, '');
+    }
+    attachEvt("common", "holdUpdated", reload);
+    attachEvt("common", "holdUpdateCanceled", reload);
+    attachEvt("common", "loginCanceled", reload);
+    holdsDrawEditor({record:target, type: 'M'});
+}
 
 
index 977bf6e..4369b53 100644 (file)
@@ -7,16 +7,6 @@ attachEvt("rdetail", "recordDrawn", rdetailBuildStatusColumns);
 attachEvt("rdetail", "recordDrawn", rdetailBuildInfoRows);
 attachEvt("rdetail", "recordDrawn", rdetailGetPageIds);
 
-G.evt.rdetail.recordDrawn.push(
-    function(){
-        if(new CGI().param('place_hold')) {
-            // This will force the login dialog to display if the user is not logged in
-            holdsDrawEditor({record:record.doc_id(), type: 'T'});
-        }
-    }
-);
-
-
 /* Per-skin configuration settings */
 var rdetailLocalOnly = true;
 var rdetailShowLocal = true;
@@ -56,6 +46,11 @@ var rdetailEnd = null;
 var mfhdDetails = [];
 var orgHiding = false;
 
+if(location.href.match(/&place_hold=1/)) {
+    // prevent load flicker between canvases
+    hideMe(dojo.byId('canvas_main'));
+}
+
 /* serials are currently the only use of Dojo strings in the OPAC */
 if (rdetailDisplaySerialHoldings) {
        dojo.require("dijit.Menu");
@@ -117,8 +112,23 @@ function _rdetailNav(id, offset) {
        goTo(buildOPACLink(args));
 }
 
+function rdetailHandlePlaceHold() {
+    function reload() {
+        location.href = location.href.replace(/&place_hold=1/, '');
+    }
+    attachEvt("common", "holdUpdated", reload);
+    attachEvt("common", "holdUpdateCanceled", reload);
+    attachEvt("common", "loginCanceled", reload);
+    holdsDrawEditor({record:getRid(), type: 'T'});
+}
+
 function rdetailDraw() {
 
+    if(new CGI().param('place_hold')) {
+        rdetailHandlePlaceHold();
+        return;
+    }
+
        detachAllEvt('common','depthChanged');
        detachAllEvt('common','locationUpdated');
        attachEvt('common','depthChanged', rdetailReload);
index a19cb26..dc3ae94 100644 (file)
@@ -16,17 +16,6 @@ if( findCurrentPage() == MRESULT || findCurrentPage() == RRESULT ) {
        G.evt.result.copyCountsReceived.push(resultDisplayCopyCounts);
        G.evt.result.allRecordsReceived.push( function(){unHideMe($('result_info_2'))}, fetchGoogleBooksLink, fetchChiliFreshReviews);
 
-    G.evt.result.allRecordsReceived.push( 
-        function(){
-            var cgi = new CGI();
-            var hold_target = cgi.param('hold_target');
-            if(hold_target) {
-                // This will force the login dialog to display if the user is not logged in
-                holdsDrawEditor({record:hold_target, type: (findCurrentPage() == MRESULT) ? 'M' : 'T'});
-            }
-        }
-    );
-
        attachEvt('result','lowHits',resultLowHits);
        attachEvt('result','zeroHits',resultZeroHits);
        attachEvt( "common", "locationUpdated", resultSBSubmit );
index 0fa0ba3..ff94bb8 100644 (file)
@@ -31,6 +31,13 @@ function rresultDoSearch() {
 function rresultCollectIds() {
        var ids;
 
+
+    var holdTarget = new CGI().param('hold_target');
+    if(holdTarget != null) {
+        rresultHandlePlaceHold(holdTarget);
+        return;
+    }
+
     var rtype = getRtype();
     if (rtype && rtype.indexOf('|') > -1)
         rtype = rtype.substring(0,rtype.indexOf('|'));
@@ -329,4 +336,13 @@ function rresultFilterSearchResults(r) {
 }
 
 
+function rresultHandlePlaceHold(target) {
+    function reload() {
+        location.href = location.href.replace(/&hold_target=\d+/, '');
+    }
+    attachEvt("common", "holdUpdated", reload);
+    attachEvt("common", "holdUpdateCanceled", reload);
+    attachEvt("common", "loginCanceled", reload);
+    holdsDrawEditor({record:target, type: 'T'});
+}
 
index 902175e..638fc79 100644 (file)
@@ -157,18 +157,18 @@ function strongPassword(pass, alrt) {
 }
 
 function initLogin() {
+    swapCanvas(G.ui.login.box);
+    try{G.ui.login.username.focus();} catch(e) {}
 
-//     if(loginBoxVisible) {
-//             showCanvas();
-//     } else {
-               swapCanvas(G.ui.login.box);
-               try{G.ui.login.username.focus();}catch(e){}
-//     }
-
-//     loginBoxVisible = !loginBoxVisible;
-       G.ui.login.cancel.onclick = function(evt) { G.ui.login.form.setAttribute('action','javascript:showCanvas();'); };
-       if(findCurrentPage() == MYOPAC) 
-               G.ui.login.cancel.onclick = function(evt) { G.ui.login.form.setAttribute('action','javascript:goHome();'); };
+    G.ui.login.cancel.onclick = function(evt) { 
+        G.ui.login.form.setAttribute('action',
+            'javascript:showCanvas();runEvt("common", "loginCanceled");'); 
+    };
+
+    if(findCurrentPage() == MYOPAC) {
+        G.ui.login.cancel.onclick = function(evt) { 
+            G.ui.login.form.setAttribute('action','javascript:goHome();'); };
+    }
 }
 
 function setSidebarLinks() {