annotate app/controller/Zusatzwerte.js @ 497:7c0653e8d9f7

Fixed some js related issues (unused vars, arrays, etc.) and code style.
author Raimund Renkert <raimund.renkert@intevation.de>
date Thu, 06 Nov 2014 10:38:17 +0100
parents d07e5086a64b
children 8b4ec61c5752
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() {
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);
497
7c0653e8d9f7 Fixed some js related issues (unused vars, arrays, etc.) and code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 496
diff changeset
59 Ext.widget('zusatzwertecreate', {
491
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');
497
7c0653e8d9f7 Fixed some js related issues (unused vars, arrays, etc.) and code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 496
diff changeset
66 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
67 },
491
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 490
diff changeset
68
497
7c0653e8d9f7 Fixed some js related issues (unused vars, arrays, etc.) and code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 496
diff changeset
69 initEditWindow: function(record, readonly) {
491
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 490
diff changeset
70 var view = Ext.widget('zusatzwertecreate', {
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 490
diff changeset
71 model: record
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 490
diff changeset
72 });
264
6aaf43f881cd Fixed Issue17.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 172
diff changeset
73 // Mark PZW Selection readonly.
6aaf43f881cd Fixed Issue17.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 172
diff changeset
74 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
75 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
76 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
77 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
78 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
79 }
110
c4f97a5a9939 Added Forms to add Zusatzwerte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
80 },
491
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 490
diff changeset
81
497
7c0653e8d9f7 Fixed some js related issues (unused vars, arrays, etc.) and code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 496
diff changeset
82 createSuccess: function(form) {
110
c4f97a5a9939 Added Forms to add Zusatzwerte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
83 // Reload store
c4f97a5a9939 Added Forms to add Zusatzwerte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
84 var store = this.getZusatzwerteStore();
c4f97a5a9939 Added Forms to add Zusatzwerte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
85 store.reload();
c4f97a5a9939 Added Forms to add Zusatzwerte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
86 var win = form.up('window');
c4f97a5a9939 Added Forms to add Zusatzwerte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
87 win.close();
c4f97a5a9939 Added Forms to add Zusatzwerte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
88 },
491
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 490
diff changeset
89
497
7c0653e8d9f7 Fixed some js related issues (unused vars, arrays, etc.) and code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 496
diff changeset
90 editSuccess: function(form) {
110
c4f97a5a9939 Added Forms to add Zusatzwerte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
91 // Reload store
c4f97a5a9939 Added Forms to add Zusatzwerte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
92 var store = this.getZusatzwerteStore();
c4f97a5a9939 Added Forms to add Zusatzwerte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
93 store.reload();
c4f97a5a9939 Added Forms to add Zusatzwerte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
94 var win = form.up('window');
c4f97a5a9939 Added Forms to add Zusatzwerte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
95 win.close();
c4f97a5a9939 Added Forms to add Zusatzwerte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
96 }
c4f97a5a9939 Added Forms to add Zusatzwerte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
97 });

http://lada.wald.intevation.org