diff --git a/www/frontend/CHANGED b/www/frontend/CHANGED index 2a1276bb2..1bc03d152 100644 --- a/www/frontend/CHANGED +++ b/www/frontend/CHANGED @@ -1,4 +1,8 @@ -Update vom 6.2.2013 +Update vom 7.3.2013 + + * Bugfixes für Chart speichern + +Update vom 6.3.2013 * Name des Charts beim Speichern escaped * Bessere Fehlermeldung bei Device Selektion diff --git a/www/frontend/FHEM/93_DbLog.pm b/www/frontend/FHEM/93_DbLog.pm index fc8d7931e..2f4741b03 100644 --- a/www/frontend/FHEM/93_DbLog.pm +++ b/www/frontend/FHEM/93_DbLog.pm @@ -810,7 +810,6 @@ sub chartQuery($@) { if ($sql eq "error") { return jsonError("Could not setup SQL String"); } - my ($hash, @a) = @_; my $dbhf= $hash->{DBHF}; @@ -863,8 +862,8 @@ sub chartQuery($@) { $jsonstring .= '":'; if (defined $data[$i]) { - my $fragment = substr($data[$i],0,2); - if ($fragment eq "[{") { + my $fragment = substr($data[$i],0,1); + if ($fragment eq "{") { $jsonstring .= $data[$i]; } else { $jsonstring .= '"'.$data[$i].'"'; @@ -1328,4 +1327,4 @@ sub chartQuery($@) { =end html_DE -=cut +=cut \ No newline at end of file diff --git a/www/frontend/controls_frontend.txt b/www/frontend/controls_frontend.txt index 0289e9db3..d8296a045 100644 --- a/www/frontend/controls_frontend.txt +++ b/www/frontend/controls_frontend.txt @@ -37,7 +37,7 @@ DIR www/frontend/lib/ext-4.1.1a/images/gray/grid DIR www/frontend/lib/ext-4.1.1a/images/gray/util DIR www/frontend/lib/ext-4.1.1a/images/gray/panel-header DIR www/frontend/lib/ext-4.1.1a/images/gray/tip -UPD 2013-03-06_11:11:22 49747 FHEM/93_DbLog.pm +UPD 2013-03-07_12:12:22 49744 FHEM/93_DbLog.pm UPD 2013-03-06_11:11:22 499 www/frontend/index.html UPD 2013-03-06_11:11:22 236 www/frontend/README.txt UPD 2013-03-06_11:11:22 1856 www/frontend/app/app.js @@ -46,7 +46,7 @@ UPD 2013-03-06_11:11:22 7826 www/frontend/app/view/Viewport.js UPD 2013-03-06_11:11:22 4269 www/frontend/app/view/DevicePanel.js UPD 2013-03-06_11:11:22 2503 www/frontend/app/view/TableDataGridPanel.js UPD 2013-03-06_11:11:22 1310 www/frontend/app/view/LineChartView.js -UPD 2013-03-06_11:11:22 41802 www/frontend/app/controller/ChartController.js +UPD 2013-03-07_06:58:22 41859 www/frontend/app/controller/ChartController.js UPD 2013-03-06_11:11:22 10761 www/frontend/app/controller/MainController.js UPD 2013-03-06_11:11:22 202 www/frontend/app/model/ReadingsModel.js UPD 2013-03-06_11:11:22 338 www/frontend/app/model/SavedChartsModel.js diff --git a/www/frontend/www/frontend/app/controller/ChartController.js b/www/frontend/www/frontend/app/controller/ChartController.js index 48efc5ec6..5a53e9aba 100644 --- a/www/frontend/www/frontend/app/controller/ChartController.js +++ b/www/frontend/www/frontend/app/controller/ChartController.js @@ -733,20 +733,20 @@ Ext.define('FHEM.controller.ChartController', { dbendtime = Ext.Date.format(endtime, 'Y-m-d_H:i:s'), view = this.getLinechartview(); - var jsonConfig = '{\\"x\\":\\"' + xaxis + '\\",\\"y\\":\\"' + yaxis + '\\",\\"device\\":\\"' + device + '\\",'; - jsonConfig += '\\"yaxiscolorcombo\\":\\"\\' + yaxiscolorcombo + '\\",\\"yaxisfillcheck\\":\\"' + yaxisfillcheck + '\\",'; - jsonConfig += '\\"y2device\\":\\"' + y2device + '\\",'; - jsonConfig += '\\"y2axis\\":\\"' + y2axis + '\\",\\"y2axiscolorcombo\\":\\"' + y2axiscolorcombo + '\\",'; - jsonConfig += '\\"y2axisfillcheck\\":\\"' + y2axisfillcheck + '\\",\\"y3axis\\":\\"' + y3axis + '\\",'; - jsonConfig += '\\"y3device\\":\\"' + y3device + '\\",'; - jsonConfig += '\\"y3axiscolorcombo\\":\\"' + y3axiscolorcombo + '\\",\\"y3axisfillcheck\\":\\"' + y3axisfillcheck + '\\",'; - jsonConfig += '\\"base1start\\":\\"' + base1start + '\\",\\"base1end\\":\\"' + base1end + '\\",'; - jsonConfig += '\\"base1color\\":\\"' + base1color + '\\",\\"base1fill\\":\\"' + base1fill + '\\",'; - jsonConfig += '\\"base2start\\":\\"' + base2start + '\\",\\"base2end\\":\\"' + base2end + '\\",'; - jsonConfig += '\\"base2color\\":\\"' + base2color + '\\",\\"base2fill\\":\\"' + base2fill + '\\",'; - jsonConfig += '\\"base3start\\":\\"' + base3start + '\\",\\"base3end\\":\\"' + base3end + '\\",'; - jsonConfig += '\\"base3color\\":\\"' + base3color + '\\",\\"base3fill\\":\\"' + base3fill + '\\",'; - jsonConfig += '\\"starttime\\":\\"' + dbstarttime + '\\",\\"endtime\\":\\"' + dbendtime + '\\"}'; + var jsonConfig = '{"x":"' + xaxis + '","y":"' + yaxis + '","device":"' + device + '",'; + jsonConfig += '"yaxiscolorcombo":"' + yaxiscolorcombo + '","yaxisfillcheck":"' + yaxisfillcheck + '",'; + jsonConfig += '"y2device":"' + y2device + '",'; + jsonConfig += '"y2axis":"' + y2axis + '","y2axiscolorcombo":"' + y2axiscolorcombo + '",'; + jsonConfig += '"y2axisfillcheck":"' + y2axisfillcheck + '","y3axis":"' + y3axis + '",'; + jsonConfig += '"y3device":"' + y3device + '",'; + jsonConfig += '"y3axiscolorcombo":"' + y3axiscolorcombo + '","y3axisfillcheck":"' + y3axisfillcheck + '",'; + jsonConfig += '"base1start":"' + base1start + '","base1end":"' + base1end + '",'; + jsonConfig += '"base1color":"' + base1color + '","base1fill":"' + base1fill + '",'; + jsonConfig += '"base2start":"' + base2start + '","base2end":"' + base2end + '",'; + jsonConfig += '"base2color":"' + base2color + '","base2fill":"' + base2fill + '",'; + jsonConfig += '"base3start":"' + base3start + '","base3end":"' + base3end + '",'; + jsonConfig += '"base3color":"' + base3color + '","base3fill":"' + base3fill + '",'; + jsonConfig += '"starttime":"' + dbstarttime + '","endtime":"' + dbendtime + '"}'; var url = '../../../fhem?cmd=get+' + FHEM.dblogname + '+-+webchart+' + dbstarttime + '+' + dbendtime + '+'; url +=device + '+savechart+""+""+' + savename + '+' + jsonConfig + '&XHR=1'; @@ -754,7 +754,7 @@ Ext.define('FHEM.controller.ChartController', { view.setLoading(true); Ext.Ajax.request({ - method: 'GET', + method: 'POST', disableCaching: false, url: url, success: function(response){ @@ -790,8 +790,16 @@ Ext.define('FHEM.controller.ChartController', { if (cellIndex === 0) { var name = record.get('NAME'), - rawchartdata = record.get('VALUE'), - chartdata = Ext.decode(rawchartdata); + chartdata = record.get('VALUE'); + + if (typeof chartdata !== "object") { + try { + chartdata = Ext.decode(chartdata); + } catch (e) { + Ext.Msg.alert("Error", "The Chart could not be loaded! RawChartdata was:
" + chartdata); + } + + } //cleanup the form before loading this.resetFormFields();