From: Jason Etheridge Date: Mon, 7 Mar 2011 09:59:46 +0000 (-0500) Subject: be more aggressive with updating the copy editor X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=2ebc5e5d04f6f2339c1365ea8d72006fe688004f;p=evergreen%2Fequinox.git be more aggressive with updating the copy editor --- diff --git a/Open-ILS/xul/staff_client/server/cat/volume_copy_creator.js b/Open-ILS/xul/staff_client/server/cat/volume_copy_creator.js index 9af3c23b54..2bbed28183 100644 --- a/Open-ILS/xul/staff_client/server/cat/volume_copy_creator.js +++ b/Open-ILS/xul/staff_client/server/cat/volume_copy_creator.js @@ -150,6 +150,10 @@ function my_init() { g.load_prefs(); + if (g.existing_copies.length > 0) { + g.gather_copies_soon(); + } + } catch(E) { var err_msg = $("commonStrings").getFormattedString('common.exception', ['cat/volume_copy_creator.js', E]); try { g.error.sdump('D_ERROR',err_msg); } catch(E) { dump(err_msg); dump(js2JSON(E)); } @@ -193,6 +197,7 @@ g.render_volume_count_entry = function(row,ou_id) { function() { render_copy_count_entry({'target':tb}); setTimeout(function(){util.widgets.vertical_tab(tb);},0); } ); tb.addEventListener( 'change', render_copy_count_entry, false); + tb.addEventListener( 'change', g.gather_copies_soon, false); tb.addEventListener( 'focus', function(ev) { g.last_focus = ev.target; }, false ); setTimeout( function() { @@ -314,8 +319,10 @@ g.render_callnumber_copy_count_entry = function(row,ou_id,count) { ); call_number_column_textbox.addEventListener( 'change', handle_change_call_number_column_textbox, false); + call_number_column_textbox.addEventListener( 'change', g.gather_copies_soon, false); call_number_column_textbox.addEventListener( 'focus', function(ev) { g.last_focus = ev.target; }, false ); number_of_copies_column_textbox.addEventListener( 'change', handle_change_number_of_copies_column_textbox, false); + number_of_copies_column_textbox.addEventListener( 'change', g.gather_copies_soon, false); number_of_copies_column_textbox.addEventListener( 'focus', function(ev) { g.last_focus = ev.target; }, false ); if ( !g.last_focus ) { number_of_copies_column_textbox.focus(); g.last_focus = number_of_copies_column_textbox; } @@ -396,6 +403,7 @@ g.render_part_menu = function(barcode_tb) { barcode_tb.setAttribute('bmp_id',menulist.selectedItem.value); button.hidden = true; } + g.gather_copies_soon(); } }); }, @@ -411,6 +419,7 @@ g.render_part_menu = function(barcode_tb) { }, false ); + menulist.addEventListener('change',g.gather_copies_soon,false); menulist.addEventListener( 'command', function(ev) { @@ -419,6 +428,7 @@ g.render_part_menu = function(barcode_tb) { }, false ); + menulist.addEventListener('command',g.gather_copies_soon,false); return hbox; } @@ -502,24 +512,8 @@ g.render_barcode_entry = function(node,callnumber,count,ou_id) { $("catStrings").getString('staff.cat.volume_copy_creator.render_barcode_entry.alert_confirm')); setTimeout( function() { ev.target.select(); ev.target.focus(); }, 0); } - if (xulG.unified_interface) { - if (g.update_copy_editor_timeoutID) { - clearTimeout(g.update_copy_editor_timeoutID); - } - // This function is expensive when it comes to keeping the UI responsive, so let's give it a delay - // that quick entry of consecutive barcodes can override - g.update_copy_editor_timeoutID = setTimeout( - function() { - g.gather_copies(); - try { - xulG.refresh_copy_editor(); - } catch(E) { - alert('Error in volume_copy_editor.js trying to call xulG.refresh_copy_editor(): ' + E); - } - }, 2000 - ); - } }, false); + tb.addEventListener('change', g.gather_copies_soon, false); tb.addEventListener( 'focus', function(ev) { g.last_focus = ev.target; }, false ); } } @@ -563,6 +557,26 @@ g.generate_barcodes = function() { } } +g.gather_copies_soon = function() { + if (g.update_copy_editor_timeoutID) { + clearTimeout(g.update_copy_editor_timeoutID); + } + // This function is expensive when it comes to keeping the UI responsive, so let's give it a delay + // that quick entry of consecutive fields can override + g.update_copy_editor_timeoutID = setTimeout( + function() { + g.gather_copies(); + try { + if (xulG.unified_interface) { + xulG.refresh_copy_editor(); + } + } catch(E) { + alert('Error in volume_copy_editor.js trying to call xulG.refresh_copy_editor(): ' + E); + } + }, 2000 + ); +} + g.new_node_id = -1; g.gather_copies = function() {