bugfixes for saving of charts

git-svn-id: https://fhem.svn.sourceforge.net/svnroot/fhem/trunk/fhem@2867 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
johannnes
2013-03-07 19:37:27 +00:00
parent f2d84d730e
commit bf7af091b2
4 changed files with 35 additions and 24 deletions

View File

@@ -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 * Name des Charts beim Speichern escaped
* Bessere Fehlermeldung bei Device Selektion * Bessere Fehlermeldung bei Device Selektion

View File

@@ -810,7 +810,6 @@ sub chartQuery($@) {
if ($sql eq "error") { if ($sql eq "error") {
return jsonError("Could not setup SQL String"); return jsonError("Could not setup SQL String");
} }
my ($hash, @a) = @_; my ($hash, @a) = @_;
my $dbhf= $hash->{DBHF}; my $dbhf= $hash->{DBHF};
@@ -863,8 +862,8 @@ sub chartQuery($@) {
$jsonstring .= '":'; $jsonstring .= '":';
if (defined $data[$i]) { if (defined $data[$i]) {
my $fragment = substr($data[$i],0,2); my $fragment = substr($data[$i],0,1);
if ($fragment eq "[{") { if ($fragment eq "{") {
$jsonstring .= $data[$i]; $jsonstring .= $data[$i];
} else { } else {
$jsonstring .= '"'.$data[$i].'"'; $jsonstring .= '"'.$data[$i].'"';
@@ -1328,4 +1327,4 @@ sub chartQuery($@) {
</ul> </ul>
=end html_DE =end html_DE
=cut =cut

View File

@@ -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/util
DIR www/frontend/lib/ext-4.1.1a/images/gray/panel-header DIR www/frontend/lib/ext-4.1.1a/images/gray/panel-header
DIR www/frontend/lib/ext-4.1.1a/images/gray/tip 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 499 www/frontend/index.html
UPD 2013-03-06_11:11:22 236 www/frontend/README.txt 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 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 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 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 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 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 202 www/frontend/app/model/ReadingsModel.js
UPD 2013-03-06_11:11:22 338 www/frontend/app/model/SavedChartsModel.js UPD 2013-03-06_11:11:22 338 www/frontend/app/model/SavedChartsModel.js

View File

@@ -733,20 +733,20 @@ Ext.define('FHEM.controller.ChartController', {
dbendtime = Ext.Date.format(endtime, 'Y-m-d_H:i:s'), dbendtime = Ext.Date.format(endtime, 'Y-m-d_H:i:s'),
view = this.getLinechartview(); view = this.getLinechartview();
var jsonConfig = '{\\"x\\":\\"' + xaxis + '\\",\\"y\\":\\"' + yaxis + '\\",\\"device\\":\\"' + device + '\\",'; var jsonConfig = '{"x":"' + xaxis + '","y":"' + yaxis + '","device":"' + device + '",';
jsonConfig += '\\"yaxiscolorcombo\\":\\"\\' + yaxiscolorcombo + '\\",\\"yaxisfillcheck\\":\\"' + yaxisfillcheck + '\\",'; jsonConfig += '"yaxiscolorcombo":"' + yaxiscolorcombo + '","yaxisfillcheck":"' + yaxisfillcheck + '",';
jsonConfig += '\\"y2device\\":\\"' + y2device + '\\",'; jsonConfig += '"y2device":"' + y2device + '",';
jsonConfig += '\\"y2axis\\":\\"' + y2axis + '\\",\\"y2axiscolorcombo\\":\\"' + y2axiscolorcombo + '\\",'; jsonConfig += '"y2axis":"' + y2axis + '","y2axiscolorcombo":"' + y2axiscolorcombo + '",';
jsonConfig += '\\"y2axisfillcheck\\":\\"' + y2axisfillcheck + '\\",\\"y3axis\\":\\"' + y3axis + '\\",'; jsonConfig += '"y2axisfillcheck":"' + y2axisfillcheck + '","y3axis":"' + y3axis + '",';
jsonConfig += '\\"y3device\\":\\"' + y3device + '\\",'; jsonConfig += '"y3device":"' + y3device + '",';
jsonConfig += '\\"y3axiscolorcombo\\":\\"' + y3axiscolorcombo + '\\",\\"y3axisfillcheck\\":\\"' + y3axisfillcheck + '\\",'; jsonConfig += '"y3axiscolorcombo":"' + y3axiscolorcombo + '","y3axisfillcheck":"' + y3axisfillcheck + '",';
jsonConfig += '\\"base1start\\":\\"' + base1start + '\\",\\"base1end\\":\\"' + base1end + '\\",'; jsonConfig += '"base1start":"' + base1start + '","base1end":"' + base1end + '",';
jsonConfig += '\\"base1color\\":\\"' + base1color + '\\",\\"base1fill\\":\\"' + base1fill + '\\",'; jsonConfig += '"base1color":"' + base1color + '","base1fill":"' + base1fill + '",';
jsonConfig += '\\"base2start\\":\\"' + base2start + '\\",\\"base2end\\":\\"' + base2end + '\\",'; jsonConfig += '"base2start":"' + base2start + '","base2end":"' + base2end + '",';
jsonConfig += '\\"base2color\\":\\"' + base2color + '\\",\\"base2fill\\":\\"' + base2fill + '\\",'; jsonConfig += '"base2color":"' + base2color + '","base2fill":"' + base2fill + '",';
jsonConfig += '\\"base3start\\":\\"' + base3start + '\\",\\"base3end\\":\\"' + base3end + '\\",'; jsonConfig += '"base3start":"' + base3start + '","base3end":"' + base3end + '",';
jsonConfig += '\\"base3color\\":\\"' + base3color + '\\",\\"base3fill\\":\\"' + base3fill + '\\",'; jsonConfig += '"base3color":"' + base3color + '","base3fill":"' + base3fill + '",';
jsonConfig += '\\"starttime\\":\\"' + dbstarttime + '\\",\\"endtime\\":\\"' + dbendtime + '\\"}'; jsonConfig += '"starttime":"' + dbstarttime + '","endtime":"' + dbendtime + '"}';
var url = '../../../fhem?cmd=get+' + FHEM.dblogname + '+-+webchart+' + dbstarttime + '+' + dbendtime + '+'; var url = '../../../fhem?cmd=get+' + FHEM.dblogname + '+-+webchart+' + dbstarttime + '+' + dbendtime + '+';
url +=device + '+savechart+""+""+' + savename + '+' + jsonConfig + '&XHR=1'; url +=device + '+savechart+""+""+' + savename + '+' + jsonConfig + '&XHR=1';
@@ -754,7 +754,7 @@ Ext.define('FHEM.controller.ChartController', {
view.setLoading(true); view.setLoading(true);
Ext.Ajax.request({ Ext.Ajax.request({
method: 'GET', method: 'POST',
disableCaching: false, disableCaching: false,
url: url, url: url,
success: function(response){ success: function(response){
@@ -790,8 +790,16 @@ Ext.define('FHEM.controller.ChartController', {
if (cellIndex === 0) { if (cellIndex === 0) {
var name = record.get('NAME'), var name = record.get('NAME'),
rawchartdata = record.get('VALUE'), chartdata = record.get('VALUE');
chartdata = Ext.decode(rawchartdata);
if (typeof chartdata !== "object") {
try {
chartdata = Ext.decode(chartdata);
} catch (e) {
Ext.Msg.alert("Error", "The Chart could not be loaded! RawChartdata was: <br>" + chartdata);
}
}
//cleanup the form before loading //cleanup the form before loading
this.resetFormFields(); this.resetFormFields();