backporting from staff-client-experiment: some layout experiments with patron display
authorphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Sun, 22 Feb 2009 01:03:54 +0000 (01:03 +0000)
committerphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Sun, 22 Feb 2009 01:03:54 +0000 (01:03 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@12250 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/xul/staff_client/chrome/content/OpenILS/data.js
Open-ILS/xul/staff_client/chrome/content/main/constants.js
Open-ILS/xul/staff_client/server/admin/org_unit_settings.xhtml
Open-ILS/xul/staff_client/server/patron/display.js
Open-ILS/xul/staff_client/server/patron/display.xul
Open-ILS/xul/staff_client/server/patron/display_overlay.xul
Open-ILS/xul/staff_client/server/patron/summary.js
Open-ILS/xul/staff_client/server/patron/summary.xul
Open-ILS/xul/staff_client/server/patron/summary_overlay_horiz.xul [new file with mode: 0644]

index 1a60bed..2445af3 100644 (file)
@@ -638,7 +638,23 @@ OpenILS.data.prototype = {
                        }
                );
 
-               // Do this after we get the user object
+               // Do these after we get the user object
+
+               this.chain.push(
+                       function() {
+                               try {
+                                       var robj = obj.network.simple_request('FM_AOUS_RETRIEVE',[ obj.list.au[0].ws_ou() ]);
+                                       if (typeof robj.ilsevent != 'undefined') throw(robj);
+                                       obj.hash.aous = robj;
+                                       obj.data_progress('Retrieved org unit settings. ');
+                               } catch(E) {
+                                       var error = 'Error: ' + js2JSON(E);
+                                       obj.error.sdump('D_ERROR',error);
+                                       throw(E);
+                               }
+                       }
+               );
+
                this.chain.push(
 
                        function() {
index 5e2941e..795f27c 100644 (file)
@@ -105,6 +105,7 @@ const api = {
        'FM_AOU_RETRIEVE_RELATED_VIA_SESSION' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.org_unit.full_path.retrieve' },
        'FM_AOU_IDS_RETRIEVE_VIA_RECORD_ID' : { 'app' : 'open-ils.cat', 'method' : 'open-ils.cat.actor.org_unit.retrieve_by_title', 'secure' : false },
        'FM_AOU_IDS_RETRIEVE_VIA_RECORD_ID.authoritative' : { 'app' : 'open-ils.cat', 'method' : 'open-ils.cat.actor.org_unit.retrieve_by_title.authoritative', 'secure' : false },
+    'FM_AOUS_RETRIEVE' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.org_unit.settings.retrieve', 'secure' : false },
        'FM_AOUT_RETRIEVE' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.org_types.retrieve', 'secure' : false },
        'FM_ASC_BATCH_RETRIEVE' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.stat_cat.asset.retrieve.batch', 'secure' : false },
        'FM_ASC_RETRIEVE_VIA_AOU' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.stat_cat.asset.retrieve.all', 'secure' : false },
index eef3ff9..e9a975b 100644 (file)
                     label : '&staff.server.admin.org_settings.patron.password.use_phone;',
                     desc : '&staff.server.admin.org_settings.patron.password.use_phone.desc;',
                     type : 'bool'
-                }
+                },
+               'ui.circ.patron_summary.horizontal' : {
+                   label : '&ui.circ.patron_summary.horizontal;',
+                   desc : '&ui.circ.patron_summary.horizontal.desc;',
+                   type : 'bool'
+               }
             };
         </script>
     </head>
index b89f69b..fb9b84b 100644 (file)
@@ -26,13 +26,17 @@ patron.display.prototype = {
 
                JSAN.use('OpenILS.data'); this.OpenILS = {}; 
                obj.OpenILS.data = new OpenILS.data(); obj.OpenILS.data.init({'via':'stash'});
-
+               
+               var horizontal_interface = String( obj.OpenILS.data.hash.aous['ui.circ.patron_summary.horizontal'] ) == 'true';
+               document.getElementById('ui.circ.patron_summary.horizontal').setAttribute('orient', horizontal_interface ? 'vertical' : 'horizontal');
+               document.getElementById('pdms1').setAttribute('orient', horizontal_interface ? 'vertical' : 'horizontal');
+               
                JSAN.use('util.deck'); 
                obj.right_deck = new util.deck('patron_right_deck');
                obj.left_deck = new util.deck('patron_left_deck');
 
                function spawn_checkout_interface() {
-            try { document.getElementById("PatronNavBarScrollbox").ensureElementIsVisible( document.getElementById("PatronNavBar_checkout" ) ); } catch(E) {};
+                   try { document.getElementById("PatronNavBarScrollbox").ensureElementIsVisible( document.getElementById("PatronNavBar_checkout" ) ); } catch(E) {};
                        obj.reset_nav_styling('cmd_patron_checkout');
                        var frame = obj.right_deck.set_iframe(
                                urls.XUL_CHECKOUT,
@@ -262,11 +266,17 @@ patron.display.prototype = {
                                                        );
                                                }
                                        ],
+                    'cmd_patron_other' : [
+                                               ['command'],
+                                               function(ev) {
+                            try { document.getElementById("PatronNavBarScrollbox").ensureElementIsVisible( document.getElementById("PatronNavBar_other" ) ); } catch(E) {};
+                                                       obj.reset_nav_styling('cmd_patron_other');
+                            try { document.getElementById('PatronNavBar_other').firstChild.showPopup(); } catch(E) {};
+                        }
+                    ],
                                        'cmd_patron_info' : [
                                                ['command'],
                                                function(ev) {
-                            try { document.getElementById("PatronNavBarScrollbox").ensureElementIsVisible( document.getElementById("PatronNavBar_info" ) ); } catch(E) {};
-                                                       obj.reset_nav_styling('cmd_patron_info');
                                                        obj.right_deck.set_iframe(
                                                                urls.XUL_PATRON_INFO, // + '?patron_id=' + window.escape( obj.patron.id() ),
                                                                {},
@@ -278,6 +288,16 @@ patron.display.prototype = {
                                                        );
                                                }
                                        ],
+                    'cmd_patron_alert' : [
+                        ['command'],
+                        function(ev) {
+                            if (obj.msg_url) {
+                                obj.right_deck.set_iframe('data:text/html,'+obj.msg_url,{},{});
+                            } else {
+                                obj.right_deck.set_iframe('data:text/html,<h1>' + $("patronStrings").getString('staff.patron.display.no_alerts_or_messages') + '</h1>',{},{});
+                            }
+                        }
+                    ],
                                        'cmd_patron_exit' : [
                                                ['command'],
                                                function(ev) {
@@ -294,6 +314,7 @@ patron.display.prototype = {
                                                                //+ '?patron_id=' + window.escape( obj.patron.id() ),
                                                                {},
                                                                {
+                                    'display_window' : window,
                                                                        'patron_id' : obj.patron.id(),
                                                                        'on_list_change' : function(h) {
                                                                                netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
@@ -402,7 +423,7 @@ patron.display.prototype = {
         x.addEventListener( 'focus', function(xx) { return function() { try { document.getElementById("PatronNavBarScrollbox").ensureElementIsVisible(xx); } catch(E) {}; } }(x), false);
         var x = document.getElementById("PatronNavBar_holds");
         x.addEventListener( 'focus', function(xx) { return function() { try { document.getElementById("PatronNavBarScrollbox").ensureElementIsVisible(xx); } catch(E) {}; } }(x), false);
-        var x = document.getElementById("PatronNavBar_info");
+        var x = document.getElementById("PatronNavBar_other");
         x.addEventListener( 'focus', function(xx) { return function() { try { document.getElementById("PatronNavBarScrollbox").ensureElementIsVisible(xx); } catch(E) {}; } }(x), false);
         var x = document.getElementById("PatronNavBar_edit");
         x.addEventListener( 'focus', function(xx) { return function() { try { document.getElementById("PatronNavBarScrollbox").ensureElementIsVisible(xx); } catch(E) {}; } }(x), false);
@@ -430,13 +451,13 @@ patron.display.prototype = {
                        obj.controller.view.cmd_patron_holds.setAttribute('disabled','true');
                        obj.controller.view.cmd_patron_bills.setAttribute('disabled','true');
                        obj.controller.view.cmd_patron_edit.setAttribute('disabled','true');
-                       obj.controller.view.cmd_patron_info.setAttribute('disabled','true');
                        obj.controller.view.patron_name.setAttribute('value', $("patronStrings").getString('staff.patron.display.init.retrieving'));
                        document.documentElement.setAttribute('class','');
                        var frame = obj.left_deck.set_iframe(
                                urls.XUL_PATRON_SUMMARY,
                                {},
                                {
+                    'display_window' : window,
                                        'barcode' : obj.barcode,
                                        'id' : obj.id,
                     'refresh' : function() { obj.refresh_all(); },
@@ -450,7 +471,6 @@ patron.display.prototype = {
                                                obj.controller.view.cmd_patron_holds.setAttribute('disabled','false');
                                                obj.controller.view.cmd_patron_bills.setAttribute('disabled','false');
                                                obj.controller.view.cmd_patron_edit.setAttribute('disabled','false');
-                                               obj.controller.view.cmd_patron_info.setAttribute('disabled','false');
 
                                                if (typeof window.xulG == 'object' && typeof window.xulG.set_tab_name == 'function') {
                                                        try { 
@@ -530,6 +550,7 @@ patron.display.prototype = {
                                                                                                + $("patronStrings").getString('staff.patron.display.init.network_request.window_message') + '</pre></blockquote>');
                                                                                        obj.right_deck.set_iframe('data:text/html,'+data_url,{},{});
                                                                                        obj.old_msg = msg;
+                                            obj.msg_url = data_url;
                                                                                } else {
                                                                                        obj.error.sdump('D_TRACE',$("patronStrings").getFormattedString('staff.patron.display.init.network_request.dump_error_message', [msg]));
                                                                                }
@@ -572,13 +593,17 @@ patron.display.prototype = {
        },
 
        'reset_nav_styling' : function(btn) {
-               this.controller.view.cmd_patron_checkout.setAttribute('style','');
-               this.controller.view.cmd_patron_items.setAttribute('style','');
-               this.controller.view.cmd_patron_edit.setAttribute('style','');
-               this.controller.view.cmd_patron_info.setAttribute('style','');
-               this.controller.view.cmd_patron_holds.setAttribute('style','');
-               this.controller.view.cmd_patron_bills.setAttribute('style','');
-               this.controller.view[ btn ].setAttribute('style','background: blue; color: white;');
+        try {
+            this.controller.view.cmd_patron_checkout.setAttribute('style','');
+            this.controller.view.cmd_patron_items.setAttribute('style','');
+            this.controller.view.cmd_patron_edit.setAttribute('style','');
+            this.controller.view.cmd_patron_other.setAttribute('style','');
+            this.controller.view.cmd_patron_holds.setAttribute('style','');
+            this.controller.view.cmd_patron_bills.setAttribute('style','');
+            this.controller.view[ btn ].setAttribute('style','background: blue; color: white;');
+        } catch(E) {
+            alert(E);
+        }
        },
 
        'render_search_form' : function(params) {
index 8a92926..1acc79c 100644 (file)
@@ -96,6 +96,8 @@
                <command id="cmd_patron_bills" />
                <command id="cmd_patron_edit" />
                <command id="cmd_patron_info" />
+               <command id="cmd_patron_other" />
+               <command id="cmd_patron_alert" />
                <command id="cmd_patron_exit" />
                <command id="cmd_patron_retrieve" />
                <command id="cmd_patron_merge" />
index e02630d..4fd6979 100644 (file)
                <label class="hideme invalid_address_indicator" value="&staff.patron.display_overlay.invalid_address.value;"/>
        </hbox>
        <hbox id="PatronNotNavBar" flex="1" class="my_bg">
-               <vbox id="pdm3" flex="1" persist="width">
-                       <deck id="patron_left_deck"/>
-               </vbox>
-               <splitter id="pdms1" collapse="before" persist="state hidden"><grippy id="pdmsg1"/></splitter>
-               <vbox id="pdm4" flex="3" persist="width">
-                       <deck id="patron_right_deck"/>
-               </vbox>
-       
+               <box id="ui.circ.patron_summary.horizontal" orient="horizontal" flex="1">
+                       <vbox id="pdm3" flex="1"> 
+                               <deck id="patron_left_deck"/>
+                       </vbox>
+                       <splitter id="pdms1" orient="horizontal" collapse="before" persist="state hidden"><grippy id="pdmsg1"/></splitter>
+                       <vbox id="pdm4" flex="9">
+                               <deck id="patron_right_deck"/>
+                       </vbox>
+                </box> 
        </hbox>
 </vbox>
 </box>
 
 <deck id="patron_right_deck" flex="1">
 </deck>
+
 <deck id="patron_left_deck" flex="1">
 </deck>
 
             <spacer flex="1"/>
             <arrowscrollbox id="PatronNavBarScrollbox" orient="horizontal" flex="1">
                 <spacer flex="1"/>
-                <button id="PatronNavBar_refresh" command="cmd_patron_refresh" class="nav"
-                    label="&staff.patron_navbar.refresh;" accesskey="&staff.patron_navbar.refresh.accesskey;"/>
-                <button id="PatronNavBar_checkout" command="cmd_patron_checkout" class="nav"
-                    label="&staff.patron_navbar.checkout;" accesskey="&staff.patron_navbar.checkout.accesskey;"/>
-                <button id="PatronNavBar_items" command="cmd_patron_items" class="nav"
-                    label="&staff.patron_navbar.items;" accesskey="&staff.patron_navbar.items.accesskey;"/>
-                <button id="PatronNavBar_holds" command="cmd_patron_holds" class="nav"
-                    label="&staff.patron_navbar.holds;" accesskey="&staff.patron_navbar.holds.accesskey;"/>
-                <button id="PatronNavBar_bills" command="cmd_patron_bills" class="nav"
-                    label="&staff.patron_navbar.bills;" accesskey="&staff.patron_navbar.bills.accesskey;"/>
-                <button id="PatronNavBar_edit" command="cmd_patron_edit" class="nav"
-                    label="&staff.patron_navbar.edit;" accesskey="&staff.patron_navbar.edit.accesskey;"/>
-                <button id="PatronNavBar_info" command="cmd_patron_info" class="nav"
-                    label="&staff.patron_navbar.info;" accesskey="&staff.patron_navbar.info.accesskey;"/>
-                <button id="PatronNavBar_exit" command="cmd_patron_exit" class="nav"
-                    label="&staff.patron.display_overlay.exit.label;" accesskey="&staff.patron.display_overlay.exit.accesskey;"/>
+                <grid>
+                    <columns>
+                        <column/>
+                        <column/>
+                        <column/>
+                        <column/>
+                        <column/>
+                        <column/>
+                        <column/>
+                        <column/>
+                    </columns>
+                    <rows>
+                        <row>
+                            <button id="PatronNavBar_refresh" command="cmd_patron_refresh" class="nav"
+                                label="&staff.patron_navbar.refresh;" accesskey="&staff.patron_navbar.refresh.accesskey;"/>
+                            <button id="PatronNavBar_checkout" command="cmd_patron_checkout" class="nav"
+                                label="&staff.patron_navbar.checkout;" accesskey="&staff.patron_navbar.checkout.accesskey;"/>
+                            <button id="PatronNavBar_items" command="cmd_patron_items" class="nav"
+                                label="&staff.patron_navbar.items;" accesskey="&staff.patron_navbar.items.accesskey;"/>
+                            <button id="PatronNavBar_holds" command="cmd_patron_holds" class="nav"
+                                label="&staff.patron_navbar.holds;" accesskey="&staff.patron_navbar.holds.accesskey;"/>
+                            <button id="PatronNavBar_bills" command="cmd_patron_bills" class="nav"
+                                label="&staff.patron_navbar.bills;" accesskey="&staff.patron_navbar.bills.accesskey;"/>
+                            <button id="PatronNavBar_edit" command="cmd_patron_edit" class="nav"
+                                label="&staff.patron_navbar.edit;" accesskey="&staff.patron_navbar.edit.accesskey;"/>
+                            <button id="PatronNavBar_other" command="cmd_patron_other" class="nav" label="&staff.patron_navbar.other;" accesskey="&staff.patron_navbar.other.accesskey;" type="menu">
+                                <menupopup>
+                                    <menuitem label="&staff.patron_navbar.alert;" accesskey="&staff.patron_navbar.alert.accesskey;" command="cmd_patron_alert"/>
+                                    <menuitem label="&staff.patron_navbar.info;" conflicting_accesskey="&staff.patron_navbar.info.accesskey;" command="cmd_patron_info"/>
+                                    <menuitem label="&staff.patron_display.verify_password.label;" accesskey="&staff.patron_display.verify_password.accesskey;" command="cmd_verify_credentials"/>
+                                    <menuitem label="&staff.main.menu.admin.user_edit.label;" accesskey="&staff.main.menu.admin.user_edit.accesskey;" command="cmd_perm_editor"/>
+                                    <menuitem label="&staff.patron_navbar.actions.menu.standing_penalties.label;" accesskey="&staff.patron_navbar.actions.menu.standing_penalties.accesskey;" 
+                                        command="cmd_standing_penalties"/>
+                                </menupopup>
+                            </button>
+                            <button id="PatronNavBar_exit" command="cmd_patron_exit" class="nav"
+                                label="&staff.patron.display_overlay.exit.label;" accesskey="&staff.patron.display_overlay.exit.accesskey;"/>
+                        </row>
+                        <row>
+                            <label id="under_refresh"/>
+                            <label id="under_checkout"/>
+                            <label id="under_items"/>
+                            <label id="under_holds"/>
+                            <label id="under_bills"/>
+                            <label id="under_edit"/>
+                            <label id="under_info"/>
+                            <label id="under_edit"/>
+                        </row>
+                    </rows>
+                </grid>
             </arrowscrollbox>
         </hbox>
-        <hbox>
-            <spacer flex="1"/>
-            <menubar>
-                <menu label="&staff.patron_navbar.actions.menu.label;" accesskey="&staff.patron_navbar.actions.menu.accesskey;">
-                    <menupopup>
-                        <menuitem label="&staff.patron_display.verify_password.label;" accesskey="&staff.patron_display.verify_password.accesskey;" command="cmd_verify_credentials"/>
-                        <menuitem label="&staff.main.menu.admin.user_edit.label;" accesskey="&staff.main.menu.admin.user_edit.accesskey;" command="cmd_perm_editor"/>
-                        <menuitem label="&staff.patron_navbar.actions.menu.standing_penalties.label;" accesskey="&staff.patron_navbar.actions.menu.standing_penalties.accesskey;" 
-                            command="cmd_standing_penalties"/>
-                    </menupopup>
-                </menu>
-            </menubar>
-        </hbox>
     </vbox>
 </hbox>
 
index 5d212d2..7f84681 100644 (file)
@@ -188,6 +188,13 @@ patron.summary.prototype = {
                                                function(e) {
                                                        return function() { 
                                                                e.setAttribute('value','...');
+                                var under_btn; 
+                                if (xulG) {
+                                    if (xulG.display_window) {
+                                        under_btn = xulG.display_window.document.getElementById('under_bills');
+                                        if (under_btn) under_btn.setAttribute('value','...');
+                                    }
+                                }
                                                                obj.network.simple_request(
                                                                        'FM_MOUS_RETRIEVE.authoritative',
                                                                        [ ses(), obj.patron.id() ],
@@ -195,6 +202,8 @@ patron.summary.prototype = {
                                                                                JSAN.use('util.money');
                                                                                var robj = req.getResultObject();
                                                                                e.setAttribute('value', patronStrings.getFormattedString('staff.patron.summary.patron_bill.money', [util.money.sanitize( robj.balance_owed() )]));
+                                                                               if (under_btn) under_btn.setAttribute('value', 
+                                            patronStrings.getFormattedString('staff.patron.summary.patron_bill.money', [util.money.sanitize( robj.balance_owed() )]));
                                                                        }
                                                                );
                                                                /*
@@ -232,6 +241,13 @@ patron.summary.prototype = {
                                                                var e4 = document.getElementById( 'patron_long_overdue' ); if (e4) e4.setAttribute('value','...');
                                                                var e5 = document.getElementById( 'patron_lost' ); if (e5) e5.setAttribute('value','...');
                                                                var e6 = document.getElementById( 'patron_noncat' ); if (e6) e6.setAttribute('value','...');
+                                var under_btn; 
+                                if (xulG) {
+                                    if (xulG.display_window) {
+                                        under_btn = xulG.display_window.document.getElementById('under_items');
+                                        if (under_btn) under_btn.setAttribute('value','...');
+                                    }
+                                }
                                                                obj.network.simple_request(
                                                                        'FM_CIRC_COUNT_RETRIEVE_VIA_USER.authoritative',
                                                                        [ ses(), obj.patron.id() ],
@@ -243,6 +259,10 @@ patron.summary.prototype = {
                                                                                        if (e3) e3.setAttribute('value', robj.claims_returned   );
                                                                                        if (e4) e4.setAttribute('value', robj.long_overdue      );
                                                                                        if (e5) e5.setAttribute('value', robj.lost      );
+                                            if (under_btn) under_btn.setAttribute('value', 
+                                                String( robj.out + robj.overdue + robj.claims_returned + robj.long_overdue) + 
+                                                ( robj.overdue > 0 || robj.claims_returned > 0 || robj.long_overdue > 0 ? '*' : '' )
+                                            );
                                                                                } catch(E) {
                                                                                        alert(E);
                                                                                }
@@ -274,6 +294,13 @@ patron.summary.prototype = {
                                                                e.setAttribute('value','...');
                                                                var e2 = document.getElementById('patron_holds_available');
                                                                if (e2) e2.setAttribute('value','...');
+                                var under_btn; 
+                                if (xulG) {
+                                    if (xulG.display_window) {
+                                        under_btn = xulG.display_window.document.getElementById('under_holds');
+                                        if (under_btn) under_btn.setAttribute('value','...');
+                                    }
+                                }
                                                                obj.network.simple_request(
                                                                        'FM_AHR_COUNT_RETRIEVE.authoritative',
                                                                        [ ses(), obj.patron.id() ],
@@ -284,6 +311,7 @@ patron.summary.prototype = {
                                                                                if (e2) e2.setAttribute('value',
                                                                                        req.getResultObject().ready
                                                                                );
+                                        if (under_btn) under_btn.setAttribute( 'value', req.getResultObject().ready + '/' + req.getResultObject().total );
                                                                        }
                                                                );
                                                        };
@@ -365,7 +393,7 @@ patron.summary.prototype = {
                                                                        patronStrings.getString('staff.patron.summary.expires_on') + ' ' + (
                                                                                obj.patron.expire_date() ?
                                                                                obj.patron.expire_date().substr(0,10) :
-                                                                               '<Unset>'
+                                                                           patronStrings.getString('staff.patron.field.unset') 
                                                                        )
                                                                );
                                                        };
@@ -375,11 +403,29 @@ patron.summary.prototype = {
                                                ['render'],
                                                function(e) {
                                                        return function() { 
-                                                               e.setAttribute('value',
+                                var hide_value = e.getAttribute('hide_value');
+                                                               e.setAttribute( hide_value == 'true' ? 'hidden_value' : 'value',
                                                                        obj.patron.dob() ?
                                                                        obj.patron.dob().substr(0,10) :
-                                                                       '<Unset>'
-                                                               );
+                                    patronStrings.getString('staff.patron.field.unset') 
+                                                               );
+                                e.setAttribute( hide_value == 'false' ? 'hidden_value' : 'value',
+                                    patronStrings.getString('staff.patron.field.hidden') 
+                                );
+                                var x = document.getElementById('PatronSummaryContact_date_of_birth_label');
+                                if (x) {
+                                    var click_to_hide_dob = x.getAttribute('click_to_hide_dob');
+                                    if (click_to_hide_dob == 'true') {
+                                        x.onclick = function() {
+                                            hide_value = e.getAttribute('hide_value');
+                                            e.setAttribute('hide_value', hide_value == 'true' ? 'false' : 'true'); 
+                                            var value = e.getAttribute('value');
+                                            var hidden_value = e.getAttribute('hidden_value');
+                                            e.setAttribute('value',hidden_value);
+                                            e.setAttribute('hidden_value',value);
+                                        }
+                                    }
+                                }
                                                        };
                                                }
                                        ],
index e3227bc..48ba120 100644 (file)
 <!-- ///////////////////////////////////////////////////////////////////////////////////////////////////////////// -->
 <!-- OVERLAYS -->
 <?xul-overlay href="/xul/server/OpenILS/util_overlay.xul"?>
-<?xul-overlay href="/xul/server/patron/summary_overlay.xul"?>
 
 <window id="patron_summary_win" 
-       onload="try { my_init(); font_helper(); } catch(E) { alert(E); }"
+       onload="try { my_init(); font_helper(); } catch(E) { alert(E); }" onunload="try { observer.unregister(); } catch(E) { alert(E); }"
        xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
 
        <!-- ///////////////////////////////////////////////////////////////////////////////////////////////////////////// -->
        <![CDATA[
                function $(id) { return document.getElementById(id); }
                
+               var observer;
+               function myObserver() { this.register(); }
+               myObserver.prototype = {
+                       register: function() {
+                               netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
+                               var observerService = Components.classes["@mozilla.org/observer-service;1"].getService(Components.interfaces.nsIObserverService);
+                               observerService.addObserver(this, "xul-overlay-merged", false);
+                       },
+                       unregister: function() {
+                               netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
+                               var observerService = Components.classes["@mozilla.org/observer-service;1"].getService(Components.interfaces.nsIObserverService);
+                               observerService.removeObserver(this, "xul-overlay-merged");
+                       },
+                       observe: function(subject,topic,data) {
+                               dump('observe: <'+subject+','+topic+','+data+'>\n');
+                               // setTimeout is needed here for xulrunner 1.8
+                               setTimeout( function() { try { post_overlay(); } catch(E) { alert(E); } }, 0 );
+                       }
+               }
+                               
                function my_init() {
                        try {
                                netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
                                JSAN.addRepository('/xul/server/');
                                JSAN.use('util.error'); g.error = new util.error();
                                g.error.sdump('D_TRACE','my_init() for patron_summary.xul');
+                               
+                               JSAN.use('OpenILS.data'); g.data = new OpenILS.data(); g.data.stash_retrieve();
+                               
+                               var horizontal_interface = String( g.data.hash.aous['ui.circ.patron_summary.horizontal'] ) == 'true';
+                               var url = horizontal_interface ? '/xul/server/patron/summary_overlay_horiz.xul' : '/xul/server/patron/summary_overlay.xul';
+                               
+                               observer = new myObserver();
+                               document.loadOverlay(location.protocol + '//' + location.hostname + url,observer)
+                       } catch(E) {
+                               var err_msg = $("commonStrings").getFormattedString('common.exception', ['patron/summary.xul:my_init()', E]);
+                               try { g.error.sdump('D_ERROR',err_msg); } catch(E) { dump(err_msg); }
+                               alert(err_msg);
+                       }
+               }
+               
+               function post_overlay() {
+                       try {
+                               netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
 
                                var patron_id = xul_param('id'); 
                                var patron_bc = xul_param('barcode'); 
                                } );
 
                                window.refresh = function () { g.summary.retrieve(); }
-
+                               font_helper();
                        } catch(E) {
-                               var err_msg = $("commonStrings").getFormattedString('common.exception', ['patron/summary.xul', E]);
+                               var err_msg = $("commonStrings").getFormattedString('common.exception', ['patron/summary.xul:post_overlay()', E]);
                                try { g.error.sdump('D_ERROR',err_msg); } catch(E) { dump(err_msg); }
                                alert(err_msg);
                        }
                }
-
        ]]>
        </script>
        
diff --git a/Open-ILS/xul/staff_client/server/patron/summary_overlay_horiz.xul b/Open-ILS/xul/staff_client/server/patron/summary_overlay_horiz.xul
new file mode 100644 (file)
index 0000000..ab8c851
--- /dev/null
@@ -0,0 +1,242 @@
+<?xml version="1.0"?>
+<!DOCTYPE overlay PUBLIC "" ""[
+       <!--#include virtual="/opac/locale/${locale}/lang.dtd"-->
+]>
+<overlay id="patron_summary_overlay" 
+       xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+
+<script>dump('loading patron/summary_overlay.xul\n');</script>
+
+<commandset id="patron_summary_cmds" />
+
+<box id="patron_summary_main" flex="1" orient="vertical" class="my_overflow">
+       <hbox id="patron_info_sidebar" flex="1"/>
+</box>
+
+<hbox id="patron_info_sidebar">
+       <image id="patron_photo_url" />
+       <vbox id="patron_info" flex="1">
+        <groupbox flex="1">
+            <caption label="Patron Info"/>
+            <label id="patron_name" />
+            <grid>
+                <columns>
+                    <column/>
+                    <column/>
+                </columns>
+                <rows>
+                    <row>
+                        <label id="PatronSummaryContact_date_of_birth_label" click_to_hide_dob="true" class="text_left dob label click_link" value="&staff.patron_display.date_of_birth.label;"/>
+                        <label id="patron_date_of_birth" class="dob value" hide_value="true" persist="hide_value"/><!-- FIXME: persist doesn't work for this -->
+                    </row>
+                    <row>
+                        <label id="PatronSummaryContact_library_card_label" class="text_left card label"
+                            value="&staff.patron_display.library_card.label;"/>
+                        <label id="patron_card" class="card value click_link" onclick="try { copy_to_clipboard(event); } catch(E) { alert(E); }"/>
+                    </row>
+                    <row>
+                        <label id="PatronSummaryContact_usrname_label" class="text_left usrname label"
+                            value="&staff.patron.summary_overlay.opac_login.value;" />
+                        <label id="patron_usrname" class="usrname value"/>
+                    </row>
+                    <row>
+                        <label id="PatronSummaryContact_email_label" class="text_left email label"
+                            value="&staff.patron_display.email.label;" />
+                        <label id="patron_email" class="email value" style="text-decoration: underline; color: blue; -moz-user-focus: normal;" onclick="copy_to_clipboard(event)"/>
+                    </row>
+                </rows>
+            </grid>
+            <spacer/><!-- bug workaround.. for some reason.. maybe timing with the overlay inserting children.. the patron_name label shows up beneath the grid when rendered -->
+        </groupbox>
+    </vbox>
+       <vbox id="contact_info" flex="1">
+        <groupbox flex="1">
+            <caption>
+                <button id="contact_info_btn" label="Mailing Address" type="menu">
+                    <menupopup>
+                        <menuitem label="&staff.patron_display.mailing_address;" oncommand="document.getElementById('contact_info_btn').setAttribute('label',this.getAttribute('label')); document.getElementById('contact_info_deck').selectedIndex = 0;"/>
+                        <menuitem label="&staff.patron_display.physical_address;" oncommand="document.getElementById('contact_info_btn').setAttribute('label',this.getAttribute('label')); document.getElementById('contact_info_deck').selectedIndex = 1;"/>
+                        <menuitem label="Phone Numbers" oncommand="document.getElementById('contact_info_btn').setAttribute('label',this.getAttribute('label')); document.getElementById('contact_info_deck').selectedIndex = 2;"/>
+                        <menuitem label="Identification" oncommand="document.getElementById('contact_info_btn').setAttribute('label',this.getAttribute('label')); document.getElementById('contact_info_deck').selectedIndex = 3;"/>
+                    </menupopup>
+                </button>
+            </caption>
+            <deck id="contact_info_deck">
+                   <vbox id="PatronSummaryContact_mailing_address" orient="vertical"/>
+                <vbox id="PatronSummaryContact_physical_address" orient="vertical"/>
+                <grid id="PatronSummaryContact_grid_phone" />
+                       <grid id="PatronSummaryContact_grid" flex="1"/>
+            </deck>
+        </groupbox>
+       </vbox>
+    <vbox>
+        <groupbox flex="1">
+            <caption label="Circ Info"/>
+               <grid id="PatronSummaryStatus_grid" flex="1"/>
+        </groupbox>
+       </vbox>
+    <vbox>
+        <groupbox flex="1">
+            <caption label="Account Info"/>
+            <grid>
+                <columns>
+                    <column/>
+                </columns>
+                <rows>
+                    <row hidden="true">
+                        <label id="patron_standing" />
+                    </row>
+                    <row id="pdsgr1">
+                        <label id="patron_profile" class="profile value"/>
+                    </row>
+                    <row id="pdsgr5">
+                        <label id="patron_library" class="homelib value"/>
+                    </row>
+                    <row id="pdsgr5a">
+                        <label id="patron_net_access" class="net_access value"/>
+                    </row>
+                    <row id="pdsgr5aa">
+                        <label id="patron_date_of_exp" class="expire_date value"/>
+                    </row>
+                </rows>
+            </grid>
+        </groupbox>
+       </vbox>
+</hbox>
+
+<grid id="PatronSummaryStatus_grid">
+       <columns id="pdsgc">
+               <column id="pdsgc1" />
+               <column id="pdsgc2" />
+               <column id="pdsgc3" />
+               <column id="pdsgc4" />
+       </columns>
+       <rows id="pdsgr" flex="1">
+               <row id="pdsgr4">
+                       <label id="PatronSummaryStatus_holds_label" class="text_left holds label"
+                               value="&staff.patron_display.holds.label;" />
+            <hbox>
+                       <label id="patron_holds_available" class="holds_ready label" />
+                <label value="/" class="holds" /> <!-- Would it be better to consolidate this into one label and use .getFormattedString? -->
+                       <label id="patron_holds" class="holds value"/>
+            </hbox>
+               </row>
+               <row id="pdsgr2" class="hide_patron_credit" hidden="true">
+                       <label id="PatronSummaryStatus_credit_label" class="text_left credit label"
+                               value="&staff.patron_display.credit.label;" />
+                       <label id="patron_credit" class="credit value"/>
+               </row><row>
+                       <label id="PatronSummaryStatus_bills_label" class="text_left bill label"
+                               value="&staff.patron_display.bills.label;" />
+                       <label id="patron_bill" class="bill value"/>
+               </row>
+               <row id="pdsgr3">
+                       <label id="PatronSummaryStatus_checkouts_label" class="text_left items_out label"
+                               value="&staff.patron_display.checkouts.label;" />
+                       <label id="patron_checkouts" class="items_out value"/>
+               </row>
+               <row>
+            <hbox>
+                       <label id="PatronSummaryStatus_checkouts_overdue_label" class="text_right items_overdue label" value="&staff.patron_display.checkouts_overdue.label;" />
+                <label value="/"/>
+                           <label id="PatronSummaryStatus_long_overdue_label" value="&staff.patron.summary_overlay.overdue.value;" class="text_right items_long_overdue label" />
+            </hbox>
+            <hbox>
+                       <label id="patron_overdue" class="items_overdue value" />
+                <label value="/"/>
+                           <label id="patron_long_overdue" class="items_long_overdue value" />
+            </hbox>
+               </row>
+               <row id="pdsgr7">
+            <hbox>
+                       <label id="PatronSummaryStatus_claimed_returned_label" value="&staff.patron.summary_overlay.claimed_returned.value;" class="text_right items_long_overdue label" />
+                <label value="/"/>
+                       <label id="PatronSummaryStatus_lost_label" value="&staff.patron.summary_overlay.lost_label.value;" class="text_left items_lost label"/>
+            </hbox>
+            <hbox>
+                       <label id="patron_claimed_returned" class="items_claimed_returned value" />
+                <label value="/"/>
+                       <label id="patron_lost" class="items_lost value"/>
+            </hbox>
+               </row>
+               <row id="pdsgr6a">
+                       <label id="PatronSummaryStatus_noncat_label" value="&staff.patron.summary_overlay.noncat_label.value;" class="text_left items_noncat label"/>
+                       <label id="patron_noncat" class="items_noncat value"/>
+               </row>
+       </rows>
+</grid>
+
+<grid id="PatronSummaryContact_grid">
+       <columns id="pdsgc">
+               <column id="pdsgc1" />
+               <column id="pdsgc2" />
+       </columns>
+       <rows id="pdsgr" flex="1">
+               <row id="pdsgr1">
+                       <label id="PatronSummaryContact_ident_label" class="text_left"
+                               value="&staff.patron_display.ident1.label;"/>
+                       <vbox id="pdsgr0h">
+                               <label id="patron_ident_type_1" class="ident ident_type ident1 value"/>
+                               <label id="patron_ident_value_1" class="ident ident_value ident1 value"/>
+                       </vbox>
+               </row>
+               <row id="pdsgr2">
+                       <label id="PatronSummaryContact_ident_label2" class="text_left"
+                               value="&staff.patron_display.ident2.label;"/>
+                       <vbox id="pdsgr0ah">
+                               <label id="patron_ident_type_2" class="ident ident_type ident2 value"/>
+                               <label id="patron_ident_value_2" class="ident ident_value ident2 value"/>
+                       </vbox>
+               </row>
+               <row id="pdsgr4"><label id="pdsgr4l" value=" "/></row>
+       </rows>
+</grid>
+
+<grid id="PatronSummaryContact_grid_phone">
+       <columns id="pdcgpc">
+               <column id="pdcgpc1" />
+               <column id="pdcgpc2" />
+       </columns>
+       <rows id="pdcgpr" flex="1">
+               <row id="pdcgpr1">
+                       <label id="PatronSummaryContact_day_phone_label" class="text_left phone label day_phone"
+                               value="&staff.patron_display.day_phone.label;" />
+                       <label id="patron_day_phone" class="phone value day_phone"/> 
+               </row>
+               <row id="pdcgpr2">
+                       <label id="PatronSummaryContact_evening_phone_label" class="text_left phone label evening_phone"
+                               value="&staff.patron_display.evening_phone.label;" />
+                       <label id="patron_evening_phone" class="phone value evening_phone"/>
+               </row>
+               <row id="pdcgpr3">
+                       <label id="PatronSummaryContact_other_phone_label" class="text_left phone label other_phone"
+                               value="&staff.patron_display.other_phone.label;" />
+                       <label id="patron_other_phone" class="phone value other_phone"/> 
+               </row>
+               <row id="pdsgpr4"><label id="pdsgpr4l" value=" "/></row>
+               <row id="pdsgpr6"><label id="pdsgpr6l" value=" "/></row>
+
+       </rows>
+</grid>
+
+<vbox id="PatronSummaryContact_mailing_address">
+       <label id="patron_mailing_address_street1" tooltiptext="&staff.patron_display.mailing.street1.label;" class="address street street1 mailing"/>
+       <label id="patron_mailing_address_street2" tooltiptext="&staff.patron_display.mailing.street2.label;" class="address street street2 mailing"/>
+       <hbox id="pdcmah">
+               <label id="patron_mailing_address_city" tooltiptext="&staff.patron_display.mailing.city.label;" class="address city mailing"/>
+               <label id="patron_mailing_address_state" tooltiptext="&staff.patron_display.mailing.state.label;" class="address state mailing"/>
+               <label id="patron_mailing_address_post_code" tooltiptext="&staff.patron_display.mailing.post_code.label;" class="address post_code mailing"/>
+       </hbox>
+</vbox>
+
+<vbox id="PatronSummaryContact_physical_address">
+       <label id="patron_physical_address_street1" tooltiptext="&staff.patron_display.physical.street1.label;" class="address street street1 physical" />
+       <label id="patron_physical_address_street2" tooltiptext="&staff.patron_display.physical.street2.label;"  class="address street street2 physical"/>
+       <hbox id="pdcpah">
+               <label id="patron_physical_address_city" tooltiptext="&staff.patron_display.physical.city.label;" class="address city physical"/>
+               <label id="patron_physical_address_state" tooltiptext="&staff.patron_display.physical.state.label;" class="address state physical"/>
+               <label id="patron_physical_address_post_code" tooltiptext="&staff.patron_display.physical.post_code.label;" class="address post_code physical"/>
+       </hbox>
+</vbox>
+
+</overlay>