annotate app/model/Messung.js @ 304:8475a625a773

Use ts2date function from lib.Helpers. Remove old code
author Torsten Irländer <torsten.irlaender@intevation.de>
date Fri, 09 Aug 2013 15:24:00 +0200
parents fe199b8828a8
children 65f8be677c8a
rev   line source
103
3552b0ee4526 Added Messungenlist to the Proben eddit view.
Torsten Irländer <torsten@irlaender.de>
parents:
diff changeset
1 Ext.define('Lada.model.Messung', {
3552b0ee4526 Added Messungenlist to the Proben eddit view.
Torsten Irländer <torsten@irlaender.de>
parents:
diff changeset
2 extend: 'Ext.data.Model',
299
fe199b8828a8 Use ts2date function from lib.Helpers. Remove old code
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 212
diff changeset
3 requires: ['Lada.lib.Helpers'],
103
3552b0ee4526 Added Messungenlist to the Proben eddit view.
Torsten Irländer <torsten@irlaender.de>
parents:
diff changeset
4 fields: [
162
5eb0cfac0e30 Added nested id attribute which comes in JSON response to the model as we need
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 159
diff changeset
5 {name: "id"},
159
f653bd7893c0 Fixed model. Added mapping.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 158
diff changeset
6 {name: "messungsId", mapping:"id.messungsId"},
f653bd7893c0 Fixed model. Added mapping.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 158
diff changeset
7 {name: "probeId", mapping:"id.probeId"},
103
3552b0ee4526 Added Messungenlist to the Proben eddit view.
Torsten Irländer <torsten@irlaender.de>
parents:
diff changeset
8 {name: "mmtId"},
3552b0ee4526 Added Messungenlist to the Proben eddit view.
Torsten Irländer <torsten@irlaender.de>
parents:
diff changeset
9 {name: "nebenprobenNr"},
3552b0ee4526 Added Messungenlist to the Proben eddit view.
Torsten Irländer <torsten@irlaender.de>
parents:
diff changeset
10 {name: "messdauer"},
299
fe199b8828a8 Use ts2date function from lib.Helpers. Remove old code
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 212
diff changeset
11 {name: "messzeitpunkt", convert: Lada.lib.Helpers.ts2date, defaultValue: new Date()},
103
3552b0ee4526 Added Messungenlist to the Proben eddit view.
Torsten Irländer <torsten@irlaender.de>
parents:
diff changeset
12 {name: "fertig", type: "boolean"},
3552b0ee4526 Added Messungenlist to the Proben eddit view.
Torsten Irländer <torsten@irlaender.de>
parents:
diff changeset
13 {name: "letzteAenderung", type:"date"},
3552b0ee4526 Added Messungenlist to the Proben eddit view.
Torsten Irländer <torsten@irlaender.de>
parents:
diff changeset
14 {name: "geplant", type: "boolean"}
3552b0ee4526 Added Messungenlist to the Proben eddit view.
Torsten Irländer <torsten@irlaender.de>
parents:
diff changeset
15 ],
212
92facbaece42 add getEidi function to model
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 171
diff changeset
16 idProperty: "id",
103
3552b0ee4526 Added Messungenlist to the Proben eddit view.
Torsten Irländer <torsten@irlaender.de>
parents:
diff changeset
17 proxy: {
3552b0ee4526 Added Messungenlist to the Proben eddit view.
Torsten Irländer <torsten@irlaender.de>
parents:
diff changeset
18 type: 'rest',
3552b0ee4526 Added Messungenlist to the Proben eddit view.
Torsten Irländer <torsten@irlaender.de>
parents:
diff changeset
19 appendId: true, //default
3552b0ee4526 Added Messungenlist to the Proben eddit view.
Torsten Irländer <torsten@irlaender.de>
parents:
diff changeset
20 url: 'server/rest/messung',
3552b0ee4526 Added Messungenlist to the Proben eddit view.
Torsten Irländer <torsten@irlaender.de>
parents:
diff changeset
21 reader: {
3552b0ee4526 Added Messungenlist to the Proben eddit view.
Torsten Irländer <torsten@irlaender.de>
parents:
diff changeset
22 type: 'json',
3552b0ee4526 Added Messungenlist to the Proben eddit view.
Torsten Irländer <torsten@irlaender.de>
parents:
diff changeset
23 root: 'data'
3552b0ee4526 Added Messungenlist to the Proben eddit view.
Torsten Irländer <torsten@irlaender.de>
parents:
diff changeset
24 }
212
92facbaece42 add getEidi function to model
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 171
diff changeset
25 },
92facbaece42 add getEidi function to model
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 171
diff changeset
26 getEidi: function() {
92facbaece42 add getEidi function to model
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 171
diff changeset
27 var messId = this.get('messungsId');
92facbaece42 add getEidi function to model
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 171
diff changeset
28 var probeId = this.get('probeId');
92facbaece42 add getEidi function to model
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 171
diff changeset
29 return "/" + messId + "/" + probeId;
103
3552b0ee4526 Added Messungenlist to the Proben eddit view.
Torsten Irländer <torsten@irlaender.de>
parents:
diff changeset
30 }
3552b0ee4526 Added Messungenlist to the Proben eddit view.
Torsten Irländer <torsten@irlaender.de>
parents:
diff changeset
31 });
171
c5422819d7b9 Show messzeitpunkt in messung listing. Convert timestamp to date.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 162
diff changeset
32
c5422819d7b9 Show messzeitpunkt in messung listing. Convert timestamp to date.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 162
diff changeset
33 function ts2date(v, record){
c5422819d7b9 Show messzeitpunkt in messung listing. Convert timestamp to date.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 162
diff changeset
34 // Converts a timestamp into a date object.
c5422819d7b9 Show messzeitpunkt in messung listing. Convert timestamp to date.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 162
diff changeset
35 return new Date(v);
c5422819d7b9 Show messzeitpunkt in messung listing. Convert timestamp to date.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 162
diff changeset
36 }

http://lada.wald.intevation.org