[open-ils-commits] r8231 - in branches/rel_1_2/Open-ILS/xul/staff_client: chrome/content/circ chrome/content/util server/admin server/cat server/circ server/patron

svn at svn.open-ils.org svn at svn.open-ils.org
Mon Dec 17 18:16:10 EST 2007


Author: phasefx
Date: 2007-12-17 17:54:45 -0500 (Mon, 17 Dec 2007)
New Revision: 8231

Modified:
   branches/rel_1_2/Open-ILS/xul/staff_client/chrome/content/circ/offline_checkin.js
   branches/rel_1_2/Open-ILS/xul/staff_client/chrome/content/circ/offline_checkout.js
   branches/rel_1_2/Open-ILS/xul/staff_client/chrome/content/circ/offline_in_house_use.js
   branches/rel_1_2/Open-ILS/xul/staff_client/chrome/content/circ/offline_renew.js
   branches/rel_1_2/Open-ILS/xul/staff_client/chrome/content/util/list.js
   branches/rel_1_2/Open-ILS/xul/staff_client/server/admin/offline_manage_xacts.js
   branches/rel_1_2/Open-ILS/xul/staff_client/server/admin/transit_list.js
   branches/rel_1_2/Open-ILS/xul/staff_client/server/cat/copy_buckets.js
   branches/rel_1_2/Open-ILS/xul/staff_client/server/cat/record_buckets.js
   branches/rel_1_2/Open-ILS/xul/staff_client/server/cat/z3950.js
   branches/rel_1_2/Open-ILS/xul/staff_client/server/circ/checkin.js
   branches/rel_1_2/Open-ILS/xul/staff_client/server/circ/checkout.js
   branches/rel_1_2/Open-ILS/xul/staff_client/server/circ/copy_status.js
   branches/rel_1_2/Open-ILS/xul/staff_client/server/circ/hold_capture.js
   branches/rel_1_2/Open-ILS/xul/staff_client/server/circ/in_house_use.js
   branches/rel_1_2/Open-ILS/xul/staff_client/server/patron/bill_history.xul
   branches/rel_1_2/Open-ILS/xul/staff_client/server/patron/holds.js
   branches/rel_1_2/Open-ILS/xul/staff_client/server/patron/items.js
   branches/rel_1_2/Open-ILS/xul/staff_client/server/patron/search_result.js
Log:
refactoring.. moved some list print/clipboard functions into list.js

Modified: branches/rel_1_2/Open-ILS/xul/staff_client/chrome/content/circ/offline_checkin.js
===================================================================
--- branches/rel_1_2/Open-ILS/xul/staff_client/chrome/content/circ/offline_checkin.js	2007-12-17 15:11:04 UTC (rev 8230)
+++ branches/rel_1_2/Open-ILS/xul/staff_client/chrome/content/circ/offline_checkin.js	2007-12-17 22:54:45 UTC (rev 8231)
@@ -107,26 +107,20 @@
 
 		if ($('print_receipt').checked) {
 			try {
-				var params = {
-					'header' : g.data.print_list_templates.offline_checkin.header,
-					'line_item' : g.data.print_list_templates.offline_checkin.line_item,
-					'footer' : g.data.print_list_templates.offline_checkin.footer,
-					'type' : g.data.print_list_templates.offline_checkin.type,
-					'list' : g.list.dump(),
-				};
-				JSAN.use('util.print'); var print = new util.print();
-				print.tree_list( params );
+                var params = {
+                    'template' : 'offline_checkin',
+                    'callback' : function() {
+                        g.list.clear();
+                        var x = $('i_barcode'); x.value = ''; x.focus();
+                    }
+                };
+                g.list.print( params );
 			} catch(E) {
 				g.error.sdump('D_ERROR','print: ' + E);
 				alert('print: ' + E);
 			}
 		}
 
-		g.list.clear();
-		
-		var x;
-		x = $('i_barcode'); x.value = ''; x.focus();
-
 	} catch(E) {
 		dump(E+'\n'); alert(E);
 	}

Modified: branches/rel_1_2/Open-ILS/xul/staff_client/chrome/content/circ/offline_checkout.js
===================================================================
--- branches/rel_1_2/Open-ILS/xul/staff_client/chrome/content/circ/offline_checkout.js	2007-12-17 15:11:04 UTC (rev 8230)
+++ branches/rel_1_2/Open-ILS/xul/staff_client/chrome/content/circ/offline_checkout.js	2007-12-17 22:54:45 UTC (rev 8231)
@@ -264,28 +264,21 @@
 			try {
 				var params = {
 					'patron_barcode' : $('p_barcode').value,
-					'header' : g.data.print_list_templates.offline_checkout.header,
-					'line_item' : g.data.print_list_templates.offline_checkout.line_item,
-					'footer' : g.data.print_list_templates.offline_checkout.footer,
-					'type' : g.data.print_list_templates.offline_checkout.type,
-					'list' : g.list.dump(),
+					'template' : 'offline_checkout',
+                    'callback' : function() {
+                        g.list.clear();
+                        var x = $('i_barcode'); x.value = '';
+                        x = $('p_barcode'); x.value = ''; 
+                        x.setAttribute('disabled','false'); x.disabled = false; 
+                        x.focus();
+                    }
 				};
-				JSAN.use('util.print'); var print = new util.print();
-				print.tree_list( params );
+				g.list.print( params );
 			} catch(E) {
 				g.error.sdump('D_ERROR','print: ' + E);
 				alert('print: ' + E);
 			}
 		}
-
-		g.list.clear();
-		
-		var x;
-		x = $('i_barcode'); x.value = '';
-		x = $('p_barcode'); x.value = ''; 
-		x.setAttribute('disabled','false'); x.disabled = false; 
-		x.focus();
-
 	} catch(E) {
 		dump(E+'\n'); alert(E);
 	}

Modified: branches/rel_1_2/Open-ILS/xul/staff_client/chrome/content/circ/offline_in_house_use.js
===================================================================
--- branches/rel_1_2/Open-ILS/xul/staff_client/chrome/content/circ/offline_in_house_use.js	2007-12-17 15:11:04 UTC (rev 8230)
+++ branches/rel_1_2/Open-ILS/xul/staff_client/chrome/content/circ/offline_in_house_use.js	2007-12-17 22:54:45 UTC (rev 8231)
@@ -111,25 +111,18 @@
 		if ($('print_receipt').checked) {
 			try {
 				var params = {
-					'header' : g.data.print_list_templates.offline_inhouse_use.header,
-					'line_item' : g.data.print_list_templates.offline_inhouse_use.line_item,
-					'footer' : g.data.print_list_templates.offline_inhouse_use.footer,
-					'type' : g.data.print_list_templates.offline_inhouse_use.type,
-					'list' : g.list.dump(),
+					'template' : 'offline_inhouse_use',
+                    'callback' : function() {
+                        g.list.clear();
+                        var x = $('i_barcode'); x.value = ''; x.focus();
+                    }
 				};
-				JSAN.use('util.print'); var print = new util.print();
-				print.tree_list( params );
+				g.list.print( params );
 			} catch(E) {
 				g.error.sdump('D_ERROR','print: ' + E);
 				alert('print: ' + E);
 			}
 		}
-
-		g.list.clear();
-		
-		var x;
-		x = $('i_barcode'); x.value = ''; x.focus();
-
 	} catch(E) {
 		dump(E+'\n'); alert(E);
 	}

Modified: branches/rel_1_2/Open-ILS/xul/staff_client/chrome/content/circ/offline_renew.js
===================================================================
--- branches/rel_1_2/Open-ILS/xul/staff_client/chrome/content/circ/offline_renew.js	2007-12-17 15:11:04 UTC (rev 8230)
+++ branches/rel_1_2/Open-ILS/xul/staff_client/chrome/content/circ/offline_renew.js	2007-12-17 22:54:45 UTC (rev 8231)
@@ -223,27 +223,20 @@
 					try {
 						var params = {
 							'patron_barcode' : $('p_barcode').value,
-							'header' : g.data.print_list_templates.offline_renew.header,
-							'line_item' : g.data.print_list_templates.offline_renew.line_item,
-							'footer' : g.data.print_list_templates.offline_renew.footer,
-							'type' : g.data.print_list_templates.offline_renew.type,
-							'list' : g.list.dump(),
+							'template' : 'offline_renew',
+                            'callback' : function() {
+                                g.list.clear();
+                                var x = $('i_barcode'); x.value = '';
+                                x = $('p_barcode'); x.value = ''; x.focus();
+                            }
 						};
-						JSAN.use('util.print'); var print = new util.print();
-						print.tree_list( params );
+						g.list.print( params );
 					} catch(E) {
 						g.error.sdump('D_ERROR','print: ' + E);
 						alert('print: ' + E);
 					}
 				}
 		}
-
-		g.list.clear();
-		
-		var x;
-		x = $('i_barcode'); x.value = '';
-		x = $('p_barcode'); x.value = ''; x.focus();
-
 	} catch(E) {
 		dump(E+'\n'); alert(E);
 	}

Modified: branches/rel_1_2/Open-ILS/xul/staff_client/chrome/content/util/list.js
===================================================================
--- branches/rel_1_2/Open-ILS/xul/staff_client/chrome/content/util/list.js	2007-12-17 15:11:04 UTC (rev 8230)
+++ branches/rel_1_2/Open-ILS/xul/staff_client/chrome/content/util/list.js	2007-12-17 22:54:45 UTC (rev 8231)
@@ -1080,6 +1080,47 @@
         }
     },
 
+    'print' : function(params) {
+        if (!params) params = {};
+		switch(this.node.nodeName) {
+			case 'tree' : return this._print_tree(params); break;
+			default: throw('NYI: Need ._print() for ' + this.node.nodeName); break;
+		}
+    },
+
+    '_print_tree' : function(params) {
+        var obj = this;
+        try {
+			JSAN.use('OpenILS.data'); var data = new OpenILS.data(); data.stash_retrieve();
+            if (!params.staff && data.list.au && data.list.au[0]) {
+                params.staff = data.list.au[0];
+            }
+            if (!params.lib && data.list.au && data.list.au[0] && data.list.au[0].ws_ou() && data.hash.aou && data.hash.aou[ data.list.au[0].ws_ou() ]) {
+                params.lib = data.hash.aou[ data.list.au[0].ws_ou() ];
+                params.lib.children(null);
+            }
+            if (params.template && data.print_list_templates[ params.template ]) {
+                var template = data.print_list_templates[ params.template ];
+                for (var i in template) params[i] = template[i];
+            }
+            obj.wrap_in_full_retrieve(
+                function() {
+                    try {
+                        if (!params.list) params.list = obj.dump_with_keys();
+                        JSAN.use('util.print'); var print = new util.print();
+                        print.tree_list( params );
+                        if (typeof params.callback == 'function') params.callback();
+                    } catch(E) {
+			            obj.error.standard_unexpected_error_alert('inner _print_tree',E);
+                    }
+                }
+            );
+            
+        } catch(E) {
+			obj.error.standard_unexpected_error_alert('_print_tree',E);
+        }
+    },
+
 	'dump_selected_with_keys' : function(params) {
 		var obj = this;
 		switch(this.node.nodeName) {

Modified: branches/rel_1_2/Open-ILS/xul/staff_client/server/admin/offline_manage_xacts.js
===================================================================
--- branches/rel_1_2/Open-ILS/xul/staff_client/server/admin/offline_manage_xacts.js	2007-12-17 15:11:04 UTC (rev 8230)
+++ branches/rel_1_2/Open-ILS/xul/staff_client/server/admin/offline_manage_xacts.js	2007-12-17 22:54:45 UTC (rev 8231)
@@ -320,17 +320,7 @@
 			'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());
-								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();
+					obj.error_list.dump_csv_to_clipboard();
 				} catch(E) {
 					obj.error.standard_unexpected_error_alert('export',E); 
 				}

Modified: branches/rel_1_2/Open-ILS/xul/staff_client/server/admin/transit_list.js
===================================================================
--- branches/rel_1_2/Open-ILS/xul/staff_client/server/admin/transit_list.js	2007-12-17 15:11:04 UTC (rev 8230)
+++ branches/rel_1_2/Open-ILS/xul/staff_client/server/admin/transit_list.js	2007-12-17 22:54:45 UTC (rev 8231)
@@ -421,37 +421,11 @@
 	'print_list' : function(which_list) {
 		var obj = this;
 		try {
-
 			var list = which_list == 0 ? obj.list : obj.list2;
-
-			if (list.on_all_fleshed != null) {
-				var r = window.confirm('This list is busy retrieving/rendering rows for a pending action.  Would you like to abort the pending action and proceed?');
-				if (!r) return;
-			}
-			list.on_all_fleshed =
-				function() {
-					try {
-						dump( js2JSON( list.dump_with_keys() ) + '\n' );
-						obj.data.stash_retrieve();
-						var lib = obj.data.hash.aou[ obj.data.list.au[0].ws_ou() ];
-						lib.children(null);
-						var p = { 
-							'lib' : lib,
-							'staff' : obj.data.list.au[0],
-							'header' : obj.data.print_list_templates.transit_list.header,
-							'line_item' : obj.data.print_list_templates.transit_list.line_item,
-							'footer' : obj.data.print_list_templates.transit_list.footer,
-							'type' : obj.data.print_list_templates.transit_list.type,
-							'list' : list.dump_with_keys(),
-						};
-						JSAN.use('util.print'); var print = new util.print();
-						print.tree_list( p );
-						setTimeout(function(){ list.on_all_fleshed = null; },0);
-					} catch(E) {
-						obj.error.standard_unexpected_error_alert('print',E); 
-					}
-				}
-			list.full_retrieve();
+            var p = { 
+                'template' : 'transit_list'
+            };
+			list.print(p);
 		} catch(E) {
 			obj.error.standard_unexpected_error_alert('print',E); 
 		}

Modified: branches/rel_1_2/Open-ILS/xul/staff_client/server/cat/copy_buckets.js
===================================================================
--- branches/rel_1_2/Open-ILS/xul/staff_client/server/cat/copy_buckets.js	2007-12-17 15:11:04 UTC (rev 8230)
+++ branches/rel_1_2/Open-ILS/xul/staff_client/server/cat/copy_buckets.js	2007-12-17 22:54:45 UTC (rev 8231)
@@ -560,31 +560,13 @@
 					'cmd_copy_buckets_export' : [
 						['command'],
 						function() {
-							obj.list2.on_all_fleshed = function() {
-								try {
-									dump(obj.list2.dump_csv() + '\n');
-									copy_to_clipboard(obj.list2.dump_csv());
-									setTimeout(function(){obj.list2.on_all_fleshed = null;},0);
-								} catch(E) {
-									alert(E); 
-								}
-							}
-							obj.list2.full_retrieve();
+							obj.list2.dump_csv_to_clipboard();
 						}
 					],
 					'cmd_export1' : [
 						['command'],
 						function() {
-							obj.list1.on_all_fleshed = function() {
-								try {
-									dump(obj.list1.dump_csv() + '\n');
-									copy_to_clipboard(obj.list1.dump_csv());
-									setTimeout(function(){obj.list1.on_all_fleshed = null;},0);
-								} catch(E) {
-									alert(E); 
-								}
-							}
-							obj.list1.full_retrieve();
+							obj.list1.dump_csv_to_clipboard();
 						}
 					],
 

Modified: branches/rel_1_2/Open-ILS/xul/staff_client/server/cat/record_buckets.js
===================================================================
--- branches/rel_1_2/Open-ILS/xul/staff_client/server/cat/record_buckets.js	2007-12-17 15:11:04 UTC (rev 8230)
+++ branches/rel_1_2/Open-ILS/xul/staff_client/server/cat/record_buckets.js	2007-12-17 22:54:45 UTC (rev 8231)
@@ -391,32 +391,14 @@
 					'cmd_record_buckets_export' : [
 						['command'],
 						function() {
-							obj.list2.on_all_fleshed = function() {
-								try {
-									dump(obj.list2.dump_csv() + '\n');
-									copy_to_clipboard(obj.list2.dump_csv());
-									setTimeout(function(){obj.list2.on_all_fleshed = null;},0);
-								} catch(E) {
-									alert(E); 
-								}
-							}
-							obj.list2.full_retrieve();
+							obj.list2.dump_csv_to_clipboard();
 						}
 					],
 
 					'cmd_export1' : [
 						['command'],
 						function() {
-							obj.list1.on_all_fleshed = function() {
-								try {
-									dump(obj.list1.dump_csv() + '\n');
-									copy_to_clipboard(obj.list1.dump_csv());
-									setTimeout(function(){obj.list1.on_all_fleshed = null;},0);
-								} catch(E) {
-									alert(E); 
-								}
-							}
-							obj.list1.full_retrieve();
+							obj.list1.dump_csv_to_clipboard();
 						}
 					],
 

Modified: branches/rel_1_2/Open-ILS/xul/staff_client/server/cat/z3950.js
===================================================================
--- branches/rel_1_2/Open-ILS/xul/staff_client/server/cat/z3950.js	2007-12-17 15:11:04 UTC (rev 8230)
+++ branches/rel_1_2/Open-ILS/xul/staff_client/server/cat/z3950.js	2007-12-17 22:54:45 UTC (rev 8231)
@@ -82,16 +82,7 @@
 						'cmd_export' : [
 							['command'],
 							function() {
-								obj.list.on_all_fleshed = function() {
-									try {
-										dump(obj.list.dump_csv() + '\n');
-										copy_to_clipboard(obj.list.dump_csv());
-										setTimeout(function(){obj.list.on_all_fleshed = null;},0);
-									} catch(E) {
-			                            obj.error.standard_unexpected_error_alert('Failure during export.',E);
-									}
-								}
-								obj.list.full_retrieve();
+								obj.list.dump_csv_to_clipboard();
 							}
 						],
 						'cmd_broken' : [
@@ -294,11 +285,11 @@
 		var obj = this;
 		var x = obj.creds.services[service].default_attr;
 		if (x) {
-			document.getElementById(x+'_input').focus();
+			var xx = document.getElementById(x+'_input'); if (xx) xx.focus();
 		} else {
 			var y;
 			for (var i in obj.services[service].attr) { y = i; }
-			document.getElementById(y+'_input').focus();
+			var xx = document.getElementById(y+'_input'); if (xx) xx.focus();
 		}
 	},
 

Modified: branches/rel_1_2/Open-ILS/xul/staff_client/server/circ/checkin.js
===================================================================
--- branches/rel_1_2/Open-ILS/xul/staff_client/server/circ/checkin.js	2007-12-17 15:11:04 UTC (rev 8230)
+++ branches/rel_1_2/Open-ILS/xul/staff_client/server/circ/checkin.js	2007-12-17 22:54:45 UTC (rev 8231)
@@ -236,44 +236,16 @@
 					'cmd_checkin_print' : [
 						['command'],
 						function() {
-							obj.list.on_all_fleshed = function() {
-								try {
-									dump( js2JSON( obj.list.dump_with_keys() ) + '\n' );
-									obj.OpenILS.data.stash_retrieve();
-									var lib = obj.OpenILS.data.hash.aou[ obj.OpenILS.data.list.au[0].ws_ou() ];
-									lib.children(null);
-									var p = { 
-										'lib' : lib,
-										'staff' : obj.OpenILS.data.list.au[0],
-										'header' : obj.OpenILS.data.print_list_templates.checkin.header,
-										'line_item' : obj.OpenILS.data.print_list_templates.checkin.line_item,
-										'footer' : obj.OpenILS.data.print_list_templates.checkin.footer,
-										'type' : obj.OpenILS.data.print_list_templates.checkin.type,
-										'list' : obj.list.dump_with_keys(),
-									};
-									JSAN.use('util.print'); var print = new util.print();
-									print.tree_list( p );
-									setTimeout(function(){obj.list.on_all_fleshed = null;},0);
-								} catch(E) {
-									alert(E); 
-								}
-							}
-							obj.list.full_retrieve();
+							var p = { 
+								'template' : 'checkin'
+							};
+							obj.list.print(p);
 						}
 					],
 					'cmd_checkin_export' : [
 						['command'],
 						function() {
-							obj.list.on_all_fleshed = function() {
-								try {
-									dump(obj.list.dump_csv() + '\n');
-									copy_to_clipboard(obj.list.dump_csv());
-									setTimeout(function(){obj.list.on_all_fleshed = null;},0);
-								} catch(E) {
-									alert(E); 
-								}
-							}
-							obj.list.full_retrieve();
+							obj.list.dump_csv_to_clipboard();
 						}
 					],
 

Modified: branches/rel_1_2/Open-ILS/xul/staff_client/server/circ/checkout.js
===================================================================
--- branches/rel_1_2/Open-ILS/xul/staff_client/server/circ/checkout.js	2007-12-17 15:11:04 UTC (rev 8230)
+++ branches/rel_1_2/Open-ILS/xul/staff_client/server/circ/checkout.js	2007-12-17 22:54:45 UTC (rev 8231)
@@ -266,39 +266,25 @@
 		var obj = this;
 		try {
 			obj.patron = obj.network.simple_request('FM_AU_FLESHED_RETRIEVE_VIA_ID',[ses(),obj.patron_id]);
-			dump( js2JSON( obj.list.dump_with_keys() ) + '\n' );
-			obj.list.on_all_fleshed = function() {
-				try {
-					var params = { 
-						'patron' : obj.patron, 
-						'lib' : obj.data.hash.aou[ obj.data.list.au[0].ws_ou() ],
-						'staff' : obj.data.list.au[0],
-						'header' : obj.data.print_list_templates.checkout.header,
-						'line_item' : obj.data.print_list_templates.checkout.line_item,
-						'footer' : obj.data.print_list_templates.checkout.footer,
-						'type' : obj.data.print_list_templates.checkout.type,
-						'list' : obj.list.dump_with_keys(),
-					};
-					if (silent) params.no_prompt = true;
-					JSAN.use('util.print'); var print = new util.print();
-					print.tree_list( params );
-					setTimeout(
-						function(){
-							obj.list.on_all_fleshed = null;
-							if (typeof f == 'function') { 
-								setTimeout( 
-									function() {
-										f();
-									}, 1000
-								)
-							} }
-						, 1000
-					);
-				} catch(E) {
-					obj.error.standard_unexpected_error_alert('print',E);
-				}
-			}
-			obj.list.full_retrieve();
+            var params = { 
+                'patron' : obj.patron, 
+                'header' : 'checkout',
+                'callback' : function() {
+                    setTimeout(
+                        function(){
+                            if (typeof f == 'function') { 
+                                setTimeout( 
+                                    function() {
+                                        f();
+                                    }, 1000
+                                )
+                            } 
+                        }, 1000
+                    );
+                }
+            };
+			if (silent) params.no_prompt = true;
+			obj.list.print(params);
 		} catch(E) {
 			obj.error.standard_unexpected_error_alert('print',E);
 		}
@@ -307,16 +293,7 @@
 	'export_list' : function(silent,f) {
 		var obj = this;
 		try {
-			obj.list.on_all_fleshed = function() {
-				try {
-					dump( obj.list.dump_csv() + '\n' );
-					copy_to_clipboard(obj.list.dump_csv());
-					setTimeout(function(){obj.list.on_all_fleshed = null;if (typeof f == 'function') f();},0);
-				} catch(E) {
-					obj.error.standard_unexpected_error_alert('print',E);
-				}
-			}
-			obj.list.full_retrieve();
+			obj.list.dump_csv_to_clipboard();
 		} catch(E) {
 			obj.error.standard_unexpected_error_alert('export',E);
 		}

Modified: branches/rel_1_2/Open-ILS/xul/staff_client/server/circ/copy_status.js
===================================================================
--- branches/rel_1_2/Open-ILS/xul/staff_client/server/circ/copy_status.js	2007-12-17 15:11:04 UTC (rev 8230)
+++ branches/rel_1_2/Open-ILS/xul/staff_client/server/circ/copy_status.js	2007-12-17 22:54:45 UTC (rev 8231)
@@ -318,30 +318,10 @@
 						['command'],
 						function() {
 							try {
-								obj.list.on_all_fleshed =
-									function() {
-										try {
-											dump( js2JSON( obj.list.dump_with_keys() ) + '\n' );
-											obj.data.stash_retrieve();
-											var lib = obj.data.hash.aou[ obj.data.list.au[0].ws_ou() ];
-											lib.children(null);
-											var p = { 
-												'lib' : lib,
-												'staff' : obj.data.list.au[0],
-												'header' : obj.data.print_list_templates.item_status.header,
-												'line_item' : obj.data.print_list_templates.item_status.line_item,
-												'footer' : obj.data.print_list_templates.item_status.footer,
-												'type' : obj.data.print_list_templates.item_status.type,
-												'list' : obj.list.dump_with_keys(),
-											};
-											JSAN.use('util.print'); var print = new util.print();
-											print.tree_list( p );
-											setTimeout(function(){ obj.list.on_all_fleshed = null; },0);
-										} catch(E) {
-											obj.error.standard_unexpected_error_alert('print',E); 
-										}
-									}
-								obj.list.full_retrieve();
+                                var p = { 
+                                    'template' : 'item_status'
+                                };
+								obj.list.print(p);
 							} catch(E) {
 								obj.error.standard_unexpected_error_alert('print',E); 
 							}
@@ -351,17 +331,7 @@
 						['command'],
 						function() {
 							try {
-								obj.list.on_all_fleshed =
-									function() {
-										try {
-											dump( obj.list.dump_csv() + '\n' );
-											copy_to_clipboard(obj.list.dump_csv());
-											setTimeout(function(){ obj.list.on_all_fleshed = null; },0);
-										} catch(E) {
-											obj.error.standard_unexpected_error_alert('export',E); 
-										}
-									}
-								obj.list.full_retrieve();
+								obj.list.dump_csv_to_clipboard();
 							} catch(E) {
 								obj.error.standard_unexpected_error_alert('export',E); 
 							}

Modified: branches/rel_1_2/Open-ILS/xul/staff_client/server/circ/hold_capture.js
===================================================================
--- branches/rel_1_2/Open-ILS/xul/staff_client/server/circ/hold_capture.js	2007-12-17 15:11:04 UTC (rev 8230)
+++ branches/rel_1_2/Open-ILS/xul/staff_client/server/circ/hold_capture.js	2007-12-17 22:54:45 UTC (rev 8231)
@@ -60,29 +60,10 @@
 					'cmd_hold_capture_print' : [
 						['command'],
 						function() {
-							obj.list.on_all_fleshed = function() {
-								try {
-									dump( js2JSON( obj.list.dump_with_keys() ) + '\n' );
-									obj.OpenILS.data.stash_retrieve();
-									var lib = obj.OpenILS.data.hash.aou[ obj.OpenILS.data.list.au[0].ws_ou() ];
-									lib.children(null);
-									var p = { 
-										'lib' : lib,
-										'staff' : obj.OpenILS.data.list.au[0],
-										'header' : obj.OpenILS.data.print_list_templates.hold_capture.header,
-										'line_item' : obj.OpenILS.data.print_list_templates.hold_capture.line_item,
-										'footer' : obj.OpenILS.data.print_list_templates.hold_capture.footer,
-										'type' : obj.OpenILS.data.print_list_templates.hold_capture.type,
-										'list' : obj.list.dump_with_keys(),
-									};
-									JSAN.use('util.print'); var print = new util.print();
-									print.tree_list( p );
-									setTimeout(function(){obj.list.on_all_fleshed = null;},0);
-								} catch(E) {
-									alert(E); 
-								}
-							}
-							obj.list.full_retrieve();
+							var p = { 
+								'template' : 'hold_capture'
+							};
+							obj.list.print(p);
 						}
 					],
 					'cmd_hold_capture_reprint' : [

Modified: branches/rel_1_2/Open-ILS/xul/staff_client/server/circ/in_house_use.js
===================================================================
--- branches/rel_1_2/Open-ILS/xul/staff_client/server/circ/in_house_use.js	2007-12-17 15:11:04 UTC (rev 8230)
+++ branches/rel_1_2/Open-ILS/xul/staff_client/server/circ/in_house_use.js	2007-12-17 22:54:45 UTC (rev 8231)
@@ -155,44 +155,16 @@
 					'cmd_in_house_use_print' : [
 						['command'],
 						function() {
-							obj.list.on_all_fleshed = function() {
-								try {
-									dump( js2JSON( obj.list.dump_with_keys() ) + '\n' );
-									obj.data.stash_retrieve();
-									var lib = obj.data.hash.aou[ obj.data.list.au[0].ws_ou() ];
-									lib.children(null);
-									var p = { 
-										'lib' : lib,
-										'staff' : obj.data.list.au[0],
-										'header' : obj.data.print_list_templates.in_house_use.header,
-										'line_item' : obj.data.print_list_templates.in_house_use.line_item,
-										'footer' : obj.data.print_list_templates.in_house_use.footer,
-										'type' : obj.data.print_list_templates.in_house_use.type,
-										'list' : obj.list.dump_with_keys(),
-									};
-									JSAN.use('util.print'); var print = new util.print();
-									print.tree_list( p );
-									setTimeout(function(){obj.list.on_all_fleshed = null;},0);
-								} catch(E) {
-									alert(E); 
-								}
-							}
-							obj.list.full_retrieve();
+							var p = { 
+								'template' : 'in_house_use'
+							};
+							obj.list.print(p);
 						}
 					],
 					'cmd_in_house_use_export' : [
 						['command'],
 						function() {
-							obj.list.on_all_fleshed = function() {
-								try {
-									dump(obj.list.dump_csv() + '\n');
-									copy_to_clipboard(obj.list.dump_csv());
-									setTimeout(function(){obj.list.on_all_fleshed = null;},0);
-								} catch(E) {
-									alert(E); 
-								}
-							}
-							obj.list.full_retrieve();
+							obj.list.dump_csv_to_clipboard();
 						}
 					],
 

Modified: branches/rel_1_2/Open-ILS/xul/staff_client/server/patron/bill_history.xul
===================================================================
--- branches/rel_1_2/Open-ILS/xul/staff_client/server/patron/bill_history.xul	2007-12-17 15:11:04 UTC (rev 8230)
+++ branches/rel_1_2/Open-ILS/xul/staff_client/server/patron/bill_history.xul	2007-12-17 22:54:45 UTC (rev 8231)
@@ -323,29 +323,13 @@
 
 		function print_bills() {
 			try {
-				g.bill_list.on_all_fleshed = function() {
-					try {
-						var template = 'bills_historical'; if (xul_param('current')) template = 'bills_current';
-						JSAN.use('patron.util');
-						var params = { 
-							'patron' : patron.util.retrieve_au_via_id(ses(),g.patron_id), 
-							'lib' : g.data.hash.aou[ g.data.list.au[0].ws_ou() ],
-							'staff' : g.data.list.au[0],
-							'header' : g.data.print_list_templates[template].header,
-							'line_item' : g.data.print_list_templates[template].line_item,
-							'footer' : g.data.print_list_templates[template].footer,
-							'type' : g.data.print_list_templates[template].type,
-							'list' : g.bill_list.dump_with_keys(),
-							//'modal' : true,
-						};
-						JSAN.use('util.print'); var print = new util.print();
-						print.tree_list( params );
-						setTimeout(function(){ g.bill_list.on_all_fleshed = null; },0);
-					} catch(E) {
-						g.error.standard_unexpected_error_alert('printing bills', E);
-					}
-				}
-				g.bill_list.full_retrieve();
+                var template = 'bills_historical'; if (xul_param('current')) template = 'bills_current';
+                JSAN.use('patron.util');
+                var params = { 
+                    'patron' : patron.util.retrieve_au_via_id(ses(),g.patron_id), 
+                    'template' : template
+                };
+				g.bill_list.print(params);
 			} catch(E) {
 				g.error.standard_unexpected_error_alert('printing bills', E);
 			}

Modified: branches/rel_1_2/Open-ILS/xul/staff_client/server/patron/holds.js
===================================================================
--- branches/rel_1_2/Open-ILS/xul/staff_client/server/patron/holds.js	2007-12-17 15:11:04 UTC (rev 8230)
+++ branches/rel_1_2/Open-ILS/xul/staff_client/server/patron/holds.js	2007-12-17 22:54:45 UTC (rev 8231)
@@ -311,29 +311,12 @@
 						['command'],
 						function() {
 							try {
-								dump(js2JSON(obj.list.dump_with_keys()) + '\n');
-								function flesh_callback() {
-									try {
-										JSAN.use('patron.util');
-										var params = { 
-											'patron' : patron.util.retrieve_au_via_id(ses(),obj.patron_id), 
-											'lib' : obj.data.hash.aou[ obj.data.list.au[0].ws_ou() ],
-											'staff' : obj.data.list.au[0],
-											'header' : obj.data.print_list_templates.holds.header,
-											'line_item' : obj.data.print_list_templates.holds.line_item,
-											'footer' : obj.data.print_list_templates.holds.footer,
-											'type' : obj.data.print_list_templates.holds.type,
-											'list' : obj.list.dump_with_keys(),
-										};
-										JSAN.use('util.print'); var print = new util.print();
-										print.tree_list( params );
-										setTimeout(function(){obj.list.on_all_fleshed = null;},0);
-									} catch(E) {
-										obj.error.standard_unexpected_error_alert('print 2',E);
-									}
-								}
-								obj.list.on_all_fleshed = flesh_callback;
-								obj.list.full_retrieve();
+								JSAN.use('patron.util');
+								var params = { 
+									'patron' : patron.util.retrieve_au_via_id(ses(),obj.patron_id), 
+									'template' : 'holds'
+								};
+								obj.list.print(params);
 							} catch(E) {
 								obj.error.standard_unexpected_error_alert('print 1',E);
 							}
@@ -343,17 +326,7 @@
 						['command'],
 						function() {
 							try {
-								function flesh_callback() {
-									try {
-										dump(obj.list.dump_csv() + '\n');
-										copy_to_clipboard(obj.list.dump_csv());
-										setTimeout(function(){obj.list.on_all_fleshed = null;},0);
-									} catch(E) {
-										obj.error.standard_unexpected_error_alert('export 2',E);
-									}
-								}
-								obj.list.on_all_fleshed = flesh_callback;
-								obj.list.full_retrieve();
+								obj.list.dump_csv_to_clipboard();
 							} catch(E) {
 								obj.error.standard_unexpected_error_alert('export 1',E);
 							}

Modified: branches/rel_1_2/Open-ILS/xul/staff_client/server/patron/items.js
===================================================================
--- branches/rel_1_2/Open-ILS/xul/staff_client/server/patron/items.js	2007-12-17 15:11:04 UTC (rev 8230)
+++ branches/rel_1_2/Open-ILS/xul/staff_client/server/patron/items.js	2007-12-17 22:54:45 UTC (rev 8231)
@@ -200,29 +200,12 @@
 		var obj = this;
 		try {
 			var list = (which==2 ? obj.list2 : obj.list);
-			dump(js2JSON( list.dump_with_keys() ) + '\n');
-			function flesh_callback() {
-				try {
-					JSAN.use('patron.util');
-					var params = { 
-						'patron' : patron.util.retrieve_fleshed_au_via_id(ses(),obj.patron_id), 
-						'lib' : obj.data.hash.aou[ obj.data.list.au[0].ws_ou() ],
-						'staff' : obj.data.list.au[0],
-						'header' : obj.data.print_list_templates.items_out.header,
-						'line_item' : obj.data.print_list_templates.items_out.line_item,
-						'footer' : obj.data.print_list_templates.items_out.footer,
-						'type' : obj.data.print_list_templates.items_out.type,
-						'list' : list.dump_with_keys(),
-					};
-					JSAN.use('util.print'); var print = new util.print();
-					print.tree_list( params );
-					setTimeout(function(){list.on_all_fleshed = null;},0);
-				} catch(E) {
-					obj.error.standard_unexpected_error_alert('printing 2',E);
-				}
-			}
-			list.on_all_fleshed = flesh_callback;
-			list.full_retrieve();
+            JSAN.use('patron.util');
+            var params = { 
+                'patron' : patron.util.retrieve_fleshed_au_via_id(ses(),obj.patron_id), 
+                'template' : 'items_out'
+            };
+            list.print( params );
 		} catch(E) {
 			obj.error.standard_unexpected_error_alert('printing 1',E);
 		}
@@ -232,17 +215,7 @@
 		var obj = this;
 		try {
 			var list = (which==2 ? obj.list2 : obj.list);
-			function flesh_callback() {
-				try {
-					dump( list.dump_csv() + '\n');
-					copy_to_clipboard(list.dump_csv());
-					setTimeout(function(){list.on_all_fleshed = null;},0);
-				} catch(E) {
-					obj.error.standard_unexpected_error_alert('export 2',E);
-				}
-			}
-			list.on_all_fleshed = flesh_callback;
-			list.full_retrieve();
+			list.dump_csv_to_clipboard();
 		} catch(E) {
 			obj.error.standard_unexpected_error_alert('export 1',E);
 		}

Modified: branches/rel_1_2/Open-ILS/xul/staff_client/server/patron/search_result.js
===================================================================
--- branches/rel_1_2/Open-ILS/xul/staff_client/server/patron/search_result.js	2007-12-17 15:11:04 UTC (rev 8230)
+++ branches/rel_1_2/Open-ILS/xul/staff_client/server/patron/search_result.js	2007-12-17 22:54:45 UTC (rev 8231)
@@ -94,32 +94,14 @@
 					'cmd_search_print' : [
 						['command'],
 						function() {
-							dump( js2JSON( obj.list.dump_with_keys() ) );
-							JSAN.use('OpenILS.data'); var data = new OpenILS.data(); data.init({'via':'stash'});
-							obj.list.on_all_fleshed = function() {
-								try {
-									dump( js2JSON( obj.list.dump_with_keys() ) + '\n' );
-									obj.OpenILS.data.stash_retrieve();
-									var lib = data.hash.aou[ data.list.au[0].ws_ou() ];
-									lib.children(null);
-									var p = { 
-										'lib' : lib,
-										'staff' : data.list.au[0],
-										'header' : data.print_list_templates.patron.header,
-										'line_item' : data.print_list_templates.patron.line_item,
-										'footer' : data.print_list_templates.patron.footer,
-										'type' : data.print_list_templates.patron.type,
-										'list' : obj.list.dump_with_keys(),
-									};
-									JSAN.use('util.print'); var print = new util.print();
-									print.tree_list( p );
-									setTimeout(function(){obj.list.on_all_fleshed = null;},0);
-								} catch(E) {
-									alert(E); 
-								}
-							}
-							obj.list.full_retrieve();
-
+                            try {
+								var p = { 
+									'template' : 'patron'
+								};
+								obj.list.print( p );
+                            } catch(E) {
+								obj.error.standard_unexpected_error_alert('patron search print',E);
+                            }
 						}
 					],
 					'cmd_sel_clip' : [



More information about the open-ils-commits mailing list