comparison app/view/form/Ort.js @ 708:2ad36c8db968

Added ClearMessages, SetWarnigs, SetReadonly
author Dustin Demuth <dustin@intevation.de>
date Fri, 27 Mar 2015 15:54:43 +0100
parents 9d0113bc2f70
children e5f72fb491f4
comparison
equal deleted inserted replaced
707:c632c7c34029 708:2ad36c8db968
84 setRecord: function(record) { 84 setRecord: function(record) {
85 this.getForm().loadRecord(record); 85 this.getForm().loadRecord(record);
86 }, 86 },
87 87
88 setMessages: function(errors, warnings) { 88 setMessages: function(errors, warnings) {
89 var key;
90 var element;
91 var content;
92 var i18n = Lada.getApplication().bundle;
93 if (warnings) {
94 for (key in warnings) {
95 element = this.down('component[name=' + key + ']');
96 if (!element) {
97 continue;
98 }
99 content = warnings[key];
100 var warnText = '';
101 for (var i = 0; i < content.length; i++) {
102 warnText += i18n.getMsg(content[i].toString()) + '\n';
103 }
104 element.showWarnings(warnText);
105 }
106 }
107 if (errors) {
108 for (key in errors) {
109 element = this.down('component[name=' + key + ']');
110 if (!element) {
111 continue;
112 }
113 content = errors[key];
114 var errorText = '';
115 for (var i = 0; i < content.length; i++) {
116 errorText += i18n.getMsg(content[i].toString()) + '\n';
117 }
118 element.showErrors(errorText);
119 }
120 }
89 }, 121 },
90 122
91 clearMessages: function() { 123 clearMessages: function() {
124 //this.down('location[name=ort]').clearWarningOrError();
125 this.down('tfield[name=ortsTyp]').clearWarningOrError();
126 //this.down('textarea[name=ortszusatztext]').clearWarningOrError();
92 }, 127 },
93 128
94 setReadOnly: function(value) { 129 setReadOnly: function(value) {
130 //this.down('location[name=ort]').setReadOnly(value);
131 this.down('tfield[name=ortsTyp]').setReadOnly(value);
132 this.down('textarea[name=ortszusatztext]').setReadOnly(value);
95 } 133 }
96 }); 134 });

http://lada.wald.intevation.org