'Print Export' is a non-templated print option that prints the csv dump for a list...
authorpines <pines@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 6 Feb 2007 06:28:27 +0000 (06:28 +0000)
committerpines <pines@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 6 Feb 2007 06:28:27 +0000 (06:28 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/branches/rel_1_0@6900 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/xul/staff_client/server/admin/offline_manage_xacts.js
Open-ILS/xul/staff_client/server/admin/offline_manage_xacts.xul
Open-ILS/xul/staff_client/server/cat/copy_summary.xul
Open-ILS/xul/staff_client/server/circ/copy_status.js
Open-ILS/xul/staff_client/server/circ/copy_status.xul
Open-ILS/xul/staff_client/server/circ/copy_status_overlay.xul
Open-ILS/xul/staff_client/server/patron/bill_details.xul

index 03288a3..2d20e1b 100644 (file)
@@ -337,6 +337,32 @@ admin.offline_manage_xacts.prototype = {
                        },
                        false
                );
+               
+               var print_export_button = document.getElementById('print_export_btn');
+               if (print_export_button) print_export_button.addEventListener(
+                       'command',
+                       function(ev) {
+                               try {
+                                       obj.error_list.on_all_fleshed =
+                                               function() {
+                                                       try {
+                                                               dump( obj.error_list.dump_csv() + '\n' );
+                                                               //copy_to_clipboard(obj.error_list.dump_csv());
+                                                               JSAN.use('util.print'); var p = new util.print();
+                                                               p.simple( obj.error_list.dump_csv(), { 'content_type' : 'text/plain' } );
+                                                               setTimeout(function(){ obj.error_list.on_all_fleshed = null; },0);
+                                                       } catch(E) {
+                                                               obj.error.standard_unexpected_error_alert('export',E); 
+                                                       }
+                                               }
+                                       obj.error_list.full_retrieve();
+                               } catch(E) {
+                                       obj.error.standard_unexpected_error_alert('print export',E); 
+                               }
+                       },
+                       false
+               );
+
        },
 
        'check_perm' : function(perms) {
index 3b1877b..c8d991c 100644 (file)
@@ -88,6 +88,7 @@
                                <vbox flex="1">
                                        <hbox>
                                                <button id='export_btn' label="Export List" />
+                                               <button id='print_export_btn' label="Print Export" />
                                                <spacer flex="1"/>
                                                <button id='retrieve_item' label="Retrieve Item" disabled="true"/>
                                                <button id='retrieve_patron' label="Retrieve Patron" disabled="true"/>
index 46dfc4c..99eaa7b 100644 (file)
                        </grid>
                </deck>
                <hbox>
-                       <label value="Alternate View" style="text-decoration: underline; color: blue" onclick="toggle_deck()"/>
-                       <label id="save_columns" value="Save Columns" style="text-decoration: underline; color: blue" onclick="try { g.list.save_columns(); } catch(E) { alert(E); }"/>
-                       <label id="sel_clip" value="Copy to Clipboard" style="text-decoration: underline; color: blue" onclick="try { g.list.node.view.selection.selectAll(); g.list.clipboard(); } catch(E) { alert(E); }"/>
+                       <button label="Alternate View" oncommand="toggle_deck()"/>
+                       <button id="save_columns" label="Save Columns" oncommand="try { g.list.save_columns(); } catch(E) { alert(E); }"/>
+                       <button id="sel_clip" label="Copy to Clipboard" oncommand="try { g.list.node.view.selection.selectAll(); g.list.clipboard(); } catch(E) { alert(E); }"/>
+                       <button id="print_export" label="Print Export" oncommand="try { g.list.on_all_fleshed = function() { JSAN.use('util.print'); var p = new util.print(); p.simple( g.list.dump_csv(), { 'content_type' : 'text/plain' } ); setTimeout( function() { g.list.on_all_fleshed = null; }, 0); }; g.list.full_retrieve(); } catch(E) { alert(E); }"/>
                </hbox>
        </groupbox>
 
index d25ddac..0cc79cf 100644 (file)
@@ -336,6 +336,29 @@ circ.copy_status.prototype = {
                                                        }
                                                }
                                        ],
+                                       'cmd_copy_status_print_export' : [
+                                               ['command'],
+                                               function() {
+                                                       try {
+                                                               obj.list.on_all_fleshed =
+                                                                       function() {
+                                                                               try {
+                                                                                       dump( obj.list.dump_csv() + '\n' );
+                                                                                       //copy_to_clipboard(obj.list.dump_csv());
+                                                                                       JSAN.use('util.print'); var print = new util.print();
+                                                                                       print.simple(obj.list.dump_csv(),{'content_type':'text/plain'});
+                                                                                       setTimeout(function(){ obj.list.on_all_fleshed = null; },0);
+                                                                               } catch(E) {
+                                                                                       obj.error.standard_unexpected_error_alert('export',E); 
+                                                                               }
+                                                                       }
+                                                               obj.list.full_retrieve();
+                                                       } catch(E) {
+                                                               obj.error.standard_unexpected_error_alert('export',E); 
+                                                       }
+                                               }
+                                       ],
+
                                        'cmd_add_items' : [
                                                ['command'],
                                                function() {
@@ -881,60 +904,72 @@ circ.copy_status.prototype = {
                                if ( obj.test_barcode(barcode) ) { /* good */ } else { /* bad */ return; }
                        }
                        JSAN.use('circ.util');
-                       var copy = obj.network.simple_request( 'FM_ACP_RETRIEVE_VIA_BARCODE', [ barcode ]);
-                       if (copy == null) {
-                               throw('Something weird happened.  null result');
-                       } else if (copy.ilsevent) {
-                               switch(copy.ilsevent) {
-                                       case -1: 
-                                               obj.error.standard_network_error_alert(); 
-                                               obj.controller.view.copy_status_barcode_entry_textbox.select();
-                                               obj.controller.view.copy_status_barcode_entry_textbox.focus();
-                                       break;
-                                       case 1502 /* ASSET_COPY_NOT_FOUND */ :
-                                               try { document.getElementById('last_scanned').setAttribute('value',barcode + ' was either mis-scanned or is not cataloged.'); } catch(E) {}
-                                               obj.error.yns_alert(barcode + ' was either mis-scanned or is not cataloged.','Not Cataloged','OK',null,null,'Check here to confirm this message');
-                                               obj.controller.view.copy_status_barcode_entry_textbox.select();
-                                               obj.controller.view.copy_status_barcode_entry_textbox.focus();
-                                       break;
-                                       default: 
-                                               throw(copy); 
-                                       break;
-                               }
-                       } else {
-                               obj.network.simple_request('FM_ACP_DETAILS', [ ses(), copy.id() ], function(req) {
-                                       try {
-                                               var details = req.getResultObject();
-                                               var msg = copy.barcode() + ' -- ';
-                                               if (copy.call_number() == -1) msg += 'Item is a Pre-Cat.  ';
-                                               if (details.hold) msg += 'Item is captured for a Hold.  ';
-                                               if (details.transit) msg += 'Item is in Transit.  ';
-                                               if (details.circ && ! details.circ.checkin_time()) msg += 'Item is circulating.  ';
-                                               try { document.getElementById('last_scanned').setAttribute('value',msg); } catch(E) {}
-                                       } catch(E) {
-                                               alert(E);
+                       obj.network.simple_request('FM_ACP_DETAILS_VIA_BARCODE', [ ses(), barcode ], function(req) {
+                               try {
+                                       var details = req.getResultObject();
+                                       if (details == null) {
+                                               throw('Something weird happened.  null result');
+                                       } else if (details.ilsevent) {
+                                               switch(details.ilsevent) {
+                                                       case -1: 
+                                                               obj.error.standard_network_error_alert(); 
+                                                               obj.controller.view.copy_status_barcode_entry_textbox.select();
+                                                               obj.controller.view.copy_status_barcode_entry_textbox.focus();
+                                                               return;
+                                                       break;
+                                                       case 1502 /* ASSET_COPY_NOT_FOUND */ :
+                                                               try { document.getElementById('last_scanned').setAttribute('value',barcode + ' was either mis-scanned or is not cataloged.'); } catch(E) {}
+                                                               obj.error.yns_alert(barcode + ' was either mis-scanned or is not cataloged.','Not Cataloged','OK',null,null,'Check here to confirm this message');
+                                                               obj.controller.view.copy_status_barcode_entry_textbox.select();
+                                                               obj.controller.view.copy_status_barcode_entry_textbox.focus();
+                                                               return;
+                                                       break;
+                                                       default: 
+                                                               throw(details); 
+                                                       break;
+                                               }
                                        }
-                               } );
-                               var my_mvr = obj.network.simple_request('MODS_SLIM_RECORD_RETRIEVE_VIA_COPY', [ copy.id() ]);
-                               if (document.getElementById('trim_list')) {
-                                       var x = document.getElementById('trim_list');
-                                       if (x.checked) { obj.list.trim_list = 20; } else { obj.list.trim_list = null; }
-                               }
-                               obj.list.append(
-                                       {
-                                               'retrieve_id' : js2JSON( { 'renewable' : copy.circulations() ? 't' : 'f', 'copy_id' : copy.id(), 'acn_id' : (typeof copy.call_number() == 'object' ? copy.call_number().id() : copy.call_number()), 'barcode' : barcode, 'doc_id' : (typeof my_mvr.ilsevent == 'undefined' ? my_mvr.doc_id() : null ) } ),
-                                               'row' : {
-                                                       'my' : {
-                                                               'mvr' : my_mvr,
-                                                               'acp' : copy,
-                                                       }
-                                               },
-                                               'to_top' : true,
+                                       var msg = details.copy.barcode() + ' -- ';
+                                       if (details.copy.call_number() == -1) msg += 'Item is a Pre-Cat.  ';
+                                       if (details.hold) msg += 'Item is captured for a Hold.  ';
+                                       if (details.transit) msg += 'Item is in Transit.  ';
+                                       if (details.circ && ! details.circ.checkin_time()) msg += 'Item is circulating.  ';
+                                       try { document.getElementById('last_scanned').setAttribute('value',msg); } catch(E) {}
+                                       if (document.getElementById('trim_list')) {
+                                               var x = document.getElementById('trim_list');
+                                               if (x.checked) { obj.list.trim_list = 20; } else { obj.list.trim_list = null; }
                                        }
-                               );
-                               obj.controller.view.copy_status_barcode_entry_textbox.value = '';
-                               obj.controller.view.copy_status_barcode_entry_textbox.focus();
-                       }
+                                       obj.list.append(
+                                               {
+                                                       'retrieve_id' : js2JSON( 
+                                                               { 
+                                                                       'renewable' : details.circ ? 't' : 'f', 
+                                                                       'copy_id' : details.copy.id(), 
+                                                                       'acn_id' : details.volume ? details.volume.id() : -1, 
+                                                                       'barcode' : barcode, 
+                                                                       'doc_id' : details.mvr ? details.mvr.doc_id() : null  
+                                                               } 
+                                                       ),
+                                                       'row' : {
+                                                               'my' : {
+                                                                       'mvr' : details.mvr,
+                                                                       'acp' : details.copy,
+                                                                       'acn' : details.volume,
+                                                                       'atc' : details.transit,
+                                                                       'circ' : details.circ,
+                                                                       'ahr' : details.hold,
+                                                               }
+                                                       },
+                                                       'to_top' : true,
+                                               }
+                                       );
+                               } catch(E) {
+                                       obj.error.standard_unexpected_error_alert('',E);
+                               }
+                       } );
+                       obj.controller.view.copy_status_barcode_entry_textbox.value = '';
+                       obj.controller.view.copy_status_barcode_entry_textbox.focus();
+                       
                } catch(E) {
                        obj.error.standard_unexpected_error_alert('',E);
                        obj.controller.view.copy_status_barcode_entry_textbox.select();
index 23a771d..21e4161 100644 (file)
@@ -86,6 +86,7 @@
                <command id="cmd_copy_status_submit_barcode" />
                <command id="cmd_copy_status_print" />
                <command id="cmd_copy_status_export" />
+               <command id="cmd_copy_status_print_export" />
                <command id="cmd_copy_status_reprint" />
                <command id="cmd_copy_status_done" />
                <command id="save_columns" />
index 9c1bd9e..7ec17fd 100644 (file)
 </hbox>
 
 <hbox id="copy_status_bottom_ui">
-       <button id="copy_status_print" 
-               label="Print"
-               command="cmd_copy_status_print"
-               accesskey="P"/>
-       <button id="copy_status_export" 
-               label="Export"
-               command="cmd_copy_status_export"
-               accesskey=""/>
+       <button id="copy_status_print" label="Print" command="cmd_copy_status_print" accesskey="P"/>
+       <button id="copy_status_export" label="Export" command="cmd_copy_status_export" accesskey=""/>
+       <button id="copy_status_export" label="Print Export" command="cmd_copy_status_print_export" accesskey=""/>
        <checkbox id="trim_list" label="Trim List (20 rows)" checked="true" persist="checked"/> 
        <checkbox id="strict_barcode" label="Strict Barcode" checked="false" persist="checked"/> 
        <spacer flex="1"/>
index f07cdc9..2938fc0 100644 (file)
                                <caption label="Bills" style="color: red"/>
                                <tree id="bill_tree" flex="1" enableColumnDrag="true"/>
                                <hbox>
-                                       <label value="Save Columns" class="click_link" onclick="g.bill_list.save_columns();"/>
-                                       <label value="Copy to Clipboard" class="click_link" onclick="g.bill_list.clipboard();"/>
+                                       <button label="Save Columns" oncommand="g.bill_list.save_columns();"/>
+                                       <button label="Copy to Clipboard" oncommand="g.bill_list.clipboard();"/>
+                                       <button label="Print Export" oncommand="try { g.bill_list.on_all_fleshed = function() { JSAN.use('util.print'); var p = new util.print(); p.simple( g.bill_list.dump_csv(), { 'content_type' : 'text/plain' } ); setTimeout( function() { g.bill_list.on_all_fleshed = null; }, 0); }; g.bill_list.full_retrieve(); } catch(E) { alert(E); }"/>
                                        <spacer flex="1"/>
                                        <button id="void" label="Void selected billings" disabled="true"/>
                                </hbox>
                                <caption label="Payments" style="color: green"/>
                                <tree id="payment_tree" flex="1" enableColumnDrag="true"/>
                                <hbox>
-                                       <label value="Save Columns" class="click_link" onclick="g.payment_list.save_columns();"/>
-                                       <label value="Copy to Clipboard" class="click_link" onclick="g.payment_list.clipboard();"/>
+                                       <button label="Save Columns" oncommand="g.payment_list.save_columns();"/>
+                                       <button label="Copy to Clipboard" oncommand="g.payment_list.clipboard();"/>
+                                       <button label="Print Export" oncommand="try { g.payment_list.on_all_fleshed = function() { JSAN.use('util.print'); var p = new util.print(); p.simple( g.payment_list.dump_csv(), { 'content_type' : 'text/plain' } ); setTimeout( function() { g.payment_list.on_all_fleshed = null; }, 0); }; g.payment_list.full_retrieve(); } catch(E) { alert(E); }"/>
                                        <spacer flex="1"/>
                                </hbox>
                        </groupbox>