patching up some bugs that popped up
authorerickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Fri, 16 Dec 2005 22:58:56 +0000 (22:58 +0000)
committererickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Fri, 16 Dec 2005 22:58:56 +0000 (22:58 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@2424 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/web/opac/common/js/init.js
Open-ILS/web/opac/common/js/opac_utils.js
Open-ILS/web/opac/common/js/utils.js
Open-ILS/web/opac/skin/default/js/mresult.js
Open-ILS/web/opac/skin/default/js/myopac.js
Open-ILS/web/opac/skin/default/js/sidebar_extras.js
Open-ILS/web/opac/skin/default/xml/myopac/myopac_prefs.xml

index 5b3825f..39ceb8e 100644 (file)
@@ -14,7 +14,8 @@ try{ attachEvt("common", "unload", cleanRemoteRequests);} catch(e){}
 function init() {
        runEvt('common','init');
        if( getOrigLocation() == 0 ) ORIGLOC = LOCATION;
-       try { if(!isFrontPage) grabUser(); }catch(e){}
+//     try { if(!isFrontPage) grabUser(); }catch(e){}
+       grabUser();
        runEvt("common", "run");
        //checkUserSkin();
        G.ui.common.now_searching.appendChild(text(findOrgUnit(getLocation()).name()));
index f1b0a2b..e10ae5a 100644 (file)
@@ -427,7 +427,7 @@ function doLogin() {
        return u;
 }
 
-function doLogout() {
+function doLogout(noredirect) {
 
        /* be nice and delete the session from the server */
        if(G.user && G.user.session) { 
@@ -448,7 +448,9 @@ function doLogout() {
        args[PARAM_DEPTH] = findOrgDepth(globalOrgTree);
        args.page = "home";
 
-       goTo(buildOPACLink(args));
+       var nored = false;
+       try{ if(isFrontPage) nored = true; } catch(e){nored = false;}
+       if(!nored) goTo(buildOPACLink(args));
 }
 
 
index 79e82a3..e1a2026 100644 (file)
@@ -174,9 +174,8 @@ function setSelector( sel, value ) {
        }
 }
 
-
 function getSelectorVal( sel ) {
-       if(!sel) return undef;
+       if(!sel) return null;
        return sel.options[sel.selectedIndex].value;
 }
 
@@ -287,7 +286,7 @@ function scaleFonts(type) {
                        break;
        }
 
-       document.body.style.fontSize = size;
+       document.getElementsByTagName('body')[0].style.fontSize = size;
        for (i = 0; (a = document.getElementsByTagName ("td")[i]); i++) a.style.fontSize = size;;
        for (i = 0; (a = document.getElementsByTagName ("div")[i]); i++) a.style.fontSize = ssize;
        for (i = 0; (a = document.getElementsByTagName ("option")[i]); i++) a.style.fontSize = ssize;
index 52bebf9..6c6eee4 100644 (file)
@@ -35,14 +35,22 @@ function mresultDoSearch() {
                        if(getAdvType() == ADVTYPE_MULTI ) mresultCollectAdvIds();
                        if(getAdvType() == ADVTYPE_MARC ) mresultCollectAdvMARCIds();
                }
-               else mresultCollectIds(FETCH_MRIDS_FULL); 
+               else {
+                       mresultCollectIds(FETCH_MRIDS_FULL); 
+                       ADVTERM = "";
+                       ADVTYPE = "";
+               }
 
        } else  {
                if( getAdvTerm() && !getTerm() ) {
                        if(getAdvType() == ADVTYPE_MULTI ) mresultCollectAdvIds();
                        if(getAdvType() == ADVTYPE_MARC ) mresultCollectAdvIds();
                }
-               else mresultCollectIds(FETCH_MRIDS);
+               else {
+                       mresultCollectIds(FETCH_MRIDS);
+                       ADVTERM = "";
+                       ADVTYPE = "";
+               }
        }
 }
 
index 24356dc..dc6f0f1 100644 (file)
@@ -335,8 +335,7 @@ function myOPACShowTransactions(r) {
 }
 
 function myOPACSavePrefs() {
-       G.user.prefs['opac.hits_per_page'] = 
-               $('prefs_hits_per').options[$('prefs_hits_per').selectedIndex].value;
+       G.user.prefs['opac.hits_per_page'] = getSelectorVal($('prefs_hits_per'));
        if(commitUserPrefs())
                alert($('prefs_update_success').innerHTML);
        else alert($('prefs_update_failure').innerHTML);
@@ -354,16 +353,8 @@ function myOPACShowHitsPer() {
        var hits = 10;
        if(G.user.prefs['opac.hits_per_page'])
                hits = G.user.prefs['opac.hits_per_page'];
-
        var hitsSel = $('prefs_hits_per');
-
-       for( var o in hitsSel.options ) {
-               var opt = hitsSel.options[o];
-               if( hits == opt.value ) {
-                       opt.selected = true;
-                       hitsSel.selectedIndex = o;
-               }
-       }
+       setSelector(hitsSel, hits);
 }
 
 var userShown = false;
index e1b6a08..3ded13b 100644 (file)
@@ -55,6 +55,8 @@ function resultDrawSeries() {
 }
 
 var _oldFashioned = true;
+var IESux = true;
+
 function resultDrawSidebarTrees( stype, treeName, items, wrapperNode, destNode ) {
        eval("tree = " + treeName);
 
@@ -64,7 +66,12 @@ function resultDrawSidebarTrees( stype, treeName, items, wrapperNode, destNode )
        for( var i in items ) {
 
                if(isNull(items[i])) continue;
+
+               /* again, IE is a turd */
+               //if(IE) { if(x++ > 5) break; }
+               //else { if(x++ > 7) break; }
                if(x++ > 7) break;
+
                found = true;
 
                var item = normalize(truncate(items[i], 65));
@@ -73,18 +80,8 @@ function resultDrawSidebarTrees( stype, treeName, items, wrapperNode, destNode )
                var href = resultQuickLink( items[i], stype );
                tree.addNode( stype + "_" + items[i], treeName + 'Root', item, href );
 
-               /*
-               if(!IE)
-                       setTimeout('resultFireXRefReq("'+treeName+'","'+stype+'","'+item+'");',200);
-                       */
-               //if(!IE) resultFireXRefReq(treeName, stype, items[i]);
-               //resultFireXRefReq(treeName, stype, items[i]);
-
-
-               if(_oldFashioned)
-                       resultFireXRefReq(treeName, stype, items[i]);
-
-               //setTimeout('resultFireXRefReq("'+treeName+'","'+stype+'","'+item+'");', 100);
+               ////if(_oldFashioned && !IE) {
+               if(_oldFashioned && !IE ) resultFireXRefReq(treeName, stype, items[i]);
 
                var a = {};
                a.type = stype;
@@ -96,6 +93,9 @@ function resultDrawSidebarTrees( stype, treeName, items, wrapperNode, destNode )
                unHideMe(wrapperNode);
                if(!_oldFashioned)
                        resultFireXRefBatch(treeName, xrefCache, stype);
+               //if(IE && stype == 'subject' ) {
+
+               if(IE) resultFireXRefSingle(treeName, xrefCache, stype);
        }
 }
 
@@ -114,6 +114,32 @@ function resultFireXRefBatch(treeName, xrefCache, stype) {
        req.send();
 }
 
+var xrefCacheIndex = {};
+xrefCacheIndex['subject'] = 0;
+xrefCacheIndex['author'] = 0;
+xrefCacheIndex['series'] = 0;
+
+function resultHandleXRefResponse(r) {
+       resultFireXRefSingle( r._treename, r._cache, r._stype );
+       resultAppendCrossRef(r);
+}
+
+
+function resultFireXRefSingle( treeName, xrefCache, stype ) {
+       var i = xrefCacheIndex[stype]++;
+       var item = xrefCache[i].term;
+       var tree;
+       eval('tree=' + treeName);
+       var req = new Request(FETCH_CROSSREF, stype, item);
+       req.request._tree = tree;
+       req.request._item = item;
+       req.request._stype = stype;
+       req.request._cache = xrefCache;
+       req.request._treename = treeName;
+       req.callback(resultHandleXRefResponse);
+       req.send();
+}
+
 function resultFireXRefReq( treeName, stype, item ) {
        var tree;
        eval('tree=' + treeName);
index 152dc39..319a235 100644 (file)
                                <td width='50%'>Search hits per page</td>
                                <td>
                                        <select id='prefs_hits_per'>
-                                               <option>5</option>
-                                               <option>8</option>
-                                               <option>10</option>
-                                               <option>15</option>
-                                               <option>20</option>
-                                               <option>25</option>
-                                               <option>50</option>
+                                               <option value='5'>5</option>
+                                               <option value='8'>8</option>
+                                               <option value='10'>10</option>
+                                               <option value='15'>15</option>
+                                               <option value='20'>20</option>
+                                               <option value='25'>25</option>
+                                               <option value='50'>50</option>
                                        </select>
                                </td>
                        </tr>