annotate app/controller/form/Messprogramm.js @ 797:b8fd43021c29

Added a Window to alter Orte of a Messprogramm
author Dustin Demuth <dustin@intevation.de>
date Wed, 20 May 2015 16:48:03 +0200
parents f0b26df02157
children ff4330d4aba1
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 /**
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
10 * A Controller for a Probe form
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 },
797
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents: 784
diff changeset
36 'messprogrammform location combobox': {
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents: 784
diff changeset
37 select: this.syncOrtWindow
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents: 784
diff changeset
38 },
777
5a153d36ed4e ClearMessages
Dustin Demuth <dustin@intevation.de>
parents: 775
diff changeset
39 'messprogrammform datetime textfield': {
5a153d36ed4e ClearMessages
Dustin Demuth <dustin@intevation.de>
parents: 775
diff changeset
40 blur: this.checkDatePeriod
774
afc9076db490 Added Offset field
Dustin Demuth <dustin@intevation.de>
parents: 759
diff changeset
41 },
777
5a153d36ed4e ClearMessages
Dustin Demuth <dustin@intevation.de>
parents: 775
diff changeset
42 'messprogrammform [name="teilintervallVon"]': {
757
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
43 change: this.synchronizeSlider,
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
44 blur: this.checkPeriod
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
45 },
777
5a153d36ed4e ClearMessages
Dustin Demuth <dustin@intevation.de>
parents: 775
diff changeset
46 'messprogrammform [name="teilintervallBis"]': {
5a153d36ed4e ClearMessages
Dustin Demuth <dustin@intevation.de>
parents: 775
diff changeset
47 change: this.synchronizeSlider,
5a153d36ed4e ClearMessages
Dustin Demuth <dustin@intevation.de>
parents: 775
diff changeset
48 blur: this.checkPeriod
5a153d36ed4e ClearMessages
Dustin Demuth <dustin@intevation.de>
parents: 775
diff changeset
49 },
5a153d36ed4e ClearMessages
Dustin Demuth <dustin@intevation.de>
parents: 775
diff changeset
50 'messprogrammform probenintervall combobox': {
757
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
51 select: this.updateIntervalls
784
f0b26df02157 Handle deskriptoren in messprogramm like in probe.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 777
diff changeset
52 },
f0b26df02157 Handle deskriptoren in messprogramm like in probe.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 777
diff changeset
53 'messprogrammform panel[xtype="deskriptor] combobox': {
f0b26df02157 Handle deskriptoren in messprogramm like in probe.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 777
diff changeset
54 select: this.deskriptorSelect
757
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
55 }
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
56 });
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
57 },
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 * When the Probenintervall was changed, update the Sliders
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
60 * and the the numberfield.
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
61 */
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
62 updateIntervalls: function(field, records) {
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
63 console.log('update Intervalls');
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
64 var form = field.up('messprogrammform');
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
65 var record = form.getRecord();
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
66 form.populateIntervall(record, field.getValue());
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
67 },
797
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents: 784
diff changeset
68 /**
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents: 784
diff changeset
69 * 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
70 */
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents: 784
diff changeset
71 editOrtWindow: function(button) {
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents: 784
diff changeset
72 var formPanel = button.up('form');
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents: 784
diff changeset
73 //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
74 if (!formPanel.ortWindow) {
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents: 784
diff changeset
75 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
76 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
77 record: formPanel.getRecord(),
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents: 784
diff changeset
78 parentWindow: formPanel.up('window')
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents: 784
diff changeset
79 });
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents: 784
diff changeset
80 formPanel.ortWindow.show();
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents: 784
diff changeset
81 formPanel.ortWindow.initData();
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents: 784
diff changeset
82 }
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents: 784
diff changeset
83 else {
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents: 784
diff changeset
84 formPanel.ortWindow.focus();
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents: 784
diff changeset
85 formPanel.ortWindow.setActive(true);
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents: 784
diff changeset
86 }
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents: 784
diff changeset
87 },
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents: 784
diff changeset
88
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents: 784
diff changeset
89 /**
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents: 784
diff changeset
90 * 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
91 */
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents: 784
diff changeset
92 syncOrtWindow: function(combo, record){
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents: 784
diff changeset
93 var formPanel = combo.up('messprogrammform');
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents: 784
diff changeset
94 if (formPanel.ortWindow) {
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents: 784
diff changeset
95 var ortwindowlocation = formPanel
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents: 784
diff changeset
96 .ortWindow.down('location')
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents: 784
diff changeset
97 var ortwindowcombo = ortwindowlocation
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents: 784
diff changeset
98 .down('combobox');
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents: 784
diff changeset
99
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents: 784
diff changeset
100 ortwindowcombo.select(combo.getValue());
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents: 784
diff changeset
101 ortwindowlocation.fireEvent('select',
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents: 784
diff changeset
102 ortwindowcombo, ortwindowcombo.record);
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 },
757
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
105
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
106 /**
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
107 * When the Slider was used,
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
108 * update the Value of the Teilintervallfields
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
109 */
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
110 synchronizeFields: function(slider, newValue, thumb) {
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
111 console.log('Synchronize Fields');
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
112 var formPanel = slider.up('form');
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
113 if (thumb.index == 0) {
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
114 formPanel.getForm()
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
115 .findField('teilintervallVon')
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
116 .setValue(newValue);
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
117 }
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
118 else if (thumb.index == 1) {
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
119 formPanel.getForm()
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
120 .findField('teilintervallBis')
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
121 .setValue(newValue);
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
122 }
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
123
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
124 },
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
125
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
126 /**
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
127 * When the IntervallFields were used,
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
128 * update the Slider
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
129 */
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
130 synchronizeSlider: function(field, newValue, oldValue) {
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
131 console.log('Synchronize Slider');
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
132 var formPanel = field.up('form');
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
133 if (field.name == 'teilintervallVon') {
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
134 formPanel.down('probenintervallslider')
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
135 .setValue(0, newValue, false);
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
136 }
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
137 else if (field.name == 'teilintervallBis') {
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
138 formPanel.down('probenintervallslider')
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
139 .setValue(1, newValue, false);
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 },
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
143 /**
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
144 * The save function saves the content of the Location form.
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
145 * On success it will reload the Store,
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
146 * on failure, it will display an Errormessage
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
147 */
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
148 save: function(button) {
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
149 var formPanel = button.up('form');
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
150 var data = formPanel.getForm().getFieldValues(true);
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
151 for (var key in data) {
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
152 formPanel.getForm().getRecord().set(key, data[key]);
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
153 }
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
154 formPanel.getForm().getRecord().save({
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
155 success: function(record, response) {
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
156 var json = Ext.decode(response.response.responseText);
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
157 if (json) {
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
158 button.setDisabled(true);
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
159 button.up('toolbar').down('button[action=discard]')
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
160 .setDisabled(true);
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
161 formPanel.clearMessages();
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
162 formPanel.setRecord(record);
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
163 formPanel.setMessages(json.errors, json.warnings);
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
164 if (response.action === 'create' && json.success) {
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
165 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
166 var win = Ext.create('Lada.view.window.Messprogramm', {
757
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
167 record: record
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
168 });
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
169 win.show();
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
170 win.initData();
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
171 }
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
172 }
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 failure: function(record, response) {
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
175 button.setDisabled(true);
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
176 button.up('toolbar').down('button[action=discard]')
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
177 .setDisabled(true);
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
178 var rec = formPanel.getForm().getRecord();
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
179 rec.dirty = false;
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
180 formPanel.getForm().loadRecord(record);
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
181 var json = response.request.scope.reader.jsonData;
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
182 if (json) {
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
183 if(json.errors.totalCount > 0 || json.warnings.totalCount > 0){
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
184 formPanel.setMessages(json.errors, json.warnings);
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
185 }
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
186
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
187 if(json.message){
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
188 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
189 +' #'+json.message,
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
190 Lada.getApplication().bundle.getMsg(json.message));
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
191 } else {
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
192 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
193 Lada.getApplication().bundle.getMsg('err.msg.generic.body'));
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
194 }
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
195 formPanel.clearMessages();
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
196 //formPanel.setRecord(record);
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
197 formPanel.setMessages(json.errors, json.warnings);
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
198 } else {
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
199 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
200 Lada.getApplication().bundle.getMsg('err.msg.response.body'));
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
201 }
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
202
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
203 }
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 },
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
206
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 * The discard function resets the Location form
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
209 * to its original state.
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
210 */
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
211 discard: function(button) {
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
212 var formPanel = button.up('form');
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
213 formPanel.getForm().loadRecord(formPanel.getForm().getRecord());
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
214 formPanel.getForm().owner.populateIntervall(
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
215 formPanel.getForm().getRecord());
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
216 },
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
217
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
218 /**
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
219 * The dirtyForm function enables or disables the save and discard
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
220 * button which are present in the toolbar of the form.
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
221 * 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
222 * (the form is dirty).
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
223 */
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
224 dirtyForm: function(form, dirty) {
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
225 if (dirty) {
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
226 form.owner.down('button[action=save]').setDisabled(false);
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
227 form.owner.down('button[action=discard]').setDisabled(false);
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
228 }
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
229 else {
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
230 form.owner.down('button[action=save]').setDisabled(true);
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
231 form.owner.down('button[action=discard]').setDisabled(true);
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
232 }
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
233 },
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
234
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
235 /**
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
236 * checkPeriod() is called when a fields defining an intervall
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
237 * were modified
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
238 * The function validates if the start is smaller than end.
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 checkPeriod: function(field) {
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
241 // This field might be a field within a Period.
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
242 // Search for Partner field (period: end/start) and validate
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
243 // End Before Start validation
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
244 if (field.period) {
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
245 var partners = new Array();
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
246 partners[0] = field.up('fieldset').down('numberfield[period=start]').getValue()
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
247 partners[1] = field.up('fieldset').down('numberfield[period=end]').getValue()
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
248 if (partners[0] && partners[1] && partners[0] > partners [1]) {
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
249 var msg = Lada.getApplication().bundle.getMsg('662');
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
250 field.up('fieldset').showWarningOrError(true, msg, false, '');
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
251 } else {
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
252 field.up('fieldset').clearMessages();
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 }
777
5a153d36ed4e ClearMessages
Dustin Demuth <dustin@intevation.de>
parents: 775
diff changeset
255 },
5a153d36ed4e ClearMessages
Dustin Demuth <dustin@intevation.de>
parents: 775
diff changeset
256
5a153d36ed4e ClearMessages
Dustin Demuth <dustin@intevation.de>
parents: 775
diff changeset
257 /**
5a153d36ed4e ClearMessages
Dustin Demuth <dustin@intevation.de>
parents: 775
diff changeset
258 * checkDatePeriod() is called when a fields defining an intervall
5a153d36ed4e ClearMessages
Dustin Demuth <dustin@intevation.de>
parents: 775
diff changeset
259 * were modified
5a153d36ed4e ClearMessages
Dustin Demuth <dustin@intevation.de>
parents: 775
diff changeset
260 * The function validates if the start is smaller than end.
5a153d36ed4e ClearMessages
Dustin Demuth <dustin@intevation.de>
parents: 775
diff changeset
261 * Same as checkPeriod but requires DATETIME fields
5a153d36ed4e ClearMessages
Dustin Demuth <dustin@intevation.de>
parents: 775
diff changeset
262 */
5a153d36ed4e ClearMessages
Dustin Demuth <dustin@intevation.de>
parents: 775
diff changeset
263 checkDatePeriod: function(field) {
5a153d36ed4e ClearMessages
Dustin Demuth <dustin@intevation.de>
parents: 775
diff changeset
264 // This field might be a field within a Period.
5a153d36ed4e ClearMessages
Dustin Demuth <dustin@intevation.de>
parents: 775
diff changeset
265 // Search for Partner field (period: end/start) and validate
5a153d36ed4e ClearMessages
Dustin Demuth <dustin@intevation.de>
parents: 775
diff changeset
266 // End Before Start validation
5a153d36ed4e ClearMessages
Dustin Demuth <dustin@intevation.de>
parents: 775
diff changeset
267 if (field.period) {
5a153d36ed4e ClearMessages
Dustin Demuth <dustin@intevation.de>
parents: 775
diff changeset
268 var partners = new Array();
5a153d36ed4e ClearMessages
Dustin Demuth <dustin@intevation.de>
parents: 775
diff changeset
269 partners[0] = field.up('fieldset')
5a153d36ed4e ClearMessages
Dustin Demuth <dustin@intevation.de>
parents: 775
diff changeset
270 .down('datetime[period=start]')
5a153d36ed4e ClearMessages
Dustin Demuth <dustin@intevation.de>
parents: 775
diff changeset
271 .down('textfield')
5a153d36ed4e ClearMessages
Dustin Demuth <dustin@intevation.de>
parents: 775
diff changeset
272 .getValue()
5a153d36ed4e ClearMessages
Dustin Demuth <dustin@intevation.de>
parents: 775
diff changeset
273 partners[1] = field.up('fieldset')
5a153d36ed4e ClearMessages
Dustin Demuth <dustin@intevation.de>
parents: 775
diff changeset
274 .down('datetime[period=end]')
5a153d36ed4e ClearMessages
Dustin Demuth <dustin@intevation.de>
parents: 775
diff changeset
275 .down('textfield')
5a153d36ed4e ClearMessages
Dustin Demuth <dustin@intevation.de>
parents: 775
diff changeset
276 .getValue()
5a153d36ed4e ClearMessages
Dustin Demuth <dustin@intevation.de>
parents: 775
diff changeset
277 if (partners[0] && partners[1] && partners[0] > partners [1]) {
5a153d36ed4e ClearMessages
Dustin Demuth <dustin@intevation.de>
parents: 775
diff changeset
278 var msg = Lada.getApplication().bundle.getMsg('662');
5a153d36ed4e ClearMessages
Dustin Demuth <dustin@intevation.de>
parents: 775
diff changeset
279 field.up('fieldset').showWarningOrError(true, msg, false, '');
5a153d36ed4e ClearMessages
Dustin Demuth <dustin@intevation.de>
parents: 775
diff changeset
280 } else {
5a153d36ed4e ClearMessages
Dustin Demuth <dustin@intevation.de>
parents: 775
diff changeset
281 field.up('fieldset').clearMessages();
5a153d36ed4e ClearMessages
Dustin Demuth <dustin@intevation.de>
parents: 775
diff changeset
282 }
5a153d36ed4e ClearMessages
Dustin Demuth <dustin@intevation.de>
parents: 775
diff changeset
283 }
784
f0b26df02157 Handle deskriptoren in messprogramm like in probe.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 777
diff changeset
284 },
f0b26df02157 Handle deskriptoren in messprogramm like in probe.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 777
diff changeset
285
f0b26df02157 Handle deskriptoren in messprogramm like in probe.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 777
diff changeset
286 deskriptorSelect: function(field, records) {
f0b26df02157 Handle deskriptoren in messprogramm like in probe.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 777
diff changeset
287 var desk = field.up('deskriptor');
f0b26df02157 Handle deskriptoren in messprogramm like in probe.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 777
diff changeset
288 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
289 var current = media.getValue().split(' ');
f0b26df02157 Handle deskriptoren in messprogramm like in probe.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 777
diff changeset
290 this.clearChildDesk(field.up('deskriptor'), current);
f0b26df02157 Handle deskriptoren in messprogramm like in probe.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 777
diff changeset
291 if (current.length < 13) {
f0b26df02157 Handle deskriptoren in messprogramm like in probe.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 777
diff changeset
292 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
293 if (i === 0) {
f0b26df02157 Handle deskriptoren in messprogramm like in probe.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 777
diff changeset
294 current.push('D:');
f0b26df02157 Handle deskriptoren in messprogramm like in probe.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 777
diff changeset
295 }
f0b26df02157 Handle deskriptoren in messprogramm like in probe.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 777
diff changeset
296 else if (i === desk.layer + 1) {
f0b26df02157 Handle deskriptoren in messprogramm like in probe.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 777
diff changeset
297 var value;
f0b26df02157 Handle deskriptoren in messprogramm like in probe.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 777
diff changeset
298 if (records[0].get('sn') < 10) {
f0b26df02157 Handle deskriptoren in messprogramm like in probe.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 777
diff changeset
299 value = '0' + records[0].get('sn');
f0b26df02157 Handle deskriptoren in messprogramm like in probe.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 777
diff changeset
300 }
f0b26df02157 Handle deskriptoren in messprogramm like in probe.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 777
diff changeset
301 else {
f0b26df02157 Handle deskriptoren in messprogramm like in probe.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 777
diff changeset
302 value = records[0].get('sn');
f0b26df02157 Handle deskriptoren in messprogramm like in probe.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 777
diff changeset
303 }
f0b26df02157 Handle deskriptoren in messprogramm like in probe.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 777
diff changeset
304 current.push(value);
f0b26df02157 Handle deskriptoren in messprogramm like in probe.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 777
diff changeset
305 }
f0b26df02157 Handle deskriptoren in messprogramm like in probe.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 777
diff changeset
306 else {
f0b26df02157 Handle deskriptoren in messprogramm like in probe.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 777
diff changeset
307 current.push('00');
f0b26df02157 Handle deskriptoren in messprogramm like in probe.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 777
diff changeset
308 }
f0b26df02157 Handle deskriptoren in messprogramm like in probe.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 777
diff changeset
309 }
f0b26df02157 Handle deskriptoren in messprogramm like in probe.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 777
diff changeset
310 }
f0b26df02157 Handle deskriptoren in messprogramm like in probe.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 777
diff changeset
311 else {
f0b26df02157 Handle deskriptoren in messprogramm like in probe.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 777
diff changeset
312 var value;
f0b26df02157 Handle deskriptoren in messprogramm like in probe.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 777
diff changeset
313 if (records[0].get('sn') < 10) {
f0b26df02157 Handle deskriptoren in messprogramm like in probe.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 777
diff changeset
314 value = '0' + records[0].get('sn');
f0b26df02157 Handle deskriptoren in messprogramm like in probe.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 777
diff changeset
315 }
f0b26df02157 Handle deskriptoren in messprogramm like in probe.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 777
diff changeset
316 else {
f0b26df02157 Handle deskriptoren in messprogramm like in probe.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 777
diff changeset
317 value = records[0].get('sn');
f0b26df02157 Handle deskriptoren in messprogramm like in probe.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 777
diff changeset
318 }
f0b26df02157 Handle deskriptoren in messprogramm like in probe.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 777
diff changeset
319 current[desk.layer + 1] = value;
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 media.setValue(current.join(' ').trim());
f0b26df02157 Handle deskriptoren in messprogramm like in probe.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 777
diff changeset
322 },
f0b26df02157 Handle deskriptoren in messprogramm like in probe.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 777
diff changeset
323
f0b26df02157 Handle deskriptoren in messprogramm like in probe.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 777
diff changeset
324 clearChildDesk: function(field, media) {
f0b26df02157 Handle deskriptoren in messprogramm like in probe.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 777
diff changeset
325 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
326 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
327 allS[i].clearValue();
f0b26df02157 Handle deskriptoren in messprogramm like in probe.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 777
diff changeset
328 media[i + 1] = '00';
f0b26df02157 Handle deskriptoren in messprogramm like in probe.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 777
diff changeset
329 }
f0b26df02157 Handle deskriptoren in messprogramm like in probe.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 777
diff changeset
330 }
f0b26df02157 Handle deskriptoren in messprogramm like in probe.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 777
diff changeset
331 });

http://lada.wald.intevation.org