Mercurial > lada > lada-client
changeset 708:2ad36c8db968
Added ClearMessages, SetWarnigs, SetReadonly
author | Dustin Demuth <dustin@intevation.de> |
---|---|
date | Fri, 27 Mar 2015 15:54:43 +0100 |
parents | c632c7c34029 |
children | 6f6d2df00130 |
files | app/view/form/Location.js app/view/form/Messung.js app/view/form/Ort.js app/view/widget/Messmethode.js |
diffstat | 4 files changed, 122 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/app/view/form/Location.js Fri Mar 27 15:22:32 2015 +0100 +++ b/app/view/form/Location.js Fri Mar 27 15:54:43 2015 +0100 @@ -113,10 +113,49 @@ }, setMessages: function(errors, warnings) { - }, + var key; + var element; + var content; + var i18n = Lada.getApplication().bundle; + if (warnings) { + for (key in warnings) { + element = this.down('component[name=' + key + ']'); + if (!element) { + continue; + } + content = warnings[key]; + var warnText = ''; + for (var i = 0; i < content.length; i++) { + warnText += i18n.getMsg(content[i].toString()) + '\n'; + } + element.showWarnings(warnText); + } + } + if (errors) { + for (key in errors) { + element = this.down('component[name=' + key + ']'); + if (!element) { + continue; + } + content = errors[key]; + var errorText = ''; + for (var i = 0; i < content.length; i++) { + errorText += i18n.getMsg(content[i].toString()) + '\n'; + } + element.showErrors(errorText); + } + } + }, clearMessages: function() { - }, + this.down('tfield[name=beschreibung]').clearWarningOrError(); + this.down('tfield[name=bezeichnung]').clearWarningOrError(); + this.down('staat[name=staatId]').clearWarningOrError(); + this.down('verwaltungseinheit[name=verwaltungseinheitId]').clearWarningOrError(); + //this.down('numberfield[name=longitude]').clearWarningOrError(); + //this.down('numberfield[name=latitude]').clearWarningOrError(); + //this.down('numberfield[name=hoeheLand]').clearWarningOrError(); + }, setReadOnly: function(value) { this.down('tfield[name=beschreibung]').setReadOnly(value);
--- a/app/view/form/Messung.js Fri Mar 27 15:22:32 2015 +0100 +++ b/app/view/form/Messung.js Fri Mar 27 15:54:43 2015 +0100 @@ -65,7 +65,7 @@ }] }], items: [{ - xtype: 'textfield', + xtype: 'tfield', name: 'nebenprobenNr', maxLength: 10, margin: '0, 10, 5, 0', @@ -122,17 +122,53 @@ this.getForm().loadRecord(record); }, - setMessages: function() { - // TODO this is a stub + setMessages: function(errors, warnings) { + var key; + var element; + var content; + var i18n = Lada.getApplication().bundle; + if (warnings) { + for (key in warnings) { + element = this.down('component[name=' + key + ']'); + if (!element) { + continue; + } + content = warnings[key]; + var warnText = ''; + for (var i = 0; i < content.length; i++) { + warnText += i18n.getMsg(content[i].toString()) + '\n'; + } + element.showWarnings(warnText); + } + } + if (errors) { + for (key in errors) { + element = this.down('component[name=' + key + ']'); + if (!element) { + continue; + } + content = errors[key]; + var errorText = ''; + for (var i = 0; i < content.length; i++) { + errorText += i18n.getMsg(content[i].toString()) + '\n'; + } + element.showErrors(errorText); + } + } }, clearMessages: function() { - // TODO this is a stub + this.down('tfield[name=nebenprobenNr]').clearWarningOrError(); + //this.down('messmethode[name=mmtId]').clearWarningOrError(); + this.down('datetime[name=messzeitpunkt]').clearWarningOrError(); + //this.down('numberfield[name=messdauer]').clearWarningOrError(); + this.down('chkbox[name=fertig]').clearWarningOrError(); + this.down('chkbox[name=geplant]').clearWarningOrError(); }, setReadOnly: function(value) { - this.down('textfield[name=nebenprobenNr]').setReadOnly(value); - this.down('messmethode[name=mmtId]').setReadOnly(value); + this.down('tfield[name=nebenprobenNr]').setReadOnly(value); + //this.down('messmethode[name=mmtId]').setReadOnly(value); this.down('datetime[name=messzeitpunkt]').setReadOnly(value); this.down('numberfield[name=messdauer]').setReadOnly(value); this.down('chkbox[name=fertig]').setReadOnly(value);
--- a/app/view/form/Ort.js Fri Mar 27 15:22:32 2015 +0100 +++ b/app/view/form/Ort.js Fri Mar 27 15:54:43 2015 +0100 @@ -86,11 +86,49 @@ }, setMessages: function(errors, warnings) { + var key; + var element; + var content; + var i18n = Lada.getApplication().bundle; + if (warnings) { + for (key in warnings) { + element = this.down('component[name=' + key + ']'); + if (!element) { + continue; + } + content = warnings[key]; + var warnText = ''; + for (var i = 0; i < content.length; i++) { + warnText += i18n.getMsg(content[i].toString()) + '\n'; + } + element.showWarnings(warnText); + } + } + if (errors) { + for (key in errors) { + element = this.down('component[name=' + key + ']'); + if (!element) { + continue; + } + content = errors[key]; + var errorText = ''; + for (var i = 0; i < content.length; i++) { + errorText += i18n.getMsg(content[i].toString()) + '\n'; + } + element.showErrors(errorText); + } + } }, clearMessages: function() { + //this.down('location[name=ort]').clearWarningOrError(); + this.down('tfield[name=ortsTyp]').clearWarningOrError(); + //this.down('textarea[name=ortszusatztext]').clearWarningOrError(); }, setReadOnly: function(value) { + //this.down('location[name=ort]').setReadOnly(value); + this.down('tfield[name=ortsTyp]').setReadOnly(value); + this.down('textarea[name=ortszusatztext]').setReadOnly(value); } });
--- a/app/view/widget/Messmethode.js Fri Mar 27 15:22:32 2015 +0100 +++ b/app/view/widget/Messmethode.js Fri Mar 27 15:54:43 2015 +0100 @@ -23,7 +23,7 @@ typeAhead: true, minChars: 0, layout: 'hbox', - + initComponent: function() { this.store = Ext.data.StoreManager.get('messmethoden'); if (!this.store) {