annotate app/controller/Zusatzwerte.js @ 490:446e99cfd425

Updated views and controllers using the new model and stores.
author Raimund Renkert <raimund.renkert@intevation.de>
date Fri, 31 Oct 2014 21:28:31 +0100
parents debfcc7713e3
children 850ccfe5f3c4
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
debfcc7713e3 Added license header to each file.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 451
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: 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 ],
c4f97a5a9939 Added Forms to add Zusatzwerte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
14 stores: [
122
a7bfaeb1655d Cleanup part three. Reenabled Zusatzwerte and implemented sending nested data.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 110
diff changeset
15 'Zusatzwerte',
490
446e99cfd425 Updated views and controllers using the new model and stores.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 472
diff changeset
16 'StaProbenzusaetze',
446e99cfd425 Updated views and controllers using the new model and stores.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 472
diff changeset
17 'StaMesseinheiten'
110
c4f97a5a9939 Added Forms to add Zusatzwerte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
18 ],
c4f97a5a9939 Added Forms to add Zusatzwerte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
19 init: function() {
c4f97a5a9939 Added Forms to add Zusatzwerte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
20 console.log('Initialising the Zusatzwerte controller');
296
529da633b8e3 Inherit from Base controller
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 264
diff changeset
21 this.callParent();
529da633b8e3 Inherit from Base controller
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 264
diff changeset
22 },
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 },
451
d49a6fcd9f57 Fix Creating, editing and deleting of Zusatzwerte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 362
diff changeset
47 saveItem: function(button) {
d49a6fcd9f57 Fix Creating, editing and deleting of Zusatzwerte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 362
diff changeset
48 console.log('Saving new Zusatzwert for Probe ' + button.probeId);
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 },
d49a6fcd9f57 Fix Creating, editing and deleting of Zusatzwerte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 362
diff changeset
52 addItem: function(button) {
172
cfa0cc437781 Implemented opening a new Messungen form when clicking and the "Add Button" on
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 141
diff changeset
53 console.log('Adding new Zusatzwert for Probe' + button.probeId);
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);
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
56 var view = Ext.widget('zusatzwertecreate', {model: zusatzwert});
110
c4f97a5a9939 Added Forms to add Zusatzwerte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
57 },
451
d49a6fcd9f57 Fix Creating, editing and deleting of Zusatzwerte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 362
diff changeset
58 editItem: function(grid, record) {
110
c4f97a5a9939 Added Forms to add Zusatzwerte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
59 console.log('Editing Zusatzwert');
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
60 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: 296
diff changeset
61 console.log("Loaded Zusatzwert 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: 296
diff changeset
62 },
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 initEditWindow: function(record, readonly, owner) {
110
c4f97a5a9939 Added Forms to add Zusatzwerte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
64 var view = Ext.widget('zusatzwertecreate', {model: record});
264
6aaf43f881cd Fixed Issue17.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 172
diff changeset
65 // Mark PZW Selection readonly.
6aaf43f881cd Fixed Issue17.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 172
diff changeset
66 view.down('probenzusatzwert').disabled = true;
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
67 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: 296
diff changeset
68 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
69 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
70 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
71 }
110
c4f97a5a9939 Added Forms to add Zusatzwerte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
72 },
c4f97a5a9939 Added Forms to add Zusatzwerte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
73 createSuccess: function(form, record, operation) {
c4f97a5a9939 Added Forms to add Zusatzwerte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
74 // Reload store
c4f97a5a9939 Added Forms to add Zusatzwerte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
75 var store = this.getZusatzwerteStore();
c4f97a5a9939 Added Forms to add Zusatzwerte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
76 store.reload();
c4f97a5a9939 Added Forms to add Zusatzwerte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
77 var win = form.up('window');
c4f97a5a9939 Added Forms to add Zusatzwerte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
78 win.close();
c4f97a5a9939 Added Forms to add Zusatzwerte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
79 },
c4f97a5a9939 Added Forms to add Zusatzwerte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
80 editSuccess: function(form, record, operation) {
c4f97a5a9939 Added Forms to add Zusatzwerte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
81 // Reload store
c4f97a5a9939 Added Forms to add Zusatzwerte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
82 var store = this.getZusatzwerteStore();
c4f97a5a9939 Added Forms to add Zusatzwerte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
83 store.reload();
c4f97a5a9939 Added Forms to add Zusatzwerte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
84 var win = form.up('window');
c4f97a5a9939 Added Forms to add Zusatzwerte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
85 win.close();
c4f97a5a9939 Added Forms to add Zusatzwerte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
86 }
c4f97a5a9939 Added Forms to add Zusatzwerte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
87 });

http://lada.wald.intevation.org