annotate app/controller/Zusatzwerte.js @ 534:0eb7751ce158

Render the NWG field in a combobox
author Roland Geider <roland.geider@intevation.de>
date Wed, 17 Dec 2014 14:53:41 +0100
parents 8b4ec61c5752
children a12c9c97d3cb
rev   line source
472
debfcc7713e3 Added license header to each file.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 451
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: 451
diff changeset
2 * Software engineering by Intevation GmbH
debfcc7713e3 Added license header to each file.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 451
diff changeset
3 *
debfcc7713e3 Added license header to each file.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 451
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: 451
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: 496
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: 451
diff changeset
7 */
debfcc7713e3 Added license header to each file.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 451
diff changeset
8
110
c4f97a5a9939 Added Forms to add Zusatzwerte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
9 Ext.define('Lada.controller.Zusatzwerte', {
296
529da633b8e3 Inherit from Base controller
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 264
diff changeset
10 extend: 'Lada.controller.Base',
110
c4f97a5a9939 Added Forms to add Zusatzwerte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
11 views: [
c4f97a5a9939 Added Forms to add Zusatzwerte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
12 'zusatzwerte.Create'
c4f97a5a9939 Added Forms to add Zusatzwerte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
13 ],
491
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 490
diff changeset
14
110
c4f97a5a9939 Added Forms to add Zusatzwerte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
15 stores: [
496
d07e5086a64b Moved stammdaten stores to app.js and load them via storemanager.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 491
diff changeset
16 'Zusatzwerte'
110
c4f97a5a9939 Added Forms to add Zusatzwerte
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
110
c4f97a5a9939 Added Forms to add Zusatzwerte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
19 init: function() {
491
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 490
diff changeset
20 this.callParent(arguments);
296
529da633b8e3 Inherit from Base controller
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 264
diff changeset
21 },
491
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 490
diff changeset
22
296
529da633b8e3 Inherit from Base controller
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 264
diff changeset
23 addListeners: function() {
110
c4f97a5a9939 Added Forms to add Zusatzwerte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
24 this.control({
c4f97a5a9939 Added Forms to add Zusatzwerte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
25 'zusatzwertelist': {
451
d49a6fcd9f57 Fix Creating, editing and deleting of Zusatzwerte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 362
diff changeset
26 itemdblclick: this.editItem
110
c4f97a5a9939 Added Forms to add Zusatzwerte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
27 },
c4f97a5a9939 Added Forms to add Zusatzwerte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
28 'zusatzwertelist toolbar button[action=add]': {
451
d49a6fcd9f57 Fix Creating, editing and deleting of Zusatzwerte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 362
diff changeset
29 click: this.addItem
110
c4f97a5a9939 Added Forms to add Zusatzwerte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
30 },
c4f97a5a9939 Added Forms to add Zusatzwerte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
31 'zusatzwertelist toolbar button[action=delete]': {
451
d49a6fcd9f57 Fix Creating, editing and deleting of Zusatzwerte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 362
diff changeset
32 click: this.deleteItem
110
c4f97a5a9939 Added Forms to add Zusatzwerte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
33 },
c4f97a5a9939 Added Forms to add Zusatzwerte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
34 'zusatzwertecreate form': {
c4f97a5a9939 Added Forms to add Zusatzwerte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
35 savesuccess: this.createSuccess,
c4f97a5a9939 Added Forms to add Zusatzwerte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
36 savefailure: this.createFailure
c4f97a5a9939 Added Forms to add Zusatzwerte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
37 },
122
a7bfaeb1655d Cleanup part three. Reenabled Zusatzwerte and implemented sending nested data.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 110
diff changeset
38 'zusatzwertecreate button[action=save]': {
451
d49a6fcd9f57 Fix Creating, editing and deleting of Zusatzwerte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 362
diff changeset
39 click: this.saveItem
122
a7bfaeb1655d Cleanup part three. Reenabled Zusatzwerte and implemented sending nested data.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 110
diff changeset
40 },
110
c4f97a5a9939 Added Forms to add Zusatzwerte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
41 'zusatzwerteedit form': {
c4f97a5a9939 Added Forms to add Zusatzwerte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
42 savesuccess: this.editSuccess,
c4f97a5a9939 Added Forms to add Zusatzwerte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
43 savefailure: this.editFailure
c4f97a5a9939 Added Forms to add Zusatzwerte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
44 }
c4f97a5a9939 Added Forms to add Zusatzwerte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
45 });
c4f97a5a9939 Added Forms to add Zusatzwerte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
46 },
491
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 490
diff changeset
47
451
d49a6fcd9f57 Fix Creating, editing and deleting of Zusatzwerte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 362
diff changeset
48 saveItem: function(button) {
d49a6fcd9f57 Fix Creating, editing and deleting of Zusatzwerte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 362
diff changeset
49 var form = button.up('window').down('form');
d49a6fcd9f57 Fix Creating, editing and deleting of Zusatzwerte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 362
diff changeset
50 form.commit();
d49a6fcd9f57 Fix Creating, editing and deleting of Zusatzwerte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 362
diff changeset
51 },
491
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 490
diff changeset
52
451
d49a6fcd9f57 Fix Creating, editing and deleting of Zusatzwerte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 362
diff changeset
53 addItem: function(button) {
126
3d8cbc2d0dc1 Use probeId value of the add button to set the probeId of new created Zusatzwerte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 122
diff changeset
54 var zusatzwert = Ext.create('Lada.model.Zusatzwert');
3d8cbc2d0dc1 Use probeId value of the add button to set the probeId of new created Zusatzwerte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 122
diff changeset
55 zusatzwert.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: 496
diff changeset
56 Ext.widget('zusatzwertecreate', {
491
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 490
diff changeset
57 model: zusatzwert
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 490
diff changeset
58 });
110
c4f97a5a9939 Added Forms to add Zusatzwerte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
59 },
491
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 490
diff changeset
60
451
d49a6fcd9f57 Fix Creating, editing and deleting of Zusatzwerte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 362
diff changeset
61 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: 496
diff changeset
62 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: 296
diff changeset
63 },
491
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 490
diff changeset
64
497
7c0653e8d9f7 Fixed some js related issues (unused vars, arrays, etc.) and code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 496
diff changeset
65 initEditWindow: function(record, readonly) {
491
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 490
diff changeset
66 var view = Ext.widget('zusatzwertecreate', {
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 490
diff changeset
67 model: record
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 490
diff changeset
68 });
264
6aaf43f881cd Fixed Issue17.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 172
diff changeset
69 // Mark PZW Selection readonly.
6aaf43f881cd Fixed Issue17.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 172
diff changeset
70 view.down('probenzusatzwert').disabled = true;
497
7c0653e8d9f7 Fixed some js related issues (unused vars, arrays, etc.) and code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 496
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: 296
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: 296
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: 296
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: 296
diff changeset
75 }
110
c4f97a5a9939 Added Forms to add Zusatzwerte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
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: 496
diff changeset
78 createSuccess: function(form) {
110
c4f97a5a9939 Added Forms to add Zusatzwerte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
79 // Reload store
c4f97a5a9939 Added Forms to add Zusatzwerte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
80 var store = this.getZusatzwerteStore();
c4f97a5a9939 Added Forms to add Zusatzwerte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
81 store.reload();
c4f97a5a9939 Added Forms to add Zusatzwerte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
82 var win = form.up('window');
c4f97a5a9939 Added Forms to add Zusatzwerte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
83 win.close();
c4f97a5a9939 Added Forms to add Zusatzwerte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
84 },
491
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 490
diff changeset
85
497
7c0653e8d9f7 Fixed some js related issues (unused vars, arrays, etc.) and code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 496
diff changeset
86 editSuccess: function(form) {
110
c4f97a5a9939 Added Forms to add Zusatzwerte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
87 // Reload store
c4f97a5a9939 Added Forms to add Zusatzwerte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
88 var store = this.getZusatzwerteStore();
c4f97a5a9939 Added Forms to add Zusatzwerte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
89 store.reload();
c4f97a5a9939 Added Forms to add Zusatzwerte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
90 var win = form.up('window');
c4f97a5a9939 Added Forms to add Zusatzwerte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
91 win.close();
c4f97a5a9939 Added Forms to add Zusatzwerte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
92 }
c4f97a5a9939 Added Forms to add Zusatzwerte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
93 });

http://lada.wald.intevation.org