annotate app/controller/Kommentare.js @ 497:7c0653e8d9f7

Fixed some js related issues (unused vars, arrays, etc.) and code style.
author Raimund Renkert <raimund.renkert@intevation.de>
date Thu, 06 Nov 2014 10:38:17 +0100
parents 850ccfe5f3c4
children 8b4ec61c5752
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
285
6c030e5739a7 Added Docstrings
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 204
diff changeset
9 /**
6c030e5739a7 Added Docstrings
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 204
diff changeset
10 * Controller for Kommentare
6c030e5739a7 Added Docstrings
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 204
diff changeset
11 */
54
3c7bfff8bd64 Added Controller for kommentare
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
12 Ext.define('Lada.controller.Kommentare', {
286
c509e9f6d4db Added BaseController and inherit Kommentar controller from it.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 285
diff changeset
13 extend: 'Lada.controller.Base',
491
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 490
diff changeset
14
54
3c7bfff8bd64 Added Controller for kommentare
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
15 views: [
107
84f32c62670f Added form to create kommentare
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 61
diff changeset
16 'kommentare.Create'
54
3c7bfff8bd64 Added Controller for kommentare
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
17 ],
491
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 490
diff changeset
18
54
3c7bfff8bd64 Added Controller for kommentare
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 'KommentareP'
54
3c7bfff8bd64 Added Controller for kommentare
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
54
3c7bfff8bd64 Added Controller for kommentare
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 'KommentarP'
54
3c7bfff8bd64 Added Controller for kommentare
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
288
ea60be45fd4d Remeoved methods which are defined in the base class.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 286
diff changeset
27 init: function() {
ea60be45fd4d Remeoved methods which are defined in the base class.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 286
diff changeset
28 console.log('Initialising the Kommentare controller');
ea60be45fd4d Remeoved methods which are defined in the base class.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 286
diff changeset
29 this.callParent();
ea60be45fd4d Remeoved methods which are defined in the base class.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 286
diff changeset
30 },
491
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 490
diff changeset
31
286
c509e9f6d4db Added BaseController and inherit Kommentar controller from it.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 285
diff changeset
32 addListeners: function() {
54
3c7bfff8bd64 Added Controller for kommentare
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
33 this.control({
55
4fa3fba50f79 Added dialog for editing kommentare. Open the dialog on double click on a
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 54
diff changeset
34 'kommentarelist': {
286
c509e9f6d4db Added BaseController and inherit Kommentar controller from it.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 285
diff changeset
35 itemdblclick: this.editItem
59
9e23eca8dfc7 Added function to delete kommentare
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 55
diff changeset
36 },
60
5db7ab34af6d Implemented Adding und Editing Kommentare
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 59
diff changeset
37 'kommentarelist toolbar button[action=add]': {
286
c509e9f6d4db Added BaseController and inherit Kommentar controller from it.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 285
diff changeset
38 click: this.addItem
60
5db7ab34af6d Implemented Adding und Editing Kommentare
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 59
diff changeset
39 },
59
9e23eca8dfc7 Added function to delete kommentare
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 55
diff changeset
40 'kommentarelist toolbar button[action=delete]': {
286
c509e9f6d4db Added BaseController and inherit Kommentar controller from it.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 285
diff changeset
41 click: this.deleteItem
60
5db7ab34af6d Implemented Adding und Editing Kommentare
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 59
diff changeset
42 },
144
7b1140bd8b3d Re-Added Kommentare
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 111
diff changeset
43 'kommentarecreate button[action=save]': {
286
c509e9f6d4db Added BaseController and inherit Kommentar controller from it.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 285
diff changeset
44 click: this.saveItem
144
7b1140bd8b3d Re-Added Kommentare
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 111
diff changeset
45 },
111
6273b73b4b27 Replaced Logic for Kommentare. Use copied code form Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 107
diff changeset
46 'kommentarecreate form': {
6273b73b4b27 Replaced Logic for Kommentare. Use copied code form Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 107
diff changeset
47 savesuccess: this.createSuccess,
6273b73b4b27 Replaced Logic for Kommentare. Use copied code form Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 107
diff changeset
48 savefailure: this.createFailure
55
4fa3fba50f79 Added dialog for editing kommentare. Open the dialog on double click on a
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 54
diff changeset
49 }
54
3c7bfff8bd64 Added Controller for kommentare
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
50 });
3c7bfff8bd64 Added Controller for kommentare
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
51 },
491
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 490
diff changeset
52
286
c509e9f6d4db Added BaseController and inherit Kommentar controller from it.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 285
diff changeset
53 addItem: function(button) {
144
7b1140bd8b3d Re-Added Kommentare
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 111
diff changeset
54 console.log('Adding new Kommentar for Probe ' + button.probeId);
490
446e99cfd425 Updated views and controllers using the new model and stores.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 472
diff changeset
55 var kommentar = Ext.create('Lada.model.KommentarP');
144
7b1140bd8b3d Re-Added Kommentare
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 111
diff changeset
56 kommentar.set('probeId', button.probeId);
497
7c0653e8d9f7 Fixed some js related issues (unused vars, arrays, etc.) and code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 491
diff changeset
57 Ext.widget('kommentarecreate', {
491
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 490
diff changeset
58 model: kommentar
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 490
diff changeset
59 });
111
6273b73b4b27 Replaced Logic for Kommentare. Use copied code form Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 107
diff changeset
60 },
491
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 490
diff changeset
61
286
c509e9f6d4db Added BaseController and inherit Kommentar controller from it.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 285
diff changeset
62 editItem: function(grid, record) {
111
6273b73b4b27 Replaced Logic for Kommentare. Use copied code form Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 107
diff changeset
63 console.log('Editing Kommentar');
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);
7c0653e8d9f7 Fixed some js related issues (unused vars, arrays, etc.) and code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 491
diff changeset
65 console.log('Loaded Kommentar with ID ' + record.getId());
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: 288
diff changeset
66 },
491
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 490
diff changeset
67
497
7c0653e8d9f7 Fixed some js related issues (unused vars, arrays, etc.) and code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 491
diff changeset
68 initEditWindow: function(record, readonly) {
491
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 490
diff changeset
69 var view = Ext.widget('kommentarecreate', {
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 });
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 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: 288
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: 288
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: 288
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: 288
diff changeset
76 }
60
5db7ab34af6d Implemented Adding und Editing Kommentare
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 59
diff changeset
77 },
491
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 490
diff changeset
78
497
7c0653e8d9f7 Fixed some js related issues (unused vars, arrays, etc.) and code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 491
diff changeset
79 createSuccess: function(form) {
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.getKommentarePStore();
111
6273b73b4b27 Replaced Logic for Kommentare. Use copied code form Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 107
diff changeset
81 store.reload();
6273b73b4b27 Replaced Logic for Kommentare. Use copied code form Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 107
diff changeset
82 var win = form.up('window');
6273b73b4b27 Replaced Logic for Kommentare. Use copied code form Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 107
diff changeset
83 win.close();
54
3c7bfff8bd64 Added Controller for kommentare
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
84 }
3c7bfff8bd64 Added Controller for kommentare
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
85 });

http://lada.wald.intevation.org