From 21f6830157284271dd964d7de0faa7559e2ed686 Mon Sep 17 00:00:00 2001 From: Manuel Penschuck Date: Tue, 5 Nov 2013 22:50:57 +0100 Subject: [PATCH] CTS GUI bug that occures when connecting to CTS w/o multi Event Builder support --- web/htdocs/scripts/cts.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/web/htdocs/scripts/cts.js b/web/htdocs/scripts/cts.js index 3dac527..84e423e 100644 --- a/web/htdocs/scripts/cts.js +++ b/web/htdocs/scripts/cts.js @@ -207,8 +207,11 @@ var CTS = new Class({ }, initEventBuilderRR: function() { - if (!this.defs.properties.cts_eventbuilder_rr) return; - $$('.eventbuilder_rr').setStyle('visibility', 'visible'); + if (!this.defs.properties.cts_eventbuilder_rr) { + $$('.eventbuilder_rr').destroy(); + } else { + $$('.eventbuilder_rr').setStyle('visibility', 'visible'); + } }, /** @@ -222,7 +225,8 @@ var CTS = new Class({ this.autoRateElems = $$('.autorate'); this.addEvent('dataUpdate', function(data) { this.autoRateElems.each(function(e) { - if (e.hasClass('autoratevalue')) { + if (undefined == data.rates[ e.get('slice') ]) return; + if (e.hasClass('autoratevalue')) { var count = data.rates[ e.get('slice') ].value; count = parseCallback(e, 'format')(count); @@ -268,6 +272,8 @@ var CTS = new Class({ var s = parseSlice(e.get('slice')); if (!s.slice) s.slice = "_compact"; + if (undefined == data.monitor[s.reg]) return; + var value = data.monitor[s.reg][e.get('type') == 'checkbox' || s.bit != undefined || e.hasClass('autoupdate-value') ? 'v' : 'f'][s.slice]; if (s.bit != undefined) value = (parseInt(value) >> s.bit) & 1; -- 2.43.0