annotate app/controller/MKommentare.js @ 440:d900db3e9be9

Added tag 0.9 for changeset 1fc4407c6c83
author Raimund Renkert <rrenkert@intevation.de>
date Mon, 02 Dec 2013 15:20:30 +0100
parents 6a7a9267e00f
children debfcc7713e3
rev   line source
291
e95662994c50 Inherit from Base controller
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 207
diff changeset
1 /**
e95662994c50 Inherit from Base controller
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 207
diff changeset
2 * Controller for Kommentare on Messungen
e95662994c50 Inherit from Base controller
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 207
diff changeset
3 */
205
cd8cd3ac0231 Added new Controller for MKommentare.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
4 Ext.define('Lada.controller.MKommentare', {
291
e95662994c50 Inherit from Base controller
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 207
diff changeset
5 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
6 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
7 '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
8 ],
205
cd8cd3ac0231 Added new Controller for MKommentare.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
9 stores: [
cd8cd3ac0231 Added new Controller for MKommentare.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
10 'MKommentare'
cd8cd3ac0231 Added new Controller for MKommentare.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
11 ],
cd8cd3ac0231 Added new Controller for MKommentare.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
12 models: [
cd8cd3ac0231 Added new Controller for MKommentare.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
13 'MKommentar'
cd8cd3ac0231 Added new Controller for MKommentare.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
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 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
16 console.log('Initialising the MKommentare controller');
291
e95662994c50 Inherit from Base controller
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 207
diff changeset
17 this.callParent();
e95662994c50 Inherit from Base controller
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 207
diff changeset
18 },
e95662994c50 Inherit from Base controller
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 207
diff changeset
19 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
20 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
21 'mkommentarelist': {
291
e95662994c50 Inherit from Base controller
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 207
diff changeset
22 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
23 },
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 'mkommentarelist toolbar button[action=add]': {
291
e95662994c50 Inherit from Base controller
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 207
diff changeset
25 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
26 },
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 'mkommentarelist toolbar button[action=delete]': {
291
e95662994c50 Inherit from Base controller
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 207
diff changeset
28 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
29 },
62e116cd3e3b Inheritance of Mkommentare from Kommentare does not work as expected. So write
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 205
diff changeset
30 'mkommentarecreate button[action=save]': {
291
e95662994c50 Inherit from Base controller
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 207
diff changeset
31 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
32 },
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 '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
34 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
35 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
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 });
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 },
291
e95662994c50 Inherit from Base controller
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 207
diff changeset
39 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
40 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
41 var kommentar = Ext.create('Lada.model.MKommentar');
cd8cd3ac0231 Added new Controller for MKommentare.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
42 kommentar.set('probeId', button.probeId);
cd8cd3ac0231 Added new Controller for MKommentare.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
43 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
44 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
45 },
291
e95662994c50 Inherit from Base controller
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 207
diff changeset
46 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
47 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
48 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
49 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
50 },
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
51 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
52 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
53 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
54 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
55 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
56 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
57 }
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
58 },
205
cd8cd3ac0231 Added new Controller for MKommentare.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
59 createSuccess: function(form, record, operation) {
cd8cd3ac0231 Added new Controller for MKommentare.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
60 // Reload store
cd8cd3ac0231 Added new Controller for MKommentare.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
61 var store = this.getMKommentareStore();
cd8cd3ac0231 Added new Controller for MKommentare.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
62 store.reload();
cd8cd3ac0231 Added new Controller for MKommentare.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
63 var win = form.up('window');
cd8cd3ac0231 Added new Controller for MKommentare.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
64 win.close();
cd8cd3ac0231 Added new Controller for MKommentare.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
65 }
cd8cd3ac0231 Added new Controller for MKommentare.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
66 });

http://lada.wald.intevation.org