[open-ils-commits] r14903 - in trunk/Open-ILS/xul/staff_client/chrome: content/util locale/en-US (phasefx)

svn at svn.open-ils.org svn at svn.open-ils.org
Fri Nov 13 11:56:01 EST 2009


Author: phasefx
Date: 2009-11-13 11:55:58 -0500 (Fri, 13 Nov 2009)
New Revision: 14903

Modified:
   trunk/Open-ILS/xul/staff_client/chrome/content/util/error.js
   trunk/Open-ILS/xul/staff_client/chrome/locale/en-US/offline.properties
Log:
Copy Message button for all yns_alert dialogs.  Mainly for error alerts, but the dialog does get used for pre-cats, etc.

Modified: trunk/Open-ILS/xul/staff_client/chrome/content/util/error.js
===================================================================
--- trunk/Open-ILS/xul/staff_client/chrome/content/util/error.js	2009-11-13 16:55:43 UTC (rev 14902)
+++ trunk/Open-ILS/xul/staff_client/chrome/content/util/error.js	2009-11-13 16:55:58 UTC (rev 14903)
@@ -346,14 +346,22 @@
             + '<groupbox flex="1" style="overflow: auto; border: solid thin red;"><caption label="' + (title) + '"/>';
 
         if (image) xml += '<hbox><image src="' + image + '"/><spacer flex="1"/></hbox>';
-        xml += '<description style="font-size: large">' + (s)
+        xml += '<description id="msg" style="-moz-user-select: text; -moz-user-focus: normal; font-size: large">' + (s)
             + '</description></groupbox><groupbox><caption label="Options"/><hbox>';
         var b1_key = b1 ? b1[0] : '';
         var b2_key = b2 ? b2[0] : '';
         var b3_key = b3 ? b3[0] : ''; /* FIXME - need to check for collisions */
-        if (b1) xml += '<button id="b1" accesskey="' + b1_key + '" label="' + (b1) + '" name="fancy_submit" value="b1"/>'
-        if (b2) xml += '<button id="b2" accesskey="' + b2_key + '" label="' + (b2) + '" name="fancy_submit" value="b2"/>'
-        if (b3) xml += '<button id="b3" accesskey="' + b3_key + '" label="' + (b3) + '" name="fancy_submit" value="b3"/>'
+        if (b1) xml += '<button id="b1" accesskey="' + b1_key + '" label="' + (b1) + '" name="fancy_submit" value="b1"/>';
+        if (b2) xml += '<button id="b2" accesskey="' + b2_key + '" label="' + (b2) + '" name="fancy_submit" value="b2"/>';
+        if (b3) xml += '<button id="b3" accesskey="' + b3_key + '" label="' + (b3) + '" name="fancy_submit" value="b3"/>';
+        var copy_button_label = 'Copy Message'; /* default in case the I18N infrastructure is failing, yns_alert often gets used for errors */
+        var x= document.getElementById('offlineStrings');
+        if (x) {
+            if (typeof x.getString == 'function') {
+                if (x.getString('common.error.copy_msg')) { copy_button_label = x.getString('common.error.copy_msg'); }
+            }
+        }
+        xml += '<spacer flex="1"/><button label="' + copy_button_label + '" oncommand="try { copy_to_clipboard( document.getElementById(' + "'msg'" + ').textContent ); } catch(E) { alert(E); }" />';
         xml += '</hbox></groupbox></vbox>';
         JSAN.use('OpenILS.data');
         //var data = new OpenILS.data(); data.init({'via':'stash'});
@@ -402,7 +410,7 @@
             c    = Text for confirmation checkbox.  null for no confirm
         */
 
-        dump('yns_alert:\n\ts = ' + s + '\n\ttitle = ' + title + '\n\tb1 = ' + b1 + '\n\tb2 = ' + b2 + '\n\tb3 = ' + b3 + '\n\tc = ' + c + '\n');
+        dump('yns_alert_formatted:\n\ts = ' + s + '\n\ttitle = ' + title + '\n\tb1 = ' + b1 + '\n\tb2 = ' + b2 + '\n\tb3 = ' + b3 + '\n\tc = ' + c + '\n');
         netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect UniversalBrowserWrite");
 
         this.sound.bad();
@@ -415,14 +423,22 @@
             + '<groupbox flex="1" style="overflow: auto; border: solid thin red;"><caption label="' + (title) + '"/>';
 
         if (image) xml += '<hbox><image src="' + image + '"/><spacer flex="1"/></hbox>';
-        xml += '<description style="font-size: large"><html:pre style="font-size: large">' + (s)
+        xml += '<description style="-moz-user-select: text; -moz-user-focus: normal; font-size: large"><html:pre id="msg" style="font-size: large">' + (s)
             + '</html:pre></description></groupbox><groupbox><caption label="Options"/><hbox>';
         var b1_key = b1 ? b1[0] : '';
         var b2_key = b2 ? b2[0] : '';
         var b3_key = b3 ? b3[0] : ''; /* FIXME - need to check for collisions */
-        if (b1) xml += '<button id="b1" accesskey="' + b1_key + '" label="' + (b1) + '" name="fancy_submit" value="b1"/>'
-        if (b2) xml += '<button id="b2" accesskey="' + b2_key + '" label="' + (b2) + '" name="fancy_submit" value="b2"/>'
-        if (b3) xml += '<button id="b3" accesskey="' + b3_key + '" label="' + (b3) + '" name="fancy_submit" value="b3"/>'
+        if (b1) xml += '<button id="b1" accesskey="' + b1_key + '" label="' + (b1) + '" name="fancy_submit" value="b1"/>';
+        if (b2) xml += '<button id="b2" accesskey="' + b2_key + '" label="' + (b2) + '" name="fancy_submit" value="b2"/>';
+        if (b3) xml += '<button id="b3" accesskey="' + b3_key + '" label="' + (b3) + '" name="fancy_submit" value="b3"/>';
+        var copy_button_label = 'Copy Message'; /* default in case the I18N infrastructure is failing, yns_alert often gets used for errors */
+        var x= document.getElementById('offlineStrings');
+        if (x) {
+            if (typeof x.getString == 'function') {
+                if (x.getString('common.error.copy_msg')) { copy_button_label = x.getString('common.error.copy_msg'); }
+            }
+        }
+        xml += '<spacer flex="1"/><button label="' + copy_button_label + '" oncommand="try { copy_to_clipboard( document.getElementById(' + "'msg'" + ').textContent ); } catch(E) { alert(E); }" />';
         xml += '</hbox></groupbox></vbox>';
         JSAN.use('OpenILS.data');
         //var data = new OpenILS.data(); data.init({'via':'stash'});

Modified: trunk/Open-ILS/xul/staff_client/chrome/locale/en-US/offline.properties
===================================================================
--- trunk/Open-ILS/xul/staff_client/chrome/locale/en-US/offline.properties	2009-11-13 16:55:43 UTC (rev 14902)
+++ trunk/Open-ILS/xul/staff_client/chrome/locale/en-US/offline.properties	2009-11-13 16:55:58 UTC (rev 14903)
@@ -4,6 +4,7 @@
 common.clear=Clear
 common.confirm=Check here to confirm this message.
 common.error.default=Please report that this happened.
+common.error.copy_msg=Copy Message
 common.barcode.status.warning=Warning: As of %1$s, this barcode (%2$s) was flagged %3.
 common.barcode.status.warning.lost=Lost
 common.barcode.status.warning.expired=Expired



More information about the open-ils-commits mailing list