comparison app/view/window/GenProbenFromMessprogramm.js @ 809:3bc19188fc3a

Added some todos, Enhanced Proge-Generation Success Msg.
author Dustin Demuth <dustin@intevation.de>
date Fri, 22 May 2015 16:14:14 +0200
parents 18697326c862
children 188a9faf96e0
comparison
equal deleted inserted replaced
808:c135201940ee 809:3bc19188fc3a
46 method: 'POST', 46 method: 'POST',
47 headers: { 47 headers: {
48 'X-OPENID-PARAMS': Lada.openIDParams 48 'X-OPENID-PARAMS': Lada.openIDParams
49 }, 49 },
50 jsonData: jsondata, 50 jsonData: jsondata,
51 success: function(form, action) { 51 success: function(response) {
52 Ext.Msg.alert('Success', action.result.msg); 52 var json = Ext.JSON.decode(response.responseText);
53 console.log(json);
54 Ext.Msg.show({
55 title: i18n.getMsg('success'),
56 autoScroll: true,
57 msg: me.evalResponse(json),
58 buttons: Ext.Msg.OK,
59 });
53 }, 60 },
54 failure: function(form, action) { 61 failure: function(response) {
55 Ext.Msg.alert('Failed', action.result.msg); 62 // TODO handle Errors correctly, especially AuthenticationTimeouts
63 var json = Ext.JSON.decode(response.responseText);
64 if (json) {
65 if(json.errors.totalCount > 0 || json.warnings.totalCount > 0){
66 formPanel.setMessages(json.errors, json.warnings);
67 }
68
69 if(json.message){
70 Ext.Msg.alert(Lada.getApplication().bundle.getMsg('err.msg.save.title')
71 +' #'+json.message,
72 Lada.getApplication().bundle.getMsg(json.message));
73 } else {
74 Ext.Msg.alert(Lada.getApplication().bundle.getMsg('err.msg.save.title'),
75 Lada.getApplication().bundle.getMsg('err.msg.generic.body'));
76 }
77 } else {
78 Ext.Msg.alert(Lada.getApplication().bundle.getMsg('err.msg.save.title'),
79 Lada.getApplication().bundle.getMsg('err.msg.response.body'));
80 }
56 } 81 }
57 }); 82 });
58 } 83 }
59 }]; 84 }];
60 this.width = 400; 85 this.width = 400;
118 */ 143 */
119 initData: function() { 144 initData: function() {
120 var i18n = Lada.getApplication().bundle; 145 var i18n = Lada.getApplication().bundle;
121 me = this; 146 me = this;
122 }, 147 },
148
149 /**
150 * Parse ServerResponse when Proben have been generated
151 */
152 evalResponse: function(response) {
153 var i18n = Lada.getApplication().bundle;
154 var r = '';
155 r += response.totalCount;
156 r += ' ' + i18n.getMsg('probecreated');
157 r += '<br/>';
158 r += i18n.getMsg('probeids');
159 var i;
160 for (i in response.data){
161 r += '<br/>';
162 r += response.data[i].probeIdAlt
163 }
164 return r;
165 }
123 }); 166 });

http://lada.wald.intevation.org