annotate app/controller/MKommentare.js @ 540:99e738c17b81

Add detail button to tables
author Roland Geider <roland.geider@intevation.de>
date Wed, 17 Dec 2014 16:59:45 +0100
parents 8972f008dfb1
children
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
497
7c0653e8d9f7 Fixed some js related issues (unused vars, arrays, etc.) and code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 491
diff changeset
6 * the documentation coming with IMIS-Labordaten-Application for details.
472
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() {
491
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 490
diff changeset
28 this.callParent(arguments);
291
e95662994c50 Inherit from Base controller
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 207
diff changeset
29 },
491
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 490
diff changeset
30
291
e95662994c50 Inherit from Base controller
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 207
diff changeset
31 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
32 this.control({
540
99e738c17b81 Add detail button to tables
Roland Geider <roland.geider@intevation.de>
parents: 524
diff changeset
33 'mkommentarelist toolbar button[action=open]': {
99e738c17b81 Add detail button to tables
Roland Geider <roland.geider@intevation.de>
parents: 524
diff changeset
34 click: this.editItem
99e738c17b81 Add detail button to tables
Roland Geider <roland.geider@intevation.de>
parents: 524
diff changeset
35 },
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 'mkommentarelist toolbar button[action=add]': {
291
e95662994c50 Inherit from Base controller
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 207
diff changeset
37 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
38 },
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 'mkommentarelist toolbar button[action=delete]': {
291
e95662994c50 Inherit from Base controller
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 207
diff changeset
40 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
41 },
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 'mkommentarecreate button[action=save]': {
291
e95662994c50 Inherit from Base controller
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 207
diff changeset
43 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
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 '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
46 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
47 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
48 }
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 },
491
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 490
diff changeset
51
291
e95662994c50 Inherit from Base controller
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 207
diff changeset
52 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
53 var kommentar = Ext.create('Lada.model.KommentarM');
205
cd8cd3ac0231 Added new Controller for MKommentare.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
54 kommentar.set('probeId', button.probeId);
cd8cd3ac0231 Added new Controller for MKommentare.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
55 kommentar.set('messungsId', button.parentId);
497
7c0653e8d9f7 Fixed some js related issues (unused vars, arrays, etc.) and code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 491
diff changeset
56 Ext.widget('mkommentarecreate', {
7c0653e8d9f7 Fixed some js related issues (unused vars, arrays, etc.) and code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 491
diff changeset
57 model: kommentar
7c0653e8d9f7 Fixed some js related issues (unused vars, arrays, etc.) and code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 491
diff changeset
58 });
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
59 },
491
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 490
diff changeset
60
540
99e738c17b81 Add detail button to tables
Roland Geider <roland.geider@intevation.de>
parents: 524
diff changeset
61 editItem: function(button) {
99e738c17b81 Add detail button to tables
Roland Geider <roland.geider@intevation.de>
parents: 524
diff changeset
62 var grid = button.up('grid');
99e738c17b81 Add detail button to tables
Roland Geider <roland.geider@intevation.de>
parents: 524
diff changeset
63 var selection = grid.getView().getSelectionModel().getSelection()[0];
99e738c17b81 Add detail button to tables
Roland Geider <roland.geider@intevation.de>
parents: 524
diff changeset
64 var commentarId = selection.getId();
99e738c17b81 Add detail button to tables
Roland Geider <roland.geider@intevation.de>
parents: 524
diff changeset
65 var record = selection.store.getById(commentarId);
99e738c17b81 Add detail button to tables
Roland Geider <roland.geider@intevation.de>
parents: 524
diff changeset
66
490
446e99cfd425 Updated views and controllers using the new model and stores.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 472
diff changeset
67 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
68 var messung = mstore.getById(record.get('messungsId'));
497
7c0653e8d9f7 Fixed some js related issues (unused vars, arrays, etc.) and code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 491
diff changeset
69 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
70 },
491
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 490
diff changeset
71
497
7c0653e8d9f7 Fixed some js related issues (unused vars, arrays, etc.) and code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 491
diff changeset
72 initEditWindow: function(record, readonly) {
491
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 490
diff changeset
73 var view = Ext.widget('mkommentarecreate', {
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 490
diff changeset
74 model: record
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 490
diff changeset
75 });
497
7c0653e8d9f7 Fixed some js related issues (unused vars, arrays, etc.) and code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 491
diff changeset
76 var ignore = [];
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
77 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
78 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
79 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
80 }
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
81 },
491
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 490
diff changeset
82
497
7c0653e8d9f7 Fixed some js related issues (unused vars, arrays, etc.) and code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 491
diff changeset
83 createSuccess: function(form) {
205
cd8cd3ac0231 Added new Controller for MKommentare.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
84 // Reload store
490
446e99cfd425 Updated views and controllers using the new model and stores.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 472
diff changeset
85 var store = this.getKommentareMStore();
205
cd8cd3ac0231 Added new Controller for MKommentare.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
86 store.reload();
cd8cd3ac0231 Added new Controller for MKommentare.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
87 var win = form.up('window');
cd8cd3ac0231 Added new Controller for MKommentare.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
88 win.close();
cd8cd3ac0231 Added new Controller for MKommentare.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
89 }
cd8cd3ac0231 Added new Controller for MKommentare.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
90 });

http://lada.wald.intevation.org