[open-ils-commits] r14915 - 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
Sat Nov 14 03:37:02 EST 2009
Author: phasefx
Date: 2009-11-14 03:36:57 -0500 (Sat, 14 Nov 2009)
New Revision: 14915
Modified:
trunk/Open-ILS/xul/staff_client/chrome/content/util/list.js
trunk/Open-ILS/xul/staff_client/chrome/locale/en-US/offline.properties
Log:
List Actions -> Print List Expanded Format
Similar to Print List CSV in that in prints visible columns without using a template, but it pivots the data vertically, similar to the \x option in psql.
So instead of getting something like:
"Alert Message"\t"Barcode"\r\n
"3 dvd's"\t"b1"\r\n
"2 cassettes"\t"b2"\r\n
You'll instead get:
=-=-=
Alert Message: 3 dvd's
Barcode: b1
=-=-=
Alert Message: 2 cassettes
Barcode: b2
Modified: trunk/Open-ILS/xul/staff_client/chrome/content/util/list.js
===================================================================
--- trunk/Open-ILS/xul/staff_client/chrome/content/util/list.js 2009-11-14 08:08:37 UTC (rev 14914)
+++ trunk/Open-ILS/xul/staff_client/chrome/content/util/list.js 2009-11-14 08:36:57 UTC (rev 14915)
@@ -1150,6 +1150,34 @@
return dump;
},
+ 'dump_extended_format' : function(params) {
+ var obj = this;
+ switch(this.node.nodeName) {
+ case 'tree' : return this._dump_tree_extended_format(params); break;
+ default: throw('NYI: Need .dump_extended_format() for ' + this.node.nodeName); break;
+ }
+
+ },
+
+ '_dump_tree_extended_format' : function(params) {
+ var obj = this;
+ var dump = '';
+ for (var i = 0; i < this.treechildren.childNodes.length; i++) {
+ var row = document.getElementById('offlineStrings').getString('list.dump_extended_format.record_separator') + '\r\n';
+ var treeitem = this.treechildren.childNodes[i];
+ var treerow = treeitem.firstChild;
+ for (var j = 0; j < treerow.childNodes.length; j++) {
+ if (obj.node.treeBoxObject.columns.getColumnAt(j).element.getAttribute('hidden') == 'true') {
+ /* skip */
+ } else {
+ row += obj.columns[j].label + ': ' + treerow.childNodes[j].getAttribute('label') + '\r\n';
+ }
+ }
+ dump += row + '\r\n';
+ }
+ return dump;
+ },
+
'dump_csv_to_clipboard' : function(params) {
var obj = this;
if (typeof params == 'undefined') params = {};
@@ -1175,6 +1203,21 @@
}
},
+ 'dump_extended_format_to_printer' : function(params) {
+ var obj = this;
+ JSAN.use('util.print'); var print = new util.print();
+ if (typeof params == 'undefined') params = {};
+ if (params.no_full_retrieve) {
+ print.simple( obj.dump_extended_format( params ), {'content_type':'text/plain'} );
+ } else {
+ obj.wrap_in_full_retrieve(
+ function() {
+ print.simple( obj.dump_extended_format( params ), {'content_type':'text/plain'} );
+ }
+ );
+ }
+ },
+
'dump_csv_to_file' : function(params) {
var obj = this;
JSAN.use('util.file'); var f = new util.file();
@@ -1436,6 +1479,11 @@
mi.setAttribute('accesskey',document.getElementById('offlineStrings').getString('list.actions.csv_to_printer.accesskey'));
mp.appendChild(mi);
mi = document.createElement('menuitem');
+ mi.setAttribute('id',obj.node.id + '_extended_to_printer');
+ mi.setAttribute('label',document.getElementById('offlineStrings').getString('list.actions.extended_to_printer.label'));
+ mi.setAttribute('accesskey',document.getElementById('offlineStrings').getString('list.actions.extended_to_printer.accesskey'));
+ mp.appendChild(mi);
+ mi = document.createElement('menuitem');
mi.setAttribute('id',obj.node.id + '_csv_to_file');
mi.setAttribute('label',document.getElementById('offlineStrings').getString('list.actions.csv_to_file.label'));
mi.setAttribute('accesskey',document.getElementById('offlineStrings').getString('list.actions.csv_to_file.accesskey'));
@@ -1502,6 +1550,20 @@
false
);
}
+ x = document.getElementById(obj.node.id + '_extended_to_printer');
+ if (x) {
+ x.addEventListener(
+ 'command',
+ function() {
+ obj.dump_extended_format_to_printer(params);
+ if (params && typeof params.on_complete == 'function') {
+ params.on_complete(params);
+ }
+ },
+ false
+ );
+ }
+
x = document.getElementById(obj.node.id + '_csv_to_file');
if (x) {
x.addEventListener(
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-14 08:08:37 UTC (rev 14914)
+++ trunk/Open-ILS/xul/staff_client/chrome/locale/en-US/offline.properties 2009-11-14 08:36:57 UTC (rev 14915)
@@ -203,10 +203,13 @@
list.actions.csv_to_clipboard.accesskey=L
list.actions.csv_to_printer.label=Print List CSV
list.actions.csv_to_printer.accesskey=P
+list.actions.extended_to_printer.label=Print List Expanded Format
+list.actions.extended_to_printer.accesskey=x
list.actions.csv_to_file.label=Save List CSV to File
list.actions.csv_to_file.accesskey=F
list.actions.save_column_configuration.label=Save Column Configuration
list.actions.save_column_configuration.accesskey=S
+list.dump_extended_format.record_separator==-=-=
menu.cmd_survey_wizard.inadequate_perm=You are lacking the CREATE_SURVEY permission and/or working locations.
menu.cmd_local_admin_fonts_and_sounds.tab=Global Font and Sound Settings
menu.cmd_local_admin_printer.tab=Printer Settings Editor
More information about the open-ils-commits
mailing list