// vim:et:sw=4:ts=4
-var g = {};
+var g = { 'disabled' : false };
g.map_acn = {};
function $(id) { return document.getElementById(id); }
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) {
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);
}
function on_click(ev){
try {
- if (block) return; block = true;
+ if (block || g.disabled || !g.edit) {
+ return;
+ }
+ block = true;
oils_lock_page();
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;
}
/***********************************************************************************************************/
}
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);
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 ****/
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);
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 );
}
}
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);
}
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');