annotate app/view/form/Ort.js @ 1296:6043187c6e8d

Show staat iso code in orte grids.
author Raimund Renkert <raimund.renkert@intevation.de>
date Thu, 02 Feb 2017 11:13:09 +0100
parents a1d72228af00
children
rev   line source
603
9d0113bc2f70 Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
1 /* Copyright (C) 2013 by Bundesamt fuer Strahlenschutz
9d0113bc2f70 Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
2 * Software engineering by Intevation GmbH
9d0113bc2f70 Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
3 *
9d0113bc2f70 Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
4 * This file is Free Software under the GNU GPL (v>=3)
9d0113bc2f70 Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
5 * and comes with ABSOLUTELY NO WARRANTY! Check out
9d0113bc2f70 Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
6 * the documentation coming with IMIS-Labordaten-Application for details.
9d0113bc2f70 Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
7 */
9d0113bc2f70 Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
8
894
a1d72228af00 jsduck for forms
Dustin Demuth <dustin@intevation.de>
parents: 853
diff changeset
9 /**
a1d72228af00 jsduck for forms
Dustin Demuth <dustin@intevation.de>
parents: 853
diff changeset
10 * Form to edit a Ort of a Probe.
a1d72228af00 jsduck for forms
Dustin Demuth <dustin@intevation.de>
parents: 853
diff changeset
11 * This differs from a Location
603
9d0113bc2f70 Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
12 */
9d0113bc2f70 Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
13 Ext.define('Lada.view.form.Ort', {
9d0113bc2f70 Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
14 extend: 'Ext.form.Panel',
9d0113bc2f70 Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
15 alias: 'widget.ortform',
9d0113bc2f70 Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
16
9d0113bc2f70 Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
17 requires: [
9d0113bc2f70 Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
18 'Lada.view.widget.Location'
9d0113bc2f70 Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
19 ],
9d0113bc2f70 Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
20
9d0113bc2f70 Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
21 model: 'Lada.model.Ort',
9d0113bc2f70 Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
22 minWidth: 300,
9d0113bc2f70 Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
23 margin: 5,
9d0113bc2f70 Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
24 border: 0,
9d0113bc2f70 Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
25
9d0113bc2f70 Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
26 recordId: null,
9d0113bc2f70 Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
27
9d0113bc2f70 Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
28 trackResetOnLoad: true,
9d0113bc2f70 Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
29
9d0113bc2f70 Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
30 initComponent: function() {
9d0113bc2f70 Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
31 this.items = [{
9d0113bc2f70 Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
32 xtype: 'fieldset',
9d0113bc2f70 Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
33 title: 'Ort',
9d0113bc2f70 Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
34 items: [{
9d0113bc2f70 Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
35 border: 0,
9d0113bc2f70 Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
36 margin: '0, 0, 10, 0',
9d0113bc2f70 Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
37 dockedItems: [{
9d0113bc2f70 Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
38 xtype: 'toolbar',
9d0113bc2f70 Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
39 dock: 'bottom',
9d0113bc2f70 Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
40 border: '0, 1, 1, 1',
9d0113bc2f70 Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
41 style: {
9d0113bc2f70 Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
42 borderBottom: '1px solid #b5b8c8 !important',
9d0113bc2f70 Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
43 borderLeft: '1px solid #b5b8c8 !important',
9d0113bc2f70 Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
44 borderRight: '1px solid #b5b8c8 !important'
9d0113bc2f70 Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
45 },
9d0113bc2f70 Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
46 items: ['->', {
9d0113bc2f70 Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
47 text: 'Speichern',
9d0113bc2f70 Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
48 qtip: 'Daten speichern',
9d0113bc2f70 Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
49 icon: 'resources/img/dialog-ok-apply.png',
9d0113bc2f70 Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
50 action: 'save',
9d0113bc2f70 Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
51 disabled: true
9d0113bc2f70 Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
52 }, {
9d0113bc2f70 Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
53 text: 'Verwerfen',
9d0113bc2f70 Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
54 qtip: 'Ă„nderungen verwerfen',
9d0113bc2f70 Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
55 icon: 'resources/img/dialog-cancel.png',
9d0113bc2f70 Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
56 action: 'discard',
9d0113bc2f70 Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
57 disabled: true
9d0113bc2f70 Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
58 }]
9d0113bc2f70 Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
59 }],
9d0113bc2f70 Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
60 items: [{
9d0113bc2f70 Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
61 xtype: 'location',
9d0113bc2f70 Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
62 name: 'ort',
9d0113bc2f70 Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
63 fieldLabel: 'Ort',
9d0113bc2f70 Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
64 labelWidth: 80,
9d0113bc2f70 Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
65 width: 280
9d0113bc2f70 Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
66 }, {
9d0113bc2f70 Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
67 xtype: 'tfield',
9d0113bc2f70 Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
68 name: 'ortsTyp',
9d0113bc2f70 Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
69 fieldLabel: 'Typ',
9d0113bc2f70 Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
70 labelWidth: 80,
9d0113bc2f70 Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
71 width: 280,
9d0113bc2f70 Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
72 maxLength: 1
9d0113bc2f70 Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
73 }, {
9d0113bc2f70 Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
74 xtype: 'textarea',
9d0113bc2f70 Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
75 name: 'ortszusatztext',
9d0113bc2f70 Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
76 fieldLabel: 'Ortszusatz',
9d0113bc2f70 Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
77 width: 280,
9d0113bc2f70 Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
78 labelWidth: 80
9d0113bc2f70 Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
79 }]
9d0113bc2f70 Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
80 }]
9d0113bc2f70 Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
81 }];
9d0113bc2f70 Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
82 this.callParent(arguments);
9d0113bc2f70 Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
83 },
9d0113bc2f70 Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
84
9d0113bc2f70 Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
85 setRecord: function(record) {
9d0113bc2f70 Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
86 this.getForm().loadRecord(record);
9d0113bc2f70 Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
87 },
9d0113bc2f70 Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
88
9d0113bc2f70 Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
89 setMessages: function(errors, warnings) {
708
2ad36c8db968 Added ClearMessages, SetWarnigs, SetReadonly
Dustin Demuth <dustin@intevation.de>
parents: 603
diff changeset
90 var key;
2ad36c8db968 Added ClearMessages, SetWarnigs, SetReadonly
Dustin Demuth <dustin@intevation.de>
parents: 603
diff changeset
91 var element;
2ad36c8db968 Added ClearMessages, SetWarnigs, SetReadonly
Dustin Demuth <dustin@intevation.de>
parents: 603
diff changeset
92 var content;
2ad36c8db968 Added ClearMessages, SetWarnigs, SetReadonly
Dustin Demuth <dustin@intevation.de>
parents: 603
diff changeset
93 var i18n = Lada.getApplication().bundle;
2ad36c8db968 Added ClearMessages, SetWarnigs, SetReadonly
Dustin Demuth <dustin@intevation.de>
parents: 603
diff changeset
94 if (warnings) {
2ad36c8db968 Added ClearMessages, SetWarnigs, SetReadonly
Dustin Demuth <dustin@intevation.de>
parents: 603
diff changeset
95 for (key in warnings) {
2ad36c8db968 Added ClearMessages, SetWarnigs, SetReadonly
Dustin Demuth <dustin@intevation.de>
parents: 603
diff changeset
96 element = this.down('component[name=' + key + ']');
2ad36c8db968 Added ClearMessages, SetWarnigs, SetReadonly
Dustin Demuth <dustin@intevation.de>
parents: 603
diff changeset
97 if (!element) {
2ad36c8db968 Added ClearMessages, SetWarnigs, SetReadonly
Dustin Demuth <dustin@intevation.de>
parents: 603
diff changeset
98 continue;
2ad36c8db968 Added ClearMessages, SetWarnigs, SetReadonly
Dustin Demuth <dustin@intevation.de>
parents: 603
diff changeset
99 }
2ad36c8db968 Added ClearMessages, SetWarnigs, SetReadonly
Dustin Demuth <dustin@intevation.de>
parents: 603
diff changeset
100 content = warnings[key];
2ad36c8db968 Added ClearMessages, SetWarnigs, SetReadonly
Dustin Demuth <dustin@intevation.de>
parents: 603
diff changeset
101 var warnText = '';
2ad36c8db968 Added ClearMessages, SetWarnigs, SetReadonly
Dustin Demuth <dustin@intevation.de>
parents: 603
diff changeset
102 for (var i = 0; i < content.length; i++) {
2ad36c8db968 Added ClearMessages, SetWarnigs, SetReadonly
Dustin Demuth <dustin@intevation.de>
parents: 603
diff changeset
103 warnText += i18n.getMsg(content[i].toString()) + '\n';
2ad36c8db968 Added ClearMessages, SetWarnigs, SetReadonly
Dustin Demuth <dustin@intevation.de>
parents: 603
diff changeset
104 }
2ad36c8db968 Added ClearMessages, SetWarnigs, SetReadonly
Dustin Demuth <dustin@intevation.de>
parents: 603
diff changeset
105 element.showWarnings(warnText);
2ad36c8db968 Added ClearMessages, SetWarnigs, SetReadonly
Dustin Demuth <dustin@intevation.de>
parents: 603
diff changeset
106 }
2ad36c8db968 Added ClearMessages, SetWarnigs, SetReadonly
Dustin Demuth <dustin@intevation.de>
parents: 603
diff changeset
107 }
2ad36c8db968 Added ClearMessages, SetWarnigs, SetReadonly
Dustin Demuth <dustin@intevation.de>
parents: 603
diff changeset
108 if (errors) {
2ad36c8db968 Added ClearMessages, SetWarnigs, SetReadonly
Dustin Demuth <dustin@intevation.de>
parents: 603
diff changeset
109 for (key in errors) {
2ad36c8db968 Added ClearMessages, SetWarnigs, SetReadonly
Dustin Demuth <dustin@intevation.de>
parents: 603
diff changeset
110 element = this.down('component[name=' + key + ']');
2ad36c8db968 Added ClearMessages, SetWarnigs, SetReadonly
Dustin Demuth <dustin@intevation.de>
parents: 603
diff changeset
111 if (!element) {
2ad36c8db968 Added ClearMessages, SetWarnigs, SetReadonly
Dustin Demuth <dustin@intevation.de>
parents: 603
diff changeset
112 continue;
2ad36c8db968 Added ClearMessages, SetWarnigs, SetReadonly
Dustin Demuth <dustin@intevation.de>
parents: 603
diff changeset
113 }
2ad36c8db968 Added ClearMessages, SetWarnigs, SetReadonly
Dustin Demuth <dustin@intevation.de>
parents: 603
diff changeset
114 content = errors[key];
2ad36c8db968 Added ClearMessages, SetWarnigs, SetReadonly
Dustin Demuth <dustin@intevation.de>
parents: 603
diff changeset
115 var errorText = '';
2ad36c8db968 Added ClearMessages, SetWarnigs, SetReadonly
Dustin Demuth <dustin@intevation.de>
parents: 603
diff changeset
116 for (var i = 0; i < content.length; i++) {
2ad36c8db968 Added ClearMessages, SetWarnigs, SetReadonly
Dustin Demuth <dustin@intevation.de>
parents: 603
diff changeset
117 errorText += i18n.getMsg(content[i].toString()) + '\n';
2ad36c8db968 Added ClearMessages, SetWarnigs, SetReadonly
Dustin Demuth <dustin@intevation.de>
parents: 603
diff changeset
118 }
2ad36c8db968 Added ClearMessages, SetWarnigs, SetReadonly
Dustin Demuth <dustin@intevation.de>
parents: 603
diff changeset
119 element.showErrors(errorText);
2ad36c8db968 Added ClearMessages, SetWarnigs, SetReadonly
Dustin Demuth <dustin@intevation.de>
parents: 603
diff changeset
120 }
2ad36c8db968 Added ClearMessages, SetWarnigs, SetReadonly
Dustin Demuth <dustin@intevation.de>
parents: 603
diff changeset
121 }
603
9d0113bc2f70 Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
122 },
9d0113bc2f70 Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
123
9d0113bc2f70 Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
124 clearMessages: function() {
708
2ad36c8db968 Added ClearMessages, SetWarnigs, SetReadonly
Dustin Demuth <dustin@intevation.de>
parents: 603
diff changeset
125 //this.down('location[name=ort]').clearWarningOrError();
2ad36c8db968 Added ClearMessages, SetWarnigs, SetReadonly
Dustin Demuth <dustin@intevation.de>
parents: 603
diff changeset
126 this.down('tfield[name=ortsTyp]').clearWarningOrError();
2ad36c8db968 Added ClearMessages, SetWarnigs, SetReadonly
Dustin Demuth <dustin@intevation.de>
parents: 603
diff changeset
127 //this.down('textarea[name=ortszusatztext]').clearWarningOrError();
603
9d0113bc2f70 Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
128 },
9d0113bc2f70 Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
129
9d0113bc2f70 Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
130 setReadOnly: function(value) {
853
e5f72fb491f4 Made Ortform readonly when the probe is readonly
Dustin Demuth <dustin@intevation.de>
parents: 708
diff changeset
131 this.down('location[name=ort]').setReadOnly(value);
708
2ad36c8db968 Added ClearMessages, SetWarnigs, SetReadonly
Dustin Demuth <dustin@intevation.de>
parents: 603
diff changeset
132 this.down('tfield[name=ortsTyp]').setReadOnly(value);
2ad36c8db968 Added ClearMessages, SetWarnigs, SetReadonly
Dustin Demuth <dustin@intevation.de>
parents: 603
diff changeset
133 this.down('textarea[name=ortszusatztext]').setReadOnly(value);
603
9d0113bc2f70 Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
134 }
9d0113bc2f70 Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
135 });

http://lada.wald.intevation.org