Mercurial > lada > lada-client
annotate app/controller/Kommentare.js @ 536:fbe81214026a
Make tables editable for 'Kommentare'
See LSB 3.5
author | Roland Geider <roland.geider@intevation.de> |
---|---|
date | Wed, 17 Dec 2014 15:34:04 +0100 |
parents | 8b4ec61c5752 |
children | 99e738c17b81 |
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 this.callParent(); |
ea60be45fd4d
Remeoved methods which are defined in the base class.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
286
diff
changeset
|
29 }, |
491
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
30 |
286
c509e9f6d4db
Added BaseController and inherit Kommentar controller from it.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
285
diff
changeset
|
31 addListeners: function() { |
54
3c7bfff8bd64
Added Controller for kommentare
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
32 this.control({ |
536
fbe81214026a
Make tables editable for 'Kommentare'
Roland Geider <roland.geider@intevation.de>
parents:
499
diff
changeset
|
33 //'kommentarelist': { |
fbe81214026a
Make tables editable for 'Kommentare'
Roland Geider <roland.geider@intevation.de>
parents:
499
diff
changeset
|
34 // itemdblclick: this.editItem |
fbe81214026a
Make tables editable for 'Kommentare'
Roland Geider <roland.geider@intevation.de>
parents:
499
diff
changeset
|
35 //}, |
60
5db7ab34af6d
Implemented Adding und Editing Kommentare
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
59
diff
changeset
|
36 '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
|
37 click: this.addItem |
60
5db7ab34af6d
Implemented Adding und Editing Kommentare
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
59
diff
changeset
|
38 }, |
59
9e23eca8dfc7
Added function to delete kommentare
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
55
diff
changeset
|
39 '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
|
40 click: this.deleteItem |
60
5db7ab34af6d
Implemented Adding und Editing Kommentare
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
59
diff
changeset
|
41 }, |
144
7b1140bd8b3d
Re-Added Kommentare
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
111
diff
changeset
|
42 '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
|
43 click: this.saveItem |
144
7b1140bd8b3d
Re-Added Kommentare
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
111
diff
changeset
|
44 }, |
111
6273b73b4b27
Replaced Logic for Kommentare. Use copied code form Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
107
diff
changeset
|
45 'kommentarecreate form': { |
6273b73b4b27
Replaced Logic for Kommentare. Use copied code form Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
107
diff
changeset
|
46 savesuccess: this.createSuccess, |
6273b73b4b27
Replaced Logic for Kommentare. Use copied code form Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
107
diff
changeset
|
47 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
|
48 } |
54
3c7bfff8bd64
Added Controller for kommentare
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
49 }); |
3c7bfff8bd64
Added Controller for kommentare
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
50 }, |
491
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
51 |
286
c509e9f6d4db
Added BaseController and inherit Kommentar controller from it.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
285
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.KommentarP'); |
144
7b1140bd8b3d
Re-Added Kommentare
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
111
diff
changeset
|
54 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
|
55 Ext.widget('kommentarecreate', { |
491
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
56 model: kommentar |
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
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 }, |
491
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
59 |
286
c509e9f6d4db
Added BaseController and inherit Kommentar controller from it.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
285
diff
changeset
|
60 editItem: function(grid, record) { |
497
7c0653e8d9f7
Fixed some js related issues (unused vars, arrays, etc.) and code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
491
diff
changeset
|
61 record.getAuthInfo(this.initEditWindow); |
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
|
62 }, |
491
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
63 |
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 initEditWindow: function(record, readonly) { |
491
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
65 var view = Ext.widget('kommentarecreate', { |
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
66 model: record |
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 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
|
69 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
|
70 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
|
71 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
|
72 } |
60
5db7ab34af6d
Implemented Adding und Editing Kommentare
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
59
diff
changeset
|
73 }, |
491
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
74 |
497
7c0653e8d9f7
Fixed some js related issues (unused vars, arrays, etc.) and code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
491
diff
changeset
|
75 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
|
76 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
|
77 store.reload(); |
6273b73b4b27
Replaced Logic for Kommentare. Use copied code form Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
107
diff
changeset
|
78 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
|
79 win.close(); |
54
3c7bfff8bd64
Added Controller for kommentare
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
80 } |
3c7bfff8bd64
Added Controller for kommentare
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
81 }); |