annotate app/model/Status.js @ 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.
author Dustin Demuth <dustin@intevation.de>
date Mon, 16 Nov 2015 11:48:15 +0100
parents a2c2039bb5d9
children 0ca27b761584 f73ca04d73a7
rev   line source
569
d9593b520b3b Added a model for Status
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
1 /* Copyright (C) 2013 by Bundesamt fuer Strahlenschutz
d9593b520b3b Added a model for Status
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
2 * Software engineering by Intevation GmbH
d9593b520b3b Added a model for Status
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
3 *
d9593b520b3b Added a model for Status
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
4 * This file is Free Software under the GNU GPL (v>=3)
d9593b520b3b Added a model for Status
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
5 * and comes with ABSOLUTELY NO WARRANTY! Check out
d9593b520b3b Added a model for Status
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
6 * the documentation coming with IMIS-Labordaten-Application for details.
d9593b520b3b Added a model for Status
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
7 */
d9593b520b3b Added a model for Status
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
8
d9593b520b3b Added a model for Status
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
9 /**
d9593b520b3b Added a model for Status
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
10 * Model class for Status
d9593b520b3b Added a model for Status
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
11 */
d9593b520b3b Added a model for Status
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
12 Ext.define('Lada.model.Status', {
d9593b520b3b Added a model for Status
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
13 extend: 'Ext.data.Model',
d9593b520b3b Added a model for Status
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
14
d9593b520b3b Added a model for Status
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
15 fields: [{
d9593b520b3b Added a model for Status
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
16 name: 'id'
d9593b520b3b Added a model for Status
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
17 }, {
702
0c8e689f3bcb Added readonly to models, Probenzusatzwertgrid does now check wheter a record is readonly and disables the roweditor in such a case
Dustin Demuth <dustin@intevation.de>
parents: 698
diff changeset
18 name: 'readonly',
0c8e689f3bcb Added readonly to models, Probenzusatzwertgrid does now check wheter a record is readonly and disables the roweditor in such a case
Dustin Demuth <dustin@intevation.de>
parents: 698
diff changeset
19 type: 'boolean',
0c8e689f3bcb Added readonly to models, Probenzusatzwertgrid does now check wheter a record is readonly and disables the roweditor in such a case
Dustin Demuth <dustin@intevation.de>
parents: 698
diff changeset
20 persist: false
0c8e689f3bcb Added readonly to models, Probenzusatzwertgrid does now check wheter a record is readonly and disables the roweditor in such a case
Dustin Demuth <dustin@intevation.de>
parents: 698
diff changeset
21 }, {
945
023e622f9551 Added the ability to work with "StatusWerten" which are delivered by the lada-server.
Dustin Demuth <dustin@intevation.de>
parents: 711
diff changeset
22 name: 'owner',
965
a2c2039bb5d9 Disabled StatusGrid Edit when StatusEdit ist false, Load StatuswerteStore differently, removed a bunch of trailing commas
Dustin Demuth <dustin@intevation.de>
parents: 956
diff changeset
23 type: 'boolean'
945
023e622f9551 Added the ability to work with "StatusWerten" which are delivered by the lada-server.
Dustin Demuth <dustin@intevation.de>
parents: 711
diff changeset
24 }, {
569
d9593b520b3b Added a model for Status
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
25 name: 'messungsId'
d9593b520b3b Added a model for Status
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
26 }, {
593
9b3adfb7b1ae Updated status model.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 569
diff changeset
27 name: 'erzeuger'
9b3adfb7b1ae Updated status model.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 569
diff changeset
28 }, {
945
023e622f9551 Added the ability to work with "StatusWerten" which are delivered by the lada-server.
Dustin Demuth <dustin@intevation.de>
parents: 711
diff changeset
29 name: 'statusStufe',
956
45c67a784b31 Added StatusStufe to the StatusGrid. Created Store and Model for StatusStufe
Dustin Demuth <dustin@intevation.de>
parents: 945
diff changeset
30 type: 'int',
45c67a784b31 Added StatusStufe to the StatusGrid. Created Store and Model for StatusStufe
Dustin Demuth <dustin@intevation.de>
parents: 945
diff changeset
31 defaultValue: 1
569
d9593b520b3b Added a model for Status
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
32 }, {
945
023e622f9551 Added the ability to work with "StatusWerten" which are delivered by the lada-server.
Dustin Demuth <dustin@intevation.de>
parents: 711
diff changeset
33 name: 'statusWert',
956
45c67a784b31 Added StatusStufe to the StatusGrid. Created Store and Model for StatusStufe
Dustin Demuth <dustin@intevation.de>
parents: 945
diff changeset
34 type: 'int',
45c67a784b31 Added StatusStufe to the StatusGrid. Created Store and Model for StatusStufe
Dustin Demuth <dustin@intevation.de>
parents: 945
diff changeset
35 defaultValue: 0
945
023e622f9551 Added the ability to work with "StatusWerten" which are delivered by the lada-server.
Dustin Demuth <dustin@intevation.de>
parents: 711
diff changeset
36 }, {
023e622f9551 Added the ability to work with "StatusWerten" which are delivered by the lada-server.
Dustin Demuth <dustin@intevation.de>
parents: 711
diff changeset
37 name: 'treeModified',
023e622f9551 Added the ability to work with "StatusWerten" which are delivered by the lada-server.
Dustin Demuth <dustin@intevation.de>
parents: 711
diff changeset
38 serialize: function(value) {
023e622f9551 Added the ability to work with "StatusWerten" which are delivered by the lada-server.
Dustin Demuth <dustin@intevation.de>
parents: 711
diff changeset
39 if (value === '') {
023e622f9551 Added the ability to work with "StatusWerten" which are delivered by the lada-server.
Dustin Demuth <dustin@intevation.de>
parents: 711
diff changeset
40 return null;
023e622f9551 Added the ability to work with "StatusWerten" which are delivered by the lada-server.
Dustin Demuth <dustin@intevation.de>
parents: 711
diff changeset
41 }
023e622f9551 Added the ability to work with "StatusWerten" which are delivered by the lada-server.
Dustin Demuth <dustin@intevation.de>
parents: 711
diff changeset
42 return value;
023e622f9551 Added the ability to work with "StatusWerten" which are delivered by the lada-server.
Dustin Demuth <dustin@intevation.de>
parents: 711
diff changeset
43 }
023e622f9551 Added the ability to work with "StatusWerten" which are delivered by the lada-server.
Dustin Demuth <dustin@intevation.de>
parents: 711
diff changeset
44 }, {
023e622f9551 Added the ability to work with "StatusWerten" which are delivered by the lada-server.
Dustin Demuth <dustin@intevation.de>
parents: 711
diff changeset
45 name: 'parentModified',
023e622f9551 Added the ability to work with "StatusWerten" which are delivered by the lada-server.
Dustin Demuth <dustin@intevation.de>
parents: 711
diff changeset
46 serialize: function(value) {
023e622f9551 Added the ability to work with "StatusWerten" which are delivered by the lada-server.
Dustin Demuth <dustin@intevation.de>
parents: 711
diff changeset
47 if (value === '') {
023e622f9551 Added the ability to work with "StatusWerten" which are delivered by the lada-server.
Dustin Demuth <dustin@intevation.de>
parents: 711
diff changeset
48 return null;
023e622f9551 Added the ability to work with "StatusWerten" which are delivered by the lada-server.
Dustin Demuth <dustin@intevation.de>
parents: 711
diff changeset
49 }
023e622f9551 Added the ability to work with "StatusWerten" which are delivered by the lada-server.
Dustin Demuth <dustin@intevation.de>
parents: 711
diff changeset
50 return value;
023e622f9551 Added the ability to work with "StatusWerten" which are delivered by the lada-server.
Dustin Demuth <dustin@intevation.de>
parents: 711
diff changeset
51 }
023e622f9551 Added the ability to work with "StatusWerten" which are delivered by the lada-server.
Dustin Demuth <dustin@intevation.de>
parents: 711
diff changeset
52 }, {
023e622f9551 Added the ability to work with "StatusWerten" which are delivered by the lada-server.
Dustin Demuth <dustin@intevation.de>
parents: 711
diff changeset
53 name: 'datum',
593
9b3adfb7b1ae Updated status model.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 569
diff changeset
54 type: 'date',
9b3adfb7b1ae Updated status model.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 569
diff changeset
55 convert: function(v) {
9b3adfb7b1ae Updated status model.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 569
diff changeset
56 if (!v) {
9b3adfb7b1ae Updated status model.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 569
diff changeset
57 return v;
9b3adfb7b1ae Updated status model.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 569
diff changeset
58 }
9b3adfb7b1ae Updated status model.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 569
diff changeset
59 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: 965
diff changeset
60 }
569
d9593b520b3b Added a model for Status
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
61 }, {
945
023e622f9551 Added the ability to work with "StatusWerten" which are delivered by the lada-server.
Dustin Demuth <dustin@intevation.de>
parents: 711
diff changeset
62 name: 'text'
569
d9593b520b3b Added a model for Status
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
63 }],
d9593b520b3b Added a model for Status
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
64
d9593b520b3b Added a model for Status
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
65 idProperty: 'id',
d9593b520b3b Added a model for Status
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
66
d9593b520b3b Added a model for Status
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
67 proxy: {
d9593b520b3b Added a model for Status
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
68 type: 'rest',
d9593b520b3b Added a model for Status
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
69 url: 'lada-server/status',
d9593b520b3b Added a model for Status
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
70 reader: {
d9593b520b3b Added a model for Status
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
71 type: 'json',
d9593b520b3b Added a model for Status
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
72 root: 'data'
d9593b520b3b Added a model for Status
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
73 }
d9593b520b3b Added a model for Status
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
74 }
d9593b520b3b Added a model for Status
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
75 });

http://lada.wald.intevation.org