From: Manuel Penschuck Date: Mon, 19 May 2014 11:37:05 +0000 (+0200) Subject: CTS-Bugfix: Unsorted drop down lists, Renamed bits of peripheral trigger inputs to... X-Git-Url: https://jspc29.x-matter.uni-frankfurt.de/git/?a=commitdiff_plain;h=f34a35f62ef6583aa75d691d5c5104339ae0b0b8;p=daqtools.git CTS-Bugfix: Unsorted drop down lists, Renamed bits of peripheral trigger inputs to match xml-db convention. Mouse-over for physical mapping --- diff --git a/web/htdocs/scripts/cts.js b/web/htdocs/scripts/cts.js index 4ad92bd..838ef58 100644 --- a/web/htdocs/scripts/cts.js +++ b/web/htdocs/scripts/cts.js @@ -127,14 +127,9 @@ var CTS = new Class({ (new Request.JSON({ url: '/cts/cts.pl?write,' + arrValues.join(','), onSuccess: function(json, text) { - console.log(json) - console.log(text) - if (!json) { var m = text.match(/
(.*)<\/pre>/i);
                
-               console.log(m)
-               
                if (m) alert("Server send error response:\n"+m[1]);
                else  alert("An unknown error occured while writing register");
             }
@@ -393,7 +388,7 @@ var CTS = new Class({
 
          e.set('title',
             s.exp + ': Address ' + formatAddress(reg._address) + bits
-            + (e.get('title') ? ' ' + e.get('title') : '')
+            + (e.get('title') ? ' \n' + e.get('title') : '')
          );
       }.bind(this));
    },
@@ -465,12 +460,16 @@ var CTS = new Class({
 	 
          if (i >= source_from) {
             var en = this.defs.registers[areg]._defs.input.enum;
+            keys = Object.keys(en);
+            keys.sort(function(a,b) {return parseInt(a)-parseInt(b)});
+            
             source.adopt(
                new Element('select', {'class': 'autocommit autoupdate', 'slice': areg + '.input'})
                .adopt(
-                  Object.values(en).map(function (r) {
-                  return new Element('option', {'value': r, 'text': this.translateName('addon-input-multiplexer', r, r)})
-               }, this))
+                  keys.map(function (k) {
+                     return new Element('option', {'value': en[k], 'text': this.translateName('addon-input-multiplexer', en[k], en[k])})
+                  }, this)
+               )
             );
          } else {
             source.set('text', 'hard wired');
@@ -489,11 +488,13 @@ var CTS = new Class({
          var reg = 'trg_addon_output_mux' + i;
          var en = this.defs.registers[reg]._defs.input.enum;
          var name = this.defs.properties['trg_addon_output_mux_names'][i];
-         
+         keys = Object.keys(en);
+         keys.sort(function(a,b) {return parseInt(a)-parseInt(b)});
+
          con.adopt(new Element('div', {'class': 'mux-container'}).adopt([
             new Element('label', {'for': 'out-mux-input' + i, 'text': this.translateName('addout-output-multiplexer', name, name)+": "}),
             new Element('select', {'id':  'out-mux-input' + i, 'slice': reg + '.input', 'class': 'autocommit autoupdate'}).adopt(
-               Object.values(en).map(function (r) {return new Element('option', {'value': r, 'text': r})})
+               keys.map(function (k) {return new Element('option', {'value': en[k], 'text': en[k]})})
             )
          ]));
       }
@@ -508,9 +509,15 @@ var CTS = new Class({
       var row, header;
       tab.adopt(header = new Element('tr', {'class': 'snd_header'}));
       header.adopt(new Element('td'));
-      for(var f=0; f < 4; f++)
-         for(var i=4; i>=0; i--)
-            header.adopt(new Element('td', {'text': 6+i, 'class': 'slice' + i}));
+      for(var f=0; f < 4; f++) {
+         for(var i=4; i>=0; i--) {
+            header.adopt(
+               new Element('td', {'class': 'slice' + i}).adopt(
+                  new Element('abbr', {'text': i-1, 'title': 'mapped to FPGA' + (f+1) + '_COMM(' + (i+6) + ')' + (i?'': ' - not accessible by most frontends')})
+               )
+            );
+         }
+      }
       
       for(var pt=0; pt < this.defs.properties['trg_periph_count']; pt++) {
          tab.adopt(row = new Element('tr', {'class': pt%2?'':'alt', 'flashgroup': 'itc-' + (pt + parseInt(this.defs.properties.trg_periph_itc_base))} ))
@@ -519,7 +526,9 @@ var CTS = new Class({
          for(var f=0; f<4; f++) {
             for(var i=4; i>=0; i--) {
                var bit = (5*f + i);
-                  row.adopt(new Element('td', {'class': 'slice' + i}).adopt(new Element('input', {'class': 'autoupdate autocommit', 'type': 'checkbox',
+                  row.adopt(new Element('td', {'class': 'slice' + i}).adopt(new Element('input', {
+                     'class': 'autoupdate autocommit', 'type': 'checkbox',
+                     'title': 'mapped to FPGA' + (f+1) + '_COMM(' + (i+6) + ')',
                      'slice': 'trg_periph_config' + pt + '.mask[' + bit + ']'})));
             }
          }
@@ -793,8 +802,6 @@ function timestamp2Date(ts) {
    
 
 function requestFailure(obj){
-   console.log(obj);
-   
    var text = (obj.responseText) ? obj.responseText : obj;
    var m = text.match(/
([\s\S]*)<\/pre>/im);
    
@@ -919,7 +926,7 @@ var GuiExpander = new Class({
                             
       this.boxes.each(function(b) {
          var id = b.get('id');
-         if (!id) {console.debug("Expandable Box without ID!"); return;}
+         if (!id) {if (console) console.debug("Expandable Box without ID!"); return;}
          this[states[id] || b.hasClass('expanded') ? 'expand' : 'collapse'](b, true);