tweak delay for synchronization between the two interfaces
authorJason Etheridge <jason@esilibrary.com>
Wed, 23 Mar 2011 15:39:26 +0000 (11:39 -0400)
committerJason Etheridge <jason@esilibrary.com>
Wed, 23 Mar 2011 15:39:26 +0000 (11:39 -0400)
Open-ILS/xul/staff_client/server/cat/volume_copy_creator.js

index 1174e7c..2b04ea2 100644 (file)
@@ -7,6 +7,7 @@ const rel_vert_pos_call_number_suffix = 5;
 const rel_vert_pos_copy_count = 6;
 const rel_vert_pos_barcode = 7;
 const rel_vert_pos_part = 8;
+const update_timer = 1000;
 var g = {};
 g.use_defaults = true;
 g.acn_map = {}; // store retrieved acn objects here by id
@@ -246,7 +247,7 @@ 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.abort_gather_copies_soon
+        g.delay_gather_copies_soon
     );
     tb.addEventListener( 'change', render_copy_count_entry, false);
     tb.addEventListener( 'change', g.gather_copies_soon, false);
@@ -424,7 +425,7 @@ g.render_callnumber_copy_count_entry = function(row,ou_id,count) {
                                 },0
                             );
                         },
-                        g.abort_gather_copies_soon
+                        g.delay_gather_copies_soon
                     );
                     call_number_column_textbox.addEventListener( 'change', handle_change_to_callnumber_data, false);
                     call_number_column_textbox.addEventListener( 'change', g.gather_copies_soon, false);
@@ -489,7 +490,7 @@ g.render_callnumber_copy_count_entry = function(row,ou_id,count) {
                                 },0
                             );
                         },
-                        g.abort_gather_copies_soon
+                        g.delay_gather_copies_soon
                     );
                     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);
@@ -676,12 +677,12 @@ g.render_barcode_entry = function(node,callnumber_composite_key,count,ou_id) {
                 util.widgets.apply_vertical_tab_on_enter_handler(
                     tb,
                     function() { ready_to_create({'target':tb}); setTimeout(function(){util.widgets.vertical_tab(tb);},0); },
-                    g.abort_gather_copies_soon
+                    g.delay_gather_copies_soon
                 );
                 util.widgets.apply_vertical_tab_on_enter_handler(
                     part_menu.firstChild,
                     function() { setTimeout(function(){util.widgets.vertical_tab(part_menu.firstChild);},0); },
-                    g.abort_gather_copies_soon
+                    g.delay_gather_copies_soon
                 );
                 tb.addEventListener('change', function(ev) {
                     var barcode = String( ev.target.value ).replace(/\s/g,'');
@@ -746,15 +747,16 @@ g.generate_barcodes = function() {
     }
 }
 
-g.abort_gather_copies_soon = function() {
-    dump('g.abort_gather_copies_soon()\n');
-    if (g.update_copy_editor_timeoutID) {
-        clearTimeout(g.update_copy_editor_timeoutID);
+g.delay_gather_copies_soon = function() {
+    if (xulG.unified_interface) {
+        dump('g.delay_gather_copies_soon()\n');
+        g.gather_copies_soon();
     }
 }
 
 g.gather_copies_soon = function() {
     try {
+        if (!xulG.unified_interface) { return; }
         dump('g.gather_copies_soon()\n');
         if (g.update_copy_editor_timeoutID) {
             clearTimeout(g.update_copy_editor_timeoutID);
@@ -765,13 +767,11 @@ g.gather_copies_soon = function() {
             function() {
                 try {
                     g.gather_copies();
-                    if (xulG.unified_interface) {
-                        xulG.refresh_copy_editor();
-                    }
+                    xulG.refresh_copy_editor();
                 } catch(E) {
                     alert('Error in volume_copy_editor.js with g.gather_copies_soon setTimeout func(): ' + E);
                 }
-            }, 2000
+            }, update_timer
         );
     } catch(E) {
         alert('Error in volume_copy_creator.js, g.gather_copies_soon(): ' + E);
@@ -1044,7 +1044,7 @@ g.stash_and_close = function(param) {
         if (xulG.unified_interface) {
             copies = xulG.copies;
         } else {
-            var copies = g.gather_copies();
+            copies = g.gather_copies();
             copies = blob.copies;
         }