comparison app/view/widgets/LadaForm.js @ 406:de73dc41f1d3

Show warnings in proben edit form.
author Raimund Renkert <rrenkert@intevation.de>
date Thu, 12 Sep 2013 12:31:57 +0200
parents 8a3991b5c200
children debfcc7713e3
comparison
equal deleted inserted replaced
405:85238577adc9 406:de73dc41f1d3
117 } 117 }
118 }, 118 },
119 119
120 onModelLoadSuccess: function(record, operation) { 120 onModelLoadSuccess: function(record, operation) {
121 this.bindModel(record); 121 this.bindModel(record);
122 this.parseResponse(operation); 122 this.parseResponse(operation.response);
123 this.fireEvent('loadsuccess', this, record, operation); 123 this.fireEvent('loadsuccess', this, record, operation);
124 }, 124 },
125 125
126 onModelLoadFailure: function(record, operation) { 126 onModelLoadFailure: function(record, operation) {
127 this.parseResponse(operation); 127 this.parseResponse(operation.response);
128 this.fireEvent('loadfailure', this, record, operation); 128 this.fireEvent('loadfailure', this, record, operation);
129 }, 129 },
130 130
131 translateReturnCodes: function(codes) { 131 translateReturnCodes: function(codes) {
132 var translated = {}; 132 var translated = {};
186 if (json) { 186 if (json) {
187 this.success = json.success; 187 this.success = json.success;
188 this.errors = this.translateReturnCodes(json.errors); 188 this.errors = this.translateReturnCodes(json.errors);
189 this.warnings = this.translateReturnCodes(json.warnings); 189 this.warnings = this.translateReturnCodes(json.warnings);
190 this.message = Lada.getApplication().bundle.getMsg(json.message); 190 this.message = Lada.getApplication().bundle.getMsg(json.message);
191 var e = Ext.Object.isEmpty(this.warnings);
192 if (!Ext.Object.isEmpty(this.warnings) ||
193 !Ext.Object.isEmpty(this.errors)) {
194 this.createMessages();
195 }
191 } else { 196 } else {
192 this.setReadOnly(this.model.get('readonly')); 197 this.setReadOnly(this.model.get('readonly'));
193 } 198 }
199 },
200 createMessages: function() {
201 var messages = Ext.create('Ext.form.Panel', {
202 bodyPadding: '5 5 5 5'
203 });
204 for (var key in this.warnings) {
205 var label = Ext.create('Ext.container.Container', {
206 layout: 'hbox',
207 bodyPadding: '5 5 5 5',
208 items: [{
209 xtype: 'image',
210 src: 'gfx/icon-warning.gif',
211 width: 18,
212 height: 18
213 }, {
214 xtype: 'label',
215 text: key + ": " + this.warnings[key],
216 margin: '4 0 0 5'
217 }]
218 });
219 messages.insert(0, label);
220 }
221 for (var key in this.errors) {
222 var label = Ext.create('Ext.container.Container', {
223 layout: 'hbox',
224 bodyPadding: '5 5 5 5',
225 items: [{
226 xtype: 'image',
227 src: 'gfx/icon-error.gif',
228 width: 18,
229 height: 18
230 }, {
231 xtype: 'label',
232 text: key + ": " + this.errors[key],
233 margin: '4 0 0 5'
234 }]
235 });
236 messages.insert(0, label);
237 }
238 this.insert(0, messages);
194 } 239 }
195 }); 240 });

http://lada.wald.intevation.org