annotate app/controller/form/Probe.js @ 1393:7cf7a8dc7818

Parse timestamp using a mapping table to identify date fields.
author Raimund Renkert <raimund.renkert@intevation.de>
date Wed, 08 Mar 2017 16:00:48 +0100
parents 7e9a6f0e55b3
children
rev   line source
587
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
1 /* Copyright (C) 2013 by Bundesamt fuer Strahlenschutz
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
2 * Software engineering by Intevation GmbH
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
3 *
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
4 * This file is Free Software under the GNU GPL (v>=3)
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
5 * and comes with ABSOLUTELY NO WARRANTY! Check out
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
6 * the documentation coming with IMIS-Labordaten-Application for details.
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
7 */
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
8
742
6e28ebbe1a73 added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents: 728
diff changeset
9 /**
6e28ebbe1a73 added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents: 728
diff changeset
10 * A Controller for a Probe form
6e28ebbe1a73 added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents: 728
diff changeset
11 */
587
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
12 Ext.define('Lada.controller.form.Probe', {
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
13 extend: 'Ext.app.Controller',
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
14
1386
7e9a6f0e55b3 Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1359
diff changeset
15 requires: [
7e9a6f0e55b3 Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1359
diff changeset
16 'Lada.view.window.AuditTrail'
7e9a6f0e55b3 Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1359
diff changeset
17 ],
7e9a6f0e55b3 Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1359
diff changeset
18
742
6e28ebbe1a73 added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents: 728
diff changeset
19 /**
6e28ebbe1a73 added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents: 728
diff changeset
20 * Initialize the Controller
6e28ebbe1a73 added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents: 728
diff changeset
21 * It has 4 listeners
6e28ebbe1a73 added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents: 728
diff changeset
22 */
587
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
23 init: function() {
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
24 this.control({
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
25 'probeform button[action=save]': {
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
26 click: this.save
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
27 },
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
28 'probeform button[action=discard]': {
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
29 click: this.discard
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
30 },
1386
7e9a6f0e55b3 Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1359
diff changeset
31 'probeform button[action=audit]': {
7e9a6f0e55b3 Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1359
diff changeset
32 click: this.showAuditTrail
7e9a6f0e55b3 Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1359
diff changeset
33 },
587
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
34 'probeform': {
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
35 dirtychange: this.dirtyForm
717
f124d24c8ade Datevalidation. When editing a timeperiod in a Probeform it is validated wheter begindate is before enddate. This only happens when the blur-event is fired. ToDo: Listen to Events from the Übernehmen Button of the DateTimePicker, ToDo: Somehow the ErrorMessages are not Cleared correctly when the form is restored.
Dustin Demuth <dustin@intevation.de>
parents: 701
diff changeset
36 },
1066
d198946e5540 Introduced laborMstId as new probe field.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 972
diff changeset
37 'probeform messstellelabor combobox': {
841
cf35c6305370 Added logic to autofill the Netzbetreiber when the Messstelle was selected.
Dustin Demuth <dustin@intevation.de>
parents: 829
diff changeset
38 select: this.setNetzbetreiber
798
ff4330d4aba1 Filter Messtellen in Probeform and Messprogramm
Dustin Demuth <dustin@intevation.de>
parents: 771
diff changeset
39 },
717
f124d24c8ade Datevalidation. When editing a timeperiod in a Probeform it is validated wheter begindate is before enddate. This only happens when the blur-event is fired. ToDo: Listen to Events from the Übernehmen Button of the DateTimePicker, ToDo: Somehow the ErrorMessages are not Cleared correctly when the form is restored.
Dustin Demuth <dustin@intevation.de>
parents: 701
diff changeset
40 'probeform [xtype="datetime"] field': {
f124d24c8ade Datevalidation. When editing a timeperiod in a Probeform it is validated wheter begindate is before enddate. This only happens when the blur-event is fired. ToDo: Listen to Events from the Übernehmen Button of the DateTimePicker, ToDo: Somehow the ErrorMessages are not Cleared correctly when the form is restored.
Dustin Demuth <dustin@intevation.de>
parents: 701
diff changeset
41 blur: this.checkDate
771
dd6925ef6028 Load, set and parse deskriptoren in probe form.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 743
diff changeset
42 },
dd6925ef6028 Load, set and parse deskriptoren in probe form.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 743
diff changeset
43 'probeform panel[xtype="deskriptor] combobox': {
dd6925ef6028 Load, set and parse deskriptoren in probe form.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 743
diff changeset
44 select: this.deskriptorSelect
587
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
45 }
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
46 });
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
47 },
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
48
742
6e28ebbe1a73 added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents: 728
diff changeset
49 /**
798
ff4330d4aba1 Filter Messtellen in Probeform and Messprogramm
Dustin Demuth <dustin@intevation.de>
parents: 771
diff changeset
50 * The Messtellen Store contains ALL Messtellen.
ff4330d4aba1 Filter Messtellen in Probeform and Messprogramm
Dustin Demuth <dustin@intevation.de>
parents: 771
diff changeset
51 * Filter the store in this combobox to reduce the choices
ff4330d4aba1 Filter Messtellen in Probeform and Messprogramm
Dustin Demuth <dustin@intevation.de>
parents: 771
diff changeset
52 * to the subset which the user is allowed to use.
967
50d7b6e17525 Filter the selectable Messtellen in the statusgrid
Dustin Demuth <dustin@intevation.de>
parents: 933
diff changeset
53 *
50d7b6e17525 Filter the selectable Messtellen in the statusgrid
Dustin Demuth <dustin@intevation.de>
parents: 933
diff changeset
54 * The app.js also creates a messstellenFiltered store,
50d7b6e17525 Filter the selectable Messtellen in the statusgrid
Dustin Demuth <dustin@intevation.de>
parents: 933
diff changeset
55 * which contains this selection. Maybe this can be used here in future
50d7b6e17525 Filter the selectable Messtellen in the statusgrid
Dustin Demuth <dustin@intevation.de>
parents: 933
diff changeset
56 * TODO
798
ff4330d4aba1 Filter Messtellen in Probeform and Messprogramm
Dustin Demuth <dustin@intevation.de>
parents: 771
diff changeset
57 */
ff4330d4aba1 Filter Messtellen in Probeform and Messprogramm
Dustin Demuth <dustin@intevation.de>
parents: 771
diff changeset
58 filter: function(field) {
ff4330d4aba1 Filter Messtellen in Probeform and Messprogramm
Dustin Demuth <dustin@intevation.de>
parents: 771
diff changeset
59 var fil = Ext.create('Ext.util.Filter', {
ff4330d4aba1 Filter Messtellen in Probeform and Messprogramm
Dustin Demuth <dustin@intevation.de>
parents: 771
diff changeset
60 filterFn: function(item) {
ff4330d4aba1 Filter Messtellen in Probeform and Messprogramm
Dustin Demuth <dustin@intevation.de>
parents: 771
diff changeset
61 if (Ext.Array.contains(Lada.mst, item.get('id'))) {
ff4330d4aba1 Filter Messtellen in Probeform and Messprogramm
Dustin Demuth <dustin@intevation.de>
parents: 771
diff changeset
62 return true;
ff4330d4aba1 Filter Messtellen in Probeform and Messprogramm
Dustin Demuth <dustin@intevation.de>
parents: 771
diff changeset
63 }
ff4330d4aba1 Filter Messtellen in Probeform and Messprogramm
Dustin Demuth <dustin@intevation.de>
parents: 771
diff changeset
64 return false;
ff4330d4aba1 Filter Messtellen in Probeform and Messprogramm
Dustin Demuth <dustin@intevation.de>
parents: 771
diff changeset
65 }
ff4330d4aba1 Filter Messtellen in Probeform and Messprogramm
Dustin Demuth <dustin@intevation.de>
parents: 771
diff changeset
66 });
ff4330d4aba1 Filter Messtellen in Probeform and Messprogramm
Dustin Demuth <dustin@intevation.de>
parents: 771
diff changeset
67 field.getStore().filter(fil);
ff4330d4aba1 Filter Messtellen in Probeform and Messprogramm
Dustin Demuth <dustin@intevation.de>
parents: 771
diff changeset
68 },
ff4330d4aba1 Filter Messtellen in Probeform and Messprogramm
Dustin Demuth <dustin@intevation.de>
parents: 771
diff changeset
69
ff4330d4aba1 Filter Messtellen in Probeform and Messprogramm
Dustin Demuth <dustin@intevation.de>
parents: 771
diff changeset
70 /**
841
cf35c6305370 Added logic to autofill the Netzbetreiber when the Messstelle was selected.
Dustin Demuth <dustin@intevation.de>
parents: 829
diff changeset
71 * When a Messtelle is selected, modify the Netzbetreiber
cf35c6305370 Added logic to autofill the Netzbetreiber when the Messstelle was selected.
Dustin Demuth <dustin@intevation.de>
parents: 829
diff changeset
72 * according to the Messstelle
cf35c6305370 Added logic to autofill the Netzbetreiber when the Messstelle was selected.
Dustin Demuth <dustin@intevation.de>
parents: 829
diff changeset
73 */
cf35c6305370 Added logic to autofill the Netzbetreiber when the Messstelle was selected.
Dustin Demuth <dustin@intevation.de>
parents: 829
diff changeset
74 setNetzbetreiber: function(combo, records){
cf35c6305370 Added logic to autofill the Netzbetreiber when the Messstelle was selected.
Dustin Demuth <dustin@intevation.de>
parents: 829
diff changeset
75 var netzbetreiber = combo.up().up('form')
cf35c6305370 Added logic to autofill the Netzbetreiber when the Messstelle was selected.
Dustin Demuth <dustin@intevation.de>
parents: 829
diff changeset
76 .down('netzbetreiber').down('combobox');
cf35c6305370 Added logic to autofill the Netzbetreiber when the Messstelle was selected.
Dustin Demuth <dustin@intevation.de>
parents: 829
diff changeset
77 var nbId = records[0].get('netzbetreiberId');
cf35c6305370 Added logic to autofill the Netzbetreiber when the Messstelle was selected.
Dustin Demuth <dustin@intevation.de>
parents: 829
diff changeset
78
846
af9d506b0700 always modify the netzbetreiber when the Messstelle was changed
Dustin Demuth <dustin@intevation.de>
parents: 843
diff changeset
79 if (nbId != null) {
841
cf35c6305370 Added logic to autofill the Netzbetreiber when the Messstelle was selected.
Dustin Demuth <dustin@intevation.de>
parents: 829
diff changeset
80 //select the NB in the NB-Combobox
cf35c6305370 Added logic to autofill the Netzbetreiber when the Messstelle was selected.
Dustin Demuth <dustin@intevation.de>
parents: 829
diff changeset
81 netzbetreiber.select(nbId);
cf35c6305370 Added logic to autofill the Netzbetreiber when the Messstelle was selected.
Dustin Demuth <dustin@intevation.de>
parents: 829
diff changeset
82 }
cf35c6305370 Added logic to autofill the Netzbetreiber when the Messstelle was selected.
Dustin Demuth <dustin@intevation.de>
parents: 829
diff changeset
83 },
cf35c6305370 Added logic to autofill the Netzbetreiber when the Messstelle was selected.
Dustin Demuth <dustin@intevation.de>
parents: 829
diff changeset
84
cf35c6305370 Added logic to autofill the Netzbetreiber when the Messstelle was selected.
Dustin Demuth <dustin@intevation.de>
parents: 829
diff changeset
85 /**
972
24b5684d74d7 Set letzteAenderung in a Bunch of controllers.
Dustin Demuth <dustin@intevation.de>
parents: 967
diff changeset
86 * The save function saves the content of the Messung form.
742
6e28ebbe1a73 added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents: 728
diff changeset
87 * On success it will reload the Store,
6e28ebbe1a73 added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents: 728
diff changeset
88 * on failure, it will display an Errormessage
6e28ebbe1a73 added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents: 728
diff changeset
89 */
587
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
90 save: function(button) {
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
91 var formPanel = button.up('form');
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
92 var data = formPanel.getForm().getFieldValues(true);
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
93 for (var key in data) {
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
94 formPanel.getForm().getRecord().set(key, data[key]);
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
95 }
972
24b5684d74d7 Set letzteAenderung in a Bunch of controllers.
Dustin Demuth <dustin@intevation.de>
parents: 967
diff changeset
96 if (!formPanel.getForm().getRecord().get('letzteAenderung')) {
24b5684d74d7 Set letzteAenderung in a Bunch of controllers.
Dustin Demuth <dustin@intevation.de>
parents: 967
diff changeset
97 formPanel.getForm().getRecord().data.letzteAenderung = new Date();
24b5684d74d7 Set letzteAenderung in a Bunch of controllers.
Dustin Demuth <dustin@intevation.de>
parents: 967
diff changeset
98 }
587
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
99 formPanel.getForm().getRecord().save({
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
100 success: function(record, response) {
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
101 var json = Ext.decode(response.response.responseText);
620
e0b966b32163 Open probe create window on button click.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 587
diff changeset
102 if (json) {
587
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
103 button.setDisabled(true);
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
104 button.up('toolbar').down('button[action=discard]')
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
105 .setDisabled(true);
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
106 formPanel.clearMessages();
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
107 formPanel.setRecord(record);
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
108 formPanel.setMessages(json.errors, json.warnings);
639
fdaabab6f4cc Open Probe-/Messung-Edit window automatically if a new item was saved
Raimund Renkert <raimund.renkert@intevation.de>
parents: 620
diff changeset
109 if (response.action === 'create' && json.success) {
fdaabab6f4cc Open Probe-/Messung-Edit window automatically if a new item was saved
Raimund Renkert <raimund.renkert@intevation.de>
parents: 620
diff changeset
110 button.up('window').close();
fdaabab6f4cc Open Probe-/Messung-Edit window automatically if a new item was saved
Raimund Renkert <raimund.renkert@intevation.de>
parents: 620
diff changeset
111 var win = Ext.create('Lada.view.window.ProbeEdit', {
fdaabab6f4cc Open Probe-/Messung-Edit window automatically if a new item was saved
Raimund Renkert <raimund.renkert@intevation.de>
parents: 620
diff changeset
112 record: record
fdaabab6f4cc Open Probe-/Messung-Edit window automatically if a new item was saved
Raimund Renkert <raimund.renkert@intevation.de>
parents: 620
diff changeset
113 });
fdaabab6f4cc Open Probe-/Messung-Edit window automatically if a new item was saved
Raimund Renkert <raimund.renkert@intevation.de>
parents: 620
diff changeset
114 win.show();
fdaabab6f4cc Open Probe-/Messung-Edit window automatically if a new item was saved
Raimund Renkert <raimund.renkert@intevation.de>
parents: 620
diff changeset
115 win.initData();
fdaabab6f4cc Open Probe-/Messung-Edit window automatically if a new item was saved
Raimund Renkert <raimund.renkert@intevation.de>
parents: 620
diff changeset
116 }
587
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
117 }
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
118 },
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
119 failure: function(record, response) {
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
120 button.setDisabled(true);
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
121 button.up('toolbar').down('button[action=discard]')
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
122 .setDisabled(true);
678
a24db43b13b5 Set record dirty flag to false if commit failed.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 639
diff changeset
123 var rec = formPanel.getForm().getRecord();
a24db43b13b5 Set record dirty flag to false if commit failed.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 639
diff changeset
124 rec.dirty = false;
728
aadb6e1f0a70 Load the record returned by the request.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 720
diff changeset
125 formPanel.getForm().loadRecord(record);
587
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
126 var json = response.request.scope.reader.jsonData;
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
127 if (json) {
693
817524db4017 Readonly was missing
Dustin Demuth <dustin@intevation.de>
parents: 686
diff changeset
128 if(json.message){
701
f0bc5387abcc Added failure - Messages
Dustin Demuth <dustin@intevation.de>
parents: 693
diff changeset
129 Ext.Msg.alert(Lada.getApplication().bundle.getMsg('err.msg.save.title')
f0bc5387abcc Added failure - Messages
Dustin Demuth <dustin@intevation.de>
parents: 693
diff changeset
130 +' #'+json.message,
693
817524db4017 Readonly was missing
Dustin Demuth <dustin@intevation.de>
parents: 686
diff changeset
131 Lada.getApplication().bundle.getMsg(json.message));
701
f0bc5387abcc Added failure - Messages
Dustin Demuth <dustin@intevation.de>
parents: 693
diff changeset
132 } else {
f0bc5387abcc Added failure - Messages
Dustin Demuth <dustin@intevation.de>
parents: 693
diff changeset
133 Ext.Msg.alert(Lada.getApplication().bundle.getMsg('err.msg.save.title'),
f0bc5387abcc Added failure - Messages
Dustin Demuth <dustin@intevation.de>
parents: 693
diff changeset
134 Lada.getApplication().bundle.getMsg('err.msg.generic.body'));
693
817524db4017 Readonly was missing
Dustin Demuth <dustin@intevation.de>
parents: 686
diff changeset
135 }
720
c2a6f7caa71b Fix for ErrorMessages in FieldSets for IE8 IE9
Dustin Demuth <dustin@intevation.de>
parents: 717
diff changeset
136 formPanel.clearMessages();
728
aadb6e1f0a70 Load the record returned by the request.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 720
diff changeset
137 //formPanel.setRecord(record);
720
c2a6f7caa71b Fix for ErrorMessages in FieldSets for IE8 IE9
Dustin Demuth <dustin@intevation.de>
parents: 717
diff changeset
138 formPanel.setMessages(json.errors, json.warnings);
701
f0bc5387abcc Added failure - Messages
Dustin Demuth <dustin@intevation.de>
parents: 693
diff changeset
139 } else {
f0bc5387abcc Added failure - Messages
Dustin Demuth <dustin@intevation.de>
parents: 693
diff changeset
140 Ext.Msg.alert(Lada.getApplication().bundle.getMsg('err.msg.save.title'),
f0bc5387abcc Added failure - Messages
Dustin Demuth <dustin@intevation.de>
parents: 693
diff changeset
141 Lada.getApplication().bundle.getMsg('err.msg.response.body'));
587
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
142 }
720
c2a6f7caa71b Fix for ErrorMessages in FieldSets for IE8 IE9
Dustin Demuth <dustin@intevation.de>
parents: 717
diff changeset
143
587
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
144 }
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
145 });
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
146 },
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
147
742
6e28ebbe1a73 added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents: 728
diff changeset
148 /**
816
e25fcc9269df Removed a Bug where Datetimepickler errormessages where not reset on Form Discard
Dustin Demuth <dustin@intevation.de>
parents: 798
diff changeset
149 * The discard function resets the Probe form
742
6e28ebbe1a73 added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents: 728
diff changeset
150 * to its original state.
6e28ebbe1a73 added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents: 728
diff changeset
151 */
587
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
152 discard: function(button) {
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
153 var formPanel = button.up('form');
816
e25fcc9269df Removed a Bug where Datetimepickler errormessages where not reset on Form Discard
Dustin Demuth <dustin@intevation.de>
parents: 798
diff changeset
154
e25fcc9269df Removed a Bug where Datetimepickler errormessages where not reset on Form Discard
Dustin Demuth <dustin@intevation.de>
parents: 798
diff changeset
155 formPanel.down('fset[name=entnahmePeriod]').clearMessages();
e25fcc9269df Removed a Bug where Datetimepickler errormessages where not reset on Form Discard
Dustin Demuth <dustin@intevation.de>
parents: 798
diff changeset
156 formPanel.down('fset[name=sollzeitPeriod]').clearMessages();
e25fcc9269df Removed a Bug where Datetimepickler errormessages where not reset on Form Discard
Dustin Demuth <dustin@intevation.de>
parents: 798
diff changeset
157 formPanel.down('datetime[name=probeentnahmeBeginn]').clearWarningOrError();
e25fcc9269df Removed a Bug where Datetimepickler errormessages where not reset on Form Discard
Dustin Demuth <dustin@intevation.de>
parents: 798
diff changeset
158 formPanel.down('datetime[name=probeentnahmeEnde]').clearWarningOrError();
e25fcc9269df Removed a Bug where Datetimepickler errormessages where not reset on Form Discard
Dustin Demuth <dustin@intevation.de>
parents: 798
diff changeset
159
741
a76638970d50 Clear filter on umwelt combox store.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 728
diff changeset
160 formPanel.down('umwelt').store.clearFilter();
1066
d198946e5540 Introduced laborMstId as new probe field.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 972
diff changeset
161 formPanel.setRecord(formPanel.getForm().getRecord());
587
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
162 },
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
163
742
6e28ebbe1a73 added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents: 728
diff changeset
164 /**
6e28ebbe1a73 added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents: 728
diff changeset
165 * The dirtyForm function enables or disables the save and discard
6e28ebbe1a73 added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents: 728
diff changeset
166 * button which are present in the toolbar of the form.
6e28ebbe1a73 added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents: 728
diff changeset
167 * The Buttons are only active if the content of the form was altered
6e28ebbe1a73 added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents: 728
diff changeset
168 * (the form is dirty).
6e28ebbe1a73 added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents: 728
diff changeset
169 * In Additon it calls the disableChildren() function of the window
6e28ebbe1a73 added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents: 728
diff changeset
170 * embedding the form. Likewise it calls the embedding windows
6e28ebbe1a73 added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents: 728
diff changeset
171 * enableChilren() function
6e28ebbe1a73 added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents: 728
diff changeset
172 */
587
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
173 dirtyForm: function(form, dirty) {
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
174 if (dirty) {
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
175 form.owner.down('button[action=save]').setDisabled(false);
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
176 form.owner.down('button[action=discard]').setDisabled(false);
686
14ac75f80ba1 Forgot to commit the controller for commit 684
Dustin Demuth <dustin@intevation.de>
parents: 678
diff changeset
177 form.owner.up('window').disableChildren();
587
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
178 }
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
179 else {
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
180 form.owner.down('button[action=save]').setDisabled(true);
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
181 form.owner.down('button[action=discard]').setDisabled(true);
686
14ac75f80ba1 Forgot to commit the controller for commit 684
Dustin Demuth <dustin@intevation.de>
parents: 678
diff changeset
182 form.owner.up('window').enableChildren(); // todo this might not be true in all cases
587
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
183 }
717
f124d24c8ade Datevalidation. When editing a timeperiod in a Probeform it is validated wheter begindate is before enddate. This only happens when the blur-event is fired. ToDo: Listen to Events from the Übernehmen Button of the DateTimePicker, ToDo: Somehow the ErrorMessages are not Cleared correctly when the form is restored.
Dustin Demuth <dustin@intevation.de>
parents: 701
diff changeset
184 },
f124d24c8ade Datevalidation. When editing a timeperiod in a Probeform it is validated wheter begindate is before enddate. This only happens when the blur-event is fired. ToDo: Listen to Events from the Übernehmen Button of the DateTimePicker, ToDo: Somehow the ErrorMessages are not Cleared correctly when the form is restored.
Dustin Demuth <dustin@intevation.de>
parents: 701
diff changeset
185
742
6e28ebbe1a73 added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents: 728
diff changeset
186 /**
6e28ebbe1a73 added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents: 728
diff changeset
187 * checkDate() is called when a xtype=datetime field was modified
6e28ebbe1a73 added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents: 728
diff changeset
188 * It checks for two things:
6e28ebbe1a73 added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents: 728
diff changeset
189 * - Is the date in the future
6e28ebbe1a73 added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents: 728
diff changeset
190 * - Does the date belong to a time period and the end is before start
6e28ebbe1a73 added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents: 728
diff changeset
191 * In both cases it adds a warning to the field which was checked.
6e28ebbe1a73 added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents: 728
diff changeset
192 */
717
f124d24c8ade Datevalidation. When editing a timeperiod in a Probeform it is validated wheter begindate is before enddate. This only happens when the blur-event is fired. ToDo: Listen to Events from the Übernehmen Button of the DateTimePicker, ToDo: Somehow the ErrorMessages are not Cleared correctly when the form is restored.
Dustin Demuth <dustin@intevation.de>
parents: 701
diff changeset
193 checkDate: function(field) {
f124d24c8ade Datevalidation. When editing a timeperiod in a Probeform it is validated wheter begindate is before enddate. This only happens when the blur-event is fired. ToDo: Listen to Events from the Übernehmen Button of the DateTimePicker, ToDo: Somehow the ErrorMessages are not Cleared correctly when the form is restored.
Dustin Demuth <dustin@intevation.de>
parents: 701
diff changeset
194 var now = Date.now();
f124d24c8ade Datevalidation. When editing a timeperiod in a Probeform it is validated wheter begindate is before enddate. This only happens when the blur-event is fired. ToDo: Listen to Events from the Übernehmen Button of the DateTimePicker, ToDo: Somehow the ErrorMessages are not Cleared correctly when the form is restored.
Dustin Demuth <dustin@intevation.de>
parents: 701
diff changeset
195 var w = 0 //amount of warnings
f124d24c8ade Datevalidation. When editing a timeperiod in a Probeform it is validated wheter begindate is before enddate. This only happens when the blur-event is fired. ToDo: Listen to Events from the Übernehmen Button of the DateTimePicker, ToDo: Somehow the ErrorMessages are not Cleared correctly when the form is restored.
Dustin Demuth <dustin@intevation.de>
parents: 701
diff changeset
196 var e = 0 //errors
f124d24c8ade Datevalidation. When editing a timeperiod in a Probeform it is validated wheter begindate is before enddate. This only happens when the blur-event is fired. ToDo: Listen to Events from the Übernehmen Button of the DateTimePicker, ToDo: Somehow the ErrorMessages are not Cleared correctly when the form is restored.
Dustin Demuth <dustin@intevation.de>
parents: 701
diff changeset
197 var emsg = '';
f124d24c8ade Datevalidation. When editing a timeperiod in a Probeform it is validated wheter begindate is before enddate. This only happens when the blur-event is fired. ToDo: Listen to Events from the Übernehmen Button of the DateTimePicker, ToDo: Somehow the ErrorMessages are not Cleared correctly when the form is restored.
Dustin Demuth <dustin@intevation.de>
parents: 701
diff changeset
198 var wmsg = '';
f124d24c8ade Datevalidation. When editing a timeperiod in a Probeform it is validated wheter begindate is before enddate. This only happens when the blur-event is fired. ToDo: Listen to Events from the Übernehmen Button of the DateTimePicker, ToDo: Somehow the ErrorMessages are not Cleared correctly when the form is restored.
Dustin Demuth <dustin@intevation.de>
parents: 701
diff changeset
199
f124d24c8ade Datevalidation. When editing a timeperiod in a Probeform it is validated wheter begindate is before enddate. This only happens when the blur-event is fired. ToDo: Listen to Events from the Übernehmen Button of the DateTimePicker, ToDo: Somehow the ErrorMessages are not Cleared correctly when the form is restored.
Dustin Demuth <dustin@intevation.de>
parents: 701
diff changeset
200 if (field.getValue() > now){
f124d24c8ade Datevalidation. When editing a timeperiod in a Probeform it is validated wheter begindate is before enddate. This only happens when the blur-event is fired. ToDo: Listen to Events from the Übernehmen Button of the DateTimePicker, ToDo: Somehow the ErrorMessages are not Cleared correctly when the form is restored.
Dustin Demuth <dustin@intevation.de>
parents: 701
diff changeset
201 wmsg += Lada.getApplication().bundle.getMsg('661');
f124d24c8ade Datevalidation. When editing a timeperiod in a Probeform it is validated wheter begindate is before enddate. This only happens when the blur-event is fired. ToDo: Listen to Events from the Übernehmen Button of the DateTimePicker, ToDo: Somehow the ErrorMessages are not Cleared correctly when the form is restored.
Dustin Demuth <dustin@intevation.de>
parents: 701
diff changeset
202 w++;
f124d24c8ade Datevalidation. When editing a timeperiod in a Probeform it is validated wheter begindate is before enddate. This only happens when the blur-event is fired. ToDo: Listen to Events from the Übernehmen Button of the DateTimePicker, ToDo: Somehow the ErrorMessages are not Cleared correctly when the form is restored.
Dustin Demuth <dustin@intevation.de>
parents: 701
diff changeset
203 }
f124d24c8ade Datevalidation. When editing a timeperiod in a Probeform it is validated wheter begindate is before enddate. This only happens when the blur-event is fired. ToDo: Listen to Events from the Übernehmen Button of the DateTimePicker, ToDo: Somehow the ErrorMessages are not Cleared correctly when the form is restored.
Dustin Demuth <dustin@intevation.de>
parents: 701
diff changeset
204 // This field might be a field within a DateTime-Period.
f124d24c8ade Datevalidation. When editing a timeperiod in a Probeform it is validated wheter begindate is before enddate. This only happens when the blur-event is fired. ToDo: Listen to Events from the Übernehmen Button of the DateTimePicker, ToDo: Somehow the ErrorMessages are not Cleared correctly when the form is restored.
Dustin Demuth <dustin@intevation.de>
parents: 701
diff changeset
205 // Search for Partner field (period: end/start) and validate
f124d24c8ade Datevalidation. When editing a timeperiod in a Probeform it is validated wheter begindate is before enddate. This only happens when the blur-event is fired. ToDo: Listen to Events from the Übernehmen Button of the DateTimePicker, ToDo: Somehow the ErrorMessages are not Cleared correctly when the form is restored.
Dustin Demuth <dustin@intevation.de>
parents: 701
diff changeset
206 // End Before Start validation
f124d24c8ade Datevalidation. When editing a timeperiod in a Probeform it is validated wheter begindate is before enddate. This only happens when the blur-event is fired. ToDo: Listen to Events from the Übernehmen Button of the DateTimePicker, ToDo: Somehow the ErrorMessages are not Cleared correctly when the form is restored.
Dustin Demuth <dustin@intevation.de>
parents: 701
diff changeset
207 if (field.period) {
f124d24c8ade Datevalidation. When editing a timeperiod in a Probeform it is validated wheter begindate is before enddate. This only happens when the blur-event is fired. ToDo: Listen to Events from the Übernehmen Button of the DateTimePicker, ToDo: Somehow the ErrorMessages are not Cleared correctly when the form is restored.
Dustin Demuth <dustin@intevation.de>
parents: 701
diff changeset
208 var partners = new Array();
f124d24c8ade Datevalidation. When editing a timeperiod in a Probeform it is validated wheter begindate is before enddate. This only happens when the blur-event is fired. ToDo: Listen to Events from the Übernehmen Button of the DateTimePicker, ToDo: Somehow the ErrorMessages are not Cleared correctly when the form is restored.
Dustin Demuth <dustin@intevation.de>
parents: 701
diff changeset
209 partners[0] = field.up('fieldset').down('datetime[period=start]').down().getValue()
f124d24c8ade Datevalidation. When editing a timeperiod in a Probeform it is validated wheter begindate is before enddate. This only happens when the blur-event is fired. ToDo: Listen to Events from the Übernehmen Button of the DateTimePicker, ToDo: Somehow the ErrorMessages are not Cleared correctly when the form is restored.
Dustin Demuth <dustin@intevation.de>
parents: 701
diff changeset
210 partners[1] = field.up('fieldset').down('datetime[period=end]').down().getValue()
f124d24c8ade Datevalidation. When editing a timeperiod in a Probeform it is validated wheter begindate is before enddate. This only happens when the blur-event is fired. ToDo: Listen to Events from the Übernehmen Button of the DateTimePicker, ToDo: Somehow the ErrorMessages are not Cleared correctly when the form is restored.
Dustin Demuth <dustin@intevation.de>
parents: 701
diff changeset
211 if (partners[0] && partners[1] && partners[0] > partners [1]) {
f124d24c8ade Datevalidation. When editing a timeperiod in a Probeform it is validated wheter begindate is before enddate. This only happens when the blur-event is fired. ToDo: Listen to Events from the Übernehmen Button of the DateTimePicker, ToDo: Somehow the ErrorMessages are not Cleared correctly when the form is restored.
Dustin Demuth <dustin@intevation.de>
parents: 701
diff changeset
212 var msg = Lada.getApplication().bundle.getMsg('662');
f124d24c8ade Datevalidation. When editing a timeperiod in a Probeform it is validated wheter begindate is before enddate. This only happens when the blur-event is fired. ToDo: Listen to Events from the Übernehmen Button of the DateTimePicker, ToDo: Somehow the ErrorMessages are not Cleared correctly when the form is restored.
Dustin Demuth <dustin@intevation.de>
parents: 701
diff changeset
213 field.up('fieldset').showWarningOrError(true, msg, false, '');
f124d24c8ade Datevalidation. When editing a timeperiod in a Probeform it is validated wheter begindate is before enddate. This only happens when the blur-event is fired. ToDo: Listen to Events from the Übernehmen Button of the DateTimePicker, ToDo: Somehow the ErrorMessages are not Cleared correctly when the form is restored.
Dustin Demuth <dustin@intevation.de>
parents: 701
diff changeset
214 } else {
f124d24c8ade Datevalidation. When editing a timeperiod in a Probeform it is validated wheter begindate is before enddate. This only happens when the blur-event is fired. ToDo: Listen to Events from the Übernehmen Button of the DateTimePicker, ToDo: Somehow the ErrorMessages are not Cleared correctly when the form is restored.
Dustin Demuth <dustin@intevation.de>
parents: 701
diff changeset
215 field.up('fieldset').clearMessages();
f124d24c8ade Datevalidation. When editing a timeperiod in a Probeform it is validated wheter begindate is before enddate. This only happens when the blur-event is fired. ToDo: Listen to Events from the Übernehmen Button of the DateTimePicker, ToDo: Somehow the ErrorMessages are not Cleared correctly when the form is restored.
Dustin Demuth <dustin@intevation.de>
parents: 701
diff changeset
216 }
f124d24c8ade Datevalidation. When editing a timeperiod in a Probeform it is validated wheter begindate is before enddate. This only happens when the blur-event is fired. ToDo: Listen to Events from the Übernehmen Button of the DateTimePicker, ToDo: Somehow the ErrorMessages are not Cleared correctly when the form is restored.
Dustin Demuth <dustin@intevation.de>
parents: 701
diff changeset
217 }
f124d24c8ade Datevalidation. When editing a timeperiod in a Probeform it is validated wheter begindate is before enddate. This only happens when the blur-event is fired. ToDo: Listen to Events from the Übernehmen Button of the DateTimePicker, ToDo: Somehow the ErrorMessages are not Cleared correctly when the form is restored.
Dustin Demuth <dustin@intevation.de>
parents: 701
diff changeset
218
f124d24c8ade Datevalidation. When editing a timeperiod in a Probeform it is validated wheter begindate is before enddate. This only happens when the blur-event is fired. ToDo: Listen to Events from the Übernehmen Button of the DateTimePicker, ToDo: Somehow the ErrorMessages are not Cleared correctly when the form is restored.
Dustin Demuth <dustin@intevation.de>
parents: 701
diff changeset
219 if (w) {
f124d24c8ade Datevalidation. When editing a timeperiod in a Probeform it is validated wheter begindate is before enddate. This only happens when the blur-event is fired. ToDo: Listen to Events from the Übernehmen Button of the DateTimePicker, ToDo: Somehow the ErrorMessages are not Cleared correctly when the form is restored.
Dustin Demuth <dustin@intevation.de>
parents: 701
diff changeset
220 field.up().showWarnings(wmsg);
f124d24c8ade Datevalidation. When editing a timeperiod in a Probeform it is validated wheter begindate is before enddate. This only happens when the blur-event is fired. ToDo: Listen to Events from the Übernehmen Button of the DateTimePicker, ToDo: Somehow the ErrorMessages are not Cleared correctly when the form is restored.
Dustin Demuth <dustin@intevation.de>
parents: 701
diff changeset
221 }
f124d24c8ade Datevalidation. When editing a timeperiod in a Probeform it is validated wheter begindate is before enddate. This only happens when the blur-event is fired. ToDo: Listen to Events from the Übernehmen Button of the DateTimePicker, ToDo: Somehow the ErrorMessages are not Cleared correctly when the form is restored.
Dustin Demuth <dustin@intevation.de>
parents: 701
diff changeset
222 if (e) {
f124d24c8ade Datevalidation. When editing a timeperiod in a Probeform it is validated wheter begindate is before enddate. This only happens when the blur-event is fired. ToDo: Listen to Events from the Übernehmen Button of the DateTimePicker, ToDo: Somehow the ErrorMessages are not Cleared correctly when the form is restored.
Dustin Demuth <dustin@intevation.de>
parents: 701
diff changeset
223 field.up().showErrors(emsg);
f124d24c8ade Datevalidation. When editing a timeperiod in a Probeform it is validated wheter begindate is before enddate. This only happens when the blur-event is fired. ToDo: Listen to Events from the Übernehmen Button of the DateTimePicker, ToDo: Somehow the ErrorMessages are not Cleared correctly when the form is restored.
Dustin Demuth <dustin@intevation.de>
parents: 701
diff changeset
224 }
f124d24c8ade Datevalidation. When editing a timeperiod in a Probeform it is validated wheter begindate is before enddate. This only happens when the blur-event is fired. ToDo: Listen to Events from the Übernehmen Button of the DateTimePicker, ToDo: Somehow the ErrorMessages are not Cleared correctly when the form is restored.
Dustin Demuth <dustin@intevation.de>
parents: 701
diff changeset
225
f124d24c8ade Datevalidation. When editing a timeperiod in a Probeform it is validated wheter begindate is before enddate. This only happens when the blur-event is fired. ToDo: Listen to Events from the Übernehmen Button of the DateTimePicker, ToDo: Somehow the ErrorMessages are not Cleared correctly when the form is restored.
Dustin Demuth <dustin@intevation.de>
parents: 701
diff changeset
226 // Clear Warnings or Errors if none Are Present
f124d24c8ade Datevalidation. When editing a timeperiod in a Probeform it is validated wheter begindate is before enddate. This only happens when the blur-event is fired. ToDo: Listen to Events from the Übernehmen Button of the DateTimePicker, ToDo: Somehow the ErrorMessages are not Cleared correctly when the form is restored.
Dustin Demuth <dustin@intevation.de>
parents: 701
diff changeset
227 if (w == 0 && e == 0) {
f124d24c8ade Datevalidation. When editing a timeperiod in a Probeform it is validated wheter begindate is before enddate. This only happens when the blur-event is fired. ToDo: Listen to Events from the Übernehmen Button of the DateTimePicker, ToDo: Somehow the ErrorMessages are not Cleared correctly when the form is restored.
Dustin Demuth <dustin@intevation.de>
parents: 701
diff changeset
228 field.up().clearWarningOrError();
f124d24c8ade Datevalidation. When editing a timeperiod in a Probeform it is validated wheter begindate is before enddate. This only happens when the blur-event is fired. ToDo: Listen to Events from the Übernehmen Button of the DateTimePicker, ToDo: Somehow the ErrorMessages are not Cleared correctly when the form is restored.
Dustin Demuth <dustin@intevation.de>
parents: 701
diff changeset
229 }
771
dd6925ef6028 Load, set and parse deskriptoren in probe form.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 743
diff changeset
230 },
dd6925ef6028 Load, set and parse deskriptoren in probe form.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 743
diff changeset
231
dd6925ef6028 Load, set and parse deskriptoren in probe form.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 743
diff changeset
232 deskriptorSelect: function(field, records) {
dd6925ef6028 Load, set and parse deskriptoren in probe form.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 743
diff changeset
233 var desk = field.up('deskriptor');
dd6925ef6028 Load, set and parse deskriptoren in probe form.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 743
diff changeset
234 var media = field.up('probeform').down('textfield[name="mediaDesk"]');
dd6925ef6028 Load, set and parse deskriptoren in probe form.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 743
diff changeset
235 var current = media.getValue().split(' ');
1283
9d298c82575f Check correct length in deskriptor string.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1281
diff changeset
236 if (current.length < 12) {
1276
8f37f8832c4a fix mediadescription in probe form
Michael Stanko <mstanko@bfs.de>
parents: 1085
diff changeset
237 var value;
1281
8012e5212bd5 Fixed initial length of deskriptor string.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1276
diff changeset
238 for (var i = 0; i < 13; i++) {
771
dd6925ef6028 Load, set and parse deskriptoren in probe form.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 743
diff changeset
239 if (i === 0) {
dd6925ef6028 Load, set and parse deskriptoren in probe form.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 743
diff changeset
240 current.push('D:');
dd6925ef6028 Load, set and parse deskriptoren in probe form.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 743
diff changeset
241 }
dd6925ef6028 Load, set and parse deskriptoren in probe form.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 743
diff changeset
242 else if (i === desk.layer + 1) {
dd6925ef6028 Load, set and parse deskriptoren in probe form.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 743
diff changeset
243 var value;
dd6925ef6028 Load, set and parse deskriptoren in probe form.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 743
diff changeset
244 if (records[0].get('sn') < 10) {
dd6925ef6028 Load, set and parse deskriptoren in probe form.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 743
diff changeset
245 value = '0' + records[0].get('sn');
dd6925ef6028 Load, set and parse deskriptoren in probe form.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 743
diff changeset
246 }
dd6925ef6028 Load, set and parse deskriptoren in probe form.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 743
diff changeset
247 else {
dd6925ef6028 Load, set and parse deskriptoren in probe form.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 743
diff changeset
248 value = records[0].get('sn');
dd6925ef6028 Load, set and parse deskriptoren in probe form.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 743
diff changeset
249 }
dd6925ef6028 Load, set and parse deskriptoren in probe form.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 743
diff changeset
250 current.push(value);
dd6925ef6028 Load, set and parse deskriptoren in probe form.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 743
diff changeset
251 }
dd6925ef6028 Load, set and parse deskriptoren in probe form.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 743
diff changeset
252 else {
dd6925ef6028 Load, set and parse deskriptoren in probe form.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 743
diff changeset
253 current.push('00');
dd6925ef6028 Load, set and parse deskriptoren in probe form.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 743
diff changeset
254 }
dd6925ef6028 Load, set and parse deskriptoren in probe form.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 743
diff changeset
255 }
dd6925ef6028 Load, set and parse deskriptoren in probe form.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 743
diff changeset
256 }
dd6925ef6028 Load, set and parse deskriptoren in probe form.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 743
diff changeset
257 else {
dd6925ef6028 Load, set and parse deskriptoren in probe form.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 743
diff changeset
258 var value;
dd6925ef6028 Load, set and parse deskriptoren in probe form.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 743
diff changeset
259 if (records[0].get('sn') < 10) {
dd6925ef6028 Load, set and parse deskriptoren in probe form.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 743
diff changeset
260 value = '0' + records[0].get('sn');
dd6925ef6028 Load, set and parse deskriptoren in probe form.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 743
diff changeset
261 }
dd6925ef6028 Load, set and parse deskriptoren in probe form.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 743
diff changeset
262 else {
dd6925ef6028 Load, set and parse deskriptoren in probe form.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 743
diff changeset
263 value = records[0].get('sn');
dd6925ef6028 Load, set and parse deskriptoren in probe form.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 743
diff changeset
264 }
dd6925ef6028 Load, set and parse deskriptoren in probe form.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 743
diff changeset
265 current[desk.layer + 1] = value;
932
c8aceb9e60cc fix descriptor editing
Michael Stanko <mstanko@bfs.de>
parents: 925
diff changeset
266 if (desk.layer < 2) {
1085
3c42c06e3a36 Decreased descriptor string parts.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1066
diff changeset
267 for (var i = desk.layer + 2; i < 12; i++) {
932
c8aceb9e60cc fix descriptor editing
Michael Stanko <mstanko@bfs.de>
parents: 925
diff changeset
268 current[i] = '00';
c8aceb9e60cc fix descriptor editing
Michael Stanko <mstanko@bfs.de>
parents: 925
diff changeset
269 }
c8aceb9e60cc fix descriptor editing
Michael Stanko <mstanko@bfs.de>
parents: 925
diff changeset
270 this.clearChildDesk(desk);
925
81e7c847cb58 Clear child descriptor fields on descriptor change.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 846
diff changeset
271 }
932
c8aceb9e60cc fix descriptor editing
Michael Stanko <mstanko@bfs.de>
parents: 925
diff changeset
272 else if (desk.layer === 2 && current[1] === '01') {
c8aceb9e60cc fix descriptor editing
Michael Stanko <mstanko@bfs.de>
parents: 925
diff changeset
273 current[4] = '00';
933
8dd758b9b8ea Clear descriptor s3 if s2 is set to empty value.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 932
diff changeset
274 desk.up('fieldset').down('deskriptor[layer=3]').clearValue();
932
c8aceb9e60cc fix descriptor editing
Michael Stanko <mstanko@bfs.de>
parents: 925
diff changeset
275 }
771
dd6925ef6028 Load, set and parse deskriptoren in probe form.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 743
diff changeset
276 }
dd6925ef6028 Load, set and parse deskriptoren in probe form.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 743
diff changeset
277 media.setValue(current.join(' ').trim());
1276
8f37f8832c4a fix mediadescription in probe form
Michael Stanko <mstanko@bfs.de>
parents: 1085
diff changeset
278
8f37f8832c4a fix mediadescription in probe form
Michael Stanko <mstanko@bfs.de>
parents: 1085
diff changeset
279 if (current[0].length == 0) {
8f37f8832c4a fix mediadescription in probe form
Michael Stanko <mstanko@bfs.de>
parents: 1085
diff changeset
280 current.splice(0,1);
8f37f8832c4a fix mediadescription in probe form
Michael Stanko <mstanko@bfs.de>
parents: 1085
diff changeset
281 }
8f37f8832c4a fix mediadescription in probe form
Michael Stanko <mstanko@bfs.de>
parents: 1085
diff changeset
282 var mediatext = field.up('probeform').down('textfield[name="media"]');
8f37f8832c4a fix mediadescription in probe form
Michael Stanko <mstanko@bfs.de>
parents: 1085
diff changeset
283
8f37f8832c4a fix mediadescription in probe form
Michael Stanko <mstanko@bfs.de>
parents: 1085
diff changeset
284 if ( (desk.layer === 0 ) && (records[0].get('sn') === 0) ){
8f37f8832c4a fix mediadescription in probe form
Michael Stanko <mstanko@bfs.de>
parents: 1085
diff changeset
285 mediatext.setValue('');
8f37f8832c4a fix mediadescription in probe form
Michael Stanko <mstanko@bfs.de>
parents: 1085
diff changeset
286 } else {
1359
49efc1cc0eac Remove trailing whitespace.
Tom Gottfried <tom@intevation.de>
parents: 1356
diff changeset
287 if ( current[1] === '01') {
1276
8f37f8832c4a fix mediadescription in probe form
Michael Stanko <mstanko@bfs.de>
parents: 1085
diff changeset
288 if ( (current[4] !== '00') && (desk.layer === 3) ) {
8f37f8832c4a fix mediadescription in probe form
Michael Stanko <mstanko@bfs.de>
parents: 1085
diff changeset
289 mediatext.setValue(records[0].data.beschreibung);
8f37f8832c4a fix mediadescription in probe form
Michael Stanko <mstanko@bfs.de>
parents: 1085
diff changeset
290 } else if ( (current[3] !== '00') && (desk.layer === 2) ) {
8f37f8832c4a fix mediadescription in probe form
Michael Stanko <mstanko@bfs.de>
parents: 1085
diff changeset
291 mediatext.setValue(records[0].data.beschreibung);
8f37f8832c4a fix mediadescription in probe form
Michael Stanko <mstanko@bfs.de>
parents: 1085
diff changeset
292 } else if ( (current[2] !== '00') && (desk.layer === 1) ) {
8f37f8832c4a fix mediadescription in probe form
Michael Stanko <mstanko@bfs.de>
parents: 1085
diff changeset
293 mediatext.setValue(records[0].data.beschreibung);
8f37f8832c4a fix mediadescription in probe form
Michael Stanko <mstanko@bfs.de>
parents: 1085
diff changeset
294 } else if ( (current[1] !== '00') && (desk.layer === 0 )) {
8f37f8832c4a fix mediadescription in probe form
Michael Stanko <mstanko@bfs.de>
parents: 1085
diff changeset
295 mediatext.setValue(records[0].data.beschreibung);
1359
49efc1cc0eac Remove trailing whitespace.
Tom Gottfried <tom@intevation.de>
parents: 1356
diff changeset
296 }
1276
8f37f8832c4a fix mediadescription in probe form
Michael Stanko <mstanko@bfs.de>
parents: 1085
diff changeset
297 }
8f37f8832c4a fix mediadescription in probe form
Michael Stanko <mstanko@bfs.de>
parents: 1085
diff changeset
298
1359
49efc1cc0eac Remove trailing whitespace.
Tom Gottfried <tom@intevation.de>
parents: 1356
diff changeset
299 if ( current[1] !== '01') {
1276
8f37f8832c4a fix mediadescription in probe form
Michael Stanko <mstanko@bfs.de>
parents: 1085
diff changeset
300 if ((current[2] !== '00') && (desk.layer === 1 )) {
8f37f8832c4a fix mediadescription in probe form
Michael Stanko <mstanko@bfs.de>
parents: 1085
diff changeset
301 mediatext.setValue(records[0].data.beschreibung);
8f37f8832c4a fix mediadescription in probe form
Michael Stanko <mstanko@bfs.de>
parents: 1085
diff changeset
302 } else if ((current[1] !== '00') && (desk.layer === 0 )) {
8f37f8832c4a fix mediadescription in probe form
Michael Stanko <mstanko@bfs.de>
parents: 1085
diff changeset
303 mediatext.setValue(records[0].data.beschreibung);
1359
49efc1cc0eac Remove trailing whitespace.
Tom Gottfried <tom@intevation.de>
parents: 1356
diff changeset
304 }
1276
8f37f8832c4a fix mediadescription in probe form
Michael Stanko <mstanko@bfs.de>
parents: 1085
diff changeset
305 }
8f37f8832c4a fix mediadescription in probe form
Michael Stanko <mstanko@bfs.de>
parents: 1085
diff changeset
306 }
771
dd6925ef6028 Load, set and parse deskriptoren in probe form.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 743
diff changeset
307 },
dd6925ef6028 Load, set and parse deskriptoren in probe form.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 743
diff changeset
308
925
81e7c847cb58 Clear child descriptor fields on descriptor change.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 846
diff changeset
309 clearChildDesk: function(field) {
771
dd6925ef6028 Load, set and parse deskriptoren in probe form.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 743
diff changeset
310 var allS = field.up('fieldset').items.items;
dd6925ef6028 Load, set and parse deskriptoren in probe form.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 743
diff changeset
311 for (var i = field.layer + 1; i < 12; i++) {
dd6925ef6028 Load, set and parse deskriptoren in probe form.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 743
diff changeset
312 allS[i].clearValue();
dd6925ef6028 Load, set and parse deskriptoren in probe form.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 743
diff changeset
313 }
1386
7e9a6f0e55b3 Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1359
diff changeset
314 },
7e9a6f0e55b3 Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1359
diff changeset
315
7e9a6f0e55b3 Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1359
diff changeset
316 showAuditTrail: function(button) {
7e9a6f0e55b3 Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1359
diff changeset
317 Ext.create('Lada.view.window.AuditTrail', {
7e9a6f0e55b3 Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1359
diff changeset
318 autoShow: true,
7e9a6f0e55b3 Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1359
diff changeset
319 closeAction: 'destroy',
7e9a6f0e55b3 Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1359
diff changeset
320 type: 'probe',
7e9a6f0e55b3 Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1359
diff changeset
321 objectId: button.up('form').recordId
7e9a6f0e55b3 Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1359
diff changeset
322 });
587
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
323 }
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
324 });

http://lada.wald.intevation.org