raimund@603: /* Copyright (C) 2013 by Bundesamt fuer Strahlenschutz raimund@603: * Software engineering by Intevation GmbH raimund@603: * raimund@603: * This file is Free Software under the GNU GPL (v>=3) raimund@603: * and comes with ABSOLUTELY NO WARRANTY! Check out raimund@603: * the documentation coming with IMIS-Labordaten-Application for details. raimund@603: */ raimund@603: dustin@894: /** dustin@894: * Form to edit a Ort of a Probe. dustin@894: * This differs from a Location raimund@603: */ raimund@603: Ext.define('Lada.view.form.Ort', { raimund@603: extend: 'Ext.form.Panel', raimund@603: alias: 'widget.ortform', raimund@603: raimund@603: requires: [ raimund@603: 'Lada.view.widget.Location' raimund@603: ], raimund@603: raimund@603: model: 'Lada.model.Ort', raimund@603: minWidth: 300, raimund@603: margin: 5, raimund@603: border: 0, raimund@603: raimund@603: recordId: null, raimund@603: raimund@603: trackResetOnLoad: true, raimund@603: raimund@603: initComponent: function() { raimund@603: this.items = [{ raimund@603: xtype: 'fieldset', raimund@603: title: 'Ort', raimund@603: items: [{ raimund@603: border: 0, raimund@603: margin: '0, 0, 10, 0', raimund@603: dockedItems: [{ raimund@603: xtype: 'toolbar', raimund@603: dock: 'bottom', raimund@603: border: '0, 1, 1, 1', raimund@603: style: { raimund@603: borderBottom: '1px solid #b5b8c8 !important', raimund@603: borderLeft: '1px solid #b5b8c8 !important', raimund@603: borderRight: '1px solid #b5b8c8 !important' raimund@603: }, raimund@603: items: ['->', { raimund@603: text: 'Speichern', raimund@603: qtip: 'Daten speichern', raimund@603: icon: 'resources/img/dialog-ok-apply.png', raimund@603: action: 'save', raimund@603: disabled: true raimund@603: }, { raimund@603: text: 'Verwerfen', raimund@603: qtip: 'Ă„nderungen verwerfen', raimund@603: icon: 'resources/img/dialog-cancel.png', raimund@603: action: 'discard', raimund@603: disabled: true raimund@603: }] raimund@603: }], raimund@603: items: [{ raimund@603: xtype: 'location', raimund@603: name: 'ort', raimund@603: fieldLabel: 'Ort', raimund@603: labelWidth: 80, raimund@603: width: 280 raimund@603: }, { raimund@603: xtype: 'tfield', raimund@603: name: 'ortsTyp', raimund@603: fieldLabel: 'Typ', raimund@603: labelWidth: 80, raimund@603: width: 280, raimund@603: maxLength: 1 raimund@603: }, { raimund@603: xtype: 'textarea', raimund@603: name: 'ortszusatztext', raimund@603: fieldLabel: 'Ortszusatz', raimund@603: width: 280, raimund@603: labelWidth: 80 raimund@603: }] raimund@603: }] raimund@603: }]; raimund@603: this.callParent(arguments); raimund@603: }, raimund@603: raimund@603: setRecord: function(record) { raimund@603: this.getForm().loadRecord(record); raimund@603: }, raimund@603: raimund@603: setMessages: function(errors, warnings) { dustin@708: var key; dustin@708: var element; dustin@708: var content; dustin@708: var i18n = Lada.getApplication().bundle; dustin@708: if (warnings) { dustin@708: for (key in warnings) { dustin@708: element = this.down('component[name=' + key + ']'); dustin@708: if (!element) { dustin@708: continue; dustin@708: } dustin@708: content = warnings[key]; dustin@708: var warnText = ''; dustin@708: for (var i = 0; i < content.length; i++) { dustin@708: warnText += i18n.getMsg(content[i].toString()) + '\n'; dustin@708: } dustin@708: element.showWarnings(warnText); dustin@708: } dustin@708: } dustin@708: if (errors) { dustin@708: for (key in errors) { dustin@708: element = this.down('component[name=' + key + ']'); dustin@708: if (!element) { dustin@708: continue; dustin@708: } dustin@708: content = errors[key]; dustin@708: var errorText = ''; dustin@708: for (var i = 0; i < content.length; i++) { dustin@708: errorText += i18n.getMsg(content[i].toString()) + '\n'; dustin@708: } dustin@708: element.showErrors(errorText); dustin@708: } dustin@708: } raimund@603: }, raimund@603: raimund@603: clearMessages: function() { dustin@708: //this.down('location[name=ort]').clearWarningOrError(); dustin@708: this.down('tfield[name=ortsTyp]').clearWarningOrError(); dustin@708: //this.down('textarea[name=ortszusatztext]').clearWarningOrError(); raimund@603: }, raimund@603: raimund@603: setReadOnly: function(value) { dustin@853: this.down('location[name=ort]').setReadOnly(value); dustin@708: this.down('tfield[name=ortsTyp]').setReadOnly(value); dustin@708: this.down('textarea[name=ortszusatztext]').setReadOnly(value); raimund@603: } raimund@603: });