annotate app/view/form/Ort.js @ 711:af16a257d5f6

Updated the model to have correct tree_modified value and parent_modified fields.
author Raimund Renkert <raimund.renkert@intevation.de>
date Wed, 08 Apr 2015 10:51:39 +0200
parents 2ad36c8db968
children e5f72fb491f4
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
9d0113bc2f70 Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
9 /*
9d0113bc2f70 Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
10 * Formular to edit a Probe
9d0113bc2f70 Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
11 */
9d0113bc2f70 Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
12 Ext.define('Lada.view.form.Ort', {
9d0113bc2f70 Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
13 extend: 'Ext.form.Panel',
9d0113bc2f70 Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
14 alias: 'widget.ortform',
9d0113bc2f70 Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
15
9d0113bc2f70 Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
16 requires: [
9d0113bc2f70 Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
17 'Lada.view.widget.Location'
9d0113bc2f70 Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
18 ],
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 model: 'Lada.model.Ort',
9d0113bc2f70 Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
21 minWidth: 300,
9d0113bc2f70 Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
22 margin: 5,
9d0113bc2f70 Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
23 border: 0,
9d0113bc2f70 Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
24
9d0113bc2f70 Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
25 recordId: null,
9d0113bc2f70 Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
26
9d0113bc2f70 Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
27 trackResetOnLoad: true,
9d0113bc2f70 Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
28
9d0113bc2f70 Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
29 initComponent: function() {
9d0113bc2f70 Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
30 this.items = [{
9d0113bc2f70 Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
31 xtype: 'fieldset',
9d0113bc2f70 Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
32 title: 'Ort',
9d0113bc2f70 Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
33 items: [{
9d0113bc2f70 Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
34 border: 0,
9d0113bc2f70 Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
35 margin: '0, 0, 10, 0',
9d0113bc2f70 Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
36 dockedItems: [{
9d0113bc2f70 Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
37 xtype: 'toolbar',
9d0113bc2f70 Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
38 dock: 'bottom',
9d0113bc2f70 Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
39 border: '0, 1, 1, 1',
9d0113bc2f70 Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
40 style: {
9d0113bc2f70 Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
41 borderBottom: '1px solid #b5b8c8 !important',
9d0113bc2f70 Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
42 borderLeft: '1px solid #b5b8c8 !important',
9d0113bc2f70 Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
43 borderRight: '1px solid #b5b8c8 !important'
9d0113bc2f70 Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
44 },
9d0113bc2f70 Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
45 items: ['->', {
9d0113bc2f70 Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
46 text: 'Speichern',
9d0113bc2f70 Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
47 qtip: 'Daten speichern',
9d0113bc2f70 Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
48 icon: 'resources/img/dialog-ok-apply.png',
9d0113bc2f70 Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
49 action: 'save',
9d0113bc2f70 Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
50 disabled: true
9d0113bc2f70 Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
51 }, {
9d0113bc2f70 Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
52 text: 'Verwerfen',
9d0113bc2f70 Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
53 qtip: 'Ă„nderungen verwerfen',
9d0113bc2f70 Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
54 icon: 'resources/img/dialog-cancel.png',
9d0113bc2f70 Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
55 action: 'discard',
9d0113bc2f70 Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
56 disabled: true
9d0113bc2f70 Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
57 }]
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 items: [{
9d0113bc2f70 Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
60 xtype: 'location',
9d0113bc2f70 Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
61 name: 'ort',
9d0113bc2f70 Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
62 fieldLabel: 'Ort',
9d0113bc2f70 Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
63 labelWidth: 80,
9d0113bc2f70 Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
64 width: 280
9d0113bc2f70 Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
65 }, {
9d0113bc2f70 Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
66 xtype: 'tfield',
9d0113bc2f70 Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
67 name: 'ortsTyp',
9d0113bc2f70 Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
68 fieldLabel: 'Typ',
9d0113bc2f70 Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
69 labelWidth: 80,
9d0113bc2f70 Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
70 width: 280,
9d0113bc2f70 Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
71 maxLength: 1
9d0113bc2f70 Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
72 }, {
9d0113bc2f70 Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
73 xtype: 'textarea',
9d0113bc2f70 Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
74 name: 'ortszusatztext',
9d0113bc2f70 Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
75 fieldLabel: 'Ortszusatz',
9d0113bc2f70 Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
76 width: 280,
9d0113bc2f70 Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
77 labelWidth: 80
9d0113bc2f70 Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
78 }]
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 this.callParent(arguments);
9d0113bc2f70 Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
82 },
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 setRecord: function(record) {
9d0113bc2f70 Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
85 this.getForm().loadRecord(record);
9d0113bc2f70 Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
86 },
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 setMessages: function(errors, warnings) {
708
2ad36c8db968 Added ClearMessages, SetWarnigs, SetReadonly
Dustin Demuth <dustin@intevation.de>
parents: 603
diff changeset
89 var key;
2ad36c8db968 Added ClearMessages, SetWarnigs, SetReadonly
Dustin Demuth <dustin@intevation.de>
parents: 603
diff changeset
90 var element;
2ad36c8db968 Added ClearMessages, SetWarnigs, SetReadonly
Dustin Demuth <dustin@intevation.de>
parents: 603
diff changeset
91 var content;
2ad36c8db968 Added ClearMessages, SetWarnigs, SetReadonly
Dustin Demuth <dustin@intevation.de>
parents: 603
diff changeset
92 var i18n = Lada.getApplication().bundle;
2ad36c8db968 Added ClearMessages, SetWarnigs, SetReadonly
Dustin Demuth <dustin@intevation.de>
parents: 603
diff changeset
93 if (warnings) {
2ad36c8db968 Added ClearMessages, SetWarnigs, SetReadonly
Dustin Demuth <dustin@intevation.de>
parents: 603
diff changeset
94 for (key in warnings) {
2ad36c8db968 Added ClearMessages, SetWarnigs, SetReadonly
Dustin Demuth <dustin@intevation.de>
parents: 603
diff changeset
95 element = this.down('component[name=' + key + ']');
2ad36c8db968 Added ClearMessages, SetWarnigs, SetReadonly
Dustin Demuth <dustin@intevation.de>
parents: 603
diff changeset
96 if (!element) {
2ad36c8db968 Added ClearMessages, SetWarnigs, SetReadonly
Dustin Demuth <dustin@intevation.de>
parents: 603
diff changeset
97 continue;
2ad36c8db968 Added ClearMessages, SetWarnigs, SetReadonly
Dustin Demuth <dustin@intevation.de>
parents: 603
diff changeset
98 }
2ad36c8db968 Added ClearMessages, SetWarnigs, SetReadonly
Dustin Demuth <dustin@intevation.de>
parents: 603
diff changeset
99 content = warnings[key];
2ad36c8db968 Added ClearMessages, SetWarnigs, SetReadonly
Dustin Demuth <dustin@intevation.de>
parents: 603
diff changeset
100 var warnText = '';
2ad36c8db968 Added ClearMessages, SetWarnigs, SetReadonly
Dustin Demuth <dustin@intevation.de>
parents: 603
diff changeset
101 for (var i = 0; i < content.length; i++) {
2ad36c8db968 Added ClearMessages, SetWarnigs, SetReadonly
Dustin Demuth <dustin@intevation.de>
parents: 603
diff changeset
102 warnText += i18n.getMsg(content[i].toString()) + '\n';
2ad36c8db968 Added ClearMessages, SetWarnigs, SetReadonly
Dustin Demuth <dustin@intevation.de>
parents: 603
diff changeset
103 }
2ad36c8db968 Added ClearMessages, SetWarnigs, SetReadonly
Dustin Demuth <dustin@intevation.de>
parents: 603
diff changeset
104 element.showWarnings(warnText);
2ad36c8db968 Added ClearMessages, SetWarnigs, SetReadonly
Dustin Demuth <dustin@intevation.de>
parents: 603
diff changeset
105 }
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 if (errors) {
2ad36c8db968 Added ClearMessages, SetWarnigs, SetReadonly
Dustin Demuth <dustin@intevation.de>
parents: 603
diff changeset
108 for (key in errors) {
2ad36c8db968 Added ClearMessages, SetWarnigs, SetReadonly
Dustin Demuth <dustin@intevation.de>
parents: 603
diff changeset
109 element = this.down('component[name=' + key + ']');
2ad36c8db968 Added ClearMessages, SetWarnigs, SetReadonly
Dustin Demuth <dustin@intevation.de>
parents: 603
diff changeset
110 if (!element) {
2ad36c8db968 Added ClearMessages, SetWarnigs, SetReadonly
Dustin Demuth <dustin@intevation.de>
parents: 603
diff changeset
111 continue;
2ad36c8db968 Added ClearMessages, SetWarnigs, SetReadonly
Dustin Demuth <dustin@intevation.de>
parents: 603
diff changeset
112 }
2ad36c8db968 Added ClearMessages, SetWarnigs, SetReadonly
Dustin Demuth <dustin@intevation.de>
parents: 603
diff changeset
113 content = errors[key];
2ad36c8db968 Added ClearMessages, SetWarnigs, SetReadonly
Dustin Demuth <dustin@intevation.de>
parents: 603
diff changeset
114 var errorText = '';
2ad36c8db968 Added ClearMessages, SetWarnigs, SetReadonly
Dustin Demuth <dustin@intevation.de>
parents: 603
diff changeset
115 for (var i = 0; i < content.length; i++) {
2ad36c8db968 Added ClearMessages, SetWarnigs, SetReadonly
Dustin Demuth <dustin@intevation.de>
parents: 603
diff changeset
116 errorText += i18n.getMsg(content[i].toString()) + '\n';
2ad36c8db968 Added ClearMessages, SetWarnigs, SetReadonly
Dustin Demuth <dustin@intevation.de>
parents: 603
diff changeset
117 }
2ad36c8db968 Added ClearMessages, SetWarnigs, SetReadonly
Dustin Demuth <dustin@intevation.de>
parents: 603
diff changeset
118 element.showErrors(errorText);
2ad36c8db968 Added ClearMessages, SetWarnigs, SetReadonly
Dustin Demuth <dustin@intevation.de>
parents: 603
diff changeset
119 }
2ad36c8db968 Added ClearMessages, SetWarnigs, SetReadonly
Dustin Demuth <dustin@intevation.de>
parents: 603
diff changeset
120 }
603
9d0113bc2f70 Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
121 },
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 clearMessages: function() {
708
2ad36c8db968 Added ClearMessages, SetWarnigs, SetReadonly
Dustin Demuth <dustin@intevation.de>
parents: 603
diff changeset
124 //this.down('location[name=ort]').clearWarningOrError();
2ad36c8db968 Added ClearMessages, SetWarnigs, SetReadonly
Dustin Demuth <dustin@intevation.de>
parents: 603
diff changeset
125 this.down('tfield[name=ortsTyp]').clearWarningOrError();
2ad36c8db968 Added ClearMessages, SetWarnigs, SetReadonly
Dustin Demuth <dustin@intevation.de>
parents: 603
diff changeset
126 //this.down('textarea[name=ortszusatztext]').clearWarningOrError();
603
9d0113bc2f70 Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
127 },
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 setReadOnly: function(value) {
708
2ad36c8db968 Added ClearMessages, SetWarnigs, SetReadonly
Dustin Demuth <dustin@intevation.de>
parents: 603
diff changeset
130 //this.down('location[name=ort]').setReadOnly(value);
2ad36c8db968 Added ClearMessages, SetWarnigs, SetReadonly
Dustin Demuth <dustin@intevation.de>
parents: 603
diff changeset
131 this.down('tfield[name=ortsTyp]').setReadOnly(value);
2ad36c8db968 Added ClearMessages, SetWarnigs, SetReadonly
Dustin Demuth <dustin@intevation.de>
parents: 603
diff changeset
132 this.down('textarea[name=ortszusatztext]').setReadOnly(value);
603
9d0113bc2f70 Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
133 }
9d0113bc2f70 Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
134 });

http://lada.wald.intevation.org