cleaned fines display some. persisting font size via cookie and user pref
authorerickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Fri, 10 Mar 2006 14:37:56 +0000 (14:37 +0000)
committererickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Fri, 10 Mar 2006 14:37:56 +0000 (14:37 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@3317 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/src/perlmods/OpenILS/Application/Actor.pm
Open-ILS/web/opac/common/js/config.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/myopac.js
Open-ILS/web/opac/skin/default/xml/myopac/myopac_bookbags.xml
Open-ILS/web/opac/skin/default/xml/myopac/myopac_fines.xml
Open-ILS/web/opac/skin/default/xml/myopac/myopac_prefs.xml

index fc180a7..25b2653 100644 (file)
@@ -55,14 +55,17 @@ sub set_user_settings {
        return $evt if $evt;
        
 
-       my ($params) = map { 
+       #my ($params) = map { 
+       #       [{ usr => $user->id, name => $_}, {value => $$settings{$_}}] } keys %$settings;
+
+       my @params = map { 
                [{ usr => $user->id, name => $_}, {value => $$settings{$_}}] } keys %$settings;
 
-       $logger->activity("User " . $staff->id . " updating user $uid settings with: " . Dumper($params));
+       $logger->activity("User " . $staff->id . " updating user $uid settings with: " . Dumper(\@params));
 
        return $apputils->simplereq(
                'open-ils.storage',
-               'open-ils.storage.direct.actor.user_setting.batch.merge', $params );
+               'open-ils.storage.direct.actor.user_setting.batch.merge', @params );
                
 }
 
index 3da5a13..ffaa602 100644 (file)
@@ -106,6 +106,7 @@ var LOGOUT_WARNING_TIME = 30; /* "head up" for session timeout */
 /* user preferences */
 var PREF_HITS_PER = 'opac.hits_per_page';
 var PREF_BOOKBAG = 'opac.bookbag_enabled';
+var PREF_DEF_FONT = 'opac.default_font';
 
 
 /* container for global variables shared accross pages */
index 60c3e52..44b4ae2 100644 (file)
@@ -121,6 +121,7 @@ function initParams() {
 function initCookies() {
        FONTSIZE = "medium";
        var font = cookieManager.read(COOKIE_FONT);
+       scaleFonts(font);
        if(font) FONTSIZE = font;
        SKIN = cookieManager.read(COOKIE_SKIN);
 }
@@ -342,6 +343,9 @@ function grabUser(ses, force) {
        if(G.user.prefs['opac.hits_per_page'])
                COUNT = parseInt(G.user.prefs['opac.hits_per_page']);
 
+       if(G.user.prefs[PREF_DEF_FONT]) 
+               setFontSize(G.user.prefs[PREF_DEF_FONT]);
+
        var at = getAuthtime();
        if(isXUL()) at = xulG['authtime'];
 
@@ -561,10 +565,11 @@ function orgSelect(id) {
        G.ui.common.now_searching.appendChild(text(findOrgUnit(id).name()));
 }
 
-var fontCookie = new HTTP.Cookies();
+//var fontCookie = new HTTP.Cookies();
+
 function setFontSize(size) {
        scaleFonts(size);
-       fontCookie.write(COOKIE_FONT, size, '+1y');
+       cookieManager.write(COOKIE_FONT, size, '+1y');
 }
 
 
index f9a3db5..79959c2 100644 (file)
@@ -397,13 +397,15 @@ function setActivateStyleSheet(name) {
 /* ----------------------------------------------------- */
 function scaleFonts(type) {
 
-       var size = "";
-       var ssize = "";
+       var size                = "";
+       var ssize       = "";
+       var size2       = "";
        var a;
 
        switch(type) {
-               case "large": 
-                       size = "148%"; 
+               case "large":  /* these are arbitrary.. but they seem to work ok in FF/IE */
+                       size = "142%"; 
+                       size2 = "107%"; 
                        ssize = "94%";
                        break;
        }
@@ -414,6 +416,8 @@ function scaleFonts(type) {
        for (i = 0; (a = document.getElementsByTagName ("option")[i]); i++) a.style.fontSize = ssize;
        for (i = 0; (a = document.getElementsByTagName ("li")[i]); i++) a.style.fontSize = ssize;
        for (i = 0; (a = document.getElementsByTagName ("span")[i]); i++) a.style.fontSize = ssize;
+       for (i = 0; (a = document.getElementsByTagName ("select")[i]); i++) a.style.fontSize = ssize;
+       for (i = 0; (a = document.getElementsByTagName ("a")[i]); i++) a.style.fontSize = size2;
 }
 
 
index 374966e..e4a55f8 100644 (file)
@@ -354,8 +354,7 @@ function _finesFormatNumber(num) {
 
 function _trimTime(time) { if(!time) return ""; return time.replace(/\ .*/,""); }
 
-function _trimSeconds(time) { if(!time) return ""; return time.replace(/\..*/,""); }
-
+function _trimSeconds(time) { if(!time) return ""; return time.replace(/:\d\d\..*$/,""); }
 
 function myOPACShowTransactions(r) {
 
@@ -441,32 +440,40 @@ function myOPACShowCircTransaction(trans, record, circ) {
        var checkin = _trimTime(circ.stop_fines_time());
 
        $n(row,'myopac_circ_trans_due').appendChild(text(due))
-       $n(row,'myopac_circ_trans_finished').appendChild(text(checkin))
+       /*$n(row,'myopac_circ_trans_finished').appendChild(text(checkin));*/
+       if(checkin)
+               appendClear($n(row,'myopac_circ_trans_finished'), text(checkin));
 
        $n(row,'myopac_circ_trans_balance').
                appendChild(text(_finesFormatNumber(trans.balance_owed())));
 
        tbody.appendChild(row);
-       /*
-       unHideMe($('myopac_circ_trans_table'));
-       */
        unHideMe($('myopac_circ_trans_div'));
 }
 
 
 function myOPACSavePrefs() {
        G.user.prefs[PREF_HITS_PER] = getSelectorVal($('prefs_hits_per'));
+       G.user.prefs[PREF_DEF_FONT] = getSelectorVal($('prefs_def_font'));
        if(commitUserPrefs())
                alert($('prefs_update_success').innerHTML);
        else alert($('prefs_update_failure').innerHTML);
 }
 
 
+function myOPACShowDefFont() {
+       var font;
+       if(G.user.prefs[PREF_DEF_FONT])
+               font = G.user.prefs[PREF_DEF_FONT];
+       else font = "regular";
+       setSelector($('prefs_def_font'), font);
+}
+
 function myOPACShowPrefs() {
        grabUserPrefs();
        myOPACShowHitsPer();
+       myOPACShowDefFont();
        hideMe($('myopac_prefs_loading'));
-       unHideMe($('myopac_prefs_row'));
 }
 
 function myOPACShowHitsPer() {
index c826d2f..75f1e7d 100644 (file)
                <tbody id='myopac_bookbag_items_tbody'>
                        <tr id='myopac_bookbag_items_row'>
                                <td> <a name='myopac_bookbag_items_title' class='classic_link'> </a> </td>
+                               <!--
                                <td> <a name='myopac_bookbag_items_author' class='classic_link'> </a> </td>
+                               -->
+                               <td name='myopac_bookbag_items_author'> </td>
                                <td><a name='myopac_bookbag_items_remove' class='classic_link'>remove</a></td>  
                        </tr>
                </tbody>
index cb555e0..0ea672e 100644 (file)
@@ -53,7 +53,7 @@
                                        <td name='myopac_circ_trans_author'> </td>
                                        <td name='myopac_circ_trans_start'> </td>
                                        <td name='myopac_circ_trans_due'> </td>
-                                       <td name='myopac_circ_trans_finished'> </td>
+                                       <td name='myopac_circ_trans_finished'><span style='color:red;'>(fines accruing)</span></td>
                                        <td>
                                                <span style='color: red; font-weight: bold;' 
                                                        name='myopac_circ_trans_balance'>$</span>
index 248e4a8..26227b7 100644 (file)
@@ -13,8 +13,8 @@
                </thead>
 
                <tbody id='myopac_prefs_tbody'>
-                       <tr id='myopac_prefs_loading'><td>Loading...</td></tr>
-                       <tr id='myopac_prefs_row' class='light_border hide_me'>
+                       <tr id='myopac_prefs_loading'><td colspan='3'><b>Loading...</b></td></tr>
+                       <tr id='myopac_prefs_row'>
                                <td width='50%'>Search hits per page</td>
                                <td>
                                        <select id='prefs_hits_per'>
                                </td>
                        </tr>
 
+                       <tr>
+                               <td>Default Font Size</td>
+                               <td>
+                                       <select id='prefs_def_font'>
+                                               <option value='regular'>Regular Font</option>
+                                               <option value='large'>Large Font</option>
+                                       </select>
+                               </td>
+                       </tr>
+
                        <tr><td colspan='2'><br/></td></tr>
 
                        <tr>
                                </td>
                        </tr>
 
-                       <!--
-                       <tr>
-                               <td colspan='2' align='center'><br/><b> * More To Come...</b></td>
-                       </tr>
-                       -->
-
                </tbody>
        </table>