Mercurial > lada > lada-client
annotate app/controller/Status.js @ 542:0a948bb99b60
Added error and warning handling to date time field.
author | Raimund Renkert <raimund.renkert@intevation.de> |
---|---|
date | Thu, 18 Dec 2014 15:03:08 +0100 |
parents | 99e738c17b81 |
children |
rev | line source |
---|---|
472
debfcc7713e3
Added license header to each file.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
422
diff
changeset
|
1 /* Copyright (C) 2013 by Bundesamt fuer Strahlenschutz |
debfcc7713e3
Added license header to each file.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
422
diff
changeset
|
2 * Software engineering by Intevation GmbH |
debfcc7713e3
Added license header to each file.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
422
diff
changeset
|
3 * |
debfcc7713e3
Added license header to each file.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
422
diff
changeset
|
4 * This file is Free Software under the GNU GPL (v>=3) |
debfcc7713e3
Added license header to each file.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
422
diff
changeset
|
5 * and comes with ABSOLUTELY NO WARRANTY! Check out |
500
ad7f574b382a
Fixed some js related issues (unused vars, arrays, etc.) and code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
499
diff
changeset
|
6 * the documentation coming with IMIS-Labordaten-Application for details. |
472
debfcc7713e3
Added license header to each file.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
422
diff
changeset
|
7 */ |
debfcc7713e3
Added license header to each file.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
422
diff
changeset
|
8 |
202
7a4d93c9b0ff
Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
9 Ext.define('Lada.controller.Status', { |
295
841dc60824b5
Inherit from Base controller
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
202
diff
changeset
|
10 extend: 'Lada.controller.Base', |
491
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
11 |
202
7a4d93c9b0ff
Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
12 views: [ |
7a4d93c9b0ff
Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
13 'status.Create' |
7a4d93c9b0ff
Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
14 ], |
491
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
15 |
202
7a4d93c9b0ff
Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
16 stores: [ |
7a4d93c9b0ff
Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
17 'Status' |
7a4d93c9b0ff
Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
18 ], |
491
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
19 |
202
7a4d93c9b0ff
Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
20 init: function() { |
491
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
21 this.callParent(arguments); |
295
841dc60824b5
Inherit from Base controller
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
202
diff
changeset
|
22 }, |
491
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
23 |
295
841dc60824b5
Inherit from Base controller
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
202
diff
changeset
|
24 addListeners: function() { |
202
7a4d93c9b0ff
Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
25 this.control({ |
540
99e738c17b81
Add detail button to tables
Roland Geider <roland.geider@intevation.de>
parents:
523
diff
changeset
|
26 'statuslist toolbar button[action=open]': { |
99e738c17b81
Add detail button to tables
Roland Geider <roland.geider@intevation.de>
parents:
523
diff
changeset
|
27 click: this.editItem |
99e738c17b81
Add detail button to tables
Roland Geider <roland.geider@intevation.de>
parents:
523
diff
changeset
|
28 }, |
202
7a4d93c9b0ff
Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
29 'statuslist toolbar button[action=add]': { |
295
841dc60824b5
Inherit from Base controller
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
202
diff
changeset
|
30 click: this.addItem |
202
7a4d93c9b0ff
Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
31 }, |
7a4d93c9b0ff
Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
32 'statuslist toolbar button[action=delete]': { |
295
841dc60824b5
Inherit from Base controller
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
202
diff
changeset
|
33 click: this.deleteItem |
202
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 'statuscreate form': { |
7a4d93c9b0ff
Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
36 savesuccess: this.createSuccess, |
7a4d93c9b0ff
Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
37 savefailure: this.createFailure |
7a4d93c9b0ff
Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
38 }, |
7a4d93c9b0ff
Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
39 'statuscreate button[action=save]': { |
295
841dc60824b5
Inherit from Base controller
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
202
diff
changeset
|
40 click: this.saveItem |
202
7a4d93c9b0ff
Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
41 }, |
7a4d93c9b0ff
Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
42 'statusedit form': { |
7a4d93c9b0ff
Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
43 savesuccess: this.editSuccess, |
7a4d93c9b0ff
Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
44 savefailure: this.editFailure |
7a4d93c9b0ff
Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
45 } |
7a4d93c9b0ff
Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
46 }); |
7a4d93c9b0ff
Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
47 }, |
491
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
48 |
295
841dc60824b5
Inherit from Base controller
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
202
diff
changeset
|
49 addItem: function(button) { |
202
7a4d93c9b0ff
Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
50 var zusatzwert = Ext.create('Lada.model.Status'); |
7a4d93c9b0ff
Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
51 zusatzwert.set('probeId', button.probeId); |
7a4d93c9b0ff
Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
52 zusatzwert.set('messungsId', button.parentId); |
500
ad7f574b382a
Fixed some js related issues (unused vars, arrays, etc.) and code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
499
diff
changeset
|
53 Ext.widget('statuscreate', { |
491
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
54 model: zusatzwert |
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
55 }); |
202
7a4d93c9b0ff
Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
56 }, |
491
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
57 |
540
99e738c17b81
Add detail button to tables
Roland Geider <roland.geider@intevation.de>
parents:
523
diff
changeset
|
58 editItem: function(button) { |
99e738c17b81
Add detail button to tables
Roland Geider <roland.geider@intevation.de>
parents:
523
diff
changeset
|
59 var grid = button.up('grid'); |
99e738c17b81
Add detail button to tables
Roland Geider <roland.geider@intevation.de>
parents:
523
diff
changeset
|
60 var selection = grid.getView().getSelectionModel().getSelection()[0]; |
99e738c17b81
Add detail button to tables
Roland Geider <roland.geider@intevation.de>
parents:
523
diff
changeset
|
61 var statusId = selection.getId(); |
99e738c17b81
Add detail button to tables
Roland Geider <roland.geider@intevation.de>
parents:
523
diff
changeset
|
62 var record = selection.store.getById(statusId); |
99e738c17b81
Add detail button to tables
Roland Geider <roland.geider@intevation.de>
parents:
523
diff
changeset
|
63 |
490
446e99cfd425
Updated views and controllers using the new model and stores.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
472
diff
changeset
|
64 var mstore = Ext.data.StoreManager.get('Messungen'); |
446e99cfd425
Updated views and controllers using the new model and stores.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
472
diff
changeset
|
65 var messung = mstore.getById(record.get('messungsId')); |
446e99cfd425
Updated views and controllers using the new model and stores.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
472
diff
changeset
|
66 record.getAuthInfo(this.initEditWindow, messung.get('probeId')); |
362
6a7a9267e00f
Issue56: Changed way how to set the form and window to readonly. Now all dialogs should
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
295
diff
changeset
|
67 }, |
491
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
68 |
500
ad7f574b382a
Fixed some js related issues (unused vars, arrays, etc.) and code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
499
diff
changeset
|
69 initEditWindow: function(record, readonly) { |
491
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
70 var view = Ext.widget('statuscreate', { |
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
71 model: record |
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
72 }); |
500
ad7f574b382a
Fixed some js related issues (unused vars, arrays, etc.) and code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
499
diff
changeset
|
73 var ignore = []; |
362
6a7a9267e00f
Issue56: Changed way how to set the form and window to readonly. Now all dialogs should
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
295
diff
changeset
|
74 if (readonly) { |
6a7a9267e00f
Issue56: Changed way how to set the form and window to readonly. Now all dialogs should
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
295
diff
changeset
|
75 var form = view.down('form'); |
6a7a9267e00f
Issue56: Changed way how to set the form and window to readonly. Now all dialogs should
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
295
diff
changeset
|
76 form.setReadOnly(true, ignore); |
6a7a9267e00f
Issue56: Changed way how to set the form and window to readonly. Now all dialogs should
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
295
diff
changeset
|
77 } |
202
7a4d93c9b0ff
Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
78 }, |
491
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
79 |
500
ad7f574b382a
Fixed some js related issues (unused vars, arrays, etc.) and code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
499
diff
changeset
|
80 createSuccess: function(form) { |
202
7a4d93c9b0ff
Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
81 // Reload store |
7a4d93c9b0ff
Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
82 var store = this.getStatusStore(); |
7a4d93c9b0ff
Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
83 store.reload(); |
7a4d93c9b0ff
Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
84 var win = form.up('window'); |
7a4d93c9b0ff
Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
85 win.close(); |
7a4d93c9b0ff
Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
86 }, |
491
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
87 |
500
ad7f574b382a
Fixed some js related issues (unused vars, arrays, etc.) and code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
499
diff
changeset
|
88 editSuccess: function(form) { |
202
7a4d93c9b0ff
Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
89 // Reload store |
7a4d93c9b0ff
Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
90 var store = this.getStatusStore(); |
7a4d93c9b0ff
Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
91 store.reload(); |
7a4d93c9b0ff
Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
92 var win = form.up('window'); |
7a4d93c9b0ff
Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
93 win.close(); |
422
f9bb1ecf6462
Removed trailing commas.
Raimund Renkert <rrenkert@intevation.de>
parents:
362
diff
changeset
|
94 } |
202
7a4d93c9b0ff
Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
95 }); |