annotate app/controller/Status.js @ 490:446e99cfd425

Updated views and controllers using the new model and stores.
author Raimund Renkert <raimund.renkert@intevation.de>
date Fri, 31 Oct 2014 21:28:31 +0100
parents debfcc7713e3
children 850ccfe5f3c4
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
debfcc7713e3 Added license header to each file.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 422
diff changeset
6 * the documentation coming with IMIS-Labordaten-Application for details.
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',
202
7a4d93c9b0ff Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
11 views: [
7a4d93c9b0ff Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
12 'status.Create'
7a4d93c9b0ff Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
13 ],
7a4d93c9b0ff Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
14 stores: [
7a4d93c9b0ff Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
15 'Status'
7a4d93c9b0ff Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
16 ],
7a4d93c9b0ff Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
17 init: function() {
7a4d93c9b0ff Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
18 console.log('Initialising the Status controller');
295
841dc60824b5 Inherit from Base controller
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 202
diff changeset
19 this.callParent();
841dc60824b5 Inherit from Base controller
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 202
diff changeset
20 },
841dc60824b5 Inherit from Base controller
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 202
diff changeset
21 addListeners: function() {
202
7a4d93c9b0ff Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
22 this.control({
7a4d93c9b0ff Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
23 'statuslist': {
295
841dc60824b5 Inherit from Base controller
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 202
diff changeset
24 itemdblclick: this.editItem
202
7a4d93c9b0ff Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
25 },
7a4d93c9b0ff Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
26 'statuslist toolbar button[action=add]': {
295
841dc60824b5 Inherit from Base controller
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 202
diff changeset
27 click: this.addItem
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=delete]': {
295
841dc60824b5 Inherit from Base controller
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 202
diff changeset
30 click: this.deleteItem
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 'statuscreate form': {
7a4d93c9b0ff Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
33 savesuccess: this.createSuccess,
7a4d93c9b0ff Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
34 savefailure: this.createFailure
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 'statuscreate button[action=save]': {
295
841dc60824b5 Inherit from Base controller
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 202
diff changeset
37 click: this.saveItem
202
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 'statusedit form': {
7a4d93c9b0ff Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
40 savesuccess: this.editSuccess,
7a4d93c9b0ff Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
41 savefailure: this.editFailure
7a4d93c9b0ff Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
42 }
7a4d93c9b0ff Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
43 });
7a4d93c9b0ff Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
44 },
295
841dc60824b5 Inherit from Base controller
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 202
diff changeset
45 addItem: function(button) {
202
7a4d93c9b0ff Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
46 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
47 var zusatzwert = Ext.create('Lada.model.Status');
7a4d93c9b0ff Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
48 zusatzwert.set('probeId', button.probeId);
7a4d93c9b0ff Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
49 zusatzwert.set('messungsId', button.parentId);
7a4d93c9b0ff Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
50 var view = Ext.widget('statuscreate', {model: zusatzwert});
7a4d93c9b0ff Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
51 },
295
841dc60824b5 Inherit from Base controller
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 202
diff changeset
52 editItem: function(grid, record) {
202
7a4d93c9b0ff Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
53 console.log('Editing Status');
490
446e99cfd425 Updated views and controllers using the new model and stores.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 472
diff changeset
54 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
55 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
56 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
57 console.log("Loaded Status with ID " + record.getId()); //outputs ID
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
58 },
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
59 initEditWindow: function(record, readonly, owner) {
202
7a4d93c9b0ff Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
60 var view = Ext.widget('statuscreate', {model: record});
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
61 var ignore = Array();
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 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
63 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
64 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
65 }
202
7a4d93c9b0ff Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
66 },
7a4d93c9b0ff Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
67 createSuccess: function(form, record, operation) {
7a4d93c9b0ff Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
68 // Reload store
7a4d93c9b0ff Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
69 var store = this.getStatusStore();
7a4d93c9b0ff Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
70 store.reload();
7a4d93c9b0ff Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
71 var win = form.up('window');
7a4d93c9b0ff Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
72 win.close();
7a4d93c9b0ff Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
73 },
7a4d93c9b0ff Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
74 editSuccess: function(form, record, operation) {
7a4d93c9b0ff Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
75 // Reload store
7a4d93c9b0ff Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
76 var store = this.getStatusStore();
7a4d93c9b0ff Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
77 store.reload();
7a4d93c9b0ff Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
78 var win = form.up('window');
7a4d93c9b0ff Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
79 win.close();
422
f9bb1ecf6462 Removed trailing commas.
Raimund Renkert <rrenkert@intevation.de>
parents: 362
diff changeset
80 }
202
7a4d93c9b0ff Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
81 });

http://lada.wald.intevation.org