From: Jason Etheridge Date: Mon, 1 Aug 2011 05:40:22 +0000 (-0400) Subject: robustify (and klunkify) unified volume copy creator X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=a1d1d5bf845fb42a4b9341357505d23baa89e8a3;p=evergreen%2Fpines.git robustify (and klunkify) unified volume copy creator Disable/style the Item Editor while changes in the volume/item pane are being considered, and require an explicit press of a Ready Item Editor button to enable the interface. This reduces the chance of editing widgets in the item editor from being ripped out from under you (for example, if you try to go straight from editing a call number to editing an item attribute). Signed-off-by: Jason Etheridge Signed-off-by: Mike Rylander --- diff --git a/Open-ILS/web/opac/locale/en-US/lang.dtd b/Open-ILS/web/opac/locale/en-US/lang.dtd index 1430b5dd56..aec871a90f 100644 --- a/Open-ILS/web/opac/locale/en-US/lang.dtd +++ b/Open-ILS/web/opac/locale/en-US/lang.dtd @@ -2833,6 +2833,8 @@ + + diff --git a/Open-ILS/xul/staff_client/chrome/content/util/widgets.js b/Open-ILS/xul/staff_client/chrome/content/util/widgets.js index 2bad0b009f..4867256e9e 100644 --- a/Open-ILS/xul/staff_client/chrome/content/util/widgets.js +++ b/Open-ILS/xul/staff_client/chrome/content/util/widgets.js @@ -232,7 +232,19 @@ util.widgets.apply_vertical_tab_on_enter_handler = function(node,onfailure,no_en } } else { if (typeof no_enter_func == 'function') { - no_enter_func(ev); + if ([ + 35 /* end */, + 36 /* home */, + 37 /* left */, + 38 /* up */, + 39 /* right */, + 40 /* down */, + 9 /* tab */ + ].indexOf(ev.keyCode) == -1 + ) { + // really the no_enter, no_arrow_key, no_tab, etc. func :) + no_enter_func(ev); + } } } }, diff --git a/Open-ILS/xul/staff_client/server/cat/copy_editor.js b/Open-ILS/xul/staff_client/server/cat/copy_editor.js index b3155b7b87..749c6891d5 100644 --- a/Open-ILS/xul/staff_client/server/cat/copy_editor.js +++ b/Open-ILS/xul/staff_client/server/cat/copy_editor.js @@ -1,5 +1,5 @@ // vim:et:sw=4:ts=4 -var g = {}; +var g = { 'disabled' : false }; g.map_acn = {}; function $(id) { return document.getElementById(id); } @@ -164,8 +164,20 @@ function my_init() { g.check_for_unmet_required_fields(); if (xulG.unified_interface) { + xulG.disable_copy_editor = function(c) { + addCSSClass(document.documentElement,'red_bg'); + g.disabled = true; + } + xulG.enable_copy_editor = function(c) { + removeCSSClass(document.documentElement,'red_bg'); + g.disabled = false; + xulG.refresh_copy_editor(); + } xulG.refresh_copy_editor = function() { + dump('refresh_copy_editor\n'); + addCSSClass(document.documentElement,'blue_bg'); try { + xulG.clear_update_copy_editor_timeout(); g.copies = xulG.copies; g.edit = g.copies.length > 0; if (g.edit) { @@ -179,6 +191,11 @@ function my_init() { g.summarize( g.copies ); g.render(); g.check_for_unmet_required_fields(); + setTimeout( + function() { + removeCSSClass(document.documentElement,'blue_bg'); + }, 1000 + ); } catch(E) { alert('Error in copy_editor.js, xulG.refresh_copy_editor(): ' + E); } @@ -1275,7 +1292,10 @@ g.render_input = function(node,blob) { function on_click(ev){ try { - if (block) return; block = true; + if (block || g.disabled || !g.edit) { + return; + } + block = true; oils_lock_page(); 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 303cea0ae6..48b87c5538 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 @@ -62,8 +62,29 @@ function my_init() { g.save_button_locked = false; document.getElementById("Create").disabled = false; } + xulG.clear_update_copy_editor_timeout = function() { + if (g.update_copy_editor_timeoutID) { + clearTimeout(g.update_copy_editor_timeoutID); + g.gather_copies(); + } + } + $('Sync').addEventListener( + 'command', + function() { + // give gather_copies_soon fired off directly/indirectly by + // onchange a chance to go first + setTimeout( + function() { + xulG.enable_copy_editor(); + }, + 0 + ); + }, + false + ); } else { $('Create').hidden = true; + $('Sync').hidden = true; } /***********************************************************************************************************/ @@ -268,8 +289,8 @@ g.render_volume_count_entry = function(row,ou_id) { } util.widgets.apply_vertical_tab_on_enter_handler( tb, - function() { render_copy_count_entry({'target':tb}); setTimeout(function(){util.widgets.vertical_tab(tb);},0); }, - g.delay_gather_copies_soon + function() { render_copy_count_entry({'target':tb}); setTimeout(function(){util.widgets.vertical_tab(tb);},0); } + ,function() { $('Sync').disabled = true; } ); tb.addEventListener( 'change', render_copy_count_entry, false); tb.addEventListener( 'change', g.gather_copies_soon, false); @@ -460,11 +481,11 @@ g.render_callnumber_copy_count_entry = function(row,ou_id,count) { util.widgets.vertical_tab(call_number_column_textbox); },0 ); - }, - g.delay_gather_copies_soon + } + ,function() { $('Sync').disabled = true; } ); call_number_column_textbox.addEventListener( 'change', handle_change_to_callnumber_data, false); - call_number_column_textbox.addEventListener( 'change', g.gather_copies_soon, 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 ); /**** CLASSIFICATION COLUMN revisited ****/ @@ -528,8 +549,8 @@ g.render_callnumber_copy_count_entry = function(row,ou_id,count) { util.widgets.vertical_tab(number_of_copies_column_textbox); },0 ); - }, - g.delay_gather_copies_soon + } + ,function() { $('Sync').disabled = true; } ); 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); @@ -752,7 +773,7 @@ g.render_barcode_entry = function(node,callnumber_composite_key,count,ou_id) { setTimeout( function() { ev.target.select(); ev.target.focus(); }, 0); } }, false); - tb.addEventListener('change', g.gather_copies_soon, false); + //tb.addEventListener('change', g.gather_copies_soon, false); tb.addEventListener( 'focus', function(ev) { g.last_focus = ev.target; }, false ); } } @@ -815,6 +836,10 @@ g.gather_copies_soon = function(ev) { try { if (!xulG.unified_interface) { return; } dump('g.gather_copies_soon()\n'); + if (typeof xulG.disable_copy_editor == 'function') { + xulG.disable_copy_editor(); + } + $('Sync').disabled = true; if (g.update_copy_editor_timeoutID) { clearTimeout(g.update_copy_editor_timeoutID); } @@ -824,6 +849,8 @@ g.gather_copies_soon = function(ev) { function() { try { g.gather_copies(); + //xulG.enable_copy_editor(); + $('Sync').disabled = false; xulG.refresh_copy_editor(); } catch(E) { dump('Error in volume_copy_editor.js with g.gather_copies_soon setTimeout func(): ' + E + '\n'); diff --git a/Open-ILS/xul/staff_client/server/cat/volume_copy_creator.xul b/Open-ILS/xul/staff_client/server/cat/volume_copy_creator.xul index 5cfc111c9b..00a846f576 100644 --- a/Open-ILS/xul/staff_client/server/cat/volume_copy_creator.xul +++ b/Open-ILS/xul/staff_client/server/cat/volume_copy_creator.xul @@ -121,6 +121,11 @@