Mercurial > lada > lada-client
annotate app/controller/form/Messprogramm.js @ 1101:421db8840f49
Adapt PLZ field to data model.
author | Tom Gottfried <tom@intevation.de> |
---|---|
date | Tue, 10 May 2016 17:15:30 +0200 |
parents | 60af12dd4a13 |
children | 7baaf2cd3f57 |
rev | line source |
---|---|
757
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
1 /* Copyright (C) 2013 by Bundesamt fuer Strahlenschutz |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
2 * Software engineering by Intevation GmbH |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
3 * |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
4 * This file is Free Software under the GNU GPL (v>=3) |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
5 * and comes with ABSOLUTELY NO WARRANTY! Check out |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
6 * the documentation coming with IMIS-Labordaten-Application for details. |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
7 */ |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
8 |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
9 /** |
1086
61cc583c3649
Messprogramm form redesign
Michael Stanko <mstanko@bfs.de>
parents:
1070
diff
changeset
|
10 * A Controller for a Messprogramm form |
757
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
11 */ |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
12 Ext.define('Lada.controller.form.Messprogramm', { |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
13 extend: 'Ext.app.Controller', |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
14 |
797
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
784
diff
changeset
|
15 requires: [ |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
784
diff
changeset
|
16 'Lada.view.window.MessprogrammOrt' |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
784
diff
changeset
|
17 ], |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
784
diff
changeset
|
18 |
757
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
19 /** |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
20 * Initialize the Controller |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
21 */ |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
22 init: function() { |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
23 this.control({ |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
24 'messprogrammform button[action=save]': { |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
25 click: this.save |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
26 }, |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
27 'messprogrammform button[action=discard]': { |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
28 click: this.discard |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
29 }, |
797
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
784
diff
changeset
|
30 'messprogrammform button[action=ort]': { |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
784
diff
changeset
|
31 click: this.editOrtWindow |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
784
diff
changeset
|
32 }, |
757
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
33 'messprogrammform': { |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
34 dirtychange: this.dirtyForm |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
35 }, |
1070
33927274f013
Fixed mst/labor_mst field and selection to automatically set the netzbetreiber.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
972
diff
changeset
|
36 'messprogrammform messstellelabor combobox': { |
842
beef4e8eeafc
Added logic to autofill the Netzbetreiber when the Messstelle was selected.
Dustin Demuth <dustin@intevation.de>
parents:
818
diff
changeset
|
37 select: this.setNetzbetreiber |
798
ff4330d4aba1
Filter Messtellen in Probeform and Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
797
diff
changeset
|
38 }, |
797
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
784
diff
changeset
|
39 'messprogrammform location combobox': { |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
784
diff
changeset
|
40 select: this.syncOrtWindow |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
784
diff
changeset
|
41 }, |
777 | 42 'messprogrammform datetime textfield': { |
43 blur: this.checkDatePeriod | |
774 | 44 }, |
777 | 45 'messprogrammform [name="teilintervallVon"]': { |
757
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
46 change: this.synchronizeSlider, |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
47 blur: this.checkPeriod |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
48 }, |
777 | 49 'messprogrammform [name="teilintervallBis"]': { |
50 change: this.synchronizeSlider, | |
51 blur: this.checkPeriod | |
52 }, | |
818
097d4edc2f00
Genprobenwindow can only be created once, also fixed messprogrammortewindow 'close with x and can not reopen' bug
Dustin Demuth <dustin@intevation.de>
parents:
808
diff
changeset
|
53 'messprogrammform probenintervall combobox': { |
757
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
54 select: this.updateIntervalls |
784
f0b26df02157
Handle deskriptoren in messprogramm like in probe.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
777
diff
changeset
|
55 }, |
f0b26df02157
Handle deskriptoren in messprogramm like in probe.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
777
diff
changeset
|
56 'messprogrammform panel[xtype="deskriptor] combobox': { |
f0b26df02157
Handle deskriptoren in messprogramm like in probe.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
777
diff
changeset
|
57 select: this.deskriptorSelect |
757
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
58 } |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
59 }); |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
60 }, |
798
ff4330d4aba1
Filter Messtellen in Probeform and Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
797
diff
changeset
|
61 |
ff4330d4aba1
Filter Messtellen in Probeform and Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
797
diff
changeset
|
62 /** |
ff4330d4aba1
Filter Messtellen in Probeform and Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
797
diff
changeset
|
63 * The Messtellen Store contains ALL Messtellen. |
ff4330d4aba1
Filter Messtellen in Probeform and Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
797
diff
changeset
|
64 * Filter the store in this combobox to reduce the choices |
ff4330d4aba1
Filter Messtellen in Probeform and Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
797
diff
changeset
|
65 * to the subset which the user is allowed to use. |
ff4330d4aba1
Filter Messtellen in Probeform and Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
797
diff
changeset
|
66 */ |
ff4330d4aba1
Filter Messtellen in Probeform and Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
797
diff
changeset
|
67 filter: function(field) { |
ff4330d4aba1
Filter Messtellen in Probeform and Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
797
diff
changeset
|
68 var fil = Ext.create('Ext.util.Filter', { |
ff4330d4aba1
Filter Messtellen in Probeform and Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
797
diff
changeset
|
69 filterFn: function(item) { |
ff4330d4aba1
Filter Messtellen in Probeform and Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
797
diff
changeset
|
70 if (Ext.Array.contains(Lada.mst, item.get('id'))) { |
ff4330d4aba1
Filter Messtellen in Probeform and Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
797
diff
changeset
|
71 return true; |
ff4330d4aba1
Filter Messtellen in Probeform and Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
797
diff
changeset
|
72 } |
ff4330d4aba1
Filter Messtellen in Probeform and Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
797
diff
changeset
|
73 return false; |
ff4330d4aba1
Filter Messtellen in Probeform and Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
797
diff
changeset
|
74 } |
ff4330d4aba1
Filter Messtellen in Probeform and Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
797
diff
changeset
|
75 }); |
ff4330d4aba1
Filter Messtellen in Probeform and Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
797
diff
changeset
|
76 field.getStore().filter(fil); |
ff4330d4aba1
Filter Messtellen in Probeform and Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
797
diff
changeset
|
77 }, |
ff4330d4aba1
Filter Messtellen in Probeform and Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
797
diff
changeset
|
78 |
757
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
79 /** |
842
beef4e8eeafc
Added logic to autofill the Netzbetreiber when the Messstelle was selected.
Dustin Demuth <dustin@intevation.de>
parents:
818
diff
changeset
|
80 * When a Messtelle is selected, modify the Netzbetreiber |
beef4e8eeafc
Added logic to autofill the Netzbetreiber when the Messstelle was selected.
Dustin Demuth <dustin@intevation.de>
parents:
818
diff
changeset
|
81 * according to the Messstelle |
beef4e8eeafc
Added logic to autofill the Netzbetreiber when the Messstelle was selected.
Dustin Demuth <dustin@intevation.de>
parents:
818
diff
changeset
|
82 */ |
beef4e8eeafc
Added logic to autofill the Netzbetreiber when the Messstelle was selected.
Dustin Demuth <dustin@intevation.de>
parents:
818
diff
changeset
|
83 setNetzbetreiber: function(combo, records){ |
beef4e8eeafc
Added logic to autofill the Netzbetreiber when the Messstelle was selected.
Dustin Demuth <dustin@intevation.de>
parents:
818
diff
changeset
|
84 var netzbetreiber = combo.up().up('form') |
beef4e8eeafc
Added logic to autofill the Netzbetreiber when the Messstelle was selected.
Dustin Demuth <dustin@intevation.de>
parents:
818
diff
changeset
|
85 .down('netzbetreiber').down('combobox'); |
beef4e8eeafc
Added logic to autofill the Netzbetreiber when the Messstelle was selected.
Dustin Demuth <dustin@intevation.de>
parents:
818
diff
changeset
|
86 var nbId = records[0].get('netzbetreiberId'); |
beef4e8eeafc
Added logic to autofill the Netzbetreiber when the Messstelle was selected.
Dustin Demuth <dustin@intevation.de>
parents:
818
diff
changeset
|
87 |
846
af9d506b0700
always modify the netzbetreiber when the Messstelle was changed
Dustin Demuth <dustin@intevation.de>
parents:
843
diff
changeset
|
88 if (nbId != null) { |
842
beef4e8eeafc
Added logic to autofill the Netzbetreiber when the Messstelle was selected.
Dustin Demuth <dustin@intevation.de>
parents:
818
diff
changeset
|
89 //select the NB in the NB-Combobox |
beef4e8eeafc
Added logic to autofill the Netzbetreiber when the Messstelle was selected.
Dustin Demuth <dustin@intevation.de>
parents:
818
diff
changeset
|
90 netzbetreiber.select(nbId); |
beef4e8eeafc
Added logic to autofill the Netzbetreiber when the Messstelle was selected.
Dustin Demuth <dustin@intevation.de>
parents:
818
diff
changeset
|
91 } |
beef4e8eeafc
Added logic to autofill the Netzbetreiber when the Messstelle was selected.
Dustin Demuth <dustin@intevation.de>
parents:
818
diff
changeset
|
92 }, |
beef4e8eeafc
Added logic to autofill the Netzbetreiber when the Messstelle was selected.
Dustin Demuth <dustin@intevation.de>
parents:
818
diff
changeset
|
93 |
beef4e8eeafc
Added logic to autofill the Netzbetreiber when the Messstelle was selected.
Dustin Demuth <dustin@intevation.de>
parents:
818
diff
changeset
|
94 /** |
757
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
95 * When the Probenintervall was changed, update the Sliders |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
96 * and the the numberfield. |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
97 */ |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
98 updateIntervalls: function(field, records) { |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
99 var form = field.up('messprogrammform'); |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
100 var record = form.getRecord(); |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
101 form.populateIntervall(record, field.getValue()); |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
102 }, |
797
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
784
diff
changeset
|
103 /** |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
784
diff
changeset
|
104 * The function will open a new Window to edit the Ort of a Messprogramm |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
784
diff
changeset
|
105 */ |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
784
diff
changeset
|
106 editOrtWindow: function(button) { |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
784
diff
changeset
|
107 var formPanel = button.up('form'); |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
784
diff
changeset
|
108 //Only Open if the WIndow does not exist, else focus |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
784
diff
changeset
|
109 if (!formPanel.ortWindow) { |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
784
diff
changeset
|
110 var data = formPanel.getForm().getFieldValues(true); |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
784
diff
changeset
|
111 formPanel.ortWindow = Ext.create('Lada.view.window.MessprogrammOrt', { |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
784
diff
changeset
|
112 record: formPanel.getRecord(), |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
784
diff
changeset
|
113 parentWindow: formPanel.up('window') |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
784
diff
changeset
|
114 }); |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
784
diff
changeset
|
115 formPanel.ortWindow.show(); |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
784
diff
changeset
|
116 formPanel.ortWindow.initData(); |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
784
diff
changeset
|
117 } |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
784
diff
changeset
|
118 else { |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
784
diff
changeset
|
119 formPanel.ortWindow.focus(); |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
784
diff
changeset
|
120 formPanel.ortWindow.setActive(true); |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
784
diff
changeset
|
121 } |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
784
diff
changeset
|
122 }, |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
784
diff
changeset
|
123 |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
784
diff
changeset
|
124 /** |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
784
diff
changeset
|
125 * When a OrtWindow exist, and the value of the location combobox is changed, update the window. |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
784
diff
changeset
|
126 */ |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
784
diff
changeset
|
127 syncOrtWindow: function(combo, record){ |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
784
diff
changeset
|
128 var formPanel = combo.up('messprogrammform'); |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
784
diff
changeset
|
129 if (formPanel.ortWindow) { |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
784
diff
changeset
|
130 var ortwindowlocation = formPanel |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
784
diff
changeset
|
131 .ortWindow.down('location') |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
784
diff
changeset
|
132 var ortwindowcombo = ortwindowlocation |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
784
diff
changeset
|
133 .down('combobox'); |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
784
diff
changeset
|
134 |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
784
diff
changeset
|
135 ortwindowcombo.select(combo.getValue()); |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
784
diff
changeset
|
136 ortwindowlocation.fireEvent('select', |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
784
diff
changeset
|
137 ortwindowcombo, ortwindowcombo.record); |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
784
diff
changeset
|
138 } |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
784
diff
changeset
|
139 }, |
757
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
140 |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
141 /** |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
142 * When the Slider was used, |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
143 * update the Value of the Teilintervallfields |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
144 */ |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
145 synchronizeFields: function(slider, newValue, thumb) { |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
146 var formPanel = slider.up('form'); |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
147 if (thumb.index == 0) { |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
148 formPanel.getForm() |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
149 .findField('teilintervallVon') |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
150 .setValue(newValue); |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
151 } |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
152 else if (thumb.index == 1) { |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
153 formPanel.getForm() |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
154 .findField('teilintervallBis') |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
155 .setValue(newValue); |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
156 } |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
157 |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
158 }, |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
159 |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
160 /** |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
161 * When the IntervallFields were used, |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
162 * update the Slider |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
163 */ |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
164 synchronizeSlider: function(field, newValue, oldValue) { |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
165 var formPanel = field.up('form'); |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
166 if (field.name == 'teilintervallVon') { |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
167 formPanel.down('probenintervallslider') |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
168 .setValue(0, newValue, false); |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
169 } |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
170 else if (field.name == 'teilintervallBis') { |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
171 formPanel.down('probenintervallslider') |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
172 .setValue(1, newValue, false); |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
173 } |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
174 |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
175 }, |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
176 /** |
972
24b5684d74d7
Set letzteAenderung in a Bunch of controllers.
Dustin Demuth <dustin@intevation.de>
parents:
857
diff
changeset
|
177 * The save function saves the content of the Messprogramm form. |
757
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
178 * On success it will reload the Store, |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
179 * on failure, it will display an Errormessage |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
180 */ |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
181 save: function(button) { |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
182 var formPanel = button.up('form'); |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
183 var data = formPanel.getForm().getFieldValues(true); |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
184 for (var key in data) { |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
185 formPanel.getForm().getRecord().set(key, data[key]); |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
186 } |
972
24b5684d74d7
Set letzteAenderung in a Bunch of controllers.
Dustin Demuth <dustin@intevation.de>
parents:
857
diff
changeset
|
187 if (!formPanel.getForm().getRecord().get('letzteAenderung')) { |
24b5684d74d7
Set letzteAenderung in a Bunch of controllers.
Dustin Demuth <dustin@intevation.de>
parents:
857
diff
changeset
|
188 formPanel.getForm().getRecord().data.letzteAenderung = new Date(); |
24b5684d74d7
Set letzteAenderung in a Bunch of controllers.
Dustin Demuth <dustin@intevation.de>
parents:
857
diff
changeset
|
189 } |
757
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
190 formPanel.getForm().getRecord().save({ |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
191 success: function(record, response) { |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
192 var json = Ext.decode(response.response.responseText); |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
193 if (json) { |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
194 button.setDisabled(true); |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
195 button.up('toolbar').down('button[action=discard]') |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
196 .setDisabled(true); |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
197 formPanel.clearMessages(); |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
198 formPanel.setRecord(record); |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
199 formPanel.setMessages(json.errors, json.warnings); |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
200 if (response.action === 'create' && json.success) { |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
201 button.up('window').close(); |
759
b7484c7da2d4
Unified the Messprogramm windows. Unfortunately the Roweditor of Messmethodengrid is broken in this commit. This is due to the fact that the Mmt store is noit autoloaded anymore
Dustin Demuth <dustin@intevation.de>
parents:
757
diff
changeset
|
202 var win = Ext.create('Lada.view.window.Messprogramm', { |
757
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
203 record: record |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
204 }); |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
205 win.show(); |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
206 win.initData(); |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
207 } |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
208 } |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
209 }, |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
210 failure: function(record, response) { |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
211 button.setDisabled(true); |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
212 button.up('toolbar').down('button[action=discard]') |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
213 .setDisabled(true); |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
214 var rec = formPanel.getForm().getRecord(); |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
215 rec.dirty = false; |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
216 formPanel.getForm().loadRecord(record); |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
217 var json = response.request.scope.reader.jsonData; |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
218 if (json) { |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
219 if(json.errors.totalCount > 0 || json.warnings.totalCount > 0){ |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
220 formPanel.setMessages(json.errors, json.warnings); |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
221 } |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
222 |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
223 if(json.message){ |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
224 Ext.Msg.alert(Lada.getApplication().bundle.getMsg('err.msg.save.title') |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
225 +' #'+json.message, |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
226 Lada.getApplication().bundle.getMsg(json.message)); |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
227 } else { |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
228 Ext.Msg.alert(Lada.getApplication().bundle.getMsg('err.msg.save.title'), |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
229 Lada.getApplication().bundle.getMsg('err.msg.generic.body')); |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
230 } |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
231 formPanel.clearMessages(); |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
232 //formPanel.setRecord(record); |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
233 formPanel.setMessages(json.errors, json.warnings); |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
234 } else { |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
235 Ext.Msg.alert(Lada.getApplication().bundle.getMsg('err.msg.save.title'), |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
236 Lada.getApplication().bundle.getMsg('err.msg.response.body')); |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
237 } |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
238 |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
239 } |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
240 }); |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
241 }, |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
242 |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
243 /** |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
244 * The discard function resets the Location form |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
245 * to its original state. |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
246 */ |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
247 discard: function(button) { |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
248 var formPanel = button.up('form'); |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
249 formPanel.getForm().loadRecord(formPanel.getForm().getRecord()); |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
250 formPanel.getForm().owner.populateIntervall( |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
251 formPanel.getForm().getRecord()); |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
252 }, |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
253 |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
254 /** |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
255 * The dirtyForm function enables or disables the save and discard |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
256 * button which are present in the toolbar of the form. |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
257 * The Buttons are only active if the content of the form was altered |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
258 * (the form is dirty). |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
259 */ |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
260 dirtyForm: function(form, dirty) { |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
261 if (dirty) { |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
262 form.owner.down('button[action=save]').setDisabled(false); |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
263 form.owner.down('button[action=discard]').setDisabled(false); |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
264 } |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
265 else { |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
266 form.owner.down('button[action=save]').setDisabled(true); |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
267 form.owner.down('button[action=discard]').setDisabled(true); |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
268 } |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
269 }, |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
270 |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
271 /** |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
272 * checkPeriod() is called when a fields defining an intervall |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
273 * were modified |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
274 * The function validates if the start is smaller than end. |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
275 */ |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
276 checkPeriod: function(field) { |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
277 // This field might be a field within a Period. |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
278 // Search for Partner field (period: end/start) and validate |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
279 // End Before Start validation |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
280 if (field.period) { |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
281 var partners = new Array(); |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
282 partners[0] = field.up('fieldset').down('numberfield[period=start]').getValue() |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
283 partners[1] = field.up('fieldset').down('numberfield[period=end]').getValue() |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
284 if (partners[0] && partners[1] && partners[0] > partners [1]) { |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
285 var msg = Lada.getApplication().bundle.getMsg('662'); |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
286 field.up('fieldset').showWarningOrError(true, msg, false, ''); |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
287 } else { |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
288 field.up('fieldset').clearMessages(); |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
289 } |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
290 } |
777 | 291 }, |
292 | |
293 /** | |
294 * checkDatePeriod() is called when a fields defining an intervall | |
295 * were modified | |
296 * The function validates if the start is smaller than end. | |
297 * Same as checkPeriod but requires DATETIME fields | |
298 */ | |
299 checkDatePeriod: function(field) { | |
300 // This field might be a field within a Period. | |
301 // Search for Partner field (period: end/start) and validate | |
302 // End Before Start validation | |
303 if (field.period) { | |
304 var partners = new Array(); | |
305 partners[0] = field.up('fieldset') | |
306 .down('datetime[period=start]') | |
307 .down('textfield') | |
308 .getValue() | |
309 partners[1] = field.up('fieldset') | |
310 .down('datetime[period=end]') | |
311 .down('textfield') | |
312 .getValue() | |
313 if (partners[0] && partners[1] && partners[0] > partners [1]) { | |
314 var msg = Lada.getApplication().bundle.getMsg('662'); | |
315 field.up('fieldset').showWarningOrError(true, msg, false, ''); | |
316 } else { | |
317 field.up('fieldset').clearMessages(); | |
318 } | |
319 } | |
784
f0b26df02157
Handle deskriptoren in messprogramm like in probe.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
777
diff
changeset
|
320 }, |
f0b26df02157
Handle deskriptoren in messprogramm like in probe.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
777
diff
changeset
|
321 |
f0b26df02157
Handle deskriptoren in messprogramm like in probe.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
777
diff
changeset
|
322 deskriptorSelect: function(field, records) { |
f0b26df02157
Handle deskriptoren in messprogramm like in probe.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
777
diff
changeset
|
323 var desk = field.up('deskriptor'); |
f0b26df02157
Handle deskriptoren in messprogramm like in probe.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
777
diff
changeset
|
324 var media = field.up('messprogrammform').down('textfield[name="mediaDesk"]'); |
f0b26df02157
Handle deskriptoren in messprogramm like in probe.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
777
diff
changeset
|
325 var current = media.getValue().split(' '); |
1086
61cc583c3649
Messprogramm form redesign
Michael Stanko <mstanko@bfs.de>
parents:
1070
diff
changeset
|
326 |
1088
60af12dd4a13
Decreased descriptor string parts in Messprogramm.
Michael Stanko <mstanko@bfs.de>
parents:
1086
diff
changeset
|
327 if (current.length < 12) { |
784
f0b26df02157
Handle deskriptoren in messprogramm like in probe.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
777
diff
changeset
|
328 for (var i = 0; i <= 12; i++) { |
f0b26df02157
Handle deskriptoren in messprogramm like in probe.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
777
diff
changeset
|
329 if (i === 0) { |
f0b26df02157
Handle deskriptoren in messprogramm like in probe.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
777
diff
changeset
|
330 current.push('D:'); |
f0b26df02157
Handle deskriptoren in messprogramm like in probe.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
777
diff
changeset
|
331 } |
f0b26df02157
Handle deskriptoren in messprogramm like in probe.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
777
diff
changeset
|
332 else if (i === desk.layer + 1) { |
f0b26df02157
Handle deskriptoren in messprogramm like in probe.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
777
diff
changeset
|
333 var value; |
f0b26df02157
Handle deskriptoren in messprogramm like in probe.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
777
diff
changeset
|
334 if (records[0].get('sn') < 10) { |
f0b26df02157
Handle deskriptoren in messprogramm like in probe.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
777
diff
changeset
|
335 value = '0' + records[0].get('sn'); |
f0b26df02157
Handle deskriptoren in messprogramm like in probe.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
777
diff
changeset
|
336 } |
f0b26df02157
Handle deskriptoren in messprogramm like in probe.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
777
diff
changeset
|
337 else { |
f0b26df02157
Handle deskriptoren in messprogramm like in probe.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
777
diff
changeset
|
338 value = records[0].get('sn'); |
f0b26df02157
Handle deskriptoren in messprogramm like in probe.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
777
diff
changeset
|
339 } |
f0b26df02157
Handle deskriptoren in messprogramm like in probe.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
777
diff
changeset
|
340 current.push(value); |
f0b26df02157
Handle deskriptoren in messprogramm like in probe.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
777
diff
changeset
|
341 } |
f0b26df02157
Handle deskriptoren in messprogramm like in probe.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
777
diff
changeset
|
342 else { |
f0b26df02157
Handle deskriptoren in messprogramm like in probe.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
777
diff
changeset
|
343 current.push('00'); |
f0b26df02157
Handle deskriptoren in messprogramm like in probe.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
777
diff
changeset
|
344 } |
f0b26df02157
Handle deskriptoren in messprogramm like in probe.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
777
diff
changeset
|
345 } |
f0b26df02157
Handle deskriptoren in messprogramm like in probe.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
777
diff
changeset
|
346 } |
f0b26df02157
Handle deskriptoren in messprogramm like in probe.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
777
diff
changeset
|
347 else { |
f0b26df02157
Handle deskriptoren in messprogramm like in probe.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
777
diff
changeset
|
348 var value; |
f0b26df02157
Handle deskriptoren in messprogramm like in probe.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
777
diff
changeset
|
349 if (records[0].get('sn') < 10) { |
f0b26df02157
Handle deskriptoren in messprogramm like in probe.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
777
diff
changeset
|
350 value = '0' + records[0].get('sn'); |
f0b26df02157
Handle deskriptoren in messprogramm like in probe.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
777
diff
changeset
|
351 } |
f0b26df02157
Handle deskriptoren in messprogramm like in probe.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
777
diff
changeset
|
352 else { |
f0b26df02157
Handle deskriptoren in messprogramm like in probe.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
777
diff
changeset
|
353 value = records[0].get('sn'); |
f0b26df02157
Handle deskriptoren in messprogramm like in probe.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
777
diff
changeset
|
354 } |
f0b26df02157
Handle deskriptoren in messprogramm like in probe.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
777
diff
changeset
|
355 current[desk.layer + 1] = value; |
1086
61cc583c3649
Messprogramm form redesign
Michael Stanko <mstanko@bfs.de>
parents:
1070
diff
changeset
|
356 if (desk.layer < 2) { |
1088
60af12dd4a13
Decreased descriptor string parts in Messprogramm.
Michael Stanko <mstanko@bfs.de>
parents:
1086
diff
changeset
|
357 for (var i = desk.layer + 2; i < 12; i++) { |
1086
61cc583c3649
Messprogramm form redesign
Michael Stanko <mstanko@bfs.de>
parents:
1070
diff
changeset
|
358 current[i] = '00'; |
61cc583c3649
Messprogramm form redesign
Michael Stanko <mstanko@bfs.de>
parents:
1070
diff
changeset
|
359 } |
61cc583c3649
Messprogramm form redesign
Michael Stanko <mstanko@bfs.de>
parents:
1070
diff
changeset
|
360 this.clearChildDesk(desk); |
61cc583c3649
Messprogramm form redesign
Michael Stanko <mstanko@bfs.de>
parents:
1070
diff
changeset
|
361 } |
61cc583c3649
Messprogramm form redesign
Michael Stanko <mstanko@bfs.de>
parents:
1070
diff
changeset
|
362 else if (desk.layer === 2 && current[1] === '01') { |
61cc583c3649
Messprogramm form redesign
Michael Stanko <mstanko@bfs.de>
parents:
1070
diff
changeset
|
363 current[4] = '00'; |
61cc583c3649
Messprogramm form redesign
Michael Stanko <mstanko@bfs.de>
parents:
1070
diff
changeset
|
364 desk.up('fieldset').down('deskriptor[layer=3]').clearValue(); |
61cc583c3649
Messprogramm form redesign
Michael Stanko <mstanko@bfs.de>
parents:
1070
diff
changeset
|
365 } |
784
f0b26df02157
Handle deskriptoren in messprogramm like in probe.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
777
diff
changeset
|
366 } |
f0b26df02157
Handle deskriptoren in messprogramm like in probe.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
777
diff
changeset
|
367 media.setValue(current.join(' ').trim()); |
f0b26df02157
Handle deskriptoren in messprogramm like in probe.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
777
diff
changeset
|
368 }, |
f0b26df02157
Handle deskriptoren in messprogramm like in probe.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
777
diff
changeset
|
369 |
1086
61cc583c3649
Messprogramm form redesign
Michael Stanko <mstanko@bfs.de>
parents:
1070
diff
changeset
|
370 clearChildDesk: function(field) { |
784
f0b26df02157
Handle deskriptoren in messprogramm like in probe.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
777
diff
changeset
|
371 var allS = field.up('fieldset').items.items; |
f0b26df02157
Handle deskriptoren in messprogramm like in probe.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
777
diff
changeset
|
372 for (var i = field.layer + 1; i < 12; i++) { |
f0b26df02157
Handle deskriptoren in messprogramm like in probe.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
777
diff
changeset
|
373 allS[i].clearValue(); |
f0b26df02157
Handle deskriptoren in messprogramm like in probe.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
777
diff
changeset
|
374 } |
f0b26df02157
Handle deskriptoren in messprogramm like in probe.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
777
diff
changeset
|
375 } |
1086
61cc583c3649
Messprogramm form redesign
Michael Stanko <mstanko@bfs.de>
parents:
1070
diff
changeset
|
376 |
61cc583c3649
Messprogramm form redesign
Michael Stanko <mstanko@bfs.de>
parents:
1070
diff
changeset
|
377 |
784
f0b26df02157
Handle deskriptoren in messprogramm like in probe.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
777
diff
changeset
|
378 }); |