Mercurial > lada > lada-client
annotate app/controller/grid/MessungList.js @ 1131:6549abef70e1
merged.
author | Raimund Renkert <raimund.renkert@intevation.de> |
---|---|
date | Wed, 25 May 2016 14:05:11 +0200 |
parents | 0a032c98c3a6 |
children | 056ffbc2790a |
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: [ |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
15 'Lada.view.window.ProbeEdit' |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
16 ], |
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 * Initialize the Controller with listeners |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
20 */ |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
21 init: function() { |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
22 this.control({ |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
23 'messunglistgrid': { |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
24 itemdblclick: this.editItem, |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
25 select: this.activateButtons, |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
26 deselect: this.deactivateButtons |
1082
dbd435256f77
Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1076
diff
changeset
|
27 }, |
dbd435256f77
Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1076
diff
changeset
|
28 'messunglistgrid toolbar button[action=setstatus]': { |
dbd435256f77
Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1076
diff
changeset
|
29 click: this.setStatus |
1076
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
30 } |
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 this.callParent(arguments); |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
33 }, |
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 /** |
1082
dbd435256f77
Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1076
diff
changeset
|
36 * Sets the Status on Bulk |
dbd435256f77
Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1076
diff
changeset
|
37 **/ |
dbd435256f77
Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1076
diff
changeset
|
38 setStatus: function(button) { |
dbd435256f77
Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1076
diff
changeset
|
39 //disable Button and setLoading... |
dbd435256f77
Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1076
diff
changeset
|
40 |
dbd435256f77
Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1076
diff
changeset
|
41 var grid = button.up('grid'); |
dbd435256f77
Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1076
diff
changeset
|
42 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
|
43 var i18n = Lada.getApplication().bundle; |
dbd435256f77
Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1076
diff
changeset
|
44 |
dbd435256f77
Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1076
diff
changeset
|
45 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
|
46 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
|
47 grid: grid, |
dbd435256f77
Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1076
diff
changeset
|
48 modal: true, |
dbd435256f77
Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1076
diff
changeset
|
49 selection: selection |
dbd435256f77
Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1076
diff
changeset
|
50 }); |
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 win.show(); |
dbd435256f77
Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1076
diff
changeset
|
53 |
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 /** |
1076
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
58 * 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
|
59 * {@link Lada.view.grid.ProbeList} |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
60 * was double-clicked. |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
61 * 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
|
62 * 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
|
63 * 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
|
64 * analyse the records modelname. |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
65 */ |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
66 editItem: function(grid, record) { |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
67 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
|
68 probeRecord.setId(record.get('probeId')); |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
69 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
|
70 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
|
71 |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
72 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
|
73 record: probeRecord, |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
74 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
|
75 }); |
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 probeWin.setPosition(30); |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
78 probeWin.show(); |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
79 probeWin.initData(); |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
80 |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
81 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
|
82 failure: function(record, action) { |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
83 me.setLoading(false); |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
84 // TODO |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
85 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
|
86 console.log(action); |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
87 console.log(record); |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
88 }, |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
89 success: function(precord, response) { |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
90 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
|
91 parentWindow: probeWin, |
1076
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
92 probe: precord, |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
93 record: record, |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
94 grid: grid |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
95 }); |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
96 messungWin.show(); |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
97 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
|
98 messungWin.initData(); |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
99 } |
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 * 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
|
105 */ |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
106 printSelection: function(button) { |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
107 |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
108 //disable Button and setLoading... |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
109 button.disable(); |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
110 button.setLoading(true); |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
111 |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
112 var grid = button.up('grid'); |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
113 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
|
114 var i18n = Lada.getApplication().bundle; |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
115 var me = this; |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
116 var columns = []; |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
117 var columnNames = []; |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
118 var visibleColumns = []; |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
119 var displayName = ''; |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
120 var data = []; |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
121 |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
122 // 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
|
123 try { |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
124 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
|
125 // 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
|
126 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
|
127 columns.push(key); |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
128 } |
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 catch (e) { |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
132 console.log(e); |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
133 } |
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 //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
|
136 // and set displayName |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
137 try { |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
138 var grid = button.up('grid'); |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
139 var cman = grid.columnManager; |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
140 var cols = cman.getColumns(); |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
141 |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
142 displayName = grid.down('tbtext').text; |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
143 |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
144 for (key in cols) { |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
145 if (cols[key].dataIndex) { |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
146 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
|
147 } |
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 catch (e) { |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
151 console.log(e); |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
152 } |
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 // Retrieve Data from selection |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
156 try { |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
157 for (item in selection) { |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
158 var row = selection[item].data; |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
159 var out = []; |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
160 //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
|
161 for (key in columns){ |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
162 var attr = columns[key]; |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
163 //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
|
164 if (row[attr] != null && |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
165 visibleColumns[attr] != null) { |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
166 out.push(row[attr].toString()); |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
167 } |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
168 else if (visibleColumns[attr] != null) { |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
169 out.push(''); |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
170 } |
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 data.push(out); |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
173 } |
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 catch (e){ |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
176 console.log(e); |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
177 } |
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 //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
|
180 try { |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
181 var grid = button.up('grid'); |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
182 var cman = grid.columnManager; |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
183 var cols = cman.getColumns(); |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
184 //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
|
185 // 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
|
186 for (key in columns){ |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
187 for (k in cols){ |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
188 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
|
189 columnNames.push(cols[k].text); |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
190 break; |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
191 } |
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 catch (e) { |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
196 console.log(e); |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
197 } |
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 var printData = { |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
200 'layout': 'A4 landscape', |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
201 'outputFormat': 'pdf', |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
202 'attributes': { |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
203 'title': 'Auszug aus LADA', |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
204 'displayName': displayName, |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
205 'table': { |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
206 'columns': columnNames, |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
207 'data': data |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
208 } |
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 Ext.Ajax.request({ |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
213 url: 'lada-printer/buildreport.pdf', |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
214 //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
|
215 jsonData: printData, |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
216 binary: true, |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
217 success: function(response) { |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
218 var content = response.responseBytes; |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
219 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
|
220 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
|
221 saveAs(blob, 'lada-print.pdf'); |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
222 button.enable(); |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
223 button.setLoading(false); |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
224 }, |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
225 failure: function(response) { |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
226 console.log('failure'); |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
227 // Error handling |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
228 // TODO |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
229 //console.log(response.responseText) |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
230 button.enable(); |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
231 button.setLoading(false); |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
232 if (response.responseText) { |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
233 try { |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
234 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
|
235 } |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
236 catch(e){ |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
237 console.log(e); |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
238 } |
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 if (json) { |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
241 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
|
242 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
|
243 } |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
244 if(json.message){ |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
245 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
|
246 +' #'+json.message, |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
247 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
|
248 } else { |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
249 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
|
250 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
|
251 } |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
252 } else { |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
253 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
|
254 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
|
255 } |
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 * 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
|
262 **/ |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
263 activateButtons: function(rowModel, record) { |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
264 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
|
265 this.buttonToggle(true, grid); |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
266 }, |
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 * 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
|
270 **/ |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
271 deactivateButtons: function(rowModel, record) { |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
272 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
|
273 // 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
|
274 if (rowModel.selected.items == 0) { |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
275 this.buttonToggle(false, grid); |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
276 } |
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 * 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
|
281 **/ |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
282 buttonToggle: function(enabled, grid) { |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
283 if (!enabled) { |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
284 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
|
285 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
|
286 } |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
287 else { |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
288 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
|
289 // 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
|
290 // readonly == false |
1082
dbd435256f77
Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1076
diff
changeset
|
291 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
|
292 } |
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 reload: function(btn) { |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
296 if (btn === 'yes') { |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
297 location.reload(); |
e32c10cf5499
Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
298 } |
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 }); |