Activating bcmagic model & initial data.
[htsworkflow.git] / htsworkflow / frontend / static / js / htsw.js
index d5829b3a0a59befa9b28554e1aa07e3c41dcfbac..4be8a5dc69f6dc21ecb4ced9f74771781c0d2ad1 100644 (file)
@@ -90,14 +90,26 @@ $(document).ready(function(){
        items: create_dynamic_panels().concat([panel_bcmagic])
     });
     
+    
+    
+    //-------------------------------
+    // East Region Setup
+    //-------------------------------
     var get_east_panel_content = function(){
       // East panel contentEl id is supplied in html div id of east_region_config.
       var east_id = Ext.fly('east_region_config').dom.textContent;
       
+      // Length of zero is a valid response... also happens to return null in next
+      //   if statement if not handled before hand.
+      if (east_id.length == 0){
+       return east_id;
+      }
+      
       // If no element exists with the supplied content id, report and error.
       if (Ext.fly(east_id) == null){
        return 'east_region_config_error';
       }
+      
       return east_id;
     }
     
@@ -170,7 +182,7 @@ $(document).ready(function(){
             xtype: 'panel',
            //autoScroll: true,
             layout: 'fit',
-            margins: '2 2 2 0',
+            margins: '2 0 2 0',
             items: [{
                 //title: 'Inner Panel',
                 contentEl: 'body_content',
@@ -208,6 +220,24 @@ $(document).ready(function(){
     
     // Shifts the remaining toolbar options to the right side.
     main_tb.add({ xtype: 'tbfill' });
+    
+    //----------------------------------------
+    // ExtJS Barcode Magic Implementation
+    var bcmagic_ext_keyhandler = function(sObj, e){
+      //Process upon enter key as input.
+      if (e.getKey() == e.ENTER)
+       bcmagic_process();
+    }
+    
+    var bcmagic_input = new Ext.form.TextField({
+      id: 'bcmagic_input_field',
+      emptyText: 'barcode magic'
+    });
+    bcmagic_input.on('specialkey', bcmagic_ext_keyhandler);
+    
+    main_tb.add(bcmagic_input);
+    //--------------------------------------
+    
     var user_info = Ext.fly('login_info');
     var logout_url = user_info.getAttribute('logouturl');
     var login_url = user_info.getAttribute('loginurl');
@@ -243,5 +273,6 @@ $(document).ready(function(){
     add_buttons_from_html(app_tb, 'app_toolbar_east');
     app_tb.doLayout();
     
-    
+    // Focus on barcode magic, because it's awesome and needs attention! ;-)
+    bcmagic_input.focus();
 });
\ No newline at end of file