annotate app/controller/Kommentare.js @ 441:60763d913203

Added MesswertNwg to the Messwert model
author Torsten Irländer <torsten.irlaender@intevation.de>
date Tue, 03 Dec 2013 11:21:08 +0100
parents 6a7a9267e00f
children debfcc7713e3
rev   line source
285
6c030e5739a7 Added Docstrings
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 204
diff changeset
1 /**
6c030e5739a7 Added Docstrings
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 204
diff changeset
2 * Controller for Kommentare
6c030e5739a7 Added Docstrings
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 204
diff changeset
3 */
54
3c7bfff8bd64 Added Controller for kommentare
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
4 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
5 extend: 'Lada.controller.Base',
54
3c7bfff8bd64 Added Controller for kommentare
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
6 views: [
107
84f32c62670f Added form to create kommentare
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 61
diff changeset
7 'kommentare.Create'
54
3c7bfff8bd64 Added Controller for kommentare
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
8 ],
3c7bfff8bd64 Added Controller for kommentare
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
9 stores: [
3c7bfff8bd64 Added Controller for kommentare
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
10 'Kommentare'
3c7bfff8bd64 Added Controller for kommentare
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
11 ],
3c7bfff8bd64 Added Controller for kommentare
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
12 models: [
3c7bfff8bd64 Added Controller for kommentare
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
13 'Kommentar'
3c7bfff8bd64 Added Controller for kommentare
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
14 ],
288
ea60be45fd4d Remeoved methods which are defined in the base class.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 286
diff changeset
15 init: function() {
ea60be45fd4d Remeoved methods which are defined in the base class.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 286
diff changeset
16 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
17 this.callParent();
ea60be45fd4d Remeoved methods which are defined in the base class.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 286
diff changeset
18 },
286
c509e9f6d4db Added BaseController and inherit Kommentar controller from it.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 285
diff changeset
19 addListeners: function() {
54
3c7bfff8bd64 Added Controller for kommentare
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
20 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
21 'kommentarelist': {
286
c509e9f6d4db Added BaseController and inherit Kommentar controller from it.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 285
diff changeset
22 itemdblclick: this.editItem
59
9e23eca8dfc7 Added function to delete kommentare
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 55
diff changeset
23 },
60
5db7ab34af6d Implemented Adding und Editing Kommentare
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 59
diff changeset
24 '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
25 click: this.addItem
60
5db7ab34af6d Implemented Adding und Editing Kommentare
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 59
diff changeset
26 },
59
9e23eca8dfc7 Added function to delete kommentare
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 55
diff changeset
27 '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
28 click: this.deleteItem
60
5db7ab34af6d Implemented Adding und Editing Kommentare
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 59
diff changeset
29 },
144
7b1140bd8b3d Re-Added Kommentare
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 111
diff changeset
30 '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
31 click: this.saveItem
144
7b1140bd8b3d Re-Added Kommentare
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 111
diff changeset
32 },
111
6273b73b4b27 Replaced Logic for Kommentare. Use copied code form Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 107
diff changeset
33 'kommentarecreate form': {
6273b73b4b27 Replaced Logic for Kommentare. Use copied code form Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 107
diff changeset
34 savesuccess: this.createSuccess,
6273b73b4b27 Replaced Logic for Kommentare. Use copied code form Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 107
diff changeset
35 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
36 }
54
3c7bfff8bd64 Added Controller for kommentare
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
37 });
3c7bfff8bd64 Added Controller for kommentare
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
38 },
286
c509e9f6d4db Added BaseController and inherit Kommentar controller from it.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 285
diff changeset
39 addItem: function(button) {
144
7b1140bd8b3d Re-Added Kommentare
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 111
diff changeset
40 console.log('Adding new Kommentar for Probe ' + button.probeId);
7b1140bd8b3d Re-Added Kommentare
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 111
diff changeset
41 var kommentar = Ext.create('Lada.model.Kommentar');
7b1140bd8b3d Re-Added Kommentare
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 111
diff changeset
42 kommentar.set('probeId', button.probeId);
7b1140bd8b3d Re-Added Kommentare
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 111
diff changeset
43 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
44 },
286
c509e9f6d4db Added BaseController and inherit Kommentar controller from it.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 285
diff changeset
45 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
46 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
47 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
48 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
49 },
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
50 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
51 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
52 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
53 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
54 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
55 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
56 }
60
5db7ab34af6d Implemented Adding und Editing Kommentare
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 59
diff changeset
57 },
111
6273b73b4b27 Replaced Logic for Kommentare. Use copied code form Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 107
diff changeset
58 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
59 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
60 store.reload();
6273b73b4b27 Replaced Logic for Kommentare. Use copied code form Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 107
diff changeset
61 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
62 win.close();
54
3c7bfff8bd64 Added Controller for kommentare
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
63 }
3c7bfff8bd64 Added Controller for kommentare
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
64 });

http://lada.wald.intevation.org