added first part of myopac, minor changes
authorerickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 13 Oct 2005 14:47:44 +0000 (14:47 +0000)
committererickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 13 Oct 2005 14:47:44 +0000 (14:47 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@1910 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/web/opac/common/js/RemoteRequest.js
Open-ILS/web/opac/common/js/config.js
Open-ILS/web/opac/common/js/opac_utils.js
Open-ILS/web/opac/skin/default/css/layout.css
Open-ILS/web/opac/skin/default/js/mresult.js
Open-ILS/web/opac/skin/default/js/search_bar.js
Open-ILS/web/opac/skin/default/js/sidebar.js
Open-ILS/web/opac/skin/default/xml/index.xml
Open-ILS/web/opac/skin/default/xml/mresult.xml
Open-ILS/web/opac/skin/default/xml/myopac.xml
Open-ILS/web/opac/theme/default/css/colors.css

index fd33111..c01adcf 100644 (file)
@@ -102,6 +102,9 @@ function _remoteRequestCallback(id) {
                                to XML_HTTP_MAX_TRIES attempts */
                        if( E && E.classname == "EXCommunication" ) {
 
+                               //try { dump('Communication Error: ' + E ); } catch(e){}
+                               alert('Debug:  Communication Error: ' + E );
+
                                if(object.sendCount >= XML_HTTP_MAX_TRIES ) {
                                        if(isXUL()) throw object;
                                         else alert("Arrrgghh, Matey! Error communicating:\n" + E  + "\n" + object.param_string);
@@ -169,7 +172,8 @@ RemoteRequest.prototype.send = function(blocking) {
                                'application/x-www-form-urlencoded');
        }
 
-       this.xmlhttp.send( data );
+       try{ this.xmlhttp.send( data ); } catch(e){}
+
        this.sendCount += 1;
        return this;
 }
@@ -187,6 +191,7 @@ RemoteRequest.prototype.isReady = function() {
 /* returns the JSON->js result object  */
 RemoteRequest.prototype.getResultObject = function() {
        if(this.cancelled) return null;
+       if(!this.xmlhttp) return null;
 
        var text = this.xmlhttp.responseText;
        var obj = JSON2js(text);
index f6b47c2..701b062 100644 (file)
@@ -189,6 +189,7 @@ var UPDATE_USER_PREFS                       = "open-ils.actor:open-ils.actor.patron.settings.update"
 var FETCH_COPY_STATUSES                        = "open-ils.search:open-ils.search.config.copy_status.retrieve.all";
 var FETCH_COPY_COUNTS_SUMMARY  = "open-ils.search:open-ils.search.biblio.copy_counts.summary.retrieve";
 var FETCH_MARC_HTML                            = "open-ils.search:open-ils.search.biblio.record.html";
+var FETCH_CHECKED_OUT                  = "open-ils.circ:open-ils.circ.actor.user.checked_out";
 /* ---------------------------------------------------------------------------- */
 
 
@@ -235,6 +236,8 @@ 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 */
+
 
 
 
index 42e4694..837d9b8 100644 (file)
@@ -295,12 +295,14 @@ function grabFleshedUser() {
 var skinCookie = new cookieObject("skin", 1, "/", COOKIE_SKIN);
 function checkUserSkin(new_skin) {
 
+       return; /* XXX do some debugging with this... */
+
        var user_skin = getSkin();
        var cur_skin = grabSkinFromURL();
 
        if(new_skin) user_skin = new_skin;
 
-       if(isNull(user_skin)) {
+       if(!user_skin) {
 
                if(grabUser()) {
                        if(grabUserPrefs()) {
@@ -311,7 +313,7 @@ function checkUserSkin(new_skin) {
                }
        }
 
-       if(isNull(user_skin)) return;
+       if(!user_skin) return;
 
        if( cur_skin != user_skin ) {
                var url = buildOPACLink();
@@ -364,13 +366,17 @@ function doLogin() {
    var auth_request = new Request( LOGIN_COMPLETE, 
                uname, hex_md5(seed + hex_md5(passwd)), "opac");
 
+
    auth_request.send(true);
    var auth_result = auth_request.result();
 
-   if(auth_result == '0' || auth_result == null || auth_result.length == 0) { return false; }
+   if(auth_result == '0' || auth_result == null || auth_result.length == 0) { 
+               alert("Login failed");
+               return false; 
+       }
 
        var u = grabUser(auth_result, true);
-       if(u) updateLoc(u.home_ou(), findOrgDepth(u.home_ou()));
+       if(u) runEvt( "common", "locationChanged", u.home_ou(), findOrgDepth(u.home_ou()) );
 
        checkUserSkin();
 
@@ -388,13 +394,22 @@ function doLogout() {
 
        G.user = null;
        cookie.remove(COOKIE_SES);
+       skinCookie.remove(COOKIE_SKIN);
+       checkUserSkin("default");
+
+       var args = {};
+       args[PARAM_TERM] = "";
+       args[PARAM_LOCATION] = globalOrgTree.id();
+       args[PARAM_DEPTH] = findOrgDepth(globalOrgTree);
+       args.page = "home";
 
+       goTo(buildOPACLink(args));
+
+       /*
        hideMe(G.ui.sidebar.logoutbox);
        unHideMe(G.ui.sidebar.loginbox);
        hideMe(G.ui.sidebar.logged_in_as);
-       skinCookie.remove(COOKIE_SKIN);
-
-       checkUserSkin("default");
+       */
 }
 
 
@@ -520,5 +535,12 @@ function setResourcePic( img, resource ) {
 
 
 
+function msg( text ) {
+       try {
+               alert( text );
+       } catch(e) {}
+}
+
+
 
 
index b6be373..22df586 100644 (file)
@@ -10,6 +10,8 @@ table { border-collapse: collapse; }
 
 .encircled { border: 1px solid black; }
 
+.light_border { border: 1px solid #E0E0E0; }
+
 #main_table { border-collapse: collapse; width: 100%; height: 100%; }
 #main_left_cell { height: 100%; width: 20%; vertical-align: top;margin: 0px; padding: 0px;}
 #main_right_cell { height: 100%; width: 80%; vertical-align: top; margin: 0px; padding:0px;}
@@ -48,7 +50,12 @@ table { border-collapse: collapse; }
 
 .sidebar_extra_item { padding: 0px; margin-right: 8px;}
 .side_bar_item { padding-left: 8px; padding-right: 8px; padding-top: 4px; padding-bottom: 4px; margin-right: 8px; }
+
 .sidebar_item_active { background: #A7EA9D; margin-right: 0px; }
+
+/*
+.sidebar_item_active { background: #035E47; margin-right: 0px; }
+*/
 .sidebar_chunk { width: 100%; }
 
 /*
@@ -114,5 +121,11 @@ border-left: 1px solid #E0E0E0; border-top: 1px solid #E0E0E0; border-bottom: 1p
 .dim2 { filter:alpha(opacity=50); -moz-opacity:0.5; opacity: 0.5; text-decoration: none; }
 .dim { filter:alpha(opacity=10); -moz-opacity:0.1; opacity: 0.1; text-decoration: none; }
 
+/* ---------------------------------------------------------------------- */
+
+.myopac_link { width: 25%; margin: 3px; padding: 3px; text-align: center; vertical-align: middle; }
+
+.myopac_table thead { padding: 2px; font-weight: 600;}
+.myopac_table td { padding: 3px; };
 
 
index 3780903..d56fb82 100644 (file)
@@ -23,7 +23,7 @@ function mresultDoSearch() {
        //      mresultGetCount(); 
                mresultCollectIds(FETCH_MRIDS_FULL); 
        } else { 
-               runEvt('result', 'hitCountReceived');
+               //runEvt('result', 'hitCountReceived');
                mresultCollectIds(FETCH_MRIDS);
        }
 }
@@ -57,13 +57,14 @@ function mresultCollectIds(method) {
        if(     getOffset() != 0 && 
                        records[getOffset()] != null && 
                        records[resultFinalPageIndex()] != null) {
+                       runEvt('result', 'hitCountReceived');
                        mresultCollectRecords(); 
 
        } else {
 
                var form = (getForm() == "all") ? null : getForm();
                var req = new Request(method, getStype(), getTerm(), 
-                       getLocation(), getDepth(), getDisplayCount() * 5, getOffset(), form );
+                       getLocation(), getDepth(), 100, getOffset(), form );
                req.callback(mresultHandleMRIds);
                req.send();
        }
@@ -73,7 +74,7 @@ function mresultHandleMRIds(r) {
        var res = r.getResultObject();
 
        if(res.count != null) {
-               HITCOUNT = res.count;
+               if( getOffset() == 0 ) HITCOUNT = res.count;
                runEvt('result', 'hitCountReceived');
        } 
        runEvt('result', 'idsReceived', res.ids);
@@ -97,6 +98,7 @@ function mresultCollectRecords() {
        var i = 0;
        for( var x = getOffset(); x!= getDisplayCount() + getOffset(); x++ ) {
                if(isNull(records[x])) break;
+               if(isNaN(records[x])) continue;
                var req = new Request(FETCH_MRMODS, records[x]);
                req.request.userdata = i++;
                req.callback(mresultHandleMods);
index 062572f..9a0a383 100644 (file)
@@ -112,8 +112,16 @@ function updateLoc(location, depth) {
                setSelector(G.ui.searchbar.depth_selector, depth);
                newSearchDepth = depth;
        }
-       if(!isFrontPage)
+
+       if(!isFrontPage && (findCurrentPage() != MYOPAC))
                searchBarSubmit();
+
+       alert(findCurrentPage());
+       /*
+       alert(MYOPAC);
+       alert(findCurrentPage() == MYOPAC);
+       */
+
 }
 
 
index 2ca5168..39e2219 100644 (file)
@@ -44,6 +44,21 @@ function initSideBar() {
 
 /* sets up the login ui components */
 var loginBoxVisible = false;
+
+/*
+function loginDance() {
+       if(doLogin()) {
+               showCanvas();
+               G.ui.sidebar.username_dest.appendChild(text(G.user.usrname()));
+               unHideMe(G.ui.sidebar.logoutbox);
+               unHideMe(G.ui.sidebar.logged_in_as);
+               hideMe(G.ui.sidebar.loginbox);
+               return true;
+       }
+       return false;
+}
+*/
+
 function initLogin() {
 
        var loginDance = function() {
@@ -53,6 +68,7 @@ function initLogin() {
                        unHideMe(G.ui.sidebar.logoutbox);
                        unHideMe(G.ui.sidebar.logged_in_as);
                        hideMe(G.ui.sidebar.loginbox);
+                       runEvt("common", "loggedIn");
                }
        }
 
@@ -66,7 +82,7 @@ function initLogin() {
                showCanvas();
        } else {
                swapCanvas(G.ui.login.box);
-               G.ui.login.username.focus();
+               try{G.ui.login.username.focus();}catch(e){}
        }
 
        loginBoxVisible = !loginBoxVisible;
index ce4b3b0..4bbd6c7 100644 (file)
@@ -22,7 +22,9 @@
 
        </head>
 
-       <body onload='init();'>
+       <body onload='init(); 
+               getId("home_adv_search_link").setAttribute("href", buildOPACLink({page:ADVANCED}));
+               getId("home_myopac_link").setAttribute("href", buildOPACLink({page:MYOPAC}, false, true));'>
                <table width='100%' style='border-collapse: collapse;'>
                        <tbody>
                                <tr>
index 5b05385..766fc4a 100644 (file)
@@ -1,8 +1,7 @@
 <?xml version='1.0'?>
 <!DOCTYPE x [ <!ENTITY % ent SYSTEM "../../../locale/en-US/lang.dtd"> %ent; ]>
 
-<html xmlns="http://www.w3.org/1999/xhtml" 
-       xmlns:xi="http://www.w3.org/2001/XInclude" xml:lang="en" lang="en">
+<html xmlns="http://www.w3.org/1999/xhtml" xmlns:xi="http://www.w3.org/2001/XInclude">
 
        <head>
                <title>Evergreen: Title Groups</title>
index 8eeb799..5d8780e 100644 (file)
@@ -7,6 +7,18 @@
                <title>Evergreen: My OPAC</title>
                <xi:include href="css_common.xml#xpointer(//link)"/>
                <xi:include href="js_common.xml#xpointer(//script)"/>
+               <script language='javascript' src='../js/myopac.js'> </script>
+
+               <!-- overwrite the fieldmapper code with the extended fieldmapper code -->
+               <script language='javascript' src='../../../common/js/fmextcore.js'> </script>
+               <script language='javascript' src='../../../common/js/fmgen.js'> </script>
+
+               <script language='javascript'>
+                       config.ids.myopac = {};
+                       config.css.myopac = {};
+                       config.names.myopac = {};
+               </script>
+
        </head>
 
        <body onload="init();">
                                                <xi:include href="sidebar.xml"/> 
                                        </td>
                                        <td style='padding-left: 6px;' valign='top' width='80%'>
+
                                                <div id='canvas' class='canvas'>
-                                               <xi:include href="searchbar.xml"/>
-                                               <xi:include href="statusbar.xml"/>
-                                               <xi:include href="altcanvas.xml"/>
-                                               <div id='canvas_main'>My OPAC Goes Here</div>
-                                       </div>
+                                                       <xi:include href="searchbar.xml"/>
+                                                       <xi:include href="statusbar.xml"/>
+                                                       <xi:include href="altcanvas.xml"/>
+                                                       <div id='canvas_main'>
+
+                                                               <table style='width: 70%'>
+                                                                       <tbody>
+                                                                               <tr id='myopac_nav_row' style='border: 1px solid #E0E0E0;'>
+       
+                                                                                       <td class='myopac_link color_3' id='myopac_checked_td' >
+                                                                                               <a href='javascript:void(0);' 
+                                                                                                       onclick='myOPACChangePage("checked");'> Checked Out</a>
+                                                                                       </td>
+       
+                                                                                       <td class='myopac_link' id='myopac_holds_td' >
+                                                                                               <a href='javascript:void(0);' 
+                                                                                                       onclick='myOPACChangePage("holds");'>Holds</a>
+                                                                                       </td>
+       
+                                                                                       <td class='myopac_link' id='myopac_fines_td' >
+                                                                                               <a href='javascript:void(0);' 
+                                                                                                       onclick='myOPACChangePage("fines");'>Fines</a>
+                                                                                       </td>
+       
+                                                                                       <td class='myopac_link' id='myopac_prefs_td' >
+                                                                                               <a href='javascript:void(0);' 
+                                                                                                       onclick='myOPACChangePage("prefs");'>Account Preferences</a>
+                                                                                       </td>
+       
+                                                                               </tr>
+                                                                       </tbody>
+                                                               </table>
+       
+                                                               <br/><br/>
+       
+                                                               <div id='myopac_main_div'>
+                                                                       <xi:include href="myopac_checked.xml"/>
+                                                                       <xi:include href="myopac_holds.xml"/>
+                                                                       <xi:include href="myopac_fines.xml"/>
+                                                                       <xi:include href="myopac_prefs.xml"/>
+                                                               </div>
+       
+                                                       </div>
+
+                                               </div> <!-- canvas -->
                                        </td>
                                </tr>
                        </tbody>
index 6a37fa0..77a66a0 100644 (file)
@@ -6,6 +6,12 @@ body a:hover   { color: red; text-decoration: underline;}
 .color_2 { background: #64EA4F; color: #000000; }
 .color_3 { background: #CCFFFF; color: #000000; }
 
+/*
+.color_1 { background: #4D8444; color: #000000; }
+.color_2 { background: #168405; color: #000000; }
+.color_3 { background: #035E47; color: #000000; }
+*/
+
 /* ---------------------------------------------------------------------- */
 .sidebar_chunk {}
 .sidebar_extra_link { text-decoration: none; }