[open-ils-commits] r8211 -
branches/rel_1_2/Open-ILS/xul/staff_client/chrome/content/util
svn at svn.open-ils.org
svn at svn.open-ils.org
Thu Dec 13 13:00:38 EST 2007
Author: phasefx
Date: 2007-12-13 12:39:51 -0500 (Thu, 13 Dec 2007)
New Revision: 8211
Modified:
branches/rel_1_2/Open-ILS/xul/staff_client/chrome/content/util/list.js
Log:
changed on_retrieve callback for list.full_retrieve so that it can handle an array of callbacks. dump_csv_to_clipboard function for refactoring elsewhere
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-13 16:52:51 UTC (rev 8210)
+++ branches/rel_1_2/Open-ILS/xul/staff_client/chrome/content/util/list.js 2007-12-13 17:39:51 UTC (rev 8211)
@@ -771,8 +771,24 @@
if (obj.row_count.fleshed >= obj.row_count.total) {
dump('Full retrieve... tree seems to be in sync\n' + js2JSON(obj.row_count) + '\n');
if (typeof obj.on_all_fleshed == 'function') {
- setTimeout( function() { obj.on_all_fleshed(); }, 0 );
- } else {
+ setTimeout(
+ function() {
+ try { obj.on_all_fleshed(); } catch(E) { obj.error.standard_unexpected_error_alert('_full_retrieve_tree callback',obj.on_all_fleshed); }
+ }, 0
+ );
+ } else if (typeof obj.on_all_fleshed.length != 'undefined') {
+ setTimeout(
+ function() {
+ var f = obj.on_all_fleshed.pop();
+ if (typeof f == 'function') {
+ try { f(); } catch(E) { obj.error.standard_unexpected_error_alert('_full_retrieve_tree callback',f); }
+ } else {
+ obj.error.standard_unexpected_error_alert('_full_retrieve_tree callback: expected a function',f);
+ }
+ if (obj.on_all_fleshed.length > 0) arguments.callee();
+ }, 0
+ );
+ } else {
dump('.full_retrieve called with no callback?' + '\n');
}
} else {
@@ -1055,6 +1071,15 @@
return dump;
},
+ 'dump_csv_to_clipboard' : function(params) {
+ var obj = this;
+ if (params && params.no_full_retrieve) {
+ copy_to_clipboard( obj.dump_csv( params ) );
+ } else {
+ obj.wrap_in_full_retrieve( function() { copy_to_clipboard( obj.dump_csv( params ) ); } );
+ }
+ },
+
'dump_selected_with_keys' : function(params) {
var obj = this;
switch(this.node.nodeName) {
@@ -1114,6 +1139,16 @@
return dump;
},
+ 'wrap_in_full_retrieve' : function(f) {
+ var obj = this;
+ if (typeof obj.on_all_fleshed == 'function') { // legacy
+ obj.on_all_fleshed = [ obj.on_all_fleshed ];
+ }
+ if (! obj.on_all_fleshed) obj.on_all_fleshed = [];
+ obj.on_all_fleshed.push(f);
+ obj.full_retrieve();
+ },
+
'_sort_tree' : function(col,sortDir) {
var obj = this;
try {
More information about the open-ils-commits
mailing list