Mercurial > lada > lada-client
comparison app/controller/FilterResult.js @ 754:6b0d0e62f7d7
added Probenintervalle to a Messprogramm... there is still a lot of work needed. For instance for the slider element.
author | Dustin Demuth <dustin@intevation.de> |
---|---|
date | Tue, 05 May 2015 17:22:38 +0200 |
parents | 704bb359c0fe |
children | 3637c453f67d |
comparison
equal
deleted
inserted
replaced
753:4dd0c645ea8b | 754:6b0d0e62f7d7 |
---|---|
10 * Controller for filter result grid. | 10 * Controller for filter result grid. |
11 */ | 11 */ |
12 Ext.define('Lada.controller.FilterResult', { | 12 Ext.define('Lada.controller.FilterResult', { |
13 extend: 'Ext.app.Controller', | 13 extend: 'Ext.app.Controller', |
14 requires: [ | 14 requires: [ |
15 'Lada.view.window.ProbeEdit' | 15 'Lada.view.window.ProbeEdit', |
16 'Lada.view.window.MessprogrammEdit' | |
16 ], | 17 ], |
17 | 18 |
18 /** | 19 /** |
19 * Initialize the Controller with 4 listeners | 20 * Initialize the Controller with 4 listeners |
20 */ | 21 */ |
21 init: function() { | 22 init: function() { |
22 this.control({ | 23 this.control({ |
23 'filterresultgrid': { | 24 'filterresultgrid': { |
24 itemdblclick: this.editItem | 25 itemdblclick: this.editItem |
25 }, | 26 }, |
26 'filterresultgrid toolbar button[action=add]': { | 27 'filterresultgrid toolbar button[action=addProbe]': { |
27 click: this.addItem | 28 click: this.addProbeItem |
28 }, | 29 }, |
29 'filterresultgrid toolbar button[action=import]': { | 30 'filterresultgrid toolbar button[action=import]': { |
30 click: this.uploadFile | 31 click: this.uploadFile |
31 }, | 32 }, |
32 'filterresultgrid toolbar button[action=export]': { | 33 'filterresultgrid toolbar button[action=export]': { |
39 /** | 40 /** |
40 * This function is called after a Row in the | 41 * This function is called after a Row in the |
41 * {@link Lada.view.grid.FilterResult} | 42 * {@link Lada.view.grid.FilterResult} |
42 * was double-clicked. | 43 * was double-clicked. |
43 * The function opens a {@link Lada.view.window.ProbeEdit} | 44 * The function opens a {@link Lada.view.window.ProbeEdit} |
45 * or a {@link Lada.view.window.MessprogrammEdit}. | |
46 * To determine which window has to be opened, the function | |
47 * analyse the records modelname. | |
44 */ | 48 */ |
45 editItem: function(grid, record) { | 49 editItem: function(grid, record) { |
46 console.log(record); | 50 var mname = record.store.model.modelName || ''; |
47 var win = Ext.create('Lada.view.window.ProbeEdit', { | 51 var winname = ''; |
48 record: record | 52 |
49 }); | 53 //Based upon the Model that was loaded, act differently |
54 if (mname == 'Lada.model.ProbeList'){ | |
55 winname = 'Lada.view.window.ProbeEdit'; | |
56 } | |
57 else if (mname == 'Lada.model.MessprogrammList'){ | |
58 winname = 'Lada.view.window.MessprogrammEdit'; | |
59 } | |
60 if (winname){ | |
61 var win = Ext.create(winname, { | |
62 record: record | |
63 }); | |
64 win.show(); | |
65 win.initData(); | |
66 } | |
67 else { | |
68 console.log('The model is unknown.' | |
69 +'No window was configured to display the data.' | |
70 +'I retrieved a model named:' + mname | |
71 ); | |
72 } | |
73 }, | |
74 | |
75 /** | |
76 * This function opens a new window to create a Probe | |
77 * {@link Lada.view.window.ProbeCreate} | |
78 */ | |
79 addProbeItem: function() { | |
80 var win = Ext.create('Lada.view.window.ProbeCreate'); | |
50 win.show(); | 81 win.show(); |
51 win.initData(); | 82 win.initData(); |
52 }, | 83 }, |
53 | 84 |
54 /** | 85 /** |
55 * This function opens a new window to create a Probe | 86 * This function opens a new window to create a Probe |
56 * {@link Lada.view.window.ProbeEdit} | 87 * {@link Lada.view.window.MessprogrammCreate} |
57 */ | 88 */ |
58 addItem: function() { | 89 addMessprogrammItem: function() { |
59 var win = Ext.create('Lada.view.window.ProbeCreate'); | 90 // TODO |
60 win.show(); | 91 console.log('implement me.') |
61 win.initData(); | |
62 }, | 92 }, |
63 | 93 |
64 /** | 94 /** |
65 * This function opens a {@link Lada.view.window.FileUpload} | 95 * This function opens a {@link Lada.view.window.FileUpload} |
66 * window to upload a LAF-File | 96 * window to upload a LAF-File |
80 * The Download does not work with Internet Explorers older than v.10 | 110 * The Download does not work with Internet Explorers older than v.10 |
81 */ | 111 */ |
82 downloadFile: function(button) { | 112 downloadFile: function(button) { |
83 var grid = button.up('grid'); | 113 var grid = button.up('grid'); |
84 var selection = grid.getView().getSelectionModel().getSelection(); | 114 var selection = grid.getView().getSelectionModel().getSelection(); |
115 var i18n = Lada.getApplication().bundle; | |
85 var proben = []; | 116 var proben = []; |
86 for (var i = 0; i < selection.length; i++) { | 117 for (var i = 0; i < selection.length; i++) { |
87 proben.push(selection[i].get('id')); | 118 proben.push(selection[i].get('id')); |
88 } | 119 } |
89 | 120 |
96 var content = response.responseText; | 127 var content = response.responseText; |
97 var blob = new Blob([content],{type: 'text/plain'}); | 128 var blob = new Blob([content],{type: 'text/plain'}); |
98 saveAs(blob, 'export.laf'); | 129 saveAs(blob, 'export.laf'); |
99 }, | 130 }, |
100 failure: function() { | 131 failure: function() { |
101 Ext.Msg.alert('Fehler', 'Failed to create LAF-File!'); | 132 Ext.Msg.create(i18n.getMsg('err.msg.generic.title'), |
133 i18n.getMsg('err.msg.laf.filecreatefailed')); | |
102 } | 134 } |
103 }); | 135 }); |
104 } | 136 } |
105 }); | 137 }); |