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

Added ClearMessages, SetWarnigs, SetReadonly
author Dustin Demuth <dustin@intevation.de>
date Fri, 27 Mar 2015 15:54:43 +0100
parents fe527f380b10
children 3139b920dd0e
comparison
equal deleted inserted replaced
707:c632c7c34029 708:2ad36c8db968
111 setRecord: function(record) { 111 setRecord: function(record) {
112 this.getForm().loadRecord(record); 112 this.getForm().loadRecord(record);
113 }, 113 },
114 114
115 setMessages: function(errors, warnings) { 115 setMessages: function(errors, warnings) {
116 }, 116 var key;
117 var element;
118 var content;
119 var i18n = Lada.getApplication().bundle;
120 if (warnings) {
121 for (key in warnings) {
122 element = this.down('component[name=' + key + ']');
123 if (!element) {
124 continue;
125 }
126 content = warnings[key];
127 var warnText = '';
128 for (var i = 0; i < content.length; i++) {
129 warnText += i18n.getMsg(content[i].toString()) + '\n';
130 }
131 element.showWarnings(warnText);
132 }
133 }
134 if (errors) {
135 for (key in errors) {
136 element = this.down('component[name=' + key + ']');
137 if (!element) {
138 continue;
139 }
140 content = errors[key];
141 var errorText = '';
142 for (var i = 0; i < content.length; i++) {
143 errorText += i18n.getMsg(content[i].toString()) + '\n';
144 }
145 element.showErrors(errorText);
146 }
147 }
148 },
117 149
118 clearMessages: function() { 150 clearMessages: function() {
119 }, 151 this.down('tfield[name=beschreibung]').clearWarningOrError();
152 this.down('tfield[name=bezeichnung]').clearWarningOrError();
153 this.down('staat[name=staatId]').clearWarningOrError();
154 this.down('verwaltungseinheit[name=verwaltungseinheitId]').clearWarningOrError();
155 //this.down('numberfield[name=longitude]').clearWarningOrError();
156 //this.down('numberfield[name=latitude]').clearWarningOrError();
157 //this.down('numberfield[name=hoeheLand]').clearWarningOrError();
158 },
120 159
121 setReadOnly: function(value) { 160 setReadOnly: function(value) {
122 this.down('tfield[name=beschreibung]').setReadOnly(value); 161 this.down('tfield[name=beschreibung]').setReadOnly(value);
123 this.down('tfield[name=bezeichnung]').setReadOnly(value); 162 this.down('tfield[name=bezeichnung]').setReadOnly(value);
124 this.down('staat[name=staatId]').setReadOnly(value); 163 this.down('staat[name=staatId]').setReadOnly(value);

http://lada.wald.intevation.org