annotate app/controller/MKommentare.js @ 472:debfcc7713e3

Added license header to each file.
author Torsten Irländer <torsten.irlaender@intevation.de>
date Thu, 16 Jan 2014 17:34:30 +0100
parents 6a7a9267e00f
children 446e99cfd425
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',
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
14 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
15 '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
16 ],
205
cd8cd3ac0231 Added new Controller for MKommentare.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
17 stores: [
cd8cd3ac0231 Added new Controller for MKommentare.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
18 'MKommentare'
cd8cd3ac0231 Added new Controller for MKommentare.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
19 ],
cd8cd3ac0231 Added new Controller for MKommentare.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
20 models: [
cd8cd3ac0231 Added new Controller for MKommentare.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
21 'MKommentar'
cd8cd3ac0231 Added new Controller for MKommentare.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
22 ],
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
23 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
24 console.log('Initialising the MKommentare controller');
291
e95662994c50 Inherit from Base controller
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 207
diff changeset
25 this.callParent();
e95662994c50 Inherit from Base controller
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 207
diff changeset
26 },
e95662994c50 Inherit from Base controller
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 207
diff changeset
27 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
28 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
29 'mkommentarelist': {
291
e95662994c50 Inherit from Base controller
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 207
diff changeset
30 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
31 },
62e116cd3e3b Inheritance of Mkommentare from Kommentare does not work as expected. So write
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 205
diff changeset
32 'mkommentarelist toolbar button[action=add]': {
291
e95662994c50 Inherit from Base controller
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 207
diff changeset
33 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
34 },
62e116cd3e3b Inheritance of Mkommentare from Kommentare does not work as expected. So write
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 205
diff changeset
35 'mkommentarelist toolbar button[action=delete]': {
291
e95662994c50 Inherit from Base controller
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 207
diff changeset
36 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
37 },
62e116cd3e3b Inheritance of Mkommentare from Kommentare does not work as expected. So write
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 205
diff changeset
38 'mkommentarecreate button[action=save]': {
291
e95662994c50 Inherit from Base controller
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 207
diff changeset
39 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
40 },
62e116cd3e3b Inheritance of Mkommentare from Kommentare does not work as expected. So write
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 205
diff changeset
41 '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
42 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
43 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
44 }
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 },
291
e95662994c50 Inherit from Base controller
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 207
diff changeset
47 addItem: function(button) {
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
48 console.log('Adding new MKommentar for Messung ' + button.parentId + ' Probe ' + button.probeId);
205
cd8cd3ac0231 Added new Controller for MKommentare.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
49 var kommentar = Ext.create('Lada.model.MKommentar');
cd8cd3ac0231 Added new Controller for MKommentare.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
50 kommentar.set('probeId', button.probeId);
cd8cd3ac0231 Added new Controller for MKommentare.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
51 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
52 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
53 },
291
e95662994c50 Inherit from Base controller
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 207
diff changeset
54 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
55 console.log('Editing Kommentar');
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
56 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: 291
diff changeset
57 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
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: 291
diff changeset
59 initEditWindow: function(record, readonly, owner) {
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
60 var view = Ext.widget('mkommentarecreate', {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: 291
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: 291
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: 291
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: 291
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: 291
diff changeset
65 }
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
66 },
205
cd8cd3ac0231 Added new Controller for MKommentare.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
67 createSuccess: function(form, record, operation) {
cd8cd3ac0231 Added new Controller for MKommentare.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
68 // Reload store
cd8cd3ac0231 Added new Controller for MKommentare.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
69 var store = this.getMKommentareStore();
cd8cd3ac0231 Added new Controller for MKommentare.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
70 store.reload();
cd8cd3ac0231 Added new Controller for MKommentare.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
71 var win = form.up('window');
cd8cd3ac0231 Added new Controller for MKommentare.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
72 win.close();
cd8cd3ac0231 Added new Controller for MKommentare.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
73 }
cd8cd3ac0231 Added new Controller for MKommentare.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
74 });

http://lada.wald.intevation.org