Mercurial > lada > lada-client
annotate app/controller/Kommentare.js @ 488:f7446ebfe5d0
Added and updated models.
author | Raimund Renkert <raimund.renkert@intevation.de> |
---|---|
date | Fri, 31 Oct 2014 21:10:35 +0100 |
parents | debfcc7713e3 |
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 |
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', |
54
3c7bfff8bd64
Added Controller for kommentare
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
14 views: [ |
107
84f32c62670f
Added form to create kommentare
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
61
diff
changeset
|
15 'kommentare.Create' |
54
3c7bfff8bd64
Added Controller for kommentare
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
16 ], |
3c7bfff8bd64
Added Controller for kommentare
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
17 stores: [ |
3c7bfff8bd64
Added Controller for kommentare
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
18 'Kommentare' |
3c7bfff8bd64
Added Controller for kommentare
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
19 ], |
3c7bfff8bd64
Added Controller for kommentare
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
20 models: [ |
3c7bfff8bd64
Added Controller for kommentare
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
21 'Kommentar' |
3c7bfff8bd64
Added Controller for kommentare
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
22 ], |
288
ea60be45fd4d
Remeoved methods which are defined in the base class.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
286
diff
changeset
|
23 init: function() { |
ea60be45fd4d
Remeoved methods which are defined in the base class.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
286
diff
changeset
|
24 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
|
25 this.callParent(); |
ea60be45fd4d
Remeoved methods which are defined in the base class.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
286
diff
changeset
|
26 }, |
286
c509e9f6d4db
Added BaseController and inherit Kommentar controller from it.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
285
diff
changeset
|
27 addListeners: function() { |
54
3c7bfff8bd64
Added Controller for kommentare
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
28 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
|
29 'kommentarelist': { |
286
c509e9f6d4db
Added BaseController and inherit Kommentar controller from it.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
285
diff
changeset
|
30 itemdblclick: this.editItem |
59
9e23eca8dfc7
Added function to delete kommentare
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
55
diff
changeset
|
31 }, |
60
5db7ab34af6d
Implemented Adding und Editing Kommentare
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
59
diff
changeset
|
32 '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
|
33 click: this.addItem |
60
5db7ab34af6d
Implemented Adding und Editing Kommentare
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
59
diff
changeset
|
34 }, |
59
9e23eca8dfc7
Added function to delete kommentare
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
55
diff
changeset
|
35 '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
|
36 click: this.deleteItem |
60
5db7ab34af6d
Implemented Adding und Editing Kommentare
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
59
diff
changeset
|
37 }, |
144
7b1140bd8b3d
Re-Added Kommentare
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
111
diff
changeset
|
38 '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
|
39 click: this.saveItem |
144
7b1140bd8b3d
Re-Added Kommentare
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
111
diff
changeset
|
40 }, |
111
6273b73b4b27
Replaced Logic for Kommentare. Use copied code form Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
107
diff
changeset
|
41 'kommentarecreate form': { |
6273b73b4b27
Replaced Logic for Kommentare. Use copied code form Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
107
diff
changeset
|
42 savesuccess: this.createSuccess, |
6273b73b4b27
Replaced Logic for Kommentare. Use copied code form Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
107
diff
changeset
|
43 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
|
44 } |
54
3c7bfff8bd64
Added Controller for kommentare
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
45 }); |
3c7bfff8bd64
Added Controller for kommentare
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
46 }, |
286
c509e9f6d4db
Added BaseController and inherit Kommentar controller from it.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
285
diff
changeset
|
47 addItem: function(button) { |
144
7b1140bd8b3d
Re-Added Kommentare
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
111
diff
changeset
|
48 console.log('Adding new Kommentar for Probe ' + button.probeId); |
7b1140bd8b3d
Re-Added Kommentare
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
111
diff
changeset
|
49 var kommentar = Ext.create('Lada.model.Kommentar'); |
7b1140bd8b3d
Re-Added Kommentare
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
111
diff
changeset
|
50 kommentar.set('probeId', button.probeId); |
7b1140bd8b3d
Re-Added Kommentare
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
111
diff
changeset
|
51 var view = Ext.widget('kommentarecreate', {model: kommentar}); |
111
6273b73b4b27
Replaced Logic for Kommentare. Use copied code form Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
107
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 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
|
54 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:
288
diff
changeset
|
55 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:
288
diff
changeset
|
56 console.log("Loaded Kommentar 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:
288
diff
changeset
|
57 }, |
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
|
58 initEditWindow: function(record, readonly, owner) { |
111
6273b73b4b27
Replaced Logic for Kommentare. Use copied code form Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
107
diff
changeset
|
59 var view = Ext.widget('kommentarecreate', {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:
288
diff
changeset
|
60 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:
288
diff
changeset
|
61 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
|
62 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
|
63 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
|
64 } |
60
5db7ab34af6d
Implemented Adding und Editing Kommentare
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
59
diff
changeset
|
65 }, |
111
6273b73b4b27
Replaced Logic for Kommentare. Use copied code form Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
107
diff
changeset
|
66 createSuccess: function(form, record, operation) { |
6273b73b4b27
Replaced Logic for Kommentare. Use copied code form Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
107
diff
changeset
|
67 var store = this.getKommentareStore(); |
6273b73b4b27
Replaced Logic for Kommentare. Use copied code form Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
107
diff
changeset
|
68 store.reload(); |
6273b73b4b27
Replaced Logic for Kommentare. Use copied code form Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
107
diff
changeset
|
69 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
|
70 win.close(); |
54
3c7bfff8bd64
Added Controller for kommentare
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
71 } |
3c7bfff8bd64
Added Controller for kommentare
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
72 }); |