Mercurial > lada > lada-client
annotate app/controller/Status.js @ 306:5e4d926d7717
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 | 841dc60824b5 |
children | 6a7a9267e00f |
rev | line source |
---|---|
202
7a4d93c9b0ff
Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
1 Ext.define('Lada.controller.Status', { |
295
841dc60824b5
Inherit from Base controller
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
202
diff
changeset
|
2 extend: 'Lada.controller.Base', |
202
7a4d93c9b0ff
Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
3 views: [ |
7a4d93c9b0ff
Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
4 'status.Create' |
7a4d93c9b0ff
Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
5 ], |
7a4d93c9b0ff
Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
6 stores: [ |
7a4d93c9b0ff
Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
7 'Status' |
7a4d93c9b0ff
Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
8 ], |
7a4d93c9b0ff
Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
9 init: function() { |
7a4d93c9b0ff
Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
10 console.log('Initialising the Status controller'); |
295
841dc60824b5
Inherit from Base controller
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
202
diff
changeset
|
11 this.callParent(); |
841dc60824b5
Inherit from Base controller
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
202
diff
changeset
|
12 }, |
841dc60824b5
Inherit from Base controller
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
202
diff
changeset
|
13 addListeners: function() { |
202
7a4d93c9b0ff
Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
14 this.control({ |
7a4d93c9b0ff
Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
15 'statuslist': { |
295
841dc60824b5
Inherit from Base controller
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
202
diff
changeset
|
16 itemdblclick: this.editItem |
202
7a4d93c9b0ff
Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
17 }, |
7a4d93c9b0ff
Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
18 'statuslist toolbar button[action=add]': { |
295
841dc60824b5
Inherit from Base controller
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
202
diff
changeset
|
19 click: this.addItem |
202
7a4d93c9b0ff
Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
20 }, |
7a4d93c9b0ff
Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
21 'statuslist toolbar button[action=delete]': { |
295
841dc60824b5
Inherit from Base controller
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
202
diff
changeset
|
22 click: this.deleteItem |
202
7a4d93c9b0ff
Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
23 }, |
7a4d93c9b0ff
Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
24 'statuscreate form': { |
7a4d93c9b0ff
Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
25 savesuccess: this.createSuccess, |
7a4d93c9b0ff
Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
26 savefailure: this.createFailure |
7a4d93c9b0ff
Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
27 }, |
7a4d93c9b0ff
Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
28 'statuscreate button[action=save]': { |
295
841dc60824b5
Inherit from Base controller
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
202
diff
changeset
|
29 click: this.saveItem |
202
7a4d93c9b0ff
Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
30 }, |
7a4d93c9b0ff
Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
31 'statusedit form': { |
7a4d93c9b0ff
Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
32 savesuccess: this.editSuccess, |
7a4d93c9b0ff
Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
33 savefailure: this.editFailure |
7a4d93c9b0ff
Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
34 } |
7a4d93c9b0ff
Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
35 }); |
7a4d93c9b0ff
Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
36 }, |
295
841dc60824b5
Inherit from Base controller
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
202
diff
changeset
|
37 addItem: function(button) { |
202
7a4d93c9b0ff
Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
38 console.log('Adding new Status for Messung ' + button.parentId + ' in Probe ' + button.probeId); |
7a4d93c9b0ff
Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
39 var zusatzwert = Ext.create('Lada.model.Status'); |
7a4d93c9b0ff
Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
40 zusatzwert.set('probeId', button.probeId); |
7a4d93c9b0ff
Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
41 zusatzwert.set('messungsId', button.parentId); |
7a4d93c9b0ff
Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
42 var view = Ext.widget('statuscreate', {model: zusatzwert}); |
7a4d93c9b0ff
Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
43 }, |
295
841dc60824b5
Inherit from Base controller
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
202
diff
changeset
|
44 editItem: function(grid, record) { |
202
7a4d93c9b0ff
Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
45 console.log('Editing Status'); |
7a4d93c9b0ff
Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
46 var view = Ext.widget('statuscreate', {model: record}); |
7a4d93c9b0ff
Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
47 console.log("Loaded Status with ID " + record.getId()); //outputs ID |
7a4d93c9b0ff
Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
48 }, |
7a4d93c9b0ff
Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
49 createSuccess: function(form, record, operation) { |
7a4d93c9b0ff
Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
50 // Reload store |
7a4d93c9b0ff
Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
51 var store = this.getStatusStore(); |
7a4d93c9b0ff
Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
52 store.reload(); |
7a4d93c9b0ff
Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
53 var win = form.up('window'); |
7a4d93c9b0ff
Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
54 win.close(); |
7a4d93c9b0ff
Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
55 }, |
7a4d93c9b0ff
Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
56 editSuccess: function(form, record, operation) { |
7a4d93c9b0ff
Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
57 // Reload store |
7a4d93c9b0ff
Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
58 var store = this.getStatusStore(); |
7a4d93c9b0ff
Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
59 store.reload(); |
7a4d93c9b0ff
Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
60 var win = form.up('window'); |
7a4d93c9b0ff
Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
61 win.close(); |
7a4d93c9b0ff
Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
62 }, |
7a4d93c9b0ff
Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
63 }); |