Mercurial > lada > lada-client
annotate app/controller/Status.js @ 504:44e054626bdd
Code cleanup.
author | Raimund Renkert <raimund.renkert@intevation.de> |
---|---|
date | Fri, 12 Dec 2014 12:18:22 +0100 |
parents | ad7f574b382a |
children | 6ad453afbc31 |
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({ |
7a4d93c9b0ff
Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
26 'statuslist': { |
295
841dc60824b5
Inherit from Base controller
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
202
diff
changeset
|
27 itemdblclick: this.editItem |
202
7a4d93c9b0ff
Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
28 }, |
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 |
295
841dc60824b5
Inherit from Base controller
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
202
diff
changeset
|
58 editItem: function(grid, record) { |
490
446e99cfd425
Updated views and controllers using the new model and stores.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
472
diff
changeset
|
59 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
|
60 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
|
61 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
|
62 }, |
491
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
63 |
500
ad7f574b382a
Fixed some js related issues (unused vars, arrays, etc.) and code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
499
diff
changeset
|
64 initEditWindow: function(record, readonly) { |
491
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
65 var view = Ext.widget('statuscreate', { |
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
66 model: record |
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
67 }); |
500
ad7f574b382a
Fixed some js related issues (unused vars, arrays, etc.) and code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
499
diff
changeset
|
68 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
|
69 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
|
70 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
|
71 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
|
72 } |
202
7a4d93c9b0ff
Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
73 }, |
491
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
74 |
500
ad7f574b382a
Fixed some js related issues (unused vars, arrays, etc.) and code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
499
diff
changeset
|
75 createSuccess: function(form) { |
202
7a4d93c9b0ff
Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
76 // Reload store |
7a4d93c9b0ff
Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
77 var store = this.getStatusStore(); |
7a4d93c9b0ff
Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
78 store.reload(); |
7a4d93c9b0ff
Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
79 var win = form.up('window'); |
7a4d93c9b0ff
Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
80 win.close(); |
7a4d93c9b0ff
Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
81 }, |
491
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
82 |
500
ad7f574b382a
Fixed some js related issues (unused vars, arrays, etc.) and code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
499
diff
changeset
|
83 editSuccess: function(form) { |
202
7a4d93c9b0ff
Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
84 // Reload store |
7a4d93c9b0ff
Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
85 var store = this.getStatusStore(); |
7a4d93c9b0ff
Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
86 store.reload(); |
7a4d93c9b0ff
Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
87 var win = form.up('window'); |
7a4d93c9b0ff
Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
88 win.close(); |
422
f9bb1ecf6462
Removed trailing commas.
Raimund Renkert <rrenkert@intevation.de>
parents:
362
diff
changeset
|
89 } |
202
7a4d93c9b0ff
Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
90 }); |