Mercurial > lada > lada-client
annotate app/controller/MKommentare.js @ 499:8b4ec61c5752
Removed most log messages to make the application less verbose.
author | Raimund Renkert <raimund.renkert@intevation.de> |
---|---|
date | Thu, 06 Nov 2014 11:12:21 +0100 |
parents | 7c0653e8d9f7 |
children | 8972f008dfb1 |
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({ |
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 'mkommentarelist': { |
291
e95662994c50
Inherit from Base controller
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
207
diff
changeset
|
34 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
|
35 }, |
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 |
291
e95662994c50
Inherit from Base controller
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
207
diff
changeset
|
61 editItem: function(grid, record) { |
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')); |
497
7c0653e8d9f7
Fixed some js related issues (unused vars, arrays, etc.) and code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
491
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 }, |
491
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
66 |
497
7c0653e8d9f7
Fixed some js related issues (unused vars, arrays, etc.) and code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
491
diff
changeset
|
67 initEditWindow: function(record, readonly) { |
491
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
68 var view = Ext.widget('mkommentarecreate', { |
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
69 model: record |
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
70 }); |
497
7c0653e8d9f7
Fixed some js related issues (unused vars, arrays, etc.) and code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
491
diff
changeset
|
71 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
|
72 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
|
73 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
|
74 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
|
75 } |
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
|
76 }, |
491
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
77 |
497
7c0653e8d9f7
Fixed some js related issues (unused vars, arrays, etc.) and code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
491
diff
changeset
|
78 createSuccess: function(form) { |
205
cd8cd3ac0231
Added new Controller for MKommentare.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
79 // Reload store |
490
446e99cfd425
Updated views and controllers using the new model and stores.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
472
diff
changeset
|
80 var store = this.getKommentareMStore(); |
205
cd8cd3ac0231
Added new Controller for MKommentare.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
81 store.reload(); |
cd8cd3ac0231
Added new Controller for MKommentare.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
82 var win = form.up('window'); |
cd8cd3ac0231
Added new Controller for MKommentare.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
83 win.close(); |
cd8cd3ac0231
Added new Controller for MKommentare.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
84 } |
cd8cd3ac0231
Added new Controller for MKommentare.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
85 }); |