# HG changeset patch # User Raimund Renkert # Date 1481707308 -3600 # Node ID a4c1a9862a88b484b22b1504555d6b386e450d24 # Parent 3d83bcb02ee32370933d8d572b77564ea42b43f9# Parent 26197c2d936230f3f8af46e7f2a57899cc6ec766 merged diff -r 3d83bcb02ee3 -r a4c1a9862a88 app/controller/grid/ProbeList.js --- a/app/controller/grid/ProbeList.js Wed Dec 14 10:20:52 2016 +0100 +++ b/app/controller/grid/ProbeList.js Wed Dec 14 10:21:48 2016 +0100 @@ -159,6 +159,7 @@ // to be a little bit asynchronous here... callback = function(response) { var data = response.responseText; + data = this.prepareData(data); // Wraps all messstellen and deskriptoren objects into an array var printData = '{"layout": "A4 portrait", "outputFormat": "pdf",' + '"attributes": { "proben": ' + data + '}}'; @@ -171,6 +172,63 @@ } }, + prepareData: function(data) { + // Copy data + prep = JSON.parse(data); + data = JSON.parse(data); + // ensure data and prep are equal, not sure + // if json.parse changes order of things + console.log(data); + + emptyMessstelle = { + "id": null, + "amtskennung": null, + "beschreibung": null, + "messStelle": null, + "mstTyp": null, + "netzbetreiberId":null + }; + + emptyDeskriptor = { + "s0": null, + "s1": null, + "s2": null, + "s3": null, + "s4": null, + "s5": null, + "s6": null, + "s7": null, + "s8": null, + "s9": null, + "s10": null, + "s11": null + }; + + for (i in data) { + probe = data[i]; + deskriptoren = probe.deskriptoren; + messstelle = probe.messstelle; + if (messstelle != null) { + prep[i].messstelle = []; + prep[i].messstelle[0] = messstelle; + } + else { + prep[i].messstelle = []; + prep[i].messstelle[0] = emptyMessstelle; + } + + if (deskriptoren != null) { + prep[i].deskriptoren = []; + prep[i].deskriptoren[0] = deskriptoren; + } + else { + prep[i].deskriptoren = []; + prep[i].deskriptoren[0] = emptyDeskriptor; + } + } + return JSON.stringify(prep); + }, + /** * Toggles the buttons in the toolbar **/ @@ -229,16 +287,15 @@ }, /** - * Returns a Json-Object whcih contains the data which has + * Returns a Json-Object which contains the data which has * to be printed. * The parameter printFunctionCallback will be called once the ajax-request * starting the json-export was evaluated **/ createSheetData: function(button, printFunctionCallback, cbscope){ //disable Button and setLoading... - // TODO ACTIVATE! - //button.disable(); - //button.setLoading(true); + button.disable(); + button.setLoading(true); // get Selected Items. @@ -269,21 +326,14 @@ console.log(response.responseText) button.enable(); button.setLoading(false); - // This is "copy & waste-code" from downloadFile - // FIXME - /* - SSO will send a 302 if the Client is not authenticated - unfortunately this seems to be filtered by the browser. - We assume that a 302 was send when the follwing statement - is true. - */ - if (response.status == 0 && response.responseText === "") { - Ext.MessageBox.confirm(Lada.getApplication().bundle.getMsg('err.msg.sso.expired.title'), - Lada.getApplication().bundle.getMsg('err.msg.sso.expired.body'), - this.reload); + if (response.responseText) { + try { + var json = Ext.JSON.decode(response.responseText); + } + catch(e){ + console.log(e); + } } - // further error handling - var json = Ext.JSON.decode(response.responseText); if (json) { if(json.errors.totalCount > 0 || json.warnings.totalCount > 0){ formPanel.setMessages(json.errors, json.warnings); @@ -294,20 +344,19 @@ Lada.getApplication().bundle.getMsg(json.message)); } else { Ext.Msg.alert(i18n.getMsg('err.msg.generic.title'), - i18n.getMsg('err.msg.print.failed')); + i18n.getMsg('err.msg.response.body')); } } else { Ext.Msg.alert(i18n.getMsg('err.msg.generic.title'), - i18n.getMsg('err.msg.print.failed')); + i18n.getMsg('err.msg.response.body')); } - return null; } }); }, /** - * Returns a Json-Object whcih contains the data which has + * Returns a Json-Object which contains the data which has * to be printed. **/ createExtractData: function(button){ diff -r 3d83bcb02ee3 -r a4c1a9862a88 app/view/panel/Map.js --- a/app/view/panel/Map.js Wed Dec 14 10:20:52 2016 +0100 +++ b/app/view/panel/Map.js Wed Dec 14 10:21:48 2016 +0100 @@ -109,8 +109,9 @@ }, featureAdded: function(features) { - this.locationRecord.set('latitude', features.feature.geometry.y); - this.locationRecord.set('longitude', features.feature.geometry.x); + this.locationRecord.set('kdaId', 4); + this.locationRecord.set('koordYExtern', features.feature.geometry.y); + this.locationRecord.set('koordXExtern', features.feature.geometry.x); this.drawPoint.deactivate(); this.fireEvent('featureadded', this.locationRecord); // this.selectControl.unselectAll();