annotate app/controller/FilterResult.js @ 813:ee8cce4b4522

In some cases there was an error bc. the Item in the StatuswerteStore was not found. this is fixed now.
author Dustin Demuth <dustin@intevation.de>
date Thu, 28 May 2015 11:06:13 +0200
parents 188a9faf96e0
children af54733a6d48
rev   line source
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
1 /* Copyright (C) 2013 by Bundesamt fuer Strahlenschutz
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
2 * Software engineering by Intevation GmbH
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
3 *
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
4 * This file is Free Software under the GNU GPL (v>=3)
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
5 * and comes with ABSOLUTELY NO WARRANTY! Check out
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
6 * the documentation coming with IMIS-Labordaten-Application for details.
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
7 */
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
8
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
9 /**
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
10 * Controller for filter result grid.
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
11 */
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
12 Ext.define('Lada.controller.FilterResult', {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
13 extend: 'Ext.app.Controller',
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
14 requires: [
754
6b0d0e62f7d7 added Probenintervalle to a Messprogramm... there is still a lot of work needed. For instance for the slider element.
Dustin Demuth <dustin@intevation.de>
parents: 751
diff changeset
15 'Lada.view.window.ProbeEdit',
759
b7484c7da2d4 Unified the Messprogramm windows. Unfortunately the Roweditor of Messmethodengrid is broken in this commit. This is due to the fact that the Mmt store is noit autoloaded anymore
Dustin Demuth <dustin@intevation.de>
parents: 755
diff changeset
16 'Lada.view.window.Messprogramm'
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
17 ],
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
18
742
6e28ebbe1a73 added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents: 727
diff changeset
19 /**
810
a5373ee662e2 Created a loading Animation for the Filterresultgrid
Dustin Demuth <dustin@intevation.de>
parents: 809
diff changeset
20 * Initialize the Controller with listeners
742
6e28ebbe1a73 added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents: 727
diff changeset
21 */
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
22 init: function() {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
23 this.control({
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
24 'filterresultgrid': {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
25 itemdblclick: this.editItem
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
26 },
810
a5373ee662e2 Created a loading Animation for the Filterresultgrid
Dustin Demuth <dustin@intevation.de>
parents: 809
diff changeset
27 'store': {
a5373ee662e2 Created a loading Animation for the Filterresultgrid
Dustin Demuth <dustin@intevation.de>
parents: 809
diff changeset
28 beforeload: this.loadingAnimationOn,
a5373ee662e2 Created a loading Animation for the Filterresultgrid
Dustin Demuth <dustin@intevation.de>
parents: 809
diff changeset
29 load: this.loadingAnimationOff
a5373ee662e2 Created a loading Animation for the Filterresultgrid
Dustin Demuth <dustin@intevation.de>
parents: 809
diff changeset
30 },
754
6b0d0e62f7d7 added Probenintervalle to a Messprogramm... there is still a lot of work needed. For instance for the slider element.
Dustin Demuth <dustin@intevation.de>
parents: 751
diff changeset
31 'filterresultgrid toolbar button[action=addProbe]': {
6b0d0e62f7d7 added Probenintervalle to a Messprogramm... there is still a lot of work needed. For instance for the slider element.
Dustin Demuth <dustin@intevation.de>
parents: 751
diff changeset
32 click: this.addProbeItem
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
33 },
755
3637c453f67d Enabled Creation of a Messprogramm, an empty Window is now shown. The save operation leads to a E 500
Dustin Demuth <dustin@intevation.de>
parents: 754
diff changeset
34 'filterresultgrid toolbar button[action=addMessprogramm]': {
3637c453f67d Enabled Creation of a Messprogramm, an empty Window is now shown. The save operation leads to a E 500
Dustin Demuth <dustin@intevation.de>
parents: 754
diff changeset
35 click: this.addMessprogrammItem
3637c453f67d Enabled Creation of a Messprogramm, an empty Window is now shown. The save operation leads to a E 500
Dustin Demuth <dustin@intevation.de>
parents: 754
diff changeset
36 },
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
37 'filterresultgrid toolbar button[action=import]': {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
38 click: this.uploadFile
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
39 },
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
40 'filterresultgrid toolbar button[action=export]': {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
41 click: this.downloadFile
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
42 }
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
43 });
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
44 this.callParent(arguments);
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
45 },
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
46
742
6e28ebbe1a73 added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents: 727
diff changeset
47 /**
6e28ebbe1a73 added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents: 727
diff changeset
48 * This function is called after a Row in the
6e28ebbe1a73 added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents: 727
diff changeset
49 * {@link Lada.view.grid.FilterResult}
6e28ebbe1a73 added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents: 727
diff changeset
50 * was double-clicked.
6e28ebbe1a73 added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents: 727
diff changeset
51 * The function opens a {@link Lada.view.window.ProbeEdit}
754
6b0d0e62f7d7 added Probenintervalle to a Messprogramm... there is still a lot of work needed. For instance for the slider element.
Dustin Demuth <dustin@intevation.de>
parents: 751
diff changeset
52 * or a {@link Lada.view.window.MessprogrammEdit}.
6b0d0e62f7d7 added Probenintervalle to a Messprogramm... there is still a lot of work needed. For instance for the slider element.
Dustin Demuth <dustin@intevation.de>
parents: 751
diff changeset
53 * To determine which window has to be opened, the function
6b0d0e62f7d7 added Probenintervalle to a Messprogramm... there is still a lot of work needed. For instance for the slider element.
Dustin Demuth <dustin@intevation.de>
parents: 751
diff changeset
54 * analyse the records modelname.
742
6e28ebbe1a73 added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents: 727
diff changeset
55 */
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
56 editItem: function(grid, record) {
754
6b0d0e62f7d7 added Probenintervalle to a Messprogramm... there is still a lot of work needed. For instance for the slider element.
Dustin Demuth <dustin@intevation.de>
parents: 751
diff changeset
57 var mname = record.store.model.modelName || '';
6b0d0e62f7d7 added Probenintervalle to a Messprogramm... there is still a lot of work needed. For instance for the slider element.
Dustin Demuth <dustin@intevation.de>
parents: 751
diff changeset
58 var winname = '';
6b0d0e62f7d7 added Probenintervalle to a Messprogramm... there is still a lot of work needed. For instance for the slider element.
Dustin Demuth <dustin@intevation.de>
parents: 751
diff changeset
59
6b0d0e62f7d7 added Probenintervalle to a Messprogramm... there is still a lot of work needed. For instance for the slider element.
Dustin Demuth <dustin@intevation.de>
parents: 751
diff changeset
60 //Based upon the Model that was loaded, act differently
6b0d0e62f7d7 added Probenintervalle to a Messprogramm... there is still a lot of work needed. For instance for the slider element.
Dustin Demuth <dustin@intevation.de>
parents: 751
diff changeset
61 if (mname == 'Lada.model.ProbeList'){
6b0d0e62f7d7 added Probenintervalle to a Messprogramm... there is still a lot of work needed. For instance for the slider element.
Dustin Demuth <dustin@intevation.de>
parents: 751
diff changeset
62 winname = 'Lada.view.window.ProbeEdit';
6b0d0e62f7d7 added Probenintervalle to a Messprogramm... there is still a lot of work needed. For instance for the slider element.
Dustin Demuth <dustin@intevation.de>
parents: 751
diff changeset
63 }
6b0d0e62f7d7 added Probenintervalle to a Messprogramm... there is still a lot of work needed. For instance for the slider element.
Dustin Demuth <dustin@intevation.de>
parents: 751
diff changeset
64 else if (mname == 'Lada.model.MessprogrammList'){
759
b7484c7da2d4 Unified the Messprogramm windows. Unfortunately the Roweditor of Messmethodengrid is broken in this commit. This is due to the fact that the Mmt store is noit autoloaded anymore
Dustin Demuth <dustin@intevation.de>
parents: 755
diff changeset
65 winname = 'Lada.view.window.Messprogramm';
754
6b0d0e62f7d7 added Probenintervalle to a Messprogramm... there is still a lot of work needed. For instance for the slider element.
Dustin Demuth <dustin@intevation.de>
parents: 751
diff changeset
66 }
6b0d0e62f7d7 added Probenintervalle to a Messprogramm... there is still a lot of work needed. For instance for the slider element.
Dustin Demuth <dustin@intevation.de>
parents: 751
diff changeset
67 if (winname){
6b0d0e62f7d7 added Probenintervalle to a Messprogramm... there is still a lot of work needed. For instance for the slider element.
Dustin Demuth <dustin@intevation.de>
parents: 751
diff changeset
68 var win = Ext.create(winname, {
6b0d0e62f7d7 added Probenintervalle to a Messprogramm... there is still a lot of work needed. For instance for the slider element.
Dustin Demuth <dustin@intevation.de>
parents: 751
diff changeset
69 record: record
6b0d0e62f7d7 added Probenintervalle to a Messprogramm... there is still a lot of work needed. For instance for the slider element.
Dustin Demuth <dustin@intevation.de>
parents: 751
diff changeset
70 });
6b0d0e62f7d7 added Probenintervalle to a Messprogramm... there is still a lot of work needed. For instance for the slider element.
Dustin Demuth <dustin@intevation.de>
parents: 751
diff changeset
71 win.show();
6b0d0e62f7d7 added Probenintervalle to a Messprogramm... there is still a lot of work needed. For instance for the slider element.
Dustin Demuth <dustin@intevation.de>
parents: 751
diff changeset
72 win.initData();
6b0d0e62f7d7 added Probenintervalle to a Messprogramm... there is still a lot of work needed. For instance for the slider element.
Dustin Demuth <dustin@intevation.de>
parents: 751
diff changeset
73 }
6b0d0e62f7d7 added Probenintervalle to a Messprogramm... there is still a lot of work needed. For instance for the slider element.
Dustin Demuth <dustin@intevation.de>
parents: 751
diff changeset
74 else {
6b0d0e62f7d7 added Probenintervalle to a Messprogramm... there is still a lot of work needed. For instance for the slider element.
Dustin Demuth <dustin@intevation.de>
parents: 751
diff changeset
75 console.log('The model is unknown.'
6b0d0e62f7d7 added Probenintervalle to a Messprogramm... there is still a lot of work needed. For instance for the slider element.
Dustin Demuth <dustin@intevation.de>
parents: 751
diff changeset
76 +'No window was configured to display the data.'
6b0d0e62f7d7 added Probenintervalle to a Messprogramm... there is still a lot of work needed. For instance for the slider element.
Dustin Demuth <dustin@intevation.de>
parents: 751
diff changeset
77 +'I retrieved a model named:' + mname
6b0d0e62f7d7 added Probenintervalle to a Messprogramm... there is still a lot of work needed. For instance for the slider element.
Dustin Demuth <dustin@intevation.de>
parents: 751
diff changeset
78 );
6b0d0e62f7d7 added Probenintervalle to a Messprogramm... there is still a lot of work needed. For instance for the slider element.
Dustin Demuth <dustin@intevation.de>
parents: 751
diff changeset
79 }
6b0d0e62f7d7 added Probenintervalle to a Messprogramm... there is still a lot of work needed. For instance for the slider element.
Dustin Demuth <dustin@intevation.de>
parents: 751
diff changeset
80 },
6b0d0e62f7d7 added Probenintervalle to a Messprogramm... there is still a lot of work needed. For instance for the slider element.
Dustin Demuth <dustin@intevation.de>
parents: 751
diff changeset
81
6b0d0e62f7d7 added Probenintervalle to a Messprogramm... there is still a lot of work needed. For instance for the slider element.
Dustin Demuth <dustin@intevation.de>
parents: 751
diff changeset
82 /**
6b0d0e62f7d7 added Probenintervalle to a Messprogramm... there is still a lot of work needed. For instance for the slider element.
Dustin Demuth <dustin@intevation.de>
parents: 751
diff changeset
83 * This function opens a new window to create a Probe
6b0d0e62f7d7 added Probenintervalle to a Messprogramm... there is still a lot of work needed. For instance for the slider element.
Dustin Demuth <dustin@intevation.de>
parents: 751
diff changeset
84 * {@link Lada.view.window.ProbeCreate}
6b0d0e62f7d7 added Probenintervalle to a Messprogramm... there is still a lot of work needed. For instance for the slider element.
Dustin Demuth <dustin@intevation.de>
parents: 751
diff changeset
85 */
6b0d0e62f7d7 added Probenintervalle to a Messprogramm... there is still a lot of work needed. For instance for the slider element.
Dustin Demuth <dustin@intevation.de>
parents: 751
diff changeset
86 addProbeItem: function() {
6b0d0e62f7d7 added Probenintervalle to a Messprogramm... there is still a lot of work needed. For instance for the slider element.
Dustin Demuth <dustin@intevation.de>
parents: 751
diff changeset
87 var win = Ext.create('Lada.view.window.ProbeCreate');
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
88 win.show();
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
89 win.initData();
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
90 },
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
91
742
6e28ebbe1a73 added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents: 727
diff changeset
92 /**
6e28ebbe1a73 added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents: 727
diff changeset
93 * This function opens a new window to create a Probe
754
6b0d0e62f7d7 added Probenintervalle to a Messprogramm... there is still a lot of work needed. For instance for the slider element.
Dustin Demuth <dustin@intevation.de>
parents: 751
diff changeset
94 * {@link Lada.view.window.MessprogrammCreate}
742
6e28ebbe1a73 added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents: 727
diff changeset
95 */
754
6b0d0e62f7d7 added Probenintervalle to a Messprogramm... there is still a lot of work needed. For instance for the slider element.
Dustin Demuth <dustin@intevation.de>
parents: 751
diff changeset
96 addMessprogrammItem: function() {
759
b7484c7da2d4 Unified the Messprogramm windows. Unfortunately the Roweditor of Messmethodengrid is broken in this commit. This is due to the fact that the Mmt store is noit autoloaded anymore
Dustin Demuth <dustin@intevation.de>
parents: 755
diff changeset
97 var win = Ext.create('Lada.view.window.Messprogramm');
755
3637c453f67d Enabled Creation of a Messprogramm, an empty Window is now shown. The save operation leads to a E 500
Dustin Demuth <dustin@intevation.de>
parents: 754
diff changeset
98 win.show();
3637c453f67d Enabled Creation of a Messprogramm, an empty Window is now shown. The save operation leads to a E 500
Dustin Demuth <dustin@intevation.de>
parents: 754
diff changeset
99 win.initData();
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
100 },
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
101
742
6e28ebbe1a73 added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents: 727
diff changeset
102 /**
6e28ebbe1a73 added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents: 727
diff changeset
103 * This function opens a {@link Lada.view.window.FileUpload}
6e28ebbe1a73 added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents: 727
diff changeset
104 * window to upload a LAF-File
6e28ebbe1a73 added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents: 727
diff changeset
105 */
725
83c571b022f3 Added window for laf file upload and use filtergrid buttons to export or import.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 620
diff changeset
106 uploadFile: function() {
83c571b022f3 Added window for laf file upload and use filtergrid buttons to export or import.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 620
diff changeset
107 var win = Ext.create('Lada.view.window.FileUpload', {
83c571b022f3 Added window for laf file upload and use filtergrid buttons to export or import.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 620
diff changeset
108 title: 'Datenimport',
83c571b022f3 Added window for laf file upload and use filtergrid buttons to export or import.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 620
diff changeset
109 modal: true
83c571b022f3 Added window for laf file upload and use filtergrid buttons to export or import.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 620
diff changeset
110 });
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
111
725
83c571b022f3 Added window for laf file upload and use filtergrid buttons to export or import.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 620
diff changeset
112 win.show();
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
113 },
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
114
742
6e28ebbe1a73 added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents: 727
diff changeset
115 /**
6e28ebbe1a73 added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents: 727
diff changeset
116 * This function can be used to Download the items which
6e28ebbe1a73 added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents: 727
diff changeset
117 * were selected in the {@link Lada.view.grid.FilterResult}
6e28ebbe1a73 added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents: 727
diff changeset
118 * The Download does not work with Internet Explorers older than v.10
6e28ebbe1a73 added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents: 727
diff changeset
119 */
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
120 downloadFile: function(button) {
725
83c571b022f3 Added window for laf file upload and use filtergrid buttons to export or import.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 620
diff changeset
121 var grid = button.up('grid');
83c571b022f3 Added window for laf file upload and use filtergrid buttons to export or import.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 620
diff changeset
122 var selection = grid.getView().getSelectionModel().getSelection();
754
6b0d0e62f7d7 added Probenintervalle to a Messprogramm... there is still a lot of work needed. For instance for the slider element.
Dustin Demuth <dustin@intevation.de>
parents: 751
diff changeset
123 var i18n = Lada.getApplication().bundle;
725
83c571b022f3 Added window for laf file upload and use filtergrid buttons to export or import.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 620
diff changeset
124 var proben = [];
83c571b022f3 Added window for laf file upload and use filtergrid buttons to export or import.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 620
diff changeset
125 for (var i = 0; i < selection.length; i++) {
83c571b022f3 Added window for laf file upload and use filtergrid buttons to export or import.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 620
diff changeset
126 proben.push(selection[i].get('id'));
83c571b022f3 Added window for laf file upload and use filtergrid buttons to export or import.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 620
diff changeset
127 }
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
128
725
83c571b022f3 Added window for laf file upload and use filtergrid buttons to export or import.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 620
diff changeset
129 Ext.Ajax.request({
83c571b022f3 Added window for laf file upload and use filtergrid buttons to export or import.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 620
diff changeset
130 method: 'POST',
727
e002234d7da5 Corrected URL for lada-server in export and import
Dustin Demuth <dustin@intevation.de>
parents: 725
diff changeset
131 url: 'lada-server/export/laf',
725
83c571b022f3 Added window for laf file upload and use filtergrid buttons to export or import.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 620
diff changeset
132 jsonData: {'proben': proben},
83c571b022f3 Added window for laf file upload and use filtergrid buttons to export or import.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 620
diff changeset
133 headers: {'X-OPENID-PARAMS': Lada.openIDParams},
83c571b022f3 Added window for laf file upload and use filtergrid buttons to export or import.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 620
diff changeset
134 success: function(response) {
83c571b022f3 Added window for laf file upload and use filtergrid buttons to export or import.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 620
diff changeset
135 var content = response.responseText;
83c571b022f3 Added window for laf file upload and use filtergrid buttons to export or import.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 620
diff changeset
136 var blob = new Blob([content],{type: 'text/plain'});
83c571b022f3 Added window for laf file upload and use filtergrid buttons to export or import.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 620
diff changeset
137 saveAs(blob, 'export.laf');
83c571b022f3 Added window for laf file upload and use filtergrid buttons to export or import.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 620
diff changeset
138 },
812
188a9faf96e0 Added Errorhandling for AJAX-Requests, especially Authentication Issues.
Dustin Demuth <dustin@intevation.de>
parents: 811
diff changeset
139 failure: function(response) {
188a9faf96e0 Added Errorhandling for AJAX-Requests, especially Authentication Issues.
Dustin Demuth <dustin@intevation.de>
parents: 811
diff changeset
140 var json = Ext.JSON.decode(response.responseText);
188a9faf96e0 Added Errorhandling for AJAX-Requests, especially Authentication Issues.
Dustin Demuth <dustin@intevation.de>
parents: 811
diff changeset
141 if (json) {
188a9faf96e0 Added Errorhandling for AJAX-Requests, especially Authentication Issues.
Dustin Demuth <dustin@intevation.de>
parents: 811
diff changeset
142 if(json.errors.totalCount > 0 || json.warnings.totalCount > 0){
188a9faf96e0 Added Errorhandling for AJAX-Requests, especially Authentication Issues.
Dustin Demuth <dustin@intevation.de>
parents: 811
diff changeset
143 formPanel.setMessages(json.errors, json.warnings);
188a9faf96e0 Added Errorhandling for AJAX-Requests, especially Authentication Issues.
Dustin Demuth <dustin@intevation.de>
parents: 811
diff changeset
144 }
188a9faf96e0 Added Errorhandling for AJAX-Requests, especially Authentication Issues.
Dustin Demuth <dustin@intevation.de>
parents: 811
diff changeset
145 // TODO Move this handling of 699 and 698 to a more central place!
188a9faf96e0 Added Errorhandling for AJAX-Requests, especially Authentication Issues.
Dustin Demuth <dustin@intevation.de>
parents: 811
diff changeset
146 // TODO i18n
188a9faf96e0 Added Errorhandling for AJAX-Requests, especially Authentication Issues.
Dustin Demuth <dustin@intevation.de>
parents: 811
diff changeset
147 if (json.message === "699" || json.message === "698") {
188a9faf96e0 Added Errorhandling for AJAX-Requests, especially Authentication Issues.
Dustin Demuth <dustin@intevation.de>
parents: 811
diff changeset
148 /* This is the unauthorized message with the authentication
188a9faf96e0 Added Errorhandling for AJAX-Requests, especially Authentication Issues.
Dustin Demuth <dustin@intevation.de>
parents: 811
diff changeset
149 * redirect in the data */
188a9faf96e0 Added Errorhandling for AJAX-Requests, especially Authentication Issues.
Dustin Demuth <dustin@intevation.de>
parents: 811
diff changeset
150
188a9faf96e0 Added Errorhandling for AJAX-Requests, especially Authentication Issues.
Dustin Demuth <dustin@intevation.de>
parents: 811
diff changeset
151 /* We decided to handle this with a redirect to the identity
188a9faf96e0 Added Errorhandling for AJAX-Requests, especially Authentication Issues.
Dustin Demuth <dustin@intevation.de>
parents: 811
diff changeset
152 * provider. In which case we have no other option then to
188a9faf96e0 Added Errorhandling for AJAX-Requests, especially Authentication Issues.
Dustin Demuth <dustin@intevation.de>
parents: 811
diff changeset
153 * handle it here with relaunch. */
188a9faf96e0 Added Errorhandling for AJAX-Requests, especially Authentication Issues.
Dustin Demuth <dustin@intevation.de>
parents: 811
diff changeset
154 Ext.MessageBox.confirm('Erneutes Login erforderlich',
188a9faf96e0 Added Errorhandling for AJAX-Requests, especially Authentication Issues.
Dustin Demuth <dustin@intevation.de>
parents: 811
diff changeset
155 'Der Server konnte die Anfrage nicht authentifizieren.<br/>'+
188a9faf96e0 Added Errorhandling for AJAX-Requests, especially Authentication Issues.
Dustin Demuth <dustin@intevation.de>
parents: 811
diff changeset
156 'Für ein erneutes Login muss die Anwendung neu geladen werden.<br/>' +
188a9faf96e0 Added Errorhandling for AJAX-Requests, especially Authentication Issues.
Dustin Demuth <dustin@intevation.de>
parents: 811
diff changeset
157 'Alle ungesicherten Daten gehen dabei verloren.<br/>' +
188a9faf96e0 Added Errorhandling for AJAX-Requests, especially Authentication Issues.
Dustin Demuth <dustin@intevation.de>
parents: 811
diff changeset
158 'Soll die Anwendung jetzt neu geladen werden?', this.reload); //TODO Scope?
188a9faf96e0 Added Errorhandling for AJAX-Requests, especially Authentication Issues.
Dustin Demuth <dustin@intevation.de>
parents: 811
diff changeset
159 }
188a9faf96e0 Added Errorhandling for AJAX-Requests, especially Authentication Issues.
Dustin Demuth <dustin@intevation.de>
parents: 811
diff changeset
160 else if(json.message){
188a9faf96e0 Added Errorhandling for AJAX-Requests, especially Authentication Issues.
Dustin Demuth <dustin@intevation.de>
parents: 811
diff changeset
161 Ext.Msg.alert(Lada.getApplication().bundle.getMsg('err.msg.generic.title')
188a9faf96e0 Added Errorhandling for AJAX-Requests, especially Authentication Issues.
Dustin Demuth <dustin@intevation.de>
parents: 811
diff changeset
162 +' #'+json.message,
188a9faf96e0 Added Errorhandling for AJAX-Requests, especially Authentication Issues.
Dustin Demuth <dustin@intevation.de>
parents: 811
diff changeset
163 Lada.getApplication().bundle.getMsg(json.message));
188a9faf96e0 Added Errorhandling for AJAX-Requests, especially Authentication Issues.
Dustin Demuth <dustin@intevation.de>
parents: 811
diff changeset
164 } else {
188a9faf96e0 Added Errorhandling for AJAX-Requests, especially Authentication Issues.
Dustin Demuth <dustin@intevation.de>
parents: 811
diff changeset
165 Ext.Msg.alert(i18n.getMsg('err.msg.generic.title'),
188a9faf96e0 Added Errorhandling for AJAX-Requests, especially Authentication Issues.
Dustin Demuth <dustin@intevation.de>
parents: 811
diff changeset
166 i18n.getMsg('err.msg.laf.filecreatefailed'));
188a9faf96e0 Added Errorhandling for AJAX-Requests, especially Authentication Issues.
Dustin Demuth <dustin@intevation.de>
parents: 811
diff changeset
167 }
188a9faf96e0 Added Errorhandling for AJAX-Requests, especially Authentication Issues.
Dustin Demuth <dustin@intevation.de>
parents: 811
diff changeset
168 } else {
188a9faf96e0 Added Errorhandling for AJAX-Requests, especially Authentication Issues.
Dustin Demuth <dustin@intevation.de>
parents: 811
diff changeset
169 Ext.Msg.alert(i18n.getMsg('err.msg.generic.title'),
754
6b0d0e62f7d7 added Probenintervalle to a Messprogramm... there is still a lot of work needed. For instance for the slider element.
Dustin Demuth <dustin@intevation.de>
parents: 751
diff changeset
170 i18n.getMsg('err.msg.laf.filecreatefailed'));
812
188a9faf96e0 Added Errorhandling for AJAX-Requests, especially Authentication Issues.
Dustin Demuth <dustin@intevation.de>
parents: 811
diff changeset
171 }
725
83c571b022f3 Added window for laf file upload and use filtergrid buttons to export or import.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 620
diff changeset
172 }
83c571b022f3 Added window for laf file upload and use filtergrid buttons to export or import.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 620
diff changeset
173 });
812
188a9faf96e0 Added Errorhandling for AJAX-Requests, especially Authentication Issues.
Dustin Demuth <dustin@intevation.de>
parents: 811
diff changeset
174 },
188a9faf96e0 Added Errorhandling for AJAX-Requests, especially Authentication Issues.
Dustin Demuth <dustin@intevation.de>
parents: 811
diff changeset
175
188a9faf96e0 Added Errorhandling for AJAX-Requests, especially Authentication Issues.
Dustin Demuth <dustin@intevation.de>
parents: 811
diff changeset
176 reload: function(btn) {
188a9faf96e0 Added Errorhandling for AJAX-Requests, especially Authentication Issues.
Dustin Demuth <dustin@intevation.de>
parents: 811
diff changeset
177 if (btn === 'yes') {
188a9faf96e0 Added Errorhandling for AJAX-Requests, especially Authentication Issues.
Dustin Demuth <dustin@intevation.de>
parents: 811
diff changeset
178 location.reload();
188a9faf96e0 Added Errorhandling for AJAX-Requests, especially Authentication Issues.
Dustin Demuth <dustin@intevation.de>
parents: 811
diff changeset
179 }
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
180 }
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
181 });

http://lada.wald.intevation.org