Updated left side of toolbar to be generated from html
[htsworkflow.git] / www / js / htsw.js
index d51ef2c9be15c7d393c03b6eba41be5a2fc36246..b0cc2579787aa03d612d184f528123624621a487 100644 (file)
@@ -96,10 +96,10 @@ $(document).ready(function(){
                     id: 'main_toolbar',
                     xtype: 'toolbar',
                     //height: 100,
-                    items: [{
+                    /*items: [{
                         text: "Demo Button",
                         handler: function() { quick_msg('Messages can be fun!'); }
-                    }],
+                    }],*/
                     margins: '2 0 0 0'
             }],
             height: 60 
@@ -122,7 +122,26 @@ $(document).ready(function(){
     //-------------------------------
     var main_tb = Ext.getCmp('main_toolbar');
     
-    var add_buttons_from_html = function(main_tb){
+    var add_buttons_from_html_left = function(main_tb){
+        var left_tbar_data = Ext.fly('left_tbar_data');
+        var div_array = left_tbar_data.query('div');
+        var div_id = null;
+        // Loop through each div since it defines a button and link or a spacer and add it to the right side of the toolbar
+        Ext.each(div_array, function(divobj) {
+            div_id = divobj.id;
+            if (div_id == 'spacer'){
+                main_tb.add('-');
+            } else {
+                main_tb.add({
+                    text: div_id,
+                    handler: function() { goto_url(divobj.getAttribute('href')); }
+                });
+            }
+        });
+        //return right_tbar_data;
+    }
+    
+    var add_buttons_from_html_right = function(main_tb){
         var right_tbar_data = Ext.fly('right_tbar_data');
         var div_array = right_tbar_data.query('div');
         var div_id = null;
@@ -141,6 +160,9 @@ $(document).ready(function(){
         //return right_tbar_data;
     }
     
+    add_buttons_from_html_left(main_tb);
+    
+    // Shifts the remaining toolbar options to the right side.
     main_tb.add({ xtype: 'tbfill' });
     var user_info = Ext.fly('login_info');
     var logout_url = user_info.getAttribute('logouturl');
@@ -152,7 +174,7 @@ $(document).ready(function(){
                         text: 'User: ' + user_info.getAttribute('user')
                     });
         main_tb.add('-');
-        add_buttons_from_html(main_tb);
+        add_buttons_from_html_right(main_tb);
         main_tb.add('-');
        main_tb.add({
                         text: 'Logout',