Mercurial > lada > lada-client
annotate app/controller/Proben.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:
465
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:
465
diff
changeset
|
2 * Software engineering by Intevation GmbH |
debfcc7713e3
Added license header to each file.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
465
diff
changeset
|
3 * |
debfcc7713e3
Added license header to each file.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
465
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:
465
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:
465
diff
changeset
|
7 */ |
debfcc7713e3
Added license header to each file.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
465
diff
changeset
|
8 |
293
bd77b6055791
Inherit from Base controller
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
270
diff
changeset
|
9 /** |
bd77b6055791
Inherit from Base controller
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
270
diff
changeset
|
10 * Controller for Proben |
bd77b6055791
Inherit from Base controller
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
270
diff
changeset
|
11 */ |
379
0fa48c66cf7d
Set first version of a report of the import.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
376
diff
changeset
|
12 |
465
20df35a31490
Improved import dialog
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
463
diff
changeset
|
13 function numOfErrors(proben) { |
20df35a31490
Improved import dialog
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
463
diff
changeset
|
14 var errors = 0; |
20df35a31490
Improved import dialog
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
463
diff
changeset
|
15 for (var key in proben) { |
20df35a31490
Improved import dialog
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
463
diff
changeset
|
16 if (proben[key].length > 0) { |
20df35a31490
Improved import dialog
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
463
diff
changeset
|
17 errors = errors + 1; |
20df35a31490
Improved import dialog
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
463
diff
changeset
|
18 } |
20df35a31490
Improved import dialog
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
463
diff
changeset
|
19 } |
20df35a31490
Improved import dialog
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
463
diff
changeset
|
20 return errors; |
20df35a31490
Improved import dialog
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
463
diff
changeset
|
21 } |
20df35a31490
Improved import dialog
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
463
diff
changeset
|
22 |
379
0fa48c66cf7d
Set first version of a report of the import.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
376
diff
changeset
|
23 function buildImportReport(filename, msg, errors, warnings) { |
497
7c0653e8d9f7
Fixed some js related issues (unused vars, arrays, etc.) and code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
496
diff
changeset
|
24 var out = []; |
465
20df35a31490
Improved import dialog
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
463
diff
changeset
|
25 // There is a entry for each imported proben in the errors dict (might be |
20df35a31490
Improved import dialog
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
463
diff
changeset
|
26 // empty) |
497
7c0653e8d9f7
Fixed some js related issues (unused vars, arrays, etc.) and code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
496
diff
changeset
|
27 var numProben = (Object.keys(errors).length > 0); |
7c0653e8d9f7
Fixed some js related issues (unused vars, arrays, etc.) and code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
496
diff
changeset
|
28 var numErrors = (numOfErrors(errors)); |
7c0653e8d9f7
Fixed some js related issues (unused vars, arrays, etc.) and code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
496
diff
changeset
|
29 var hasWarnings = (Object.keys(warnings).length > 0); |
7c0653e8d9f7
Fixed some js related issues (unused vars, arrays, etc.) and code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
496
diff
changeset
|
30 if (msg !== 200) { |
7c0653e8d9f7
Fixed some js related issues (unused vars, arrays, etc.) and code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
496
diff
changeset
|
31 out.push('Der Import der Datei ' + |
7c0653e8d9f7
Fixed some js related issues (unused vars, arrays, etc.) and code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
496
diff
changeset
|
32 filename + |
7c0653e8d9f7
Fixed some js related issues (unused vars, arrays, etc.) and code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
496
diff
changeset
|
33 ' war nicht erfolgreich. Der Importvorgang konnte aufgrund' + |
7c0653e8d9f7
Fixed some js related issues (unused vars, arrays, etc.) and code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
496
diff
changeset
|
34 'eines Fehlers im Server nicht beendet werden.'); |
7c0653e8d9f7
Fixed some js related issues (unused vars, arrays, etc.) and code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
496
diff
changeset
|
35 } |
7c0653e8d9f7
Fixed some js related issues (unused vars, arrays, etc.) and code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
496
diff
changeset
|
36 else { |
7c0653e8d9f7
Fixed some js related issues (unused vars, arrays, etc.) and code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
496
diff
changeset
|
37 if (numErrors === numProben) { |
7c0653e8d9f7
Fixed some js related issues (unused vars, arrays, etc.) and code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
496
diff
changeset
|
38 out.push('Der Import der Datei ' |
7c0653e8d9f7
Fixed some js related issues (unused vars, arrays, etc.) and code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
496
diff
changeset
|
39 + filename + ' war nicht erfolgreich.'); |
397
c5188d71ef87
Fixed import report dialog.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
382
diff
changeset
|
40 } |
497
7c0653e8d9f7
Fixed some js related issues (unused vars, arrays, etc.) and code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
496
diff
changeset
|
41 else if (numErrors === 0) { |
7c0653e8d9f7
Fixed some js related issues (unused vars, arrays, etc.) and code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
496
diff
changeset
|
42 out.push('Der Import der Datei ' + filename + ' war erfolgreich.'); |
7c0653e8d9f7
Fixed some js related issues (unused vars, arrays, etc.) and code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
496
diff
changeset
|
43 } |
7c0653e8d9f7
Fixed some js related issues (unused vars, arrays, etc.) and code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
496
diff
changeset
|
44 else { |
7c0653e8d9f7
Fixed some js related issues (unused vars, arrays, etc.) and code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
496
diff
changeset
|
45 out.push('Der Import der Datei ' |
7c0653e8d9f7
Fixed some js related issues (unused vars, arrays, etc.) and code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
496
diff
changeset
|
46 + filename + ' war nicht oder nur teilweise erfolgreich.'); |
7c0653e8d9f7
Fixed some js related issues (unused vars, arrays, etc.) and code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
496
diff
changeset
|
47 } |
7c0653e8d9f7
Fixed some js related issues (unused vars, arrays, etc.) and code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
496
diff
changeset
|
48 out.push(' Bei dem Import sind folgende Fehler und Warnungen ' + |
7c0653e8d9f7
Fixed some js related issues (unused vars, arrays, etc.) and code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
496
diff
changeset
|
49 'aufgetreten:'); |
7c0653e8d9f7
Fixed some js related issues (unused vars, arrays, etc.) and code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
496
diff
changeset
|
50 out.push('<br/>'); |
7c0653e8d9f7
Fixed some js related issues (unused vars, arrays, etc.) and code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
496
diff
changeset
|
51 var key; |
7c0653e8d9f7
Fixed some js related issues (unused vars, arrays, etc.) and code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
496
diff
changeset
|
52 var msgs; |
7c0653e8d9f7
Fixed some js related issues (unused vars, arrays, etc.) and code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
496
diff
changeset
|
53 if (numErrors) { |
7c0653e8d9f7
Fixed some js related issues (unused vars, arrays, etc.) and code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
496
diff
changeset
|
54 out.push('<strong>Fehler:</strong>'); |
7c0653e8d9f7
Fixed some js related issues (unused vars, arrays, etc.) and code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
496
diff
changeset
|
55 out.push('<br/>'); |
7c0653e8d9f7
Fixed some js related issues (unused vars, arrays, etc.) and code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
496
diff
changeset
|
56 out.push('<ol>'); |
7c0653e8d9f7
Fixed some js related issues (unused vars, arrays, etc.) and code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
496
diff
changeset
|
57 for (key in errors) { |
7c0653e8d9f7
Fixed some js related issues (unused vars, arrays, etc.) and code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
496
diff
changeset
|
58 out.push('<li>Probe: ' + key); |
7c0653e8d9f7
Fixed some js related issues (unused vars, arrays, etc.) and code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
496
diff
changeset
|
59 msgs = errors[key]; |
7c0653e8d9f7
Fixed some js related issues (unused vars, arrays, etc.) and code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
496
diff
changeset
|
60 out.push('<ol>'); |
7c0653e8d9f7
Fixed some js related issues (unused vars, arrays, etc.) and code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
496
diff
changeset
|
61 for (var i = msgs.length - 1; i >= 0; i--) { |
7c0653e8d9f7
Fixed some js related issues (unused vars, arrays, etc.) and code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
496
diff
changeset
|
62 out.push('<li>' + msgs[i].key + |
7c0653e8d9f7
Fixed some js related issues (unused vars, arrays, etc.) and code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
496
diff
changeset
|
63 ' (' + Lada.getApplication().bundle.getMsg( |
7c0653e8d9f7
Fixed some js related issues (unused vars, arrays, etc.) and code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
496
diff
changeset
|
64 msgs[i].code.toString()) + |
7c0653e8d9f7
Fixed some js related issues (unused vars, arrays, etc.) and code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
496
diff
changeset
|
65 '): ' + msgs[i].value + '</li>'); |
7c0653e8d9f7
Fixed some js related issues (unused vars, arrays, etc.) and code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
496
diff
changeset
|
66 } |
7c0653e8d9f7
Fixed some js related issues (unused vars, arrays, etc.) and code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
496
diff
changeset
|
67 out.push('</ol>'); |
7c0653e8d9f7
Fixed some js related issues (unused vars, arrays, etc.) and code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
496
diff
changeset
|
68 out.push('</li>'); |
463
e18b170b34bc
Improved Import Dialog.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
448
diff
changeset
|
69 } |
497
7c0653e8d9f7
Fixed some js related issues (unused vars, arrays, etc.) and code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
496
diff
changeset
|
70 out.push('</ol>'); |
7c0653e8d9f7
Fixed some js related issues (unused vars, arrays, etc.) and code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
496
diff
changeset
|
71 out.push('<br/>'); |
397
c5188d71ef87
Fixed import report dialog.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
382
diff
changeset
|
72 } |
497
7c0653e8d9f7
Fixed some js related issues (unused vars, arrays, etc.) and code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
496
diff
changeset
|
73 if (hasWarnings) { |
7c0653e8d9f7
Fixed some js related issues (unused vars, arrays, etc.) and code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
496
diff
changeset
|
74 out.push('<strong>Warnungen:</strong>'); |
7c0653e8d9f7
Fixed some js related issues (unused vars, arrays, etc.) and code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
496
diff
changeset
|
75 out.push('<br/>'); |
7c0653e8d9f7
Fixed some js related issues (unused vars, arrays, etc.) and code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
496
diff
changeset
|
76 out.push('<ol>'); |
7c0653e8d9f7
Fixed some js related issues (unused vars, arrays, etc.) and code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
496
diff
changeset
|
77 for (key in warnings) { |
7c0653e8d9f7
Fixed some js related issues (unused vars, arrays, etc.) and code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
496
diff
changeset
|
78 out.push('<li>' + key); |
7c0653e8d9f7
Fixed some js related issues (unused vars, arrays, etc.) and code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
496
diff
changeset
|
79 msgs = warnings[key]; |
7c0653e8d9f7
Fixed some js related issues (unused vars, arrays, etc.) and code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
496
diff
changeset
|
80 out.push('<ol>'); |
7c0653e8d9f7
Fixed some js related issues (unused vars, arrays, etc.) and code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
496
diff
changeset
|
81 for (var i = msgs.length - 1; i >= 0; i--) { |
7c0653e8d9f7
Fixed some js related issues (unused vars, arrays, etc.) and code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
496
diff
changeset
|
82 out.push('<li>' + msgs[i].key + ' (' + Lada.getApplication().bundle.getMsg(msgs[i].code.toString())+'): '+msgs[i].value+'</li>') |
7c0653e8d9f7
Fixed some js related issues (unused vars, arrays, etc.) and code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
496
diff
changeset
|
83 } |
7c0653e8d9f7
Fixed some js related issues (unused vars, arrays, etc.) and code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
496
diff
changeset
|
84 out.push('</ol>'); |
7c0653e8d9f7
Fixed some js related issues (unused vars, arrays, etc.) and code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
496
diff
changeset
|
85 out.push('</li>'); |
463
e18b170b34bc
Improved Import Dialog.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
448
diff
changeset
|
86 } |
497
7c0653e8d9f7
Fixed some js related issues (unused vars, arrays, etc.) and code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
496
diff
changeset
|
87 out.push('</ol>'); |
463
e18b170b34bc
Improved Import Dialog.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
448
diff
changeset
|
88 } |
397
c5188d71ef87
Fixed import report dialog.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
382
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 return out.join(''); |
379
0fa48c66cf7d
Set first version of a report of the import.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
376
diff
changeset
|
91 } |
0fa48c66cf7d
Set first version of a report of the import.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
376
diff
changeset
|
92 |
1
af8d7217521d
Added basic Proben controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
93 Ext.define('Lada.controller.Proben', { |
293
bd77b6055791
Inherit from Base controller
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
270
diff
changeset
|
94 extend: 'Lada.controller.Base', |
491
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
95 |
4
b8e56e880f02
Added a first example view (userlisting) from the EXJS Tutorial. Need to be
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
1
diff
changeset
|
96 views: [ |
65
9e2e09e819fd
Added a new Dialog to create proben without any kommentare or other additional
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
64
diff
changeset
|
97 'proben.Edit', |
357
94884cd8f8c0
Added logic to upload a file to the server.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
293
diff
changeset
|
98 'proben.Create', |
94884cd8f8c0
Added logic to upload a file to the server.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
293
diff
changeset
|
99 'proben.Import' |
4
b8e56e880f02
Added a first example view (userlisting) from the EXJS Tutorial. Need to be
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
1
diff
changeset
|
100 ], |
491
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
101 |
13
a8efc4b96888
Added model for Proben and a Store.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
5
diff
changeset
|
102 stores: [ |
122
a7bfaeb1655d
Cleanup part three. Reenabled Zusatzwerte and implemented sending nested data.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
121
diff
changeset
|
103 'Proben', |
135
e80a9114524c
Load Probenzusatzwerte on editing a Probe. Values are needed in the
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
122
diff
changeset
|
104 'Zusatzwerte', |
490
446e99cfd425
Updated views and controllers using the new model and stores.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
472
diff
changeset
|
105 'KommentareP', |
157
237a4efe715a
Enabled loading Messungen.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
149
diff
changeset
|
106 'Orte', |
237a4efe715a
Enabled loading Messungen.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
149
diff
changeset
|
107 'Messungen' |
13
a8efc4b96888
Added model for Proben and a Store.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
5
diff
changeset
|
108 ], |
491
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
109 |
1
af8d7217521d
Added basic Proben controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
110 init: function() { |
af8d7217521d
Added basic Proben controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
111 console.log('Initialising the Proben controller'); |
491
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
112 this.callParent(arguments); |
293
bd77b6055791
Inherit from Base controller
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
270
diff
changeset
|
113 }, |
491
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
114 |
293
bd77b6055791
Inherit from Base controller
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
270
diff
changeset
|
115 addListeners: function() { |
1
af8d7217521d
Added basic Proben controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
116 this.control({ |
18
9e1a40312bbe
Implemented a basic edit dialog. Data will be set to data/proben2.json url
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
13
diff
changeset
|
117 'probenlist': { |
293
bd77b6055791
Inherit from Base controller
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
270
diff
changeset
|
118 itemdblclick: this.editItem |
18
9e1a40312bbe
Implemented a basic edit dialog. Data will be set to data/proben2.json url
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
13
diff
changeset
|
119 }, |
64
a4a24e737deb
Added listener to open a new window to enter data fpr the new probe.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
54
diff
changeset
|
120 'probenlist toolbar button[action=add]': { |
293
bd77b6055791
Inherit from Base controller
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
270
diff
changeset
|
121 click: this.addItem |
64
a4a24e737deb
Added listener to open a new window to enter data fpr the new probe.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
54
diff
changeset
|
122 }, |
357
94884cd8f8c0
Added logic to upload a file to the server.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
293
diff
changeset
|
123 'probenlist toolbar button[action=import]': { |
94884cd8f8c0
Added logic to upload a file to the server.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
293
diff
changeset
|
124 click: this.selectUploadFile |
94884cd8f8c0
Added logic to upload a file to the server.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
293
diff
changeset
|
125 }, |
381
9bc080ecdbc9
Added action in controller to download the file in a new window.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
379
diff
changeset
|
126 'probenlist toolbar button[action=export]': { |
9bc080ecdbc9
Added action in controller to download the file in a new window.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
379
diff
changeset
|
127 click: this.downloadFile |
9bc080ecdbc9
Added action in controller to download the file in a new window.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
379
diff
changeset
|
128 }, |
270
0d6552bb28ea
Add cancel Button to the editproben window and only show save button if the
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
256
diff
changeset
|
129 'probencreate button[action=save]': { |
293
bd77b6055791
Inherit from Base controller
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
270
diff
changeset
|
130 click: this.saveItem |
270
0d6552bb28ea
Add cancel Button to the editproben window and only show save button if the
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
256
diff
changeset
|
131 }, |
0d6552bb28ea
Add cancel Button to the editproben window and only show save button if the
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
256
diff
changeset
|
132 'probenedit button[action=save]': { |
293
bd77b6055791
Inherit from Base controller
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
270
diff
changeset
|
133 click: this.saveItem |
270
0d6552bb28ea
Add cancel Button to the editproben window and only show save button if the
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
256
diff
changeset
|
134 }, |
357
94884cd8f8c0
Added logic to upload a file to the server.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
293
diff
changeset
|
135 'probenimport button[action=save]': { |
94884cd8f8c0
Added logic to upload a file to the server.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
293
diff
changeset
|
136 click: this.uploadItem |
94884cd8f8c0
Added logic to upload a file to the server.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
293
diff
changeset
|
137 }, |
70
1a943947a7d2
Added new listeners for events comming from the Probenforms.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
69
diff
changeset
|
138 'probencreate form': { |
1a943947a7d2
Added new listeners for events comming from the Probenforms.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
69
diff
changeset
|
139 savesuccess: this.createSuccess, |
1a943947a7d2
Added new listeners for events comming from the Probenforms.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
69
diff
changeset
|
140 savefailure: this.createFailure |
1a943947a7d2
Added new listeners for events comming from the Probenforms.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
69
diff
changeset
|
141 }, |
1a943947a7d2
Added new listeners for events comming from the Probenforms.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
69
diff
changeset
|
142 'probenedit form': { |
1a943947a7d2
Added new listeners for events comming from the Probenforms.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
69
diff
changeset
|
143 savesuccess: this.editSuccess, |
1a943947a7d2
Added new listeners for events comming from the Probenforms.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
69
diff
changeset
|
144 savefailure: this.editFailure |
1
af8d7217521d
Added basic Proben controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
145 } |
af8d7217521d
Added basic Proben controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
146 }); |
af8d7217521d
Added basic Proben controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
147 }, |
491
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
148 |
497
7c0653e8d9f7
Fixed some js related issues (unused vars, arrays, etc.) and code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
496
diff
changeset
|
149 addItem: function() { |
71
db26aeebe521
Added new Form for editing proben. Use this form in the edit window.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
70
diff
changeset
|
150 console.log('Adding new Probe'); |
497
7c0653e8d9f7
Fixed some js related issues (unused vars, arrays, etc.) and code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
496
diff
changeset
|
151 Ext.widget('probencreate'); |
64
a4a24e737deb
Added listener to open a new window to enter data fpr the new probe.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
54
diff
changeset
|
152 }, |
491
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
153 |
357
94884cd8f8c0
Added logic to upload a file to the server.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
293
diff
changeset
|
154 /** |
94884cd8f8c0
Added logic to upload a file to the server.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
293
diff
changeset
|
155 * Opens a window with a file chooser to select the file to upload |
94884cd8f8c0
Added logic to upload a file to the server.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
293
diff
changeset
|
156 * @private |
94884cd8f8c0
Added logic to upload a file to the server.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
293
diff
changeset
|
157 */ |
497
7c0653e8d9f7
Fixed some js related issues (unused vars, arrays, etc.) and code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
496
diff
changeset
|
158 selectUploadFile: function() { |
357
94884cd8f8c0
Added logic to upload a file to the server.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
293
diff
changeset
|
159 console.log('Importing'); |
497
7c0653e8d9f7
Fixed some js related issues (unused vars, arrays, etc.) and code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
496
diff
changeset
|
160 Ext.widget('probenimport'); |
357
94884cd8f8c0
Added logic to upload a file to the server.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
293
diff
changeset
|
161 }, |
491
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
162 |
357
94884cd8f8c0
Added logic to upload a file to the server.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
293
diff
changeset
|
163 /** Uploads the selected file the the server |
94884cd8f8c0
Added logic to upload a file to the server.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
293
diff
changeset
|
164 * @private |
94884cd8f8c0
Added logic to upload a file to the server.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
293
diff
changeset
|
165 */ |
94884cd8f8c0
Added logic to upload a file to the server.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
293
diff
changeset
|
166 uploadItem: function(button) { |
94884cd8f8c0
Added logic to upload a file to the server.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
293
diff
changeset
|
167 var win = button.up('window'); |
94884cd8f8c0
Added logic to upload a file to the server.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
293
diff
changeset
|
168 var form = win.down('form'); |
491
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
169 if (form.isValid()) { |
357
94884cd8f8c0
Added logic to upload a file to the server.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
293
diff
changeset
|
170 form.submit({ |
376
90cec3bb9c09
Updated URL for import service.
Raimund Renkert <rrenkert@intevation.de>
parents:
362
diff
changeset
|
171 url: 'server/rest/import/laf', |
357
94884cd8f8c0
Added logic to upload a file to the server.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
293
diff
changeset
|
172 waitMsg: 'Importiere...', |
94884cd8f8c0
Added logic to upload a file to the server.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
293
diff
changeset
|
173 // TODO: Handle the response correct. o must must contain the |
94884cd8f8c0
Added logic to upload a file to the server.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
293
diff
changeset
|
174 // filename (None) <2013-08-13 16:17> |
94884cd8f8c0
Added logic to upload a file to the server.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
293
diff
changeset
|
175 success: function(fp, resp) { |
397
c5188d71ef87
Fixed import report dialog.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
382
diff
changeset
|
176 var errors = resp.result.data.errors; |
c5188d71ef87
Fixed import report dialog.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
382
diff
changeset
|
177 var warnings = resp.result.data.warnings; |
c5188d71ef87
Fixed import report dialog.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
382
diff
changeset
|
178 var filename = resp.result.data.filename; |
c5188d71ef87
Fixed import report dialog.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
382
diff
changeset
|
179 var message = resp.result.message; |
497
7c0653e8d9f7
Fixed some js related issues (unused vars, arrays, etc.) and code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
496
diff
changeset
|
180 var dialogbody = |
7c0653e8d9f7
Fixed some js related issues (unused vars, arrays, etc.) and code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
496
diff
changeset
|
181 buildImportReport(filename, message, errors, warnings); |
397
c5188d71ef87
Fixed import report dialog.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
382
diff
changeset
|
182 Ext.Msg.alert('Erfolg', dialogbody); |
357
94884cd8f8c0
Added logic to upload a file to the server.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
293
diff
changeset
|
183 win.close(); |
94884cd8f8c0
Added logic to upload a file to the server.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
293
diff
changeset
|
184 }, |
94884cd8f8c0
Added logic to upload a file to the server.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
293
diff
changeset
|
185 failure: function(fp, resp) { |
382
91193c49c2bb
Make the error dialog look better.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
381
diff
changeset
|
186 var errors = resp.result.data.errors; |
91193c49c2bb
Make the error dialog look better.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
381
diff
changeset
|
187 var warnings = resp.result.data.warnings; |
91193c49c2bb
Make the error dialog look better.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
381
diff
changeset
|
188 var filename = resp.result.data.filename; |
91193c49c2bb
Make the error dialog look better.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
381
diff
changeset
|
189 var message = resp.result.message; |
497
7c0653e8d9f7
Fixed some js related issues (unused vars, arrays, etc.) and code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
496
diff
changeset
|
190 var dialogbody = |
7c0653e8d9f7
Fixed some js related issues (unused vars, arrays, etc.) and code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
496
diff
changeset
|
191 buildImportReport(filename, message, errors, warnings); |
379
0fa48c66cf7d
Set first version of a report of the import.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
376
diff
changeset
|
192 Ext.Msg.alert('Fehler', dialogbody); |
357
94884cd8f8c0
Added logic to upload a file to the server.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
293
diff
changeset
|
193 win.close(); |
94884cd8f8c0
Added logic to upload a file to the server.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
293
diff
changeset
|
194 } |
94884cd8f8c0
Added logic to upload a file to the server.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
293
diff
changeset
|
195 }); |
94884cd8f8c0
Added logic to upload a file to the server.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
293
diff
changeset
|
196 } |
94884cd8f8c0
Added logic to upload a file to the server.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
293
diff
changeset
|
197 }, |
491
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
198 |
381
9bc080ecdbc9
Added action in controller to download the file in a new window.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
379
diff
changeset
|
199 /** |
9bc080ecdbc9
Added action in controller to download the file in a new window.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
379
diff
changeset
|
200 * Will download the selected Probe in LAF format in a new window (tab). |
9bc080ecdbc9
Added action in controller to download the file in a new window.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
379
diff
changeset
|
201 */ |
9bc080ecdbc9
Added action in controller to download the file in a new window.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
379
diff
changeset
|
202 downloadFile: function(button) { |
9bc080ecdbc9
Added action in controller to download the file in a new window.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
379
diff
changeset
|
203 var grid = button.up('grid'); |
400
4fdc09ebf21d
Enable multiselect in probe list and download LAF export via POST request.
Raimund Renkert <rrenkert@intevation.de>
parents:
397
diff
changeset
|
204 var selection = grid.getView().getSelectionModel().getSelection(); |
4fdc09ebf21d
Enable multiselect in probe list and download LAF export via POST request.
Raimund Renkert <rrenkert@intevation.de>
parents:
397
diff
changeset
|
205 var hiddenItems = []; |
4fdc09ebf21d
Enable multiselect in probe list and download LAF export via POST request.
Raimund Renkert <rrenkert@intevation.de>
parents:
397
diff
changeset
|
206 for (var i = 0; i < selection.length; i++) { |
491
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
207 hiddenItems.push({ |
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
208 xtype: 'hiddenfield', |
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
209 name: 'probeId', |
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
210 value: selection[i].get('probeId') |
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
211 }); |
400
4fdc09ebf21d
Enable multiselect in probe list and download LAF export via POST request.
Raimund Renkert <rrenkert@intevation.de>
parents:
397
diff
changeset
|
212 } |
4fdc09ebf21d
Enable multiselect in probe list and download LAF export via POST request.
Raimund Renkert <rrenkert@intevation.de>
parents:
397
diff
changeset
|
213 console.log('create download form.'); |
4fdc09ebf21d
Enable multiselect in probe list and download LAF export via POST request.
Raimund Renkert <rrenkert@intevation.de>
parents:
397
diff
changeset
|
214 var hiddenForm = Ext.create('Ext.form.Panel', { |
4fdc09ebf21d
Enable multiselect in probe list and download LAF export via POST request.
Raimund Renkert <rrenkert@intevation.de>
parents:
397
diff
changeset
|
215 title: 'hiddenForm', |
4fdc09ebf21d
Enable multiselect in probe list and download LAF export via POST request.
Raimund Renkert <rrenkert@intevation.de>
parents:
397
diff
changeset
|
216 standardSubmit: true, |
4fdc09ebf21d
Enable multiselect in probe list and download LAF export via POST request.
Raimund Renkert <rrenkert@intevation.de>
parents:
397
diff
changeset
|
217 url: 'server/rest/export/laf', |
4fdc09ebf21d
Enable multiselect in probe list and download LAF export via POST request.
Raimund Renkert <rrenkert@intevation.de>
parents:
397
diff
changeset
|
218 timeout: 120, |
4fdc09ebf21d
Enable multiselect in probe list and download LAF export via POST request.
Raimund Renkert <rrenkert@intevation.de>
parents:
397
diff
changeset
|
219 height: 0, |
4fdc09ebf21d
Enable multiselect in probe list and download LAF export via POST request.
Raimund Renkert <rrenkert@intevation.de>
parents:
397
diff
changeset
|
220 width: 0, |
4fdc09ebf21d
Enable multiselect in probe list and download LAF export via POST request.
Raimund Renkert <rrenkert@intevation.de>
parents:
397
diff
changeset
|
221 hidden: true, |
4fdc09ebf21d
Enable multiselect in probe list and download LAF export via POST request.
Raimund Renkert <rrenkert@intevation.de>
parents:
397
diff
changeset
|
222 items: hiddenItems |
4fdc09ebf21d
Enable multiselect in probe list and download LAF export via POST request.
Raimund Renkert <rrenkert@intevation.de>
parents:
397
diff
changeset
|
223 }); |
4fdc09ebf21d
Enable multiselect in probe list and download LAF export via POST request.
Raimund Renkert <rrenkert@intevation.de>
parents:
397
diff
changeset
|
224 hiddenForm.getForm().submit(); |
381
9bc080ecdbc9
Added action in controller to download the file in a new window.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
379
diff
changeset
|
225 }, |
491
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
226 |
293
bd77b6055791
Inherit from Base controller
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
270
diff
changeset
|
227 editItem: function(grid, record) { |
71
db26aeebe521
Added new Form for editing proben. Use this form in the edit window.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
70
diff
changeset
|
228 console.log('Editing Probe'); |
490
446e99cfd425
Updated views and controllers using the new model and stores.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
472
diff
changeset
|
229 var id = record.get('id'); |
446e99cfd425
Updated views and controllers using the new model and stores.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
472
diff
changeset
|
230 console.log('id is: ' + id); |
122
a7bfaeb1655d
Cleanup part three. Reenabled Zusatzwerte and implemented sending nested data.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
121
diff
changeset
|
231 // Load Zusatzwerte |
496
d07e5086a64b
Moved stammdaten stores to app.js and load them via storemanager.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
491
diff
changeset
|
232 var pstore = Ext.data.StoreManager.get('staProbenzusaetze'); |
135
e80a9114524c
Load Probenzusatzwerte on editing a Probe. Values are needed in the
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
122
diff
changeset
|
233 pstore.load(); |
122
a7bfaeb1655d
Cleanup part three. Reenabled Zusatzwerte and implemented sending nested data.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
121
diff
changeset
|
234 var zstore = this.getZusatzwerteStore(); |
a7bfaeb1655d
Cleanup part three. Reenabled Zusatzwerte and implemented sending nested data.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
121
diff
changeset
|
235 zstore.load({ |
a7bfaeb1655d
Cleanup part three. Reenabled Zusatzwerte and implemented sending nested data.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
121
diff
changeset
|
236 params: { |
139
df6e36dd57ee
Changed params probe -> probeId, mst -> mstId, uwb -> umwId
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
135
diff
changeset
|
237 probeId: id |
122
a7bfaeb1655d
Cleanup part three. Reenabled Zusatzwerte and implemented sending nested data.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
121
diff
changeset
|
238 } |
a7bfaeb1655d
Cleanup part three. Reenabled Zusatzwerte and implemented sending nested data.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
121
diff
changeset
|
239 }); |
149
26ac4c99f8c4
Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
144
diff
changeset
|
240 // Load Kommentare |
490
446e99cfd425
Updated views and controllers using the new model and stores.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
472
diff
changeset
|
241 var kstore = this.getKommentarePStore(); |
144
7b1140bd8b3d
Re-Added Kommentare
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
141
diff
changeset
|
242 kstore.load({ |
7b1140bd8b3d
Re-Added Kommentare
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
141
diff
changeset
|
243 params: { |
7b1140bd8b3d
Re-Added Kommentare
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
141
diff
changeset
|
244 probeId: id |
7b1140bd8b3d
Re-Added Kommentare
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
141
diff
changeset
|
245 } |
7b1140bd8b3d
Re-Added Kommentare
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
141
diff
changeset
|
246 }); |
149
26ac4c99f8c4
Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
144
diff
changeset
|
247 // Load Orte |
26ac4c99f8c4
Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
144
diff
changeset
|
248 var ostore = this.getOrteStore(); |
26ac4c99f8c4
Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
144
diff
changeset
|
249 ostore.load({ |
26ac4c99f8c4
Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
144
diff
changeset
|
250 params: { |
26ac4c99f8c4
Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
144
diff
changeset
|
251 probeId: id |
26ac4c99f8c4
Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
144
diff
changeset
|
252 } |
26ac4c99f8c4
Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
144
diff
changeset
|
253 }); |
157
237a4efe715a
Enabled loading Messungen.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
149
diff
changeset
|
254 // Load Orte |
237a4efe715a
Enabled loading Messungen.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
149
diff
changeset
|
255 var mstore = this.getMessungenStore(); |
237a4efe715a
Enabled loading Messungen.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
149
diff
changeset
|
256 mstore.load({ |
237a4efe715a
Enabled loading Messungen.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
149
diff
changeset
|
257 params: { |
237a4efe715a
Enabled loading Messungen.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
149
diff
changeset
|
258 probeId: id |
237a4efe715a
Enabled loading Messungen.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
149
diff
changeset
|
259 } |
237a4efe715a
Enabled loading Messungen.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
149
diff
changeset
|
260 }); |
491
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
261 var view = Ext.widget('probenedit', { |
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
262 modelId: id |
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
263 }); |
490
446e99cfd425
Updated views and controllers using the new model and stores.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
472
diff
changeset
|
264 view.show(); |
497
7c0653e8d9f7
Fixed some js related issues (unused vars, arrays, etc.) and code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
496
diff
changeset
|
265 console.log('Loaded Probe with ID ' + record.getId()); |
18
9e1a40312bbe
Implemented a basic edit dialog. Data will be set to data/proben2.json url
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
13
diff
changeset
|
266 }, |
491
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
267 |
255
82118c01bc52
#57: Open Edit-Dialog after creating a new Probe.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
157
diff
changeset
|
268 createSuccess: function(form, record, response) { |
256
d8993f5b96e8
Added a possible fix for issue57. After the create dialog is closed the edit
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
255
diff
changeset
|
269 // Close Createdialog |
69
cb1138f5cea7
Removed old code
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
65
diff
changeset
|
270 var win = form.up('window'); |
18
9e1a40312bbe
Implemented a basic edit dialog. Data will be set to data/proben2.json url
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
13
diff
changeset
|
271 win.close(); |
448
bd2b26c249e2
Use 'load', not 'reload' to fill the proben store if its empty.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
405
diff
changeset
|
272 var store = this.getProbenStore(); |
497
7c0653e8d9f7
Fixed some js related issues (unused vars, arrays, etc.) and code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
496
diff
changeset
|
273 // Load or reload the probenstore. |
448
bd2b26c249e2
Use 'load', not 'reload' to fill the proben store if its empty.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
405
diff
changeset
|
274 if (store.getCount() === 0) { |
bd2b26c249e2
Use 'load', not 'reload' to fill the proben store if its empty.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
405
diff
changeset
|
275 store.load({ |
bd2b26c249e2
Use 'load', not 'reload' to fill the proben store if its empty.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
405
diff
changeset
|
276 scope: this, |
497
7c0653e8d9f7
Fixed some js related issues (unused vars, arrays, etc.) and code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
496
diff
changeset
|
277 callback: function() { |
448
bd2b26c249e2
Use 'load', not 'reload' to fill the proben store if its empty.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
405
diff
changeset
|
278 console.log('Loaded store'); |
bd2b26c249e2
Use 'load', not 'reload' to fill the proben store if its empty.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
405
diff
changeset
|
279 // Open Editdialog |
bd2b26c249e2
Use 'load', not 'reload' to fill the proben store if its empty.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
405
diff
changeset
|
280 var json = Ext.decode(response.responseText); |
bd2b26c249e2
Use 'load', not 'reload' to fill the proben store if its empty.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
405
diff
changeset
|
281 if (json) { |
bd2b26c249e2
Use 'load', not 'reload' to fill the proben store if its empty.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
405
diff
changeset
|
282 var probeId = json.data.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
|
283 var probe = store.findRecord('probeId', probeId); |
448
bd2b26c249e2
Use 'load', not 'reload' to fill the proben store if its empty.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
405
diff
changeset
|
284 this.editItem(null, probe); |
bd2b26c249e2
Use 'load', not 'reload' to fill the proben store if its empty.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
405
diff
changeset
|
285 } |
bd2b26c249e2
Use 'load', not 'reload' to fill the proben store if its empty.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
405
diff
changeset
|
286 } |
bd2b26c249e2
Use 'load', not 'reload' to fill the proben store if its empty.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
405
diff
changeset
|
287 }); |
405
85238577adc9
Show warnings when saving a new Probe.
Raimund Renkert <rrenkert@intevation.de>
parents:
400
diff
changeset
|
288 } |
448
bd2b26c249e2
Use 'load', not 'reload' to fill the proben store if its empty.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
405
diff
changeset
|
289 else { |
bd2b26c249e2
Use 'load', not 'reload' to fill the proben store if its empty.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
405
diff
changeset
|
290 store.reload({ |
bd2b26c249e2
Use 'load', not 'reload' to fill the proben store if its empty.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
405
diff
changeset
|
291 scope: this, |
497
7c0653e8d9f7
Fixed some js related issues (unused vars, arrays, etc.) and code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
496
diff
changeset
|
292 callback: function() { |
448
bd2b26c249e2
Use 'load', not 'reload' to fill the proben store if its empty.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
405
diff
changeset
|
293 console.log('Reloaded store'); |
bd2b26c249e2
Use 'load', not 'reload' to fill the proben store if its empty.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
405
diff
changeset
|
294 // Open Editdialog |
bd2b26c249e2
Use 'load', not 'reload' to fill the proben store if its empty.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
405
diff
changeset
|
295 var json = Ext.decode(response.responseText); |
bd2b26c249e2
Use 'load', not 'reload' to fill the proben store if its empty.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
405
diff
changeset
|
296 if (json) { |
bd2b26c249e2
Use 'load', not 'reload' to fill the proben store if its empty.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
405
diff
changeset
|
297 var probeId = json.data.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
|
298 var probe = store.findRecord('probeId', probeId); |
448
bd2b26c249e2
Use 'load', not 'reload' to fill the proben store if its empty.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
405
diff
changeset
|
299 this.editItem(null, probe); |
bd2b26c249e2
Use 'load', not 'reload' to fill the proben store if its empty.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
405
diff
changeset
|
300 } |
256
d8993f5b96e8
Added a possible fix for issue57. After the create dialog is closed the edit
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
255
diff
changeset
|
301 } |
448
bd2b26c249e2
Use 'load', not 'reload' to fill the proben store if its empty.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
405
diff
changeset
|
302 }); |
bd2b26c249e2
Use 'load', not 'reload' to fill the proben store if its empty.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
405
diff
changeset
|
303 } |
70
1a943947a7d2
Added new listeners for events comming from the Probenforms.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
69
diff
changeset
|
304 }, |
491
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
305 |
497
7c0653e8d9f7
Fixed some js related issues (unused vars, arrays, etc.) and code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
496
diff
changeset
|
306 editSuccess: function(form) { |
86
eb40b74f871a
Reload the store after the probe was created or edited.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
76
diff
changeset
|
307 // Reload store |
eb40b74f871a
Reload the store after the probe was created or edited.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
76
diff
changeset
|
308 var store = this.getProbenStore(); |
eb40b74f871a
Reload the store after the probe was created or edited.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
76
diff
changeset
|
309 store.reload(); |
70
1a943947a7d2
Added new listeners for events comming from the Probenforms.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
69
diff
changeset
|
310 var win = form.up('window'); |
1a943947a7d2
Added new listeners for events comming from the Probenforms.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
69
diff
changeset
|
311 win.close(); |
1
af8d7217521d
Added basic Proben controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
312 } |
af8d7217521d
Added basic Proben controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
313 }); |