clipboard function; using it for patron barcode and record tcn
authorphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Fri, 4 Aug 2006 10:03:13 +0000 (10:03 +0000)
committerphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Fri, 4 Aug 2006 10:03:13 +0000 (10:03 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@5291 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/xul/staff_client/server/OpenILS/global_util.js
Open-ILS/xul/staff_client/server/cat/bib_brief.xul
Open-ILS/xul/staff_client/server/patron/summary_overlay.xul

index 8775dc6..b0f82bc 100644 (file)
                return 'f';
        }
 
+       function copy_to_clipboard(ev) {
+               try {
+                       netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
+                       var text;
+                       if (typeof ev == 'object') {
+                               if (typeof ev.target != 'undefined') {
+                                       if (typeof ev.target.textContent != 'undefined') if (ev.target.textContent) text = ev.target.textContent;
+                                       if (typeof ev.target.value != 'undefined') if (ev.target.value) text = ev.target.value;
+                               }
+                       } else if (typeof ev == 'string') {
+                               text = ev;
+                       }
+                       const gClipboardHelper = Components.classes["@mozilla.org/widget/clipboardhelper;1"]
+                               .getService(Components.interfaces.nsIClipboardHelper);
+                       gClipboardHelper.copyString(text);
+                       alert('Copied "'+text+'" to clipboard.');
+               } catch(E) {
+                       alert('Clipboard action failed: ' + E); 
+               }
+       }
 
index e428966..dc348fc 100644 (file)
                                </html:tr>
                                <html:tr valign="top">
                                        <html:td>
-                                               <html:span style="font-weight: bold;">TCN: </html:span><html:span id="tcn" />
+                                               <html:span style="font-weight: bold;">TCN: </html:span><html:span id="tcn" style="text-decoration: underline; color: blue;" onclick="copy_to_clipboard(event)"/>
                                        </html:td>
                                        <html:td>
                                                <html:span style="font-weight: bold;">Created By: </html:span><html:span id="creator" />
index bd4737b..65584af 100644 (file)
                <row id="pdsgr0">
                        <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"/>-->
-                       <textbox id="patron_card" class="plain" readonly="true" onclick="this.select()"/>
+                       <label id="patron_card" class="card value" style="text-decoration: underline; color: blue; -moz-user-focus: normal;" onclick="copy_to_clipboard(event)"/>
+                       <!--<textbox id="patron_card" class="plain" readonly="true" onclick="this.select()"/>-->
                </row>
                <row id="pdsgr1">
                        <label id="PatronSummaryContact_ident_label" class="text_left"
                <row id="pdcgpr5">
                        <label id="PatronSummaryContact_email_label" class="text_left email label"
                                value="&staff.patron_display.email.label;" />
-                       <label id="patron_email" class="email value"/>
+                       <label id="patron_email" class="email value" style="text-decoration: underline; color: blue; -moz-user-focus: normal;" onclick="copy_to_clipboard(event)"/>
                </row>
                <row id="pdsgpr6"><label id="pdsgpr6l" value=" "/></row>