[open-ils-commits] r17209 - in trunk/Open-ILS: web/opac/locale/en-US xul/staff_client/chrome/content/main xul/staff_client/chrome/locale/en-US xul/staff_client/server/cat (phasefx)

svn at svn.open-ils.org svn at svn.open-ils.org
Fri Aug 13 04:18:48 EDT 2010


Author: phasefx
Date: 2010-08-13 04:18:42 -0400 (Fri, 13 Aug 2010)
New Revision: 17209

Modified:
   trunk/Open-ILS/web/opac/locale/en-US/lang.dtd
   trunk/Open-ILS/xul/staff_client/chrome/content/main/menu.js
   trunk/Open-ILS/xul/staff_client/chrome/content/main/menu_frame_menus.xul
   trunk/Open-ILS/xul/staff_client/chrome/locale/en-US/offline.properties
   trunk/Open-ILS/xul/staff_client/server/cat/util.js
Log:
spawn external text editor for Patron Letter during Mark Item Missing Pieces workflow.  Put configuration option under Admin -> Local System Administration -> External Text Editor Command


Modified: trunk/Open-ILS/web/opac/locale/en-US/lang.dtd
===================================================================
--- trunk/Open-ILS/web/opac/locale/en-US/lang.dtd	2010-08-13 08:17:45 UTC (rev 17208)
+++ trunk/Open-ILS/web/opac/locale/en-US/lang.dtd	2010-08-13 08:18:42 UTC (rev 17209)
@@ -1804,6 +1804,8 @@
 <!ENTITY staff.server.admin.index.transits "Transits">
 <!ENTITY staff.server.admin.index.transit_list "Transit List">
 <!ENTITY staff.server.admin.index.conify "Server Settings">
+<!ENTITY staff.server.admin.index.external_text_editor.label "External Text Editor Command">
+<!ENTITY staff.server.admin.index.external_text_editor.accesskey "x">
 
 <!ENTITY staff.server.admin.index.booking "Booking">
 <!ENTITY staff.server.admin.index.booking.reservation "Create/Cancel Reservations">

Modified: trunk/Open-ILS/xul/staff_client/chrome/content/main/menu.js
===================================================================
--- trunk/Open-ILS/xul/staff_client/chrome/content/main/menu.js	2010-08-13 08:17:45 UTC (rev 17208)
+++ trunk/Open-ILS/xul/staff_client/chrome/content/main/menu.js	2010-08-13 08:18:42 UTC (rev 17209)
@@ -617,6 +617,21 @@
                 ['oncommand'],
                 function() { open_eg_web_page('conify/global/permission/grp_penalty_threshold'); }
             ],
+            'cmd_local_admin_external_text_editor' : [
+                ['oncommand'],
+                function() {
+                    var prefs = Components.classes['@mozilla.org/preferences-service;1'].getService(Components.interfaces['nsIPrefBranch']);
+                    var key = 'oils.text_editor.external.cmd';
+                    var has_key = prefs.prefHasUserValue(key);
+                    var value = has_key ? prefs.getCharPref(key) : 'C:\\Windows\\notepad.exe %letter.txt%';
+                    var cmd = window.prompt(
+                        document.getElementById('offlineStrings').getString('text_editor.prompt_for_external_cmd'),
+                        value
+                    );
+                    if (!cmd) { return; }
+                    prefs.setCharPref(key,cmd);
+                }
+            ],
             'cmd_local_admin_idl_field_doc' : [
                 ['oncommand'],
                 function() { open_eg_web_page('conify/global/config/idl_field_doc'); }

Modified: trunk/Open-ILS/xul/staff_client/chrome/content/main/menu_frame_menus.xul
===================================================================
--- trunk/Open-ILS/xul/staff_client/chrome/content/main/menu_frame_menus.xul	2010-08-13 08:17:45 UTC (rev 17208)
+++ trunk/Open-ILS/xul/staff_client/chrome/content/main/menu_frame_menus.xul	2010-08-13 08:18:42 UTC (rev 17209)
@@ -114,6 +114,9 @@
     <command id="cmd_local_admin_standing_penalty"/>
     <command id="cmd_local_admin_grp_penalty_threshold"/>
     <command id="cmd_local_admin_copy_location_order"/>
+    <command id="cmd_local_admin_external_text_editor"
+        label="&staff.server.admin.index.external_text_editor.label;"
+        accesskey="&staff.server.admin.index.external_text_editor.accesskey;"/>
     <command id="cmd_local_admin_idl_field_doc"/>
     <command id="cmd_local_admin_action_trigger"/>
     <command id="cmd_local_admin_survey"/>
@@ -345,6 +348,7 @@
                 <menuitem label="&staff.server.admin.index.closed_dates;" command="cmd_local_admin_closed_dates"/>
                 <menuitem label="&staff.server.admin.index.copy_locations;" command="cmd_local_admin_copy_locations"/>
                 <menuitem label="&staff.main.menu.admin.local_admin.conify.copy_location_order.label;" command="cmd_local_admin_copy_location_order"/>
+                <menuitem command="cmd_local_admin_external_text_editor"/>
                 <menuitem label="&staff.main.menu.admin.local_admin.conify.idl_field_doc.label;" command="cmd_local_admin_idl_field_doc"/>
                 <menuitem label="&staff.server.admin.index.fonts_and_sounds;" command="cmd_local_admin_fonts_and_sounds"/>
                 <menuitem label="&staff.main.menu.admin.local_admin.conify.grp_penalty_threshold.label;" command="cmd_local_admin_grp_penalty_threshold"/>

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	2010-08-13 08:17:45 UTC (rev 17208)
+++ trunk/Open-ILS/xul/staff_client/chrome/locale/en-US/offline.properties	2010-08-13 08:18:42 UTC (rev 17209)
@@ -263,3 +263,4 @@
 printing.nothing_to_reprint=Nothing to re-print
 printing.prompt_for_external_print_cmd=Enter external print command and parameters (use %receipt.txt% or %receipt.html% as the file containing the print data. Those values will be substituted with the proper path.):
 printing.print_strategy_saved=Print strategy (%1$s) saved to file system.
+text_editor.prompt_for_external_cmd=Enter external text editor command and parameters (use %letter.txt% as the file containing the text. This value will be substituted with the proper path.):

Modified: trunk/Open-ILS/xul/staff_client/server/cat/util.js
===================================================================
--- trunk/Open-ILS/xul/staff_client/server/cat/util.js	2010-08-13 08:17:45 UTC (rev 17208)
+++ trunk/Open-ILS/xul/staff_client/server/cat/util.js	2010-08-13 08:18:42 UTC (rev 17209)
@@ -775,7 +775,7 @@
                                 'chrome,resizable,modal',
                                 { 'copy_id' : copies[i].id() }
                             );
-                            // TODO: patron notes/messages
+                            // Patron Message
                             var my_xulG = win.open(
                                 urls.XUL_NEW_STANDING_PENALTY,
                                 'new_standing_penalty',
@@ -794,7 +794,35 @@
                                     [ ses(), penalty ]
                                 );
                             }
-                            // TODO: Invoke 3rd party app with letter to patron
+                            // Patron Letter
+
+                            var txt_file = new util.file('letter.txt');
+                            txt_file.write_content('truncate',robj.payload.letter.template_output().data());
+                            var text_path = '"' + txt_file._file.path + '"';
+                            txt_file.close();
+
+                            var prefs = Components.classes['@mozilla.org/preferences-service;1'].getService(Components.interfaces['nsIPrefBranch']);
+                            var key = 'oils.text_editor.external.cmd';
+                            var has_key = prefs.prefHasUserValue(key);
+                            var oils_external_letter_opener_cmd = has_key ? prefs.getCharPref(key) : 'C:\\Windows\\notepad.exe %letter.txt%';
+
+                            var cmd = oils_external_letter_opener_cmd.replace('%letter.txt%',text_path);
+
+                            var file = new util.file('letter.bat');
+                            file.write_content('truncate+exec',cmd);
+                            file.close();
+                            file = new util.file('letter.bat');
+
+                            dump('letter exec: ' + cmd + '\n');
+                            var process = Components.classes["@mozilla.org/process/util;1"].createInstance(Components.interfaces.nsIProcess);
+                            process.init(file._file);
+
+                            var args = [];
+
+                            dump('process.run = ' + process.run(false, args, args.length) + '\n');
+
+                            file.close();
+
                         } else if (robj.ilsevent == 1500 /* ACTION_CIRCULATION_NOT_FOUND */) {
                             alert( $("catStrings").getFormattedString('staff.cat.util.mark_item_missing_pieces.circ_not_found',[ copies[i].barcode() ]) );
                         } else {



More information about the open-ils-commits mailing list