Mercurial > lada > lada-client
annotate app/controller/grid/MessungList.js @ 1399:78839fe4b9b7 release-2.5
Do not set a default value for messzeitpunkt in messung.
author | Raimund Renkert <raimund.renkert@intevation.de> |
---|---|
date | Thu, 16 Mar 2017 14:44:04 +0100 |
parents | 056ffbc2790a |
children | 69ebd572fe5c |
rev | line source |
---|---|
1076
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
1 /* Copyright (C) 2013 by Bundesamt fuer Strahlenschutz |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
2 * Software engineering by Intevation GmbH |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
3 * |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
4 * This file is Free Software under the GNU GPL (v>=3) |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
5 * and comes with ABSOLUTELY NO WARRANTY! Check out |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
6 * the documentation coming with IMIS-Labordaten-Application for details. |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
7 */ |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
8 |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
9 /** |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
10 * Controller for the MessungList result grid. |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
11 */ |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
12 Ext.define('Lada.controller.grid.MessungList', { |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
13 extend: 'Ext.app.Controller', |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
14 requires: [ |
1157
056ffbc2790a
Add more missing requirements.
Tom Gottfried <tom@intevation.de>
parents:
1120
diff
changeset
|
15 'Lada.view.window.SetStatus', |
1076
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
16 'Lada.view.window.ProbeEdit' |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
17 ], |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
18 |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
19 /** |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
20 * Initialize the Controller with listeners |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
21 */ |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
22 init: function() { |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
23 this.control({ |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
24 'messunglistgrid': { |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
25 itemdblclick: this.editItem, |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
26 select: this.activateButtons, |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
27 deselect: this.deactivateButtons |
1082
dbd435256f77
Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1076
diff
changeset
|
28 }, |
dbd435256f77
Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1076
diff
changeset
|
29 'messunglistgrid toolbar button[action=setstatus]': { |
dbd435256f77
Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1076
diff
changeset
|
30 click: this.setStatus |
1076
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
31 } |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
32 }); |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
33 this.callParent(arguments); |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
34 }, |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
35 |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
36 /** |
1082
dbd435256f77
Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1076
diff
changeset
|
37 * Sets the Status on Bulk |
dbd435256f77
Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1076
diff
changeset
|
38 **/ |
dbd435256f77
Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1076
diff
changeset
|
39 setStatus: function(button) { |
dbd435256f77
Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1076
diff
changeset
|
40 //disable Button and setLoading... |
dbd435256f77
Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1076
diff
changeset
|
41 |
dbd435256f77
Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1076
diff
changeset
|
42 var grid = button.up('grid'); |
dbd435256f77
Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1076
diff
changeset
|
43 var selection = grid.getView().getSelectionModel().getSelection(); |
dbd435256f77
Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1076
diff
changeset
|
44 var i18n = Lada.getApplication().bundle; |
dbd435256f77
Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1076
diff
changeset
|
45 |
dbd435256f77
Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1076
diff
changeset
|
46 var win = Ext.create('Lada.view.window.SetStatus', { |
dbd435256f77
Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1076
diff
changeset
|
47 title: i18n.getMsg('statusSetzen.win.title'), |
dbd435256f77
Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1076
diff
changeset
|
48 grid: grid, |
dbd435256f77
Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1076
diff
changeset
|
49 modal: true, |
dbd435256f77
Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1076
diff
changeset
|
50 selection: selection |
dbd435256f77
Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1076
diff
changeset
|
51 }); |
dbd435256f77
Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1076
diff
changeset
|
52 |
dbd435256f77
Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1076
diff
changeset
|
53 win.show(); |
dbd435256f77
Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1076
diff
changeset
|
54 |
dbd435256f77
Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1076
diff
changeset
|
55 }, |
dbd435256f77
Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1076
diff
changeset
|
56 |
dbd435256f77
Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1076
diff
changeset
|
57 |
dbd435256f77
Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1076
diff
changeset
|
58 /** |
1076
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
59 * This function is called after a Row in the |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
60 * {@link Lada.view.grid.ProbeList} |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
61 * was double-clicked. |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
62 * The function opens a {@link Lada.view.window.ProbeEdit} |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
63 * or a {@link Lada.view.window.Messprogramm}. |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
64 * To determine which window has to be opened, the function |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
65 * analyse the records modelname. |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
66 */ |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
67 editItem: function(grid, record) { |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
68 var probeRecord = Ext.create('Lada.model.ProbeList'); |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
69 probeRecord.setId(record.get('probeId')); |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
70 probeRecord.set('owner', record.get('owner')); |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
71 probeRecord.set('readonly', record.get('readonly')); |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
72 |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
73 var probeWin = Ext.create('Lada.view.window.ProbeEdit', { |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
74 record: probeRecord, |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
75 style: 'z-index: -1;' //Fixes an Issue where windows could not be created in IE8 |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
76 }); |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
77 |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
78 probeWin.setPosition(30); |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
79 probeWin.show(); |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
80 probeWin.initData(); |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
81 |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
82 Ext.ClassManager.get('Lada.model.Probe').load(record.get('probeId'), { |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
83 failure: function(record, action) { |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
84 me.setLoading(false); |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
85 // TODO |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
86 console.log('An unhandled Failure occured. See following Response and Record'); |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
87 console.log(action); |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
88 console.log(record); |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
89 }, |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
90 success: function(precord, response) { |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
91 var messungWin = Ext.create('Lada.view.window.MessungEdit', { |
1120
0a032c98c3a6
Use correct parent window reference for messung windows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1082
diff
changeset
|
92 parentWindow: probeWin, |
1076
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
93 probe: precord, |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
94 record: record, |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
95 grid: grid |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
96 }); |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
97 messungWin.show(); |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
98 messungWin.setPosition(window.innerWidth - 30 - messungWin.width); |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
99 messungWin.initData(); |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
100 } |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
101 }); |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
102 }, |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
103 |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
104 /** |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
105 * Send the selection to a Printservice |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
106 */ |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
107 printSelection: function(button) { |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
108 |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
109 //disable Button and setLoading... |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
110 button.disable(); |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
111 button.setLoading(true); |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
112 |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
113 var grid = button.up('grid'); |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
114 var selection = grid.getView().getSelectionModel().getSelection(); |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
115 var i18n = Lada.getApplication().bundle; |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
116 var me = this; |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
117 var columns = []; |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
118 var columnNames = []; |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
119 var visibleColumns = []; |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
120 var displayName = ''; |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
121 var data = []; |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
122 |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
123 // Write the columns to an array |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
124 try { |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
125 for (key in selection[0].data) { |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
126 // Do not write owner or readonly or id |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
127 if (["owner", "readonly", "id", "probeId"].indexOf(key) == -1){ |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
128 columns.push(key); |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
129 } |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
130 } |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
131 } |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
132 catch (e) { |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
133 console.log(e); |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
134 } |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
135 |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
136 //Retrieve visible columns' id's and names. |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
137 // and set displayName |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
138 try { |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
139 var grid = button.up('grid'); |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
140 var cman = grid.columnManager; |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
141 var cols = cman.getColumns(); |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
142 |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
143 displayName = grid.down('tbtext').text; |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
144 |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
145 for (key in cols) { |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
146 if (cols[key].dataIndex) { |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
147 visibleColumns[cols[key].dataIndex] = cols[key].text; |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
148 } |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
149 } |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
150 } |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
151 catch (e) { |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
152 console.log(e); |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
153 } |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
154 |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
155 |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
156 // Retrieve Data from selection |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
157 try { |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
158 for (item in selection) { |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
159 var row = selection[item].data; |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
160 var out = []; |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
161 //Lookup every column and write to data array. |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
162 for (key in columns){ |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
163 var attr = columns[key]; |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
164 //Only write data to output when the column is not hidden. |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
165 if (row[attr] != null && |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
166 visibleColumns[attr] != null) { |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
167 out.push(row[attr].toString()); |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
168 } |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
169 else if (visibleColumns[attr] != null) { |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
170 out.push(''); |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
171 } |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
172 } |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
173 data.push(out); |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
174 } |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
175 } |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
176 catch (e){ |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
177 console.log(e); |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
178 } |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
179 |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
180 //Retrieve the names of the columns. |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
181 try { |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
182 var grid = button.up('grid'); |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
183 var cman = grid.columnManager; |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
184 var cols = cman.getColumns(); |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
185 //Iterate columns and find column names for the key... |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
186 // This WILL run into bad behaviour when column-keys exist twice. |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
187 for (key in columns){ |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
188 for (k in cols){ |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
189 if (cols[k].dataIndex == columns[key]){ |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
190 columnNames.push(cols[k].text); |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
191 break; |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
192 } |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
193 } |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
194 } |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
195 } |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
196 catch (e) { |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
197 console.log(e); |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
198 } |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
199 |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
200 var printData = { |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
201 'layout': 'A4 landscape', |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
202 'outputFormat': 'pdf', |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
203 'attributes': { |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
204 'title': 'Auszug aus LADA', |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
205 'displayName': displayName, |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
206 'table': { |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
207 'columns': columnNames, |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
208 'data': data |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
209 } |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
210 } |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
211 } |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
212 |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
213 Ext.Ajax.request({ |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
214 url: 'lada-printer/buildreport.pdf', |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
215 //configure a proxy in apache conf! |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
216 jsonData: printData, |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
217 binary: true, |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
218 success: function(response) { |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
219 var content = response.responseBytes; |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
220 var filetype = response.getResponseHeader('Content-Type'); |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
221 var blob = new Blob([content],{type: filetype}); |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
222 saveAs(blob, 'lada-print.pdf'); |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
223 button.enable(); |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
224 button.setLoading(false); |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
225 }, |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
226 failure: function(response) { |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
227 console.log('failure'); |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
228 // Error handling |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
229 // TODO |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
230 //console.log(response.responseText) |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
231 button.enable(); |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
232 button.setLoading(false); |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
233 if (response.responseText) { |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
234 try { |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
235 var json = Ext.JSON.decode(response.responseText); |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
236 } |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
237 catch(e){ |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
238 console.log(e); |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
239 } |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
240 } |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
241 if (json) { |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
242 if(json.errors.totalCount > 0 || json.warnings.totalCount > 0){ |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
243 formPanel.setMessages(json.errors, json.warnings); |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
244 } |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
245 if(json.message){ |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
246 Ext.Msg.alert(Lada.getApplication().bundle.getMsg('err.msg.generic.title') |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
247 +' #'+json.message, |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
248 Lada.getApplication().bundle.getMsg(json.message)); |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
249 } else { |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
250 Ext.Msg.alert(i18n.getMsg('err.msg.generic.title'), |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
251 i18n.getMsg('err.msg.print.noContact')); |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
252 } |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
253 } else { |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
254 Ext.Msg.alert(i18n.getMsg('err.msg.generic.title'), |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
255 i18n.getMsg('err.msg.print.noContact')); |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
256 } |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
257 } |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
258 }); |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
259 }, |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
260 |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
261 /** |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
262 * Toggles the buttons in the toolbar |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
263 **/ |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
264 activateButtons: function(rowModel, record) { |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
265 var grid = rowModel.view.up('grid'); |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
266 this.buttonToggle(true, grid); |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
267 }, |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
268 |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
269 /** |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
270 * Toggles the buttons in the toolbar |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
271 **/ |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
272 deactivateButtons: function(rowModel, record) { |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
273 var grid = rowModel.view.up('grid'); |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
274 // Only disable buttons when nothing is selected |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
275 if (rowModel.selected.items == 0) { |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
276 this.buttonToggle(false, grid); |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
277 } |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
278 }, |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
279 |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
280 /** |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
281 * Enables/Disables a set of buttons |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
282 **/ |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
283 buttonToggle: function(enabled, grid) { |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
284 if (!enabled) { |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
285 grid.down('button[action=print]').disable(); |
1082
dbd435256f77
Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1076
diff
changeset
|
286 grid.down('button[action=setstatus]').disable(); |
1076
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
287 } |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
288 else { |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
289 grid.down('button[action=print]').enable(); |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
290 // TODO: enable button only on messungen with owner == true and |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
291 // readonly == false |
1082
dbd435256f77
Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1076
diff
changeset
|
292 grid.down('button[action=setstatus]').enable(); |
1076
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
293 } |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
294 }, |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
295 |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
296 reload: function(btn) { |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
297 if (btn === 'yes') { |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
298 location.reload(); |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
299 } |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
300 } |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
301 }); |