[open-ils-commits] r17204 - in trunk/Open-ILS: web/opac/locale/en-US xul/staff_client/server/patron (phasefx)

svn at svn.open-ils.org svn at svn.open-ils.org
Thu Aug 12 22:39:52 EDT 2010


Author: phasefx
Date: 2010-08-12 22:39:49 -0400 (Thu, 12 Aug 2010)
New Revision: 17204

Modified:
   trunk/Open-ILS/web/opac/locale/en-US/lang.dtd
   trunk/Open-ILS/xul/staff_client/server/patron/summary.xul
   trunk/Open-ILS/xul/staff_client/server/patron/summary_overlay.xul
   trunk/Open-ILS/xul/staff_client/server/patron/summary_overlay_horiz.xul
Log:
change the (Copy) link next to addresses in the patron summary to (Copy/Print), with a popup menu for choosing which action to do

Modified: trunk/Open-ILS/web/opac/locale/en-US/lang.dtd
===================================================================
--- trunk/Open-ILS/web/opac/locale/en-US/lang.dtd	2010-08-13 00:58:26 UTC (rev 17203)
+++ trunk/Open-ILS/web/opac/locale/en-US/lang.dtd	2010-08-13 02:39:49 UTC (rev 17204)
@@ -1356,7 +1356,6 @@
 <!ENTITY staff.patron_display.toggle_summary.accesskey 'T'>
 <!ENTITY staff.patron_display.delete_patron.label 'Delete Patron Account'>
 <!ENTITY staff.patron_display.delete_patron.accesskey 'D'>
-<!ENTITY staff.patron_display.mailing.copy '(Copy)'>
 <!ENTITY staff.patron_display.mailing.city.label 'Mailing City:'>
 <!ENTITY staff.patron_display.mailing.post_code.label 'Mailing ZIP:'>
 <!ENTITY staff.patron_display.mailing.state.label 'Mailing State:'>
@@ -1364,14 +1363,15 @@
 <!ENTITY staff.patron_display.mailing.street2.label 'Mailing Address 2:'>
 <!ENTITY staff.patron_display.mailing_address 'Mailing Address'>
 <!ENTITY staff.patron_display.addresses.caption 'Addresses'>
-<!ENTITY staff.patron_display.address.copy '(Copy)'>
+<!ENTITY staff.patron_display.address_export '(Copy/Print)'>
+<!ENTITY staff.patron_display.address_export_popup.copy 'Copy to Clipboard'>
+<!ENTITY staff.patron_display.address_export_popup.print 'Print'>
 <!ENTITY staff.patron_display.radio.mailing_address.label 'Mailing'>
 <!ENTITY staff.patron_display.radio.mailing_address.accesskey ''>
 <!ENTITY staff.patron_display.radio.physical_address.label 'Billing'>
 <!ENTITY staff.patron_display.radio.physical_address.accesskey ''>
 <!ENTITY staff.patron_display.name.label 'Patron Name'>
 <!ENTITY staff.patron_display.other_phone.label 'Other Phone:'>
-<!ENTITY staff.patron_display.physical.copy '(Copy)'>
 <!ENTITY staff.patron_display.physical.city.label 'Physical City:'>
 <!ENTITY staff.patron_display.physical.post_code.label 'Physical ZIP:'>
 <!ENTITY staff.patron_display.physical.state.label 'Physical State:'>

Modified: trunk/Open-ILS/xul/staff_client/server/patron/summary.xul
===================================================================
--- trunk/Open-ILS/xul/staff_client/server/patron/summary.xul	2010-08-13 00:58:26 UTC (rev 17203)
+++ trunk/Open-ILS/xul/staff_client/server/patron/summary.xul	2010-08-13 02:39:49 UTC (rev 17204)
@@ -76,8 +76,19 @@
             }
         }
 
-        function copy_address(a) {
+        function export_address(ev) {
+            var action = ev.originalTarget.id;
+            var a;
             var p = g.summary.patron;
+            switch(document.popupNode.id) {
+                case 'addr_export_mailing':
+                    a = g.summary.patron.mailing_address();
+                break;
+                case 'addr_export_physical':
+                    a = g.summary.patron.billing_address();
+                break;
+            };
+
             var parts = [
                 p.first_given_name(), p.second_given_name(), p.family_name(),
                 a.street1(), a.street2(), a.city(), a.county(),
@@ -89,31 +100,20 @@
             var s = $("patronStrings").getFormattedString(
                 'staff.patron.mailable_address_format', parts
             );
-            // Replace literal instances of '\n' and excessive whitespace.
-            copy_to_clipboard(
-                s.replace(/(\\n)+/g, "\r\n").replace(/ {2,}/g, " ")
-            );
-        }
 
-        function copy_displayed_address() {
-            if ( $('radio_address').selectedIndex == 0 ) {
-                copy_mailing_address();
-            } else {
-                copy_billing_address();
-            }
+            switch(action) {
+                case 'addr_export_copy':
+                    // Replace literal instances of '\n' and excessive whitespace.
+                    s = s.replace(/(\\n)+/g, "\r\n").replace(/ {2,}/g, " ");
+                    copy_to_clipboard(s);
+                break;
+                case 'addr_export_print':
+                    // Replace literal instances of '\n' and excessive whitespace.
+                    s = s.replace(/(\\n)+/g, "<br/>").replace(/ {2,}/g, " ");
+                    JSAN.use('util.print'); var print = new util.print(); print.simple(s);
+                break;
+            };
         }
-
-        function copy_mailing_address() {
-            var a = g.summary.patron.mailing_address();
-            if (!a) return;
-            copy_address(a);
-        }
-
-        function copy_billing_address() {
-            var a = g.summary.patron.billing_address();
-            if (!a) return;
-            copy_address(a);
-        }
     
         function post_overlay() {
             try {

Modified: trunk/Open-ILS/xul/staff_client/server/patron/summary_overlay.xul
===================================================================
--- trunk/Open-ILS/xul/staff_client/server/patron/summary_overlay.xul	2010-08-13 00:58:26 UTC (rev 17203)
+++ trunk/Open-ILS/xul/staff_client/server/patron/summary_overlay.xul	2010-08-13 02:39:49 UTC (rev 17204)
@@ -198,6 +198,13 @@
     </rows>
 </grid>
 
+<popupset id="patron_summary_popups">
+    <popup id="addr_export_popup" oncommand="export_address(event);">
+        <menuitem id="addr_export_copy" label="&staff.patron_display.address_export_popup.copy;"/>
+        <menuitem id="addr_export_print" label="&staff.patron_display.address_export_popup.print;"/>
+    </popup>
+</popupset>
+
 <groupbox id="PatronSummaryContact_mailing_address" orient="vertical">
     <caption id="pdcmac" label="&staff.patron_display.mailing_address;" class="shrinkable_groupbox"/>
     <description id="patron_mailing_address_street1" tooltiptext="&staff.patron_display.mailing.street1.label;" class="copyable address street street1 mailing value"/>
@@ -209,7 +216,7 @@
     </hbox>
     <hbox>
         <spacer flex="1" />
-        <label value="&staff.patron_display.mailing.copy;" onclick="copy_mailing_address();" class="copyable click_link"/>
+        <label id="addr_export_mailing" value="&staff.patron_display.address_export;" popup="addr_export_popup" class="copyable click_link"/>
     </hbox>
 </groupbox>
 
@@ -224,7 +231,7 @@
     </hbox>
     <hbox>
         <spacer flex="1" />
-        <label value="&staff.patron_display.physical.copy;" onclick="copy_billing_address();" class="copyable click_link"/>
+        <label id="addr_export_physical" value="&staff.patron_display.address_export;" popup="addr_export_popup" class="copyable click_link"/>
     </hbox>
 </groupbox>
 

Modified: trunk/Open-ILS/xul/staff_client/server/patron/summary_overlay_horiz.xul
===================================================================
--- trunk/Open-ILS/xul/staff_client/server/patron/summary_overlay_horiz.xul	2010-08-13 00:58:26 UTC (rev 17203)
+++ trunk/Open-ILS/xul/staff_client/server/patron/summary_overlay_horiz.xul	2010-08-13 02:39:49 UTC (rev 17204)
@@ -247,6 +247,13 @@
     </groupbox>
 </vbox>
 
+<popupset id="patron_summary_popups">
+    <popup id="addr_export_popup" oncommand="export_address(event);">
+        <menuitem id="addr_export_copy" label="&staff.patron_display.address_export_popup.copy;"/>
+        <menuitem id="addr_export_print" label="&staff.patron_display.address_export_popup.print;"/>
+    </popup>
+</popupset>
+
 <vbox id="PatronSummaryContact_address">
     <groupbox>
         <caption label="&staff.patron_display.addresses.caption;"/>
@@ -273,16 +280,19 @@
         <hbox>
             <radiogroup id="radio_address" orient="horizontal" oils_persist="value">
                 <radio id="radio_address_mailing" selected="true" value="mailing"
-                    oncommand="oils_persist(this.parentNode); $('address_deck').selectedIndex = 0;"
+                    oncommand="oils_persist(this.parentNode); $('address_deck').selectedIndex = 0; $('address_action_deck').selectedIndex = 0;"
                     label="&staff.patron_display.radio.mailing_address.label;" 
                     accesskey="&staff.patron_display.radio.mailing_address.accesskey;" />
                 <radio id="radio_address_physical" value="physical"
-                    oncommand="oils_persist(this.parentNode); $('address_deck').selectedIndex = 1;"
+                    oncommand="oils_persist(this.parentNode); $('address_deck').selectedIndex = 1; $('address_action_deck').selectedIndex = 1;"
                     label="&staff.patron_display.radio.physical_address.label;"
                     accesskey="&staff.patron_display.radio.physical_address.accesskey;" /> 
             </radiogroup>
             <spacer flex="1" />
-            <label value="&staff.patron_display.address.copy;" onclick="copy_displayed_address();" class="copyable click_link"/>
+            <deck id="address_action_deck">
+                <label id="addr_export_mailing" value="&staff.patron_display.address_export;" popup="addr_export_popup" class="copyable click_link"/>
+                <label id="addr_export_physical" value="&staff.patron_display.address_export;" popup="addr_export_popup" class="copyable click_link"/>
+            </deck>
         </hbox>
     </groupbox>
 </vbox>



More information about the open-ils-commits mailing list