annotate app/controller/Status.js @ 491:850ccfe5f3c4

Code style.
author Raimund Renkert <raimund.renkert@intevation.de>
date Fri, 31 Oct 2014 23:23:32 +0100
parents 446e99cfd425
children 8b4ec61c5752
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',
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() {
7a4d93c9b0ff Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
21 console.log('Initialising the Status controller');
491
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 490
diff changeset
22 this.callParent(arguments);
295
841dc60824b5 Inherit from Base controller
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 202
diff changeset
23 },
491
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 490
diff changeset
24
295
841dc60824b5 Inherit from Base controller
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 202
diff changeset
25 addListeners: function() {
202
7a4d93c9b0ff Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
26 this.control({
7a4d93c9b0ff Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
27 'statuslist': {
295
841dc60824b5 Inherit from Base controller
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 202
diff changeset
28 itemdblclick: this.editItem
202
7a4d93c9b0ff Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
29 },
7a4d93c9b0ff Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
30 'statuslist toolbar button[action=add]': {
295
841dc60824b5 Inherit from Base controller
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 202
diff changeset
31 click: this.addItem
202
7a4d93c9b0ff Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
32 },
7a4d93c9b0ff Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
33 'statuslist toolbar button[action=delete]': {
295
841dc60824b5 Inherit from Base controller
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 202
diff changeset
34 click: this.deleteItem
202
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 form': {
7a4d93c9b0ff Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
37 savesuccess: this.createSuccess,
7a4d93c9b0ff Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
38 savefailure: this.createFailure
7a4d93c9b0ff Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
39 },
7a4d93c9b0ff Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
40 'statuscreate button[action=save]': {
295
841dc60824b5 Inherit from Base controller
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 202
diff changeset
41 click: this.saveItem
202
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 'statusedit form': {
7a4d93c9b0ff Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
44 savesuccess: this.editSuccess,
7a4d93c9b0ff Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
45 savefailure: this.editFailure
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 });
7a4d93c9b0ff Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
48 },
491
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 490
diff changeset
49
295
841dc60824b5 Inherit from Base controller
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 202
diff changeset
50 addItem: function(button) {
202
7a4d93c9b0ff Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
51 var zusatzwert = Ext.create('Lada.model.Status');
7a4d93c9b0ff Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
52 zusatzwert.set('probeId', button.probeId);
7a4d93c9b0ff Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
53 zusatzwert.set('messungsId', button.parentId);
491
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 490
diff changeset
54 var view = Ext.widget('statuscreate', {
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 490
diff changeset
55 model: zusatzwert
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 490
diff changeset
56 });
202
7a4d93c9b0ff Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
57 },
491
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 490
diff changeset
58
295
841dc60824b5 Inherit from Base controller
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 202
diff changeset
59 editItem: function(grid, record) {
202
7a4d93c9b0ff Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
60 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
61 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
62 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
63 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
64 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
65 },
491
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 490
diff changeset
66
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 initEditWindow: function(record, readonly, owner) {
491
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 490
diff changeset
68 var view = Ext.widget('statuscreate', {
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 490
diff changeset
69 model: record
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 490
diff changeset
70 });
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
71 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
72 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
73 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
74 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
75 }
202
7a4d93c9b0ff Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
76 },
491
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 490
diff changeset
77
202
7a4d93c9b0ff Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
78 createSuccess: function(form, record, operation) {
7a4d93c9b0ff Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
79 // Reload store
7a4d93c9b0ff Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
80 var store = this.getStatusStore();
7a4d93c9b0ff Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
81 store.reload();
7a4d93c9b0ff Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
82 var win = form.up('window');
7a4d93c9b0ff Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
83 win.close();
7a4d93c9b0ff Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
84 },
491
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 490
diff changeset
85
202
7a4d93c9b0ff Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
86 editSuccess: function(form, record, operation) {
7a4d93c9b0ff Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
87 // Reload store
7a4d93c9b0ff Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
88 var store = this.getStatusStore();
7a4d93c9b0ff Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
89 store.reload();
7a4d93c9b0ff Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
90 var win = form.up('window');
7a4d93c9b0ff Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
91 win.close();
422
f9bb1ecf6462 Removed trailing commas.
Raimund Renkert <rrenkert@intevation.de>
parents: 362
diff changeset
92 }
202
7a4d93c9b0ff Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
93 });

http://lada.wald.intevation.org