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

Code style.
author Raimund Renkert <raimund.renkert@intevation.de>
date Fri, 31 Oct 2014 23:23:32 +0100
parents 446e99cfd425
children 7c0653e8d9f7
rev   line source
472
debfcc7713e3 Added license header to each file.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 362
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: 362
diff changeset
2 * Software engineering by Intevation GmbH
debfcc7713e3 Added license header to each file.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 362
diff changeset
3 *
debfcc7713e3 Added license header to each file.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 362
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: 362
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: 362
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: 362
diff changeset
7 */
debfcc7713e3 Added license header to each file.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 362
diff changeset
8
291
e95662994c50 Inherit from Base controller
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 207
diff changeset
9 /**
e95662994c50 Inherit from Base controller
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 207
diff changeset
10 * Controller for Kommentare on Messungen
e95662994c50 Inherit from Base controller
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 207
diff changeset
11 */
205
cd8cd3ac0231 Added new Controller for MKommentare.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
12 Ext.define('Lada.controller.MKommentare', {
291
e95662994c50 Inherit from Base controller
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 207
diff changeset
13 extend: 'Lada.controller.Base',
491
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 490
diff changeset
14
207
62e116cd3e3b Inheritance of Mkommentare from Kommentare does not work as expected. So write
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 205
diff changeset
15 views: [
62e116cd3e3b Inheritance of Mkommentare from Kommentare does not work as expected. So write
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 205
diff changeset
16 'mkommentare.Create'
62e116cd3e3b Inheritance of Mkommentare from Kommentare does not work as expected. So write
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 205
diff changeset
17 ],
491
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 490
diff changeset
18
205
cd8cd3ac0231 Added new Controller for MKommentare.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
19 stores: [
490
446e99cfd425 Updated views and controllers using the new model and stores.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 472
diff changeset
20 'KommentareM'
205
cd8cd3ac0231 Added new Controller for MKommentare.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
21 ],
491
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 490
diff changeset
22
205
cd8cd3ac0231 Added new Controller for MKommentare.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
23 models: [
490
446e99cfd425 Updated views and controllers using the new model and stores.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 472
diff changeset
24 'KommentarM'
205
cd8cd3ac0231 Added new Controller for MKommentare.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
25 ],
491
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 490
diff changeset
26
207
62e116cd3e3b Inheritance of Mkommentare from Kommentare does not work as expected. So write
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 205
diff changeset
27 init: function() {
62e116cd3e3b Inheritance of Mkommentare from Kommentare does not work as expected. So write
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 205
diff changeset
28 console.log('Initialising the MKommentare controller');
491
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 490
diff changeset
29 this.callParent(arguments);
291
e95662994c50 Inherit from Base controller
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 207
diff changeset
30 },
491
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 490
diff changeset
31
291
e95662994c50 Inherit from Base controller
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 207
diff changeset
32 addListeners: function() {
207
62e116cd3e3b Inheritance of Mkommentare from Kommentare does not work as expected. So write
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 205
diff changeset
33 this.control({
62e116cd3e3b Inheritance of Mkommentare from Kommentare does not work as expected. So write
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 205
diff changeset
34 'mkommentarelist': {
291
e95662994c50 Inherit from Base controller
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 207
diff changeset
35 itemdblclick: this.editItem
207
62e116cd3e3b Inheritance of Mkommentare from Kommentare does not work as expected. So write
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 205
diff changeset
36 },
62e116cd3e3b Inheritance of Mkommentare from Kommentare does not work as expected. So write
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 205
diff changeset
37 'mkommentarelist toolbar button[action=add]': {
291
e95662994c50 Inherit from Base controller
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 207
diff changeset
38 click: this.addItem
207
62e116cd3e3b Inheritance of Mkommentare from Kommentare does not work as expected. So write
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 205
diff changeset
39 },
62e116cd3e3b Inheritance of Mkommentare from Kommentare does not work as expected. So write
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 205
diff changeset
40 'mkommentarelist toolbar button[action=delete]': {
291
e95662994c50 Inherit from Base controller
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 207
diff changeset
41 click: this.deleteItem
207
62e116cd3e3b Inheritance of Mkommentare from Kommentare does not work as expected. So write
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 205
diff changeset
42 },
62e116cd3e3b Inheritance of Mkommentare from Kommentare does not work as expected. So write
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 205
diff changeset
43 'mkommentarecreate button[action=save]': {
291
e95662994c50 Inherit from Base controller
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 207
diff changeset
44 click: this.saveItem
207
62e116cd3e3b Inheritance of Mkommentare from Kommentare does not work as expected. So write
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 205
diff changeset
45 },
62e116cd3e3b Inheritance of Mkommentare from Kommentare does not work as expected. So write
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 205
diff changeset
46 'mkommentarecreate form': {
62e116cd3e3b Inheritance of Mkommentare from Kommentare does not work as expected. So write
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 205
diff changeset
47 savesuccess: this.createSuccess,
62e116cd3e3b Inheritance of Mkommentare from Kommentare does not work as expected. So write
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 205
diff changeset
48 savefailure: this.createFailure
62e116cd3e3b Inheritance of Mkommentare from Kommentare does not work as expected. So write
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 205
diff changeset
49 }
62e116cd3e3b Inheritance of Mkommentare from Kommentare does not work as expected. So write
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 205
diff changeset
50 });
62e116cd3e3b Inheritance of Mkommentare from Kommentare does not work as expected. So write
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 205
diff changeset
51 },
491
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 490
diff changeset
52
291
e95662994c50 Inherit from Base controller
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 207
diff changeset
53 addItem: function(button) {
490
446e99cfd425 Updated views and controllers using the new model and stores.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 472
diff changeset
54 var kommentar = Ext.create('Lada.model.KommentarM');
205
cd8cd3ac0231 Added new Controller for MKommentare.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
55 kommentar.set('probeId', button.probeId);
cd8cd3ac0231 Added new Controller for MKommentare.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
56 kommentar.set('messungsId', button.parentId);
207
62e116cd3e3b Inheritance of Mkommentare from Kommentare does not work as expected. So write
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 205
diff changeset
57 var view = Ext.widget('mkommentarecreate', {model: kommentar});
62e116cd3e3b Inheritance of Mkommentare from Kommentare does not work as expected. So write
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 205
diff changeset
58 },
491
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 490
diff changeset
59
291
e95662994c50 Inherit from Base controller
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 207
diff changeset
60 editItem: function(grid, record) {
207
62e116cd3e3b Inheritance of Mkommentare from Kommentare does not work as expected. So write
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 205
diff changeset
61 console.log('Editing Kommentar');
490
446e99cfd425 Updated views and controllers using the new model and stores.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 472
diff changeset
62 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
63 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
64 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: 291
diff changeset
65 console.log("Loaded MKommentar 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: 291
diff changeset
66 },
491
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 490
diff changeset
67
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: 291
diff changeset
68 initEditWindow: function(record, readonly, owner) {
491
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 490
diff changeset
69 var view = Ext.widget('mkommentarecreate', {
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 490
diff changeset
70 model: record
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 490
diff changeset
71 });
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: 291
diff changeset
72 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: 291
diff changeset
73 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: 291
diff changeset
74 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: 291
diff changeset
75 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: 291
diff changeset
76 }
207
62e116cd3e3b Inheritance of Mkommentare from Kommentare does not work as expected. So write
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 205
diff changeset
77 },
491
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 490
diff changeset
78
205
cd8cd3ac0231 Added new Controller for MKommentare.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
79 createSuccess: function(form, record, operation) {
cd8cd3ac0231 Added new Controller for MKommentare.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
80 // Reload store
490
446e99cfd425 Updated views and controllers using the new model and stores.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 472
diff changeset
81 var store = this.getKommentareMStore();
205
cd8cd3ac0231 Added new Controller for MKommentare.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
82 store.reload();
cd8cd3ac0231 Added new Controller for MKommentare.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
83 var win = form.up('window');
cd8cd3ac0231 Added new Controller for MKommentare.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
84 win.close();
cd8cd3ac0231 Added new Controller for MKommentare.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
85 }
cd8cd3ac0231 Added new Controller for MKommentare.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
86 });

http://lada.wald.intevation.org