annotate app/model/Messprogramm.js @ 1183:287ce20bb1cb schema-update

Set the netzbetreiber and set netzbetreiber widget to a non-form field.
author Raimund Renkert <raimund.renkert@intevation.de>
date Wed, 31 Aug 2016 15:57:49 +0200
parents 52bf58630e58
children
rev   line source
745
df684c3d4a7c Added Messprogramme Store and Model
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
1 /* Copyright (C) 2013 by Bundesamt fuer Strahlenschutz
df684c3d4a7c Added Messprogramme Store and Model
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
2 * Software engineering by Intevation GmbH
df684c3d4a7c Added Messprogramme Store and Model
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
3 *
df684c3d4a7c Added Messprogramme Store and Model
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
4 * This file is Free Software under the GNU GPL (v>=3)
df684c3d4a7c Added Messprogramme Store and Model
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
5 * and comes with ABSOLUTELY NO WARRANTY! Check out
df684c3d4a7c Added Messprogramme Store and Model
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
6 * the documentation coming with IMIS-Labordaten-Application for details.
df684c3d4a7c Added Messprogramme Store and Model
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
7 */
df684c3d4a7c Added Messprogramme Store and Model
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
8
df684c3d4a7c Added Messprogramme Store and Model
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
9 /**
df684c3d4a7c Added Messprogramme Store and Model
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
10 * A Messprogramm.
df684c3d4a7c Added Messprogramme Store and Model
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
11 * This class represents and defines the model of a 'Messprogramm'
df684c3d4a7c Added Messprogramme Store and Model
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
12 **/
df684c3d4a7c Added Messprogramme Store and Model
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
13 Ext.define('Lada.model.Messprogramm', {
df684c3d4a7c Added Messprogramme Store and Model
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
14 extend: 'Ext.data.Model',
df684c3d4a7c Added Messprogramme Store and Model
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
15
df684c3d4a7c Added Messprogramme Store and Model
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
16 fields: [{
df684c3d4a7c Added Messprogramme Store and Model
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
17 name: 'id'
df684c3d4a7c Added Messprogramme Store and Model
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
18 }, {
754
6b0d0e62f7d7 added Probenintervalle to a Messprogramm... there is still a lot of work needed. For instance for the slider element.
Dustin Demuth <dustin@intevation.de>
parents: 749
diff changeset
19 name: 'test',
745
df684c3d4a7c Added Messprogramme Store and Model
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
20 type: 'boolean'
df684c3d4a7c Added Messprogramme Store and Model
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
21 }, {
df684c3d4a7c Added Messprogramme Store and Model
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
22 name: 'netzbetreiberId',
df684c3d4a7c Added Messprogramme Store and Model
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
23 serialize: function(value) {
df684c3d4a7c Added Messprogramme Store and Model
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
24 if (value === '') {
df684c3d4a7c Added Messprogramme Store and Model
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
25 return null;
df684c3d4a7c Added Messprogramme Store and Model
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
26 }
df684c3d4a7c Added Messprogramme Store and Model
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
27 return value;
1181
52bf58630e58 Updated model.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1174
diff changeset
28 },
52bf58630e58 Updated model.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1174
diff changeset
29 persist: false
745
df684c3d4a7c Added Messprogramme Store and Model
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
30 }, {
df684c3d4a7c Added Messprogramme Store and Model
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
31 name: 'mstId'
df684c3d4a7c Added Messprogramme Store and Model
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
32 }, {
1067
3da8e8b973ad Use the laborMstId to generate probe objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 999
diff changeset
33 name: 'laborMstId'
3da8e8b973ad Use the laborMstId to generate probe objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 999
diff changeset
34 }, {
745
df684c3d4a7c Added Messprogramme Store and Model
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
35 name: 'datenbasisId'
df684c3d4a7c Added Messprogramme Store and Model
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
36 }, {
df684c3d4a7c Added Messprogramme Store and Model
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
37 name: 'baId'
df684c3d4a7c Added Messprogramme Store and Model
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
38 }, {
df684c3d4a7c Added Messprogramme Store and Model
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
39 name: 'gemId'
df684c3d4a7c Added Messprogramme Store and Model
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
40 }, {
df684c3d4a7c Added Messprogramme Store and Model
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
41 name: 'ortId'
df684c3d4a7c Added Messprogramme Store and Model
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
42 }, {
df684c3d4a7c Added Messprogramme Store and Model
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
43 name: 'mediaDesk'
df684c3d4a7c Added Messprogramme Store and Model
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
44 }, {
df684c3d4a7c Added Messprogramme Store and Model
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
45 name: 'umwId',
df684c3d4a7c Added Messprogramme Store and Model
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
46 serialize: function(value) {
df684c3d4a7c Added Messprogramme Store and Model
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
47 if (value === '') {
df684c3d4a7c Added Messprogramme Store and Model
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
48 return null;
df684c3d4a7c Added Messprogramme Store and Model
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
49 }
df684c3d4a7c Added Messprogramme Store and Model
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
50 return value;
df684c3d4a7c Added Messprogramme Store and Model
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
51 }
df684c3d4a7c Added Messprogramme Store and Model
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
52 }, {
df684c3d4a7c Added Messprogramme Store and Model
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
53 name: 'probenartId'
df684c3d4a7c Added Messprogramme Store and Model
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
54 }, {
df684c3d4a7c Added Messprogramme Store and Model
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
55 name: 'probenintervall'
df684c3d4a7c Added Messprogramme Store and Model
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
56 }, {
df684c3d4a7c Added Messprogramme Store and Model
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
57 name: 'teilintervallVon'
df684c3d4a7c Added Messprogramme Store and Model
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
58 }, {
df684c3d4a7c Added Messprogramme Store and Model
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
59 name: 'teilintervallBis'
df684c3d4a7c Added Messprogramme Store and Model
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
60 }, {
df684c3d4a7c Added Messprogramme Store and Model
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
61 name: 'intervallOffset'
df684c3d4a7c Added Messprogramme Store and Model
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
62 }, {
774
afc9076db490 Added Offset field
Dustin Demuth <dustin@intevation.de>
parents: 754
diff changeset
63 name: 'gueltigVon',
afc9076db490 Added Offset field
Dustin Demuth <dustin@intevation.de>
parents: 754
diff changeset
64 type: 'date',
afc9076db490 Added Offset field
Dustin Demuth <dustin@intevation.de>
parents: 754
diff changeset
65 convert: function(v) {
793
d4eb8fb99b5e Serialising GueltigVon and GueltigBis natively with Ext
Dustin Demuth <dustin@intevation.de>
parents: 781
diff changeset
66 var firstofyeartimestamp = new Date(
d4eb8fb99b5e Serialising GueltigVon and GueltigBis natively with Ext
Dustin Demuth <dustin@intevation.de>
parents: 781
diff changeset
67 Date.UTC(
d4eb8fb99b5e Serialising GueltigVon and GueltigBis natively with Ext
Dustin Demuth <dustin@intevation.de>
parents: 781
diff changeset
68 new Date().getFullYear(),0,1))
d4eb8fb99b5e Serialising GueltigVon and GueltigBis natively with Ext
Dustin Demuth <dustin@intevation.de>
parents: 781
diff changeset
69 .valueOf();
d4eb8fb99b5e Serialising GueltigVon and GueltigBis natively with Ext
Dustin Demuth <dustin@intevation.de>
parents: 781
diff changeset
70 var dayToMilli = 86400000;
d4eb8fb99b5e Serialising GueltigVon and GueltigBis natively with Ext
Dustin Demuth <dustin@intevation.de>
parents: 781
diff changeset
71
774
afc9076db490 Added Offset field
Dustin Demuth <dustin@intevation.de>
parents: 754
diff changeset
72 if (!v) {
afc9076db490 Added Offset field
Dustin Demuth <dustin@intevation.de>
parents: 754
diff changeset
73 return v;
afc9076db490 Added Offset field
Dustin Demuth <dustin@intevation.de>
parents: 754
diff changeset
74 }
793
d4eb8fb99b5e Serialising GueltigVon and GueltigBis natively with Ext
Dustin Demuth <dustin@intevation.de>
parents: 781
diff changeset
75 //check if v might be a date
d4eb8fb99b5e Serialising GueltigVon and GueltigBis natively with Ext
Dustin Demuth <dustin@intevation.de>
parents: 781
diff changeset
76 // unless we go back in time this will work
d4eb8fb99b5e Serialising GueltigVon and GueltigBis natively with Ext
Dustin Demuth <dustin@intevation.de>
parents: 781
diff changeset
77 if (v < 1000) {
d4eb8fb99b5e Serialising GueltigVon and GueltigBis natively with Ext
Dustin Demuth <dustin@intevation.de>
parents: 781
diff changeset
78 v = v * dayToMilli;
d4eb8fb99b5e Serialising GueltigVon and GueltigBis natively with Ext
Dustin Demuth <dustin@intevation.de>
parents: 781
diff changeset
79 v = v + firstofyeartimestamp;
d4eb8fb99b5e Serialising GueltigVon and GueltigBis natively with Ext
Dustin Demuth <dustin@intevation.de>
parents: 781
diff changeset
80 v = new Date(v);
d4eb8fb99b5e Serialising GueltigVon and GueltigBis natively with Ext
Dustin Demuth <dustin@intevation.de>
parents: 781
diff changeset
81 }
d4eb8fb99b5e Serialising GueltigVon and GueltigBis natively with Ext
Dustin Demuth <dustin@intevation.de>
parents: 781
diff changeset
82 return v;
774
afc9076db490 Added Offset field
Dustin Demuth <dustin@intevation.de>
parents: 754
diff changeset
83 },
781
4c1101f0ba99 Serialize Date to DayOfYear when writing/saving
Dustin Demuth <dustin@intevation.de>
parents: 774
diff changeset
84 serialize: function(value) {
4c1101f0ba99 Serialize Date to DayOfYear when writing/saving
Dustin Demuth <dustin@intevation.de>
parents: 774
diff changeset
85 if (value instanceof Date && !isNaN(value.valueOf())) {
793
d4eb8fb99b5e Serialising GueltigVon and GueltigBis natively with Ext
Dustin Demuth <dustin@intevation.de>
parents: 781
diff changeset
86 return Ext.Date.getDayOfYear(value);
781
4c1101f0ba99 Serialize Date to DayOfYear when writing/saving
Dustin Demuth <dustin@intevation.de>
parents: 774
diff changeset
87 }
4c1101f0ba99 Serialize Date to DayOfYear when writing/saving
Dustin Demuth <dustin@intevation.de>
parents: 774
diff changeset
88 }
745
df684c3d4a7c Added Messprogramme Store and Model
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
89 }, {
774
afc9076db490 Added Offset field
Dustin Demuth <dustin@intevation.de>
parents: 754
diff changeset
90 name: 'gueltigBis',
afc9076db490 Added Offset field
Dustin Demuth <dustin@intevation.de>
parents: 754
diff changeset
91 type: 'date',
afc9076db490 Added Offset field
Dustin Demuth <dustin@intevation.de>
parents: 754
diff changeset
92 convert: function(v) {
793
d4eb8fb99b5e Serialising GueltigVon and GueltigBis natively with Ext
Dustin Demuth <dustin@intevation.de>
parents: 781
diff changeset
93 var firstofyeartimestamp = new Date(
d4eb8fb99b5e Serialising GueltigVon and GueltigBis natively with Ext
Dustin Demuth <dustin@intevation.de>
parents: 781
diff changeset
94 Date.UTC(
d4eb8fb99b5e Serialising GueltigVon and GueltigBis natively with Ext
Dustin Demuth <dustin@intevation.de>
parents: 781
diff changeset
95 new Date().getFullYear(),0,1))
d4eb8fb99b5e Serialising GueltigVon and GueltigBis natively with Ext
Dustin Demuth <dustin@intevation.de>
parents: 781
diff changeset
96 .valueOf();
d4eb8fb99b5e Serialising GueltigVon and GueltigBis natively with Ext
Dustin Demuth <dustin@intevation.de>
parents: 781
diff changeset
97 var dayToMilli = 86400000;
d4eb8fb99b5e Serialising GueltigVon and GueltigBis natively with Ext
Dustin Demuth <dustin@intevation.de>
parents: 781
diff changeset
98
774
afc9076db490 Added Offset field
Dustin Demuth <dustin@intevation.de>
parents: 754
diff changeset
99 if (!v) {
afc9076db490 Added Offset field
Dustin Demuth <dustin@intevation.de>
parents: 754
diff changeset
100 return v;
afc9076db490 Added Offset field
Dustin Demuth <dustin@intevation.de>
parents: 754
diff changeset
101 }
793
d4eb8fb99b5e Serialising GueltigVon and GueltigBis natively with Ext
Dustin Demuth <dustin@intevation.de>
parents: 781
diff changeset
102
d4eb8fb99b5e Serialising GueltigVon and GueltigBis natively with Ext
Dustin Demuth <dustin@intevation.de>
parents: 781
diff changeset
103 //check if v might be a date
d4eb8fb99b5e Serialising GueltigVon and GueltigBis natively with Ext
Dustin Demuth <dustin@intevation.de>
parents: 781
diff changeset
104 // unless we go back in time this will work
d4eb8fb99b5e Serialising GueltigVon and GueltigBis natively with Ext
Dustin Demuth <dustin@intevation.de>
parents: 781
diff changeset
105 if (v < 1000) {
d4eb8fb99b5e Serialising GueltigVon and GueltigBis natively with Ext
Dustin Demuth <dustin@intevation.de>
parents: 781
diff changeset
106 v = v * dayToMilli;
d4eb8fb99b5e Serialising GueltigVon and GueltigBis natively with Ext
Dustin Demuth <dustin@intevation.de>
parents: 781
diff changeset
107 v = v + firstofyeartimestamp;
d4eb8fb99b5e Serialising GueltigVon and GueltigBis natively with Ext
Dustin Demuth <dustin@intevation.de>
parents: 781
diff changeset
108 v = new Date(v);
d4eb8fb99b5e Serialising GueltigVon and GueltigBis natively with Ext
Dustin Demuth <dustin@intevation.de>
parents: 781
diff changeset
109 }
d4eb8fb99b5e Serialising GueltigVon and GueltigBis natively with Ext
Dustin Demuth <dustin@intevation.de>
parents: 781
diff changeset
110 return v;
774
afc9076db490 Added Offset field
Dustin Demuth <dustin@intevation.de>
parents: 754
diff changeset
111 },
781
4c1101f0ba99 Serialize Date to DayOfYear when writing/saving
Dustin Demuth <dustin@intevation.de>
parents: 774
diff changeset
112 serialize: function(value) {
4c1101f0ba99 Serialize Date to DayOfYear when writing/saving
Dustin Demuth <dustin@intevation.de>
parents: 774
diff changeset
113 if (value instanceof Date && !isNaN(value.valueOf())) {
793
d4eb8fb99b5e Serialising GueltigVon and GueltigBis natively with Ext
Dustin Demuth <dustin@intevation.de>
parents: 781
diff changeset
114 return Ext.Date.getDayOfYear(value);
781
4c1101f0ba99 Serialize Date to DayOfYear when writing/saving
Dustin Demuth <dustin@intevation.de>
parents: 774
diff changeset
115 }
4c1101f0ba99 Serialize Date to DayOfYear when writing/saving
Dustin Demuth <dustin@intevation.de>
parents: 774
diff changeset
116 }
745
df684c3d4a7c Added Messprogramme Store and Model
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
117 }, {
df684c3d4a7c Added Messprogramme Store and Model
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
118 name: 'probeNehmerId'
df684c3d4a7c Added Messprogramme Store and Model
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
119 }, {
df684c3d4a7c Added Messprogramme Store and Model
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
120 name: 'probeKommentar'
df684c3d4a7c Added Messprogramme Store and Model
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
121 }, {
df684c3d4a7c Added Messprogramme Store and Model
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
122 name: 'letzteAenderung',
df684c3d4a7c Added Messprogramme Store and Model
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
123 type: 'date',
df684c3d4a7c Added Messprogramme Store and Model
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
124 convert: function(v) {
df684c3d4a7c Added Messprogramme Store and Model
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
125 if (!v) {
df684c3d4a7c Added Messprogramme Store and Model
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
126 return v;
df684c3d4a7c Added Messprogramme Store and Model
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
127 }
df684c3d4a7c Added Messprogramme Store and Model
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
128 return new Date(v);
970
f4eb53ba63fc Setting Timestamps the correct way. Before this commit the times of the instatiation of the model were used as default values, which led to wrong dates.
Dustin Demuth <dustin@intevation.de>
parents: 793
diff changeset
129 }
1086
61cc583c3649 Messprogramm form redesign
Michael Stanko <mstanko@bfs.de>
parents: 1067
diff changeset
130 }, {
61cc583c3649 Messprogramm form redesign
Michael Stanko <mstanko@bfs.de>
parents: 1067
diff changeset
131 name: 'media',
61cc583c3649 Messprogramm form redesign
Michael Stanko <mstanko@bfs.de>
parents: 1067
diff changeset
132 persist: false
745
df684c3d4a7c Added Messprogramme Store and Model
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
133 }],
df684c3d4a7c Added Messprogramme Store and Model
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
134
df684c3d4a7c Added Messprogramme Store and Model
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
135 idProperty: 'id',
df684c3d4a7c Added Messprogramme Store and Model
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
136
df684c3d4a7c Added Messprogramme Store and Model
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
137 proxy: {
df684c3d4a7c Added Messprogramme Store and Model
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
138 type: 'rest',
999
f73ca04d73a7 Refactored Server URL
Dustin Demuth <dustin@intevation.de>
parents: 970
diff changeset
139 url: 'lada-server/rest/messprogramm',
745
df684c3d4a7c Added Messprogramme Store and Model
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
140 reader: {
df684c3d4a7c Added Messprogramme Store and Model
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
141 type: 'json',
df684c3d4a7c Added Messprogramme Store and Model
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
142 root: 'data'
df684c3d4a7c Added Messprogramme Store and Model
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
143 }
df684c3d4a7c Added Messprogramme Store and Model
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
144 }
754
6b0d0e62f7d7 added Probenintervalle to a Messprogramm... there is still a lot of work needed. For instance for the slider element.
Dustin Demuth <dustin@intevation.de>
parents: 749
diff changeset
145 });

http://lada.wald.intevation.org