change the (Copy) link next to addresses in the patron summary to (Copy/Print), with...
authorphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Fri, 13 Aug 2010 02:39:49 +0000 (02:39 +0000)
committerphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Fri, 13 Aug 2010 02:39:49 +0000 (02:39 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@17204 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/web/opac/locale/en-US/lang.dtd
Open-ILS/xul/staff_client/server/patron/summary.xul
Open-ILS/xul/staff_client/server/patron/summary_overlay.xul
Open-ILS/xul/staff_client/server/patron/summary_overlay_horiz.xul

index 575f100..0b12f89 100644 (file)
 <!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:'>
 <!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:'>
index 33b821b..b80e4af 100644 (file)
             }
         }
 
-        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(),
             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();
-            }
-        }
-
-        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);
+            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 post_overlay() {
index 2371a8c..0c540e1 100644 (file)
     </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"/>
     </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>
 
     </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>
 
index 8ddd04c..1e30b78 100644 (file)
     </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;"/>
         <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>