From 6f165e8013be90f33d40310d7f16df6f5b84441f Mon Sep 17 00:00:00 2001 From: phasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4> Date: Fri, 13 Aug 2010 02:39:49 +0000 Subject: [PATCH] change the (Copy) link next to addresses in the patron summary to (Copy/Print), with a popup menu for choosing which action to do 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 | 6 +-- .../xul/staff_client/server/patron/summary.xul | 48 +++++++++++----------- .../staff_client/server/patron/summary_overlay.xul | 11 ++++- .../server/patron/summary_overlay_horiz.xul | 16 ++++++-- 4 files changed, 49 insertions(+), 32 deletions(-) diff --git a/Open-ILS/web/opac/locale/en-US/lang.dtd b/Open-ILS/web/opac/locale/en-US/lang.dtd index 575f100d53..0b12f89929 100644 --- a/Open-ILS/web/opac/locale/en-US/lang.dtd +++ b/Open-ILS/web/opac/locale/en-US/lang.dtd @@ -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:'> diff --git a/Open-ILS/xul/staff_client/server/patron/summary.xul b/Open-ILS/xul/staff_client/server/patron/summary.xul index 33b821b287..b80e4afb5f 100644 --- a/Open-ILS/xul/staff_client/server/patron/summary.xul +++ b/Open-ILS/xul/staff_client/server/patron/summary.xul @@ -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,30 +100,19 @@ 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() { diff --git a/Open-ILS/xul/staff_client/server/patron/summary_overlay.xul b/Open-ILS/xul/staff_client/server/patron/summary_overlay.xul index 2371a8cd91..0c540e1f8f 100644 --- a/Open-ILS/xul/staff_client/server/patron/summary_overlay.xul +++ b/Open-ILS/xul/staff_client/server/patron/summary_overlay.xul @@ -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> 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 index 8ddd04ce82..1e30b78f12 100644 --- a/Open-ILS/xul/staff_client/server/patron/summary_overlay_horiz.xul +++ b/Open-ILS/xul/staff_client/server/patron/summary_overlay_horiz.xul @@ -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> -- 2.11.0