Mercurial > lada > lada-client
annotate app/controller/FilterResult.js @ 732:fca4e738415e
merged
author | Dustin Demuth <dustin@intevation.de> |
---|---|
date | Fri, 17 Apr 2015 14:13:28 +0200 |
parents | e002234d7da5 |
children | 6e28ebbe1a73 |
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: [ |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
15 'Lada.view.window.ProbeEdit' |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
16 ], |
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 init: function() { |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
19 this.control({ |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
20 'filterresultgrid': { |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
21 itemdblclick: this.editItem |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
22 }, |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
23 'filterresultgrid toolbar button[action=add]': { |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
24 click: this.addItem |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
25 }, |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
26 'filterresultgrid toolbar button[action=import]': { |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
27 click: this.uploadFile |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
28 }, |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
29 'filterresultgrid toolbar button[action=export]': { |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
30 click: this.downloadFile |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
31 } |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
32 }); |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
33 this.callParent(arguments); |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
34 }, |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
35 |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
36 editItem: function(grid, record) { |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
37 var win = Ext.create('Lada.view.window.ProbeEdit', { |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
38 record: record |
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 win.show(); |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
41 win.initData(); |
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 |
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
|
44 addItem: function() { |
620
e0b966b32163
Open probe create window on button click.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
548
diff
changeset
|
45 var win = Ext.create('Lada.view.window.ProbeCreate'); |
e0b966b32163
Open probe create window on button click.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
548
diff
changeset
|
46 win.show(); |
e0b966b32163
Open probe create window on button click.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
548
diff
changeset
|
47 win.initData(); |
548
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
48 }, |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
49 |
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
|
50 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
|
51 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
|
52 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
|
53 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
|
54 }); |
548
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
55 |
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
|
56 win.show(); |
548
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
57 }, |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
58 |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
59 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
|
60 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
|
61 var selection = grid.getView().getSelectionModel().getSelection(); |
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
|
62 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
|
63 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
|
64 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
|
65 } |
548
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
66 |
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
|
67 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
|
68 method: 'POST', |
727
e002234d7da5
Corrected URL for lada-server in export and import
Dustin Demuth <dustin@intevation.de>
parents:
725
diff
changeset
|
69 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
|
70 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
|
71 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
|
72 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
|
73 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
|
74 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
|
75 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
|
76 }, |
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
|
77 failure: 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
|
78 Ext.Msg.alert('Fehler', 'Failed to create LAF-File!'); |
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
|
79 } |
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
|
80 }); |
548
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
81 } |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
82 }); |