Mercurial > lada > lada-client
annotate app/controller/Zusatzwerte.js @ 496:d07e5086a64b
Moved stammdaten stores to app.js and load them via storemanager.
author | Raimund Renkert <raimund.renkert@intevation.de> |
---|---|
date | Thu, 06 Nov 2014 10:35:35 +0100 |
parents | 850ccfe5f3c4 |
children | 7c0653e8d9f7 |
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 ], |
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() { |
c4f97a5a9939
Added Forms to add Zusatzwerte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
20 console.log('Initialising the Zusatzwerte controller'); |
491
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
21 this.callParent(arguments); |
296
529da633b8e3
Inherit from Base controller
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
264
diff
changeset
|
22 }, |
491
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
23 |
296
529da633b8e3
Inherit from Base controller
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
264
diff
changeset
|
24 addListeners: function() { |
110
c4f97a5a9939
Added Forms to add Zusatzwerte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
25 this.control({ |
c4f97a5a9939
Added Forms to add Zusatzwerte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
26 'zusatzwertelist': { |
451
d49a6fcd9f57
Fix Creating, editing and deleting of Zusatzwerte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
362
diff
changeset
|
27 itemdblclick: this.editItem |
110
c4f97a5a9939
Added Forms to add Zusatzwerte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
28 }, |
c4f97a5a9939
Added Forms to add Zusatzwerte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
29 '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
|
30 click: this.addItem |
110
c4f97a5a9939
Added Forms to add Zusatzwerte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
31 }, |
c4f97a5a9939
Added Forms to add Zusatzwerte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
32 '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
|
33 click: this.deleteItem |
110
c4f97a5a9939
Added Forms to add Zusatzwerte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
34 }, |
c4f97a5a9939
Added Forms to add Zusatzwerte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
35 'zusatzwertecreate form': { |
c4f97a5a9939
Added Forms to add Zusatzwerte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
36 savesuccess: this.createSuccess, |
c4f97a5a9939
Added Forms to add Zusatzwerte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
37 savefailure: this.createFailure |
c4f97a5a9939
Added Forms to add Zusatzwerte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
38 }, |
122
a7bfaeb1655d
Cleanup part three. Reenabled Zusatzwerte and implemented sending nested data.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
110
diff
changeset
|
39 'zusatzwertecreate button[action=save]': { |
451
d49a6fcd9f57
Fix Creating, editing and deleting of Zusatzwerte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
362
diff
changeset
|
40 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
|
41 }, |
110
c4f97a5a9939
Added Forms to add Zusatzwerte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
42 'zusatzwerteedit form': { |
c4f97a5a9939
Added Forms to add Zusatzwerte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
43 savesuccess: this.editSuccess, |
c4f97a5a9939
Added Forms to add Zusatzwerte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
44 savefailure: this.editFailure |
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 }); |
c4f97a5a9939
Added Forms to add Zusatzwerte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
47 }, |
491
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
48 |
451
d49a6fcd9f57
Fix Creating, editing and deleting of Zusatzwerte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
362
diff
changeset
|
49 saveItem: function(button) { |
d49a6fcd9f57
Fix Creating, editing and deleting of Zusatzwerte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
362
diff
changeset
|
50 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
|
51 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
|
52 form.commit(); |
d49a6fcd9f57
Fix Creating, editing and deleting of Zusatzwerte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
362
diff
changeset
|
53 }, |
491
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
54 |
451
d49a6fcd9f57
Fix Creating, editing and deleting of Zusatzwerte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
362
diff
changeset
|
55 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
|
56 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
|
57 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
|
58 zusatzwert.set('probeId', button.probeId); |
491
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
59 var view = Ext.widget('zusatzwertecreate', { |
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
60 model: zusatzwert |
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
61 }); |
110
c4f97a5a9939
Added Forms to add Zusatzwerte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
62 }, |
491
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
63 |
451
d49a6fcd9f57
Fix Creating, editing and deleting of Zusatzwerte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
362
diff
changeset
|
64 editItem: function(grid, record) { |
110
c4f97a5a9939
Added Forms to add Zusatzwerte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
65 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
|
66 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
|
67 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
|
68 }, |
491
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
69 |
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
|
70 initEditWindow: function(record, readonly, owner) { |
491
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
71 var view = Ext.widget('zusatzwertecreate', { |
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
72 model: record |
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
73 }); |
264
6aaf43f881cd
Fixed Issue17.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
172
diff
changeset
|
74 // Mark PZW Selection readonly. |
6aaf43f881cd
Fixed Issue17.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
172
diff
changeset
|
75 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
|
76 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
|
77 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
|
78 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
|
79 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
|
80 } |
110
c4f97a5a9939
Added Forms to add Zusatzwerte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
81 }, |
491
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
82 |
110
c4f97a5a9939
Added Forms to add Zusatzwerte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
83 createSuccess: function(form, record, operation) { |
c4f97a5a9939
Added Forms to add Zusatzwerte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
84 // Reload store |
c4f97a5a9939
Added Forms to add Zusatzwerte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
85 var store = this.getZusatzwerteStore(); |
c4f97a5a9939
Added Forms to add Zusatzwerte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
86 store.reload(); |
c4f97a5a9939
Added Forms to add Zusatzwerte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
87 var win = form.up('window'); |
c4f97a5a9939
Added Forms to add Zusatzwerte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
88 win.close(); |
c4f97a5a9939
Added Forms to add Zusatzwerte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
89 }, |
491
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
90 |
110
c4f97a5a9939
Added Forms to add Zusatzwerte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
91 editSuccess: function(form, record, operation) { |
c4f97a5a9939
Added Forms to add Zusatzwerte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
92 // Reload store |
c4f97a5a9939
Added Forms to add Zusatzwerte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
93 var store = this.getZusatzwerteStore(); |
c4f97a5a9939
Added Forms to add Zusatzwerte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
94 store.reload(); |
c4f97a5a9939
Added Forms to add Zusatzwerte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
95 var win = form.up('window'); |
c4f97a5a9939
Added Forms to add Zusatzwerte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
96 win.close(); |
c4f97a5a9939
Added Forms to add Zusatzwerte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
97 } |
c4f97a5a9939
Added Forms to add Zusatzwerte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
98 }); |