annotate app/controller/Status.js @ 486:0952c7767d98

Added new static data matching the new data model.
author Raimund Renkert <raimund.renkert@intevation.de>
date Fri, 31 Oct 2014 21:06:19 +0100
parents debfcc7713e3
children 446e99cfd425
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');
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
54 record.getAuthInfo(this.initEditWindow)
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
55 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
56 },
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 initEditWindow: function(record, readonly, owner) {
202
7a4d93c9b0ff Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
58 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
59 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
60 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
61 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
62 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
63 }
202
7a4d93c9b0ff Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
64 },
7a4d93c9b0ff Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
65 createSuccess: function(form, record, operation) {
7a4d93c9b0ff Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
66 // Reload store
7a4d93c9b0ff Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
67 var store = this.getStatusStore();
7a4d93c9b0ff Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
68 store.reload();
7a4d93c9b0ff Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
69 var win = form.up('window');
7a4d93c9b0ff Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
70 win.close();
7a4d93c9b0ff Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
71 },
7a4d93c9b0ff Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
72 editSuccess: function(form, record, operation) {
7a4d93c9b0ff Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
73 // Reload store
7a4d93c9b0ff Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
74 var store = this.getStatusStore();
7a4d93c9b0ff Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
75 store.reload();
7a4d93c9b0ff Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
76 var win = form.up('window');
7a4d93c9b0ff Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
77 win.close();
422
f9bb1ecf6462 Removed trailing commas.
Raimund Renkert <rrenkert@intevation.de>
parents: 362
diff changeset
78 }
202
7a4d93c9b0ff Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
79 });

http://lada.wald.intevation.org