Mercurial > lada > lada-client
annotate app/view/window/GenProbenFromMessprogramm.js @ 1280:3b4dcc83a21b
fix sencha compile warnings
author | Michael Stanko <mstanko@bfs.de> |
---|---|
date | Wed, 18 Jan 2017 14:49:05 +0100 |
parents | 96f9417c105e |
children | 0120a72b3690 |
rev | line source |
---|---|
760
2e7e1a8bf79f
Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
1 /* Copyright (C) 2013 by Bundesamt fuer Strahlenschutz |
2e7e1a8bf79f
Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
2 * Software engineering by Intevation GmbH |
2e7e1a8bf79f
Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
3 * |
2e7e1a8bf79f
Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
4 * This file is Free Software under the GNU GPL (v>=3) |
2e7e1a8bf79f
Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
5 * and comes with ABSOLUTELY NO WARRANTY! Check out |
2e7e1a8bf79f
Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
6 * the documentation coming with IMIS-Labordaten-Application for details. |
2e7e1a8bf79f
Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
7 */ |
2e7e1a8bf79f
Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
8 |
891 | 9 /** |
760
2e7e1a8bf79f
Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
10 * Window to generate Proben from a Messprogramm |
2e7e1a8bf79f
Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
11 */ |
2e7e1a8bf79f
Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
12 Ext.define('Lada.view.window.GenProbenFromMessprogramm', { |
2e7e1a8bf79f
Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
13 extend: 'Ext.window.Window', |
2e7e1a8bf79f
Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
14 alias: 'widget.genpfm', |
2e7e1a8bf79f
Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
15 |
1195
39d98891881c
Add missing requirement.
Tom Gottfried <tom@intevation.de>
parents:
1191
diff
changeset
|
16 requires: [ |
39d98891881c
Add missing requirement.
Tom Gottfried <tom@intevation.de>
parents:
1191
diff
changeset
|
17 'Lada.store.Proben' |
39d98891881c
Add missing requirement.
Tom Gottfried <tom@intevation.de>
parents:
1191
diff
changeset
|
18 ], |
39d98891881c
Add missing requirement.
Tom Gottfried <tom@intevation.de>
parents:
1191
diff
changeset
|
19 |
760
2e7e1a8bf79f
Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
20 collapsible: true, |
2e7e1a8bf79f
Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
21 maximizable: true, |
2e7e1a8bf79f
Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
22 autoShow: true, |
2e7e1a8bf79f
Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
23 autoScroll: true, |
2e7e1a8bf79f
Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
24 layout: 'fit', |
2e7e1a8bf79f
Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
25 constrain: true, |
2e7e1a8bf79f
Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
26 |
2e7e1a8bf79f
Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
27 record: null, |
818
097d4edc2f00
Genprobenwindow can only be created once, also fixed messprogrammortewindow 'close with x and can not reopen' bug
Dustin Demuth <dustin@intevation.de>
parents:
812
diff
changeset
|
28 parentWindow: null, |
760
2e7e1a8bf79f
Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
29 |
890
def27cdd0dfa
Added Documentation to Windows
Dustin Demuth <dustin@intevation.de>
parents:
882
diff
changeset
|
30 /** |
def27cdd0dfa
Added Documentation to Windows
Dustin Demuth <dustin@intevation.de>
parents:
882
diff
changeset
|
31 * This function initialises the Window |
def27cdd0dfa
Added Documentation to Windows
Dustin Demuth <dustin@intevation.de>
parents:
882
diff
changeset
|
32 */ |
760
2e7e1a8bf79f
Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
33 initComponent: function() { |
2e7e1a8bf79f
Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
34 var i18n = Lada.getApplication().bundle; |
2e7e1a8bf79f
Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
35 |
818
097d4edc2f00
Genprobenwindow can only be created once, also fixed messprogrammortewindow 'close with x and can not reopen' bug
Dustin Demuth <dustin@intevation.de>
parents:
812
diff
changeset
|
36 // add listeners to change the window appearence when it becomes inactive |
097d4edc2f00
Genprobenwindow can only be created once, also fixed messprogrammortewindow 'close with x and can not reopen' bug
Dustin Demuth <dustin@intevation.de>
parents:
812
diff
changeset
|
37 this.on({ |
097d4edc2f00
Genprobenwindow can only be created once, also fixed messprogrammortewindow 'close with x and can not reopen' bug
Dustin Demuth <dustin@intevation.de>
parents:
812
diff
changeset
|
38 activate: function(){ |
097d4edc2f00
Genprobenwindow can only be created once, also fixed messprogrammortewindow 'close with x and can not reopen' bug
Dustin Demuth <dustin@intevation.de>
parents:
812
diff
changeset
|
39 this.getEl().removeCls('window-inactive'); |
097d4edc2f00
Genprobenwindow can only be created once, also fixed messprogrammortewindow 'close with x and can not reopen' bug
Dustin Demuth <dustin@intevation.de>
parents:
812
diff
changeset
|
40 }, |
097d4edc2f00
Genprobenwindow can only be created once, also fixed messprogrammortewindow 'close with x and can not reopen' bug
Dustin Demuth <dustin@intevation.de>
parents:
812
diff
changeset
|
41 deactivate: function(){ |
097d4edc2f00
Genprobenwindow can only be created once, also fixed messprogrammortewindow 'close with x and can not reopen' bug
Dustin Demuth <dustin@intevation.de>
parents:
812
diff
changeset
|
42 this.getEl().addCls('window-inactive'); |
097d4edc2f00
Genprobenwindow can only be created once, also fixed messprogrammortewindow 'close with x and can not reopen' bug
Dustin Demuth <dustin@intevation.de>
parents:
812
diff
changeset
|
43 } |
097d4edc2f00
Genprobenwindow can only be created once, also fixed messprogrammortewindow 'close with x and can not reopen' bug
Dustin Demuth <dustin@intevation.de>
parents:
812
diff
changeset
|
44 }); |
097d4edc2f00
Genprobenwindow can only be created once, also fixed messprogrammortewindow 'close with x and can not reopen' bug
Dustin Demuth <dustin@intevation.de>
parents:
812
diff
changeset
|
45 |
760
2e7e1a8bf79f
Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
46 this.title = i18n.getMsg('gpfm.window.title'); |
2e7e1a8bf79f
Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
47 var me = this; |
2e7e1a8bf79f
Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
48 this.buttons = [{ |
2e7e1a8bf79f
Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
49 text: i18n.getMsg('cancel'), |
2e7e1a8bf79f
Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
50 scope: this, |
2e7e1a8bf79f
Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
51 handler: this.close |
2e7e1a8bf79f
Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
52 }, { |
2e7e1a8bf79f
Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
53 text: i18n.getMsg('generateproben'), |
2e7e1a8bf79f
Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
54 handler: function() { |
1208
1179a6358213
Tell the user something is happening.
Tom Gottfried <tom@intevation.de>
parents:
1205
diff
changeset
|
55 me.setLoading(true); |
1191
62f374ea7ab7
Use UTC date in messprogramm to generate probe objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1162
diff
changeset
|
56 var startDate = new Date(me.down('datefield[name=start]').getValue()); |
62f374ea7ab7
Use UTC date in messprogramm to generate probe objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1162
diff
changeset
|
57 var startUTC = Date.UTC( |
62f374ea7ab7
Use UTC date in messprogramm to generate probe objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1162
diff
changeset
|
58 startDate.getFullYear(), startDate.getMonth(), startDate.getDate()); |
62f374ea7ab7
Use UTC date in messprogramm to generate probe objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1162
diff
changeset
|
59 var endDate = new Date(me.down('datefield[name=end]').getValue()); |
62f374ea7ab7
Use UTC date in messprogramm to generate probe objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1162
diff
changeset
|
60 var endUTC = Date.UTC( |
62f374ea7ab7
Use UTC date in messprogramm to generate probe objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1162
diff
changeset
|
61 endDate.getFullYear(), endDate.getMonth(), endDate.getDate()); |
760
2e7e1a8bf79f
Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
62 var jsondata = { |
2e7e1a8bf79f
Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
63 id: me.record.id, |
1191
62f374ea7ab7
Use UTC date in messprogramm to generate probe objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1162
diff
changeset
|
64 start: startUTC, |
62f374ea7ab7
Use UTC date in messprogramm to generate probe objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1162
diff
changeset
|
65 end: endUTC |
760
2e7e1a8bf79f
Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
66 }; |
2e7e1a8bf79f
Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
67 |
2e7e1a8bf79f
Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
68 Ext.Ajax.request({ |
999 | 69 url: 'lada-server/rest/probe/messprogramm', |
760
2e7e1a8bf79f
Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
70 method: 'POST', |
1245
cadd1c113bd0
Increased timeout for generate proben request.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1233
diff
changeset
|
71 timeout: 2 * 60 * 1000, |
760
2e7e1a8bf79f
Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
72 jsonData: jsondata, |
1204 | 73 success: me.onSuccess, |
1280
3b4dcc83a21b
fix sencha compile warnings
Michael Stanko <mstanko@bfs.de>
parents:
1260
diff
changeset
|
74 failure: me.onFailure |
760
2e7e1a8bf79f
Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
75 }); |
2e7e1a8bf79f
Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
76 } |
2e7e1a8bf79f
Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
77 }]; |
834
2214aea9fd3a
Patched correct file of r. 832
Dustin Demuth <dustin@intevation.de>
parents:
833
diff
changeset
|
78 this.width = 350; |
2214aea9fd3a
Patched correct file of r. 832
Dustin Demuth <dustin@intevation.de>
parents:
833
diff
changeset
|
79 this.height = 250; |
760
2e7e1a8bf79f
Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
80 |
2e7e1a8bf79f
Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
81 // add listeners to change the window appearence when it becomes inactive |
2e7e1a8bf79f
Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
82 this.on({ |
2e7e1a8bf79f
Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
83 activate: function(){ |
2e7e1a8bf79f
Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
84 this.getEl().removeCls('window-inactive'); |
2e7e1a8bf79f
Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
85 }, |
2e7e1a8bf79f
Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
86 deactivate: function(){ |
2e7e1a8bf79f
Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
87 this.getEl().addCls('window-inactive'); |
818
097d4edc2f00
Genprobenwindow can only be created once, also fixed messprogrammortewindow 'close with x and can not reopen' bug
Dustin Demuth <dustin@intevation.de>
parents:
812
diff
changeset
|
88 }, |
097d4edc2f00
Genprobenwindow can only be created once, also fixed messprogrammortewindow 'close with x and can not reopen' bug
Dustin Demuth <dustin@intevation.de>
parents:
812
diff
changeset
|
89 close: function () { |
860
03f39ddae596
Restructured Filterresultgrid button-dock, added button to generate Proben from a selection of messprogramme.
Dustin Demuth <dustin@intevation.de>
parents:
855
diff
changeset
|
90 if (this.parentWindow) { |
03f39ddae596
Restructured Filterresultgrid button-dock, added button to generate Proben from a selection of messprogramme.
Dustin Demuth <dustin@intevation.de>
parents:
855
diff
changeset
|
91 this.parentWindow.probenWindow = null; |
03f39ddae596
Restructured Filterresultgrid button-dock, added button to generate Proben from a selection of messprogramme.
Dustin Demuth <dustin@intevation.de>
parents:
855
diff
changeset
|
92 } |
760
2e7e1a8bf79f
Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
93 } |
2e7e1a8bf79f
Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
94 }); |
2e7e1a8bf79f
Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
95 |
2e7e1a8bf79f
Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
96 // InitialConfig is the config object passed to the constructor on |
2e7e1a8bf79f
Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
97 // creation of this window. We need to pass it throuh to the form as |
2e7e1a8bf79f
Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
98 // we need the "Id" param to load the correct item. |
2e7e1a8bf79f
Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
99 this.items = [{ |
2e7e1a8bf79f
Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
100 border: 0, |
2e7e1a8bf79f
Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
101 autoScroll: true, |
2e7e1a8bf79f
Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
102 items: [{ |
807 | 103 xtype: 'panel', |
104 border: 0, | |
105 margin: 5, | |
106 layout: 'fit', | |
107 html: '<p>' | |
108 + i18n.getMsg('nameofmessprogramm') | |
109 + '<br/>' | |
110 + this.record.get('name') | |
111 + '</p>' | |
760
2e7e1a8bf79f
Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
112 }, { |
807 | 113 xtype: 'panel', |
114 border: 0, | |
115 margin: 5, | |
116 layout: 'fit', | |
117 html: '<p>' + i18n.getMsg('messprogtimeperiod') + '</p>' | |
760
2e7e1a8bf79f
Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
118 }, { |
1105
953b359748bb
change time range format in GenProbenFromMessprogramm
Michael Stanko <mstanko@bfs.de>
parents:
999
diff
changeset
|
119 xtype: 'datefield', |
760
2e7e1a8bf79f
Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
120 fieldLabel: i18n.getMsg('from'), |
2e7e1a8bf79f
Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
121 labelWidth: 90, |
807 | 122 margin: 5, |
1105
953b359748bb
change time range format in GenProbenFromMessprogramm
Michael Stanko <mstanko@bfs.de>
parents:
999
diff
changeset
|
123 width: 200, |
760
2e7e1a8bf79f
Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
124 name: 'start', |
1105
953b359748bb
change time range format in GenProbenFromMessprogramm
Michael Stanko <mstanko@bfs.de>
parents:
999
diff
changeset
|
125 format: 'd.m.Y', |
1260
96f9417c105e
Set default date value GenProbenFromMessprogramm
Evi Huber <ehuber@bfs.de>
parents:
1245
diff
changeset
|
126 period: 'start', |
96f9417c105e
Set default date value GenProbenFromMessprogramm
Evi Huber <ehuber@bfs.de>
parents:
1245
diff
changeset
|
127 value: new Date() |
760
2e7e1a8bf79f
Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
128 }, { |
1105
953b359748bb
change time range format in GenProbenFromMessprogramm
Michael Stanko <mstanko@bfs.de>
parents:
999
diff
changeset
|
129 xtype: 'datefield', |
760
2e7e1a8bf79f
Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
130 fieldLabel: i18n.getMsg('to'), |
2e7e1a8bf79f
Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
131 labelWidth: 90, |
807 | 132 margin: 5, |
1105
953b359748bb
change time range format in GenProbenFromMessprogramm
Michael Stanko <mstanko@bfs.de>
parents:
999
diff
changeset
|
133 width: 200, |
760
2e7e1a8bf79f
Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
134 name: 'end', |
1105
953b359748bb
change time range format in GenProbenFromMessprogramm
Michael Stanko <mstanko@bfs.de>
parents:
999
diff
changeset
|
135 format: 'd.m.Y', |
1260
96f9417c105e
Set default date value GenProbenFromMessprogramm
Evi Huber <ehuber@bfs.de>
parents:
1245
diff
changeset
|
136 period: 'end', |
96f9417c105e
Set default date value GenProbenFromMessprogramm
Evi Huber <ehuber@bfs.de>
parents:
1245
diff
changeset
|
137 value: new Date(new Date().getFullYear(), 11, 31) |
760
2e7e1a8bf79f
Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
138 }] |
2e7e1a8bf79f
Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
139 }]; |
2e7e1a8bf79f
Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
140 this.callParent(arguments); |
2e7e1a8bf79f
Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
141 }, |
2e7e1a8bf79f
Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
142 |
2e7e1a8bf79f
Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
143 /** |
1204 | 144 * Callback on success of request (HTTP status 200) |
145 */ | |
146 onSuccess: function(response) { | |
147 var i18n = Lada.getApplication().bundle; | |
148 | |
149 var json = Ext.JSON.decode(response.responseText); | |
150 | |
1205
613e48a3fef9
Error messages from LADA server are not related to HTTP errors.
Tom Gottfried <tom@intevation.de>
parents:
1204
diff
changeset
|
151 if (json.message != '200') { |
613e48a3fef9
Error messages from LADA server are not related to HTTP errors.
Tom Gottfried <tom@intevation.de>
parents:
1204
diff
changeset
|
152 // handle LADA server errors |
613e48a3fef9
Error messages from LADA server are not related to HTTP errors.
Tom Gottfried <tom@intevation.de>
parents:
1204
diff
changeset
|
153 Ext.Msg.alert(i18n.getMsg('err.msg.generic.title'), |
613e48a3fef9
Error messages from LADA server are not related to HTTP errors.
Tom Gottfried <tom@intevation.de>
parents:
1204
diff
changeset
|
154 i18n.getMsg(json.message)); |
1209
78805e951c37
Release window if server reports errors.
Tom Gottfried <tom@intevation.de>
parents:
1208
diff
changeset
|
155 me.setLoading(false); |
1205
613e48a3fef9
Error messages from LADA server are not related to HTTP errors.
Tom Gottfried <tom@intevation.de>
parents:
1204
diff
changeset
|
156 } else { |
613e48a3fef9
Error messages from LADA server are not related to HTTP errors.
Tom Gottfried <tom@intevation.de>
parents:
1204
diff
changeset
|
157 var radio = Ext.ComponentQuery.query('modeswitcher')[0] |
613e48a3fef9
Error messages from LADA server are not related to HTTP errors.
Tom Gottfried <tom@intevation.de>
parents:
1204
diff
changeset
|
158 .down('radiofield[inputValue=proben]'); |
613e48a3fef9
Error messages from LADA server are not related to HTTP errors.
Tom Gottfried <tom@intevation.de>
parents:
1204
diff
changeset
|
159 radio.setValue(true); |
613e48a3fef9
Error messages from LADA server are not related to HTTP errors.
Tom Gottfried <tom@intevation.de>
parents:
1204
diff
changeset
|
160 |
613e48a3fef9
Error messages from LADA server are not related to HTTP errors.
Tom Gottfried <tom@intevation.de>
parents:
1204
diff
changeset
|
161 var contentPanel = Ext.ComponentQuery.query('panel[name=main]')[0] |
613e48a3fef9
Error messages from LADA server are not related to HTTP errors.
Tom Gottfried <tom@intevation.de>
parents:
1204
diff
changeset
|
162 .down('panel[name=contentpanel]'); |
613e48a3fef9
Error messages from LADA server are not related to HTTP errors.
Tom Gottfried <tom@intevation.de>
parents:
1204
diff
changeset
|
163 contentPanel.removeAll(); //clear panel: make space for new grids |
613e48a3fef9
Error messages from LADA server are not related to HTTP errors.
Tom Gottfried <tom@intevation.de>
parents:
1204
diff
changeset
|
164 var gridstore = Ext.create('Lada.store.Proben'); |
613e48a3fef9
Error messages from LADA server are not related to HTTP errors.
Tom Gottfried <tom@intevation.de>
parents:
1204
diff
changeset
|
165 var frgrid = Ext.create('Lada.view.grid.ProbeList', { |
613e48a3fef9
Error messages from LADA server are not related to HTTP errors.
Tom Gottfried <tom@intevation.de>
parents:
1204
diff
changeset
|
166 plugins: [{ |
613e48a3fef9
Error messages from LADA server are not related to HTTP errors.
Tom Gottfried <tom@intevation.de>
parents:
1204
diff
changeset
|
167 ptype: 'gridrowexpander', |
613e48a3fef9
Error messages from LADA server are not related to HTTP errors.
Tom Gottfried <tom@intevation.de>
parents:
1204
diff
changeset
|
168 gridType: 'Lada.view.grid.Messung', |
613e48a3fef9
Error messages from LADA server are not related to HTTP errors.
Tom Gottfried <tom@intevation.de>
parents:
1204
diff
changeset
|
169 expandOnDblClick: false, |
613e48a3fef9
Error messages from LADA server are not related to HTTP errors.
Tom Gottfried <tom@intevation.de>
parents:
1204
diff
changeset
|
170 gridConfig: { |
613e48a3fef9
Error messages from LADA server are not related to HTTP errors.
Tom Gottfried <tom@intevation.de>
parents:
1204
diff
changeset
|
171 bottomBar: false |
613e48a3fef9
Error messages from LADA server are not related to HTTP errors.
Tom Gottfried <tom@intevation.de>
parents:
1204
diff
changeset
|
172 } |
613e48a3fef9
Error messages from LADA server are not related to HTTP errors.
Tom Gottfried <tom@intevation.de>
parents:
1204
diff
changeset
|
173 }] |
613e48a3fef9
Error messages from LADA server are not related to HTTP errors.
Tom Gottfried <tom@intevation.de>
parents:
1204
diff
changeset
|
174 }); |
613e48a3fef9
Error messages from LADA server are not related to HTTP errors.
Tom Gottfried <tom@intevation.de>
parents:
1204
diff
changeset
|
175 |
613e48a3fef9
Error messages from LADA server are not related to HTTP errors.
Tom Gottfried <tom@intevation.de>
parents:
1204
diff
changeset
|
176 var columns = [{ |
613e48a3fef9
Error messages from LADA server are not related to HTTP errors.
Tom Gottfried <tom@intevation.de>
parents:
1204
diff
changeset
|
177 header: i18n.getMsg('prnId'), |
1233
a1bbfddb77b9
Fix result list from generation of Probe objects.
Tom Gottfried <tom@intevation.de>
parents:
1232
diff
changeset
|
178 dataIndex: 'idAlt' |
1205
613e48a3fef9
Error messages from LADA server are not related to HTTP errors.
Tom Gottfried <tom@intevation.de>
parents:
1204
diff
changeset
|
179 }, { |
613e48a3fef9
Error messages from LADA server are not related to HTTP errors.
Tom Gottfried <tom@intevation.de>
parents:
1204
diff
changeset
|
180 header: i18n.getMsg('mstId'), |
613e48a3fef9
Error messages from LADA server are not related to HTTP errors.
Tom Gottfried <tom@intevation.de>
parents:
1204
diff
changeset
|
181 dataIndex: 'mstId', |
613e48a3fef9
Error messages from LADA server are not related to HTTP errors.
Tom Gottfried <tom@intevation.de>
parents:
1204
diff
changeset
|
182 renderer: function(value) { |
613e48a3fef9
Error messages from LADA server are not related to HTTP errors.
Tom Gottfried <tom@intevation.de>
parents:
1204
diff
changeset
|
183 var r = ''; |
613e48a3fef9
Error messages from LADA server are not related to HTTP errors.
Tom Gottfried <tom@intevation.de>
parents:
1204
diff
changeset
|
184 if (!value || value === '') { |
613e48a3fef9
Error messages from LADA server are not related to HTTP errors.
Tom Gottfried <tom@intevation.de>
parents:
1204
diff
changeset
|
185 r = 'Error'; |
613e48a3fef9
Error messages from LADA server are not related to HTTP errors.
Tom Gottfried <tom@intevation.de>
parents:
1204
diff
changeset
|
186 } |
613e48a3fef9
Error messages from LADA server are not related to HTTP errors.
Tom Gottfried <tom@intevation.de>
parents:
1204
diff
changeset
|
187 var store = Ext.data.StoreManager.get('messstellen'); |
613e48a3fef9
Error messages from LADA server are not related to HTTP errors.
Tom Gottfried <tom@intevation.de>
parents:
1204
diff
changeset
|
188 var record = store.getById(value); |
613e48a3fef9
Error messages from LADA server are not related to HTTP errors.
Tom Gottfried <tom@intevation.de>
parents:
1204
diff
changeset
|
189 if (record) { |
613e48a3fef9
Error messages from LADA server are not related to HTTP errors.
Tom Gottfried <tom@intevation.de>
parents:
1204
diff
changeset
|
190 r = record.get('messStelle'); |
613e48a3fef9
Error messages from LADA server are not related to HTTP errors.
Tom Gottfried <tom@intevation.de>
parents:
1204
diff
changeset
|
191 } |
613e48a3fef9
Error messages from LADA server are not related to HTTP errors.
Tom Gottfried <tom@intevation.de>
parents:
1204
diff
changeset
|
192 return r; |
1204 | 193 } |
1205
613e48a3fef9
Error messages from LADA server are not related to HTTP errors.
Tom Gottfried <tom@intevation.de>
parents:
1204
diff
changeset
|
194 }, { |
613e48a3fef9
Error messages from LADA server are not related to HTTP errors.
Tom Gottfried <tom@intevation.de>
parents:
1204
diff
changeset
|
195 header: i18n.getMsg('datenbasisId'), |
613e48a3fef9
Error messages from LADA server are not related to HTTP errors.
Tom Gottfried <tom@intevation.de>
parents:
1204
diff
changeset
|
196 dataIndex: 'datenbasisId', |
613e48a3fef9
Error messages from LADA server are not related to HTTP errors.
Tom Gottfried <tom@intevation.de>
parents:
1204
diff
changeset
|
197 renderer: function(value) { |
613e48a3fef9
Error messages from LADA server are not related to HTTP errors.
Tom Gottfried <tom@intevation.de>
parents:
1204
diff
changeset
|
198 var r = ''; |
613e48a3fef9
Error messages from LADA server are not related to HTTP errors.
Tom Gottfried <tom@intevation.de>
parents:
1204
diff
changeset
|
199 if (!value || value === '') { |
613e48a3fef9
Error messages from LADA server are not related to HTTP errors.
Tom Gottfried <tom@intevation.de>
parents:
1204
diff
changeset
|
200 r = value; |
613e48a3fef9
Error messages from LADA server are not related to HTTP errors.
Tom Gottfried <tom@intevation.de>
parents:
1204
diff
changeset
|
201 } |
613e48a3fef9
Error messages from LADA server are not related to HTTP errors.
Tom Gottfried <tom@intevation.de>
parents:
1204
diff
changeset
|
202 var store = Ext.data.StoreManager.get('datenbasis'); |
613e48a3fef9
Error messages from LADA server are not related to HTTP errors.
Tom Gottfried <tom@intevation.de>
parents:
1204
diff
changeset
|
203 var record = store.getById(value); |
613e48a3fef9
Error messages from LADA server are not related to HTTP errors.
Tom Gottfried <tom@intevation.de>
parents:
1204
diff
changeset
|
204 if (record) { |
613e48a3fef9
Error messages from LADA server are not related to HTTP errors.
Tom Gottfried <tom@intevation.de>
parents:
1204
diff
changeset
|
205 r = record.get('datenbasis'); |
613e48a3fef9
Error messages from LADA server are not related to HTTP errors.
Tom Gottfried <tom@intevation.de>
parents:
1204
diff
changeset
|
206 } |
613e48a3fef9
Error messages from LADA server are not related to HTTP errors.
Tom Gottfried <tom@intevation.de>
parents:
1204
diff
changeset
|
207 return r; |
1204 | 208 } |
1205
613e48a3fef9
Error messages from LADA server are not related to HTTP errors.
Tom Gottfried <tom@intevation.de>
parents:
1204
diff
changeset
|
209 }, { |
613e48a3fef9
Error messages from LADA server are not related to HTTP errors.
Tom Gottfried <tom@intevation.de>
parents:
1204
diff
changeset
|
210 header: i18n.getMsg('baId'), |
613e48a3fef9
Error messages from LADA server are not related to HTTP errors.
Tom Gottfried <tom@intevation.de>
parents:
1204
diff
changeset
|
211 dataIndex: 'baId', |
613e48a3fef9
Error messages from LADA server are not related to HTTP errors.
Tom Gottfried <tom@intevation.de>
parents:
1204
diff
changeset
|
212 renderer: function(value) { |
613e48a3fef9
Error messages from LADA server are not related to HTTP errors.
Tom Gottfried <tom@intevation.de>
parents:
1204
diff
changeset
|
213 var r = ''; |
613e48a3fef9
Error messages from LADA server are not related to HTTP errors.
Tom Gottfried <tom@intevation.de>
parents:
1204
diff
changeset
|
214 var store = Ext.create('Ext.data.Store', { |
1232
9c429e7bf747
Fix display of Messregime in result from generation of Proben.
Tom Gottfried <tom@intevation.de>
parents:
1209
diff
changeset
|
215 fields: ['id', 'betriebsart'], |
1205
613e48a3fef9
Error messages from LADA server are not related to HTTP errors.
Tom Gottfried <tom@intevation.de>
parents:
1204
diff
changeset
|
216 data: [{ |
1232
9c429e7bf747
Fix display of Messregime in result from generation of Proben.
Tom Gottfried <tom@intevation.de>
parents:
1209
diff
changeset
|
217 'id': 1, |
1205
613e48a3fef9
Error messages from LADA server are not related to HTTP errors.
Tom Gottfried <tom@intevation.de>
parents:
1204
diff
changeset
|
218 'betriebsart': 'Normal-/Routinebetrieb' |
613e48a3fef9
Error messages from LADA server are not related to HTTP errors.
Tom Gottfried <tom@intevation.de>
parents:
1204
diff
changeset
|
219 }, { |
1232
9c429e7bf747
Fix display of Messregime in result from generation of Proben.
Tom Gottfried <tom@intevation.de>
parents:
1209
diff
changeset
|
220 'id': 2, |
1205
613e48a3fef9
Error messages from LADA server are not related to HTTP errors.
Tom Gottfried <tom@intevation.de>
parents:
1204
diff
changeset
|
221 'betriebsart': 'Störfall/Intensivbetrieb' |
613e48a3fef9
Error messages from LADA server are not related to HTTP errors.
Tom Gottfried <tom@intevation.de>
parents:
1204
diff
changeset
|
222 }] |
613e48a3fef9
Error messages from LADA server are not related to HTTP errors.
Tom Gottfried <tom@intevation.de>
parents:
1204
diff
changeset
|
223 }); |
613e48a3fef9
Error messages from LADA server are not related to HTTP errors.
Tom Gottfried <tom@intevation.de>
parents:
1204
diff
changeset
|
224 var record = store.getById(value); |
613e48a3fef9
Error messages from LADA server are not related to HTTP errors.
Tom Gottfried <tom@intevation.de>
parents:
1204
diff
changeset
|
225 if (record) { |
613e48a3fef9
Error messages from LADA server are not related to HTTP errors.
Tom Gottfried <tom@intevation.de>
parents:
1204
diff
changeset
|
226 r = record.get('betriebsart'); |
613e48a3fef9
Error messages from LADA server are not related to HTTP errors.
Tom Gottfried <tom@intevation.de>
parents:
1204
diff
changeset
|
227 } |
613e48a3fef9
Error messages from LADA server are not related to HTTP errors.
Tom Gottfried <tom@intevation.de>
parents:
1204
diff
changeset
|
228 return r; |
1204 | 229 } |
1205
613e48a3fef9
Error messages from LADA server are not related to HTTP errors.
Tom Gottfried <tom@intevation.de>
parents:
1204
diff
changeset
|
230 }, { |
613e48a3fef9
Error messages from LADA server are not related to HTTP errors.
Tom Gottfried <tom@intevation.de>
parents:
1204
diff
changeset
|
231 header: i18n.getMsg('probenartId'), |
613e48a3fef9
Error messages from LADA server are not related to HTTP errors.
Tom Gottfried <tom@intevation.de>
parents:
1204
diff
changeset
|
232 dataIndex: 'probenartId', |
613e48a3fef9
Error messages from LADA server are not related to HTTP errors.
Tom Gottfried <tom@intevation.de>
parents:
1204
diff
changeset
|
233 renderer: function(value) { |
613e48a3fef9
Error messages from LADA server are not related to HTTP errors.
Tom Gottfried <tom@intevation.de>
parents:
1204
diff
changeset
|
234 var r = ''; |
613e48a3fef9
Error messages from LADA server are not related to HTTP errors.
Tom Gottfried <tom@intevation.de>
parents:
1204
diff
changeset
|
235 if (!value || value === '') { |
613e48a3fef9
Error messages from LADA server are not related to HTTP errors.
Tom Gottfried <tom@intevation.de>
parents:
1204
diff
changeset
|
236 r = value; |
613e48a3fef9
Error messages from LADA server are not related to HTTP errors.
Tom Gottfried <tom@intevation.de>
parents:
1204
diff
changeset
|
237 } |
613e48a3fef9
Error messages from LADA server are not related to HTTP errors.
Tom Gottfried <tom@intevation.de>
parents:
1204
diff
changeset
|
238 var store = Ext.data.StoreManager.get('probenarten'); |
613e48a3fef9
Error messages from LADA server are not related to HTTP errors.
Tom Gottfried <tom@intevation.de>
parents:
1204
diff
changeset
|
239 var record = store.getById(value); |
613e48a3fef9
Error messages from LADA server are not related to HTTP errors.
Tom Gottfried <tom@intevation.de>
parents:
1204
diff
changeset
|
240 if (record) { |
613e48a3fef9
Error messages from LADA server are not related to HTTP errors.
Tom Gottfried <tom@intevation.de>
parents:
1204
diff
changeset
|
241 r = record.get('probenart'); |
613e48a3fef9
Error messages from LADA server are not related to HTTP errors.
Tom Gottfried <tom@intevation.de>
parents:
1204
diff
changeset
|
242 } |
613e48a3fef9
Error messages from LADA server are not related to HTTP errors.
Tom Gottfried <tom@intevation.de>
parents:
1204
diff
changeset
|
243 return r; |
613e48a3fef9
Error messages from LADA server are not related to HTTP errors.
Tom Gottfried <tom@intevation.de>
parents:
1204
diff
changeset
|
244 } |
613e48a3fef9
Error messages from LADA server are not related to HTTP errors.
Tom Gottfried <tom@intevation.de>
parents:
1204
diff
changeset
|
245 }, { |
613e48a3fef9
Error messages from LADA server are not related to HTTP errors.
Tom Gottfried <tom@intevation.de>
parents:
1204
diff
changeset
|
246 header: i18n.getMsg('sollVon'), |
613e48a3fef9
Error messages from LADA server are not related to HTTP errors.
Tom Gottfried <tom@intevation.de>
parents:
1204
diff
changeset
|
247 dataIndex: 'solldatumBeginn', |
613e48a3fef9
Error messages from LADA server are not related to HTTP errors.
Tom Gottfried <tom@intevation.de>
parents:
1204
diff
changeset
|
248 renderer: function(value) { |
613e48a3fef9
Error messages from LADA server are not related to HTTP errors.
Tom Gottfried <tom@intevation.de>
parents:
1204
diff
changeset
|
249 if (!value) { |
613e48a3fef9
Error messages from LADA server are not related to HTTP errors.
Tom Gottfried <tom@intevation.de>
parents:
1204
diff
changeset
|
250 return ''; |
613e48a3fef9
Error messages from LADA server are not related to HTTP errors.
Tom Gottfried <tom@intevation.de>
parents:
1204
diff
changeset
|
251 } |
613e48a3fef9
Error messages from LADA server are not related to HTTP errors.
Tom Gottfried <tom@intevation.de>
parents:
1204
diff
changeset
|
252 return Ext.Date.format(value, 'd.m.Y'); |
613e48a3fef9
Error messages from LADA server are not related to HTTP errors.
Tom Gottfried <tom@intevation.de>
parents:
1204
diff
changeset
|
253 } |
613e48a3fef9
Error messages from LADA server are not related to HTTP errors.
Tom Gottfried <tom@intevation.de>
parents:
1204
diff
changeset
|
254 }, { |
613e48a3fef9
Error messages from LADA server are not related to HTTP errors.
Tom Gottfried <tom@intevation.de>
parents:
1204
diff
changeset
|
255 header: i18n.getMsg('sollBis'), |
613e48a3fef9
Error messages from LADA server are not related to HTTP errors.
Tom Gottfried <tom@intevation.de>
parents:
1204
diff
changeset
|
256 dataIndex: 'solldatumEnde', |
613e48a3fef9
Error messages from LADA server are not related to HTTP errors.
Tom Gottfried <tom@intevation.de>
parents:
1204
diff
changeset
|
257 renderer: function(value) { |
613e48a3fef9
Error messages from LADA server are not related to HTTP errors.
Tom Gottfried <tom@intevation.de>
parents:
1204
diff
changeset
|
258 if (!value) { |
613e48a3fef9
Error messages from LADA server are not related to HTTP errors.
Tom Gottfried <tom@intevation.de>
parents:
1204
diff
changeset
|
259 return ''; |
613e48a3fef9
Error messages from LADA server are not related to HTTP errors.
Tom Gottfried <tom@intevation.de>
parents:
1204
diff
changeset
|
260 } |
613e48a3fef9
Error messages from LADA server are not related to HTTP errors.
Tom Gottfried <tom@intevation.de>
parents:
1204
diff
changeset
|
261 return Ext.Date.format(value, 'd.m.Y'); |
613e48a3fef9
Error messages from LADA server are not related to HTTP errors.
Tom Gottfried <tom@intevation.de>
parents:
1204
diff
changeset
|
262 } |
613e48a3fef9
Error messages from LADA server are not related to HTTP errors.
Tom Gottfried <tom@intevation.de>
parents:
1204
diff
changeset
|
263 }]; |
613e48a3fef9
Error messages from LADA server are not related to HTTP errors.
Tom Gottfried <tom@intevation.de>
parents:
1204
diff
changeset
|
264 frgrid.reconfigure(gridstore, columns); |
1204 | 265 |
1205
613e48a3fef9
Error messages from LADA server are not related to HTTP errors.
Tom Gottfried <tom@intevation.de>
parents:
1204
diff
changeset
|
266 gridstore.loadData(json.data); |
613e48a3fef9
Error messages from LADA server are not related to HTTP errors.
Tom Gottfried <tom@intevation.de>
parents:
1204
diff
changeset
|
267 contentPanel.add(frgrid); |
613e48a3fef9
Error messages from LADA server are not related to HTTP errors.
Tom Gottfried <tom@intevation.de>
parents:
1204
diff
changeset
|
268 Ext.Msg.show({ |
613e48a3fef9
Error messages from LADA server are not related to HTTP errors.
Tom Gottfried <tom@intevation.de>
parents:
1204
diff
changeset
|
269 title: i18n.getMsg('success'), |
613e48a3fef9
Error messages from LADA server are not related to HTTP errors.
Tom Gottfried <tom@intevation.de>
parents:
1204
diff
changeset
|
270 autoScroll: true, |
613e48a3fef9
Error messages from LADA server are not related to HTTP errors.
Tom Gottfried <tom@intevation.de>
parents:
1204
diff
changeset
|
271 msg: me.evalResponse(json), |
613e48a3fef9
Error messages from LADA server are not related to HTTP errors.
Tom Gottfried <tom@intevation.de>
parents:
1204
diff
changeset
|
272 buttons: Ext.Msg.OK |
613e48a3fef9
Error messages from LADA server are not related to HTTP errors.
Tom Gottfried <tom@intevation.de>
parents:
1204
diff
changeset
|
273 }); |
613e48a3fef9
Error messages from LADA server are not related to HTTP errors.
Tom Gottfried <tom@intevation.de>
parents:
1204
diff
changeset
|
274 me.close(); |
613e48a3fef9
Error messages from LADA server are not related to HTTP errors.
Tom Gottfried <tom@intevation.de>
parents:
1204
diff
changeset
|
275 } |
1204 | 276 }, |
277 | |
278 /** | |
279 * Callback on failure of request (HTTP status != 200) | |
280 */ | |
281 onFailure: function(response) { | |
1208
1179a6358213
Tell the user something is happening.
Tom Gottfried <tom@intevation.de>
parents:
1205
diff
changeset
|
282 me.setLoading(false); |
1179a6358213
Tell the user something is happening.
Tom Gottfried <tom@intevation.de>
parents:
1205
diff
changeset
|
283 |
1204 | 284 var i18n = Lada.getApplication().bundle; |
285 | |
286 var json = null; | |
287 try { | |
288 json = Ext.JSON.decode(response.responseText); | |
289 } | |
290 catch(err){ | |
291 Ext.Msg.alert(i18n.getMsg('err.msg.generic.title'), | |
292 i18n.getMsg('err.msg.response.body')); | |
293 } | |
294 if (json) { | |
295 if(json.errors.totalCount > 0 || json.warnings.totalCount > 0){ | |
296 formPanel.setMessages(json.errors, json.warnings); | |
297 } | |
298 /* | |
299 SSO will send a 302 if the Client is not authenticated | |
300 unfortunately this seems to be filtered by the browser. | |
301 We assume that a 302 was send when the follwing statement | |
302 is true. | |
303 */ | |
304 if (response.status == 0 && response.responseText === "") { | |
305 Ext.MessageBox.confirm( | |
306 'Erneutes Login erforderlich', | |
307 'Ihre Session ist abgelaufen.<br/>' | |
308 + 'Für ein erneutes Login muss die Anwendung ' | |
309 + 'neu geladen werden.<br/>' | |
310 + 'Alle ungesicherten Daten gehen dabei verloren.<br/>' | |
311 + 'Soll die Anwendung jetzt neu geladen werden?', | |
312 this.reload); | |
313 } | |
314 // further error handling | |
1205
613e48a3fef9
Error messages from LADA server are not related to HTTP errors.
Tom Gottfried <tom@intevation.de>
parents:
1204
diff
changeset
|
315 Ext.Msg.alert(i18n.getMsg('err.msg.generic.title'), |
613e48a3fef9
Error messages from LADA server are not related to HTTP errors.
Tom Gottfried <tom@intevation.de>
parents:
1204
diff
changeset
|
316 i18n.getMsg('err.msg.generic.body')); |
1204 | 317 } else { |
318 Ext.Msg.alert(i18n.getMsg('err.msg.generic.title'), | |
319 i18n.getMsg('err.msg.response.body')); | |
320 } | |
321 }, | |
322 | |
323 | |
324 /** | |
890
def27cdd0dfa
Added Documentation to Windows
Dustin Demuth <dustin@intevation.de>
parents:
882
diff
changeset
|
325 * Initiatlise the Data |
760
2e7e1a8bf79f
Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
326 */ |
2e7e1a8bf79f
Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
327 initData: function() { |
2e7e1a8bf79f
Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
328 var i18n = Lada.getApplication().bundle; |
2e7e1a8bf79f
Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
329 me = this; |
2e7e1a8bf79f
Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
330 }, |
809
3bc19188fc3a
Added some todos, Enhanced Proge-Generation Success Msg.
Dustin Demuth <dustin@intevation.de>
parents:
807
diff
changeset
|
331 |
3bc19188fc3a
Added some todos, Enhanced Proge-Generation Success Msg.
Dustin Demuth <dustin@intevation.de>
parents:
807
diff
changeset
|
332 /** |
3bc19188fc3a
Added some todos, Enhanced Proge-Generation Success Msg.
Dustin Demuth <dustin@intevation.de>
parents:
807
diff
changeset
|
333 * Parse ServerResponse when Proben have been generated |
3bc19188fc3a
Added some todos, Enhanced Proge-Generation Success Msg.
Dustin Demuth <dustin@intevation.de>
parents:
807
diff
changeset
|
334 */ |
3bc19188fc3a
Added some todos, Enhanced Proge-Generation Success Msg.
Dustin Demuth <dustin@intevation.de>
parents:
807
diff
changeset
|
335 evalResponse: function(response) { |
3bc19188fc3a
Added some todos, Enhanced Proge-Generation Success Msg.
Dustin Demuth <dustin@intevation.de>
parents:
807
diff
changeset
|
336 var i18n = Lada.getApplication().bundle; |
3bc19188fc3a
Added some todos, Enhanced Proge-Generation Success Msg.
Dustin Demuth <dustin@intevation.de>
parents:
807
diff
changeset
|
337 var r = ''; |
812
188a9faf96e0
Added Errorhandling for AJAX-Requests, especially Authentication Issues.
Dustin Demuth <dustin@intevation.de>
parents:
809
diff
changeset
|
338 r += response.data.length; |
809
3bc19188fc3a
Added some todos, Enhanced Proge-Generation Success Msg.
Dustin Demuth <dustin@intevation.de>
parents:
807
diff
changeset
|
339 r += ' ' + i18n.getMsg('probecreated'); |
3bc19188fc3a
Added some todos, Enhanced Proge-Generation Success Msg.
Dustin Demuth <dustin@intevation.de>
parents:
807
diff
changeset
|
340 r += '<br/>'; |
3bc19188fc3a
Added some todos, Enhanced Proge-Generation Success Msg.
Dustin Demuth <dustin@intevation.de>
parents:
807
diff
changeset
|
341 return r; |
812
188a9faf96e0
Added Errorhandling for AJAX-Requests, especially Authentication Issues.
Dustin Demuth <dustin@intevation.de>
parents:
809
diff
changeset
|
342 }, |
188a9faf96e0
Added Errorhandling for AJAX-Requests, especially Authentication Issues.
Dustin Demuth <dustin@intevation.de>
parents:
809
diff
changeset
|
343 |
890
def27cdd0dfa
Added Documentation to Windows
Dustin Demuth <dustin@intevation.de>
parents:
882
diff
changeset
|
344 /** |
def27cdd0dfa
Added Documentation to Windows
Dustin Demuth <dustin@intevation.de>
parents:
882
diff
changeset
|
345 * Reload the Application |
def27cdd0dfa
Added Documentation to Windows
Dustin Demuth <dustin@intevation.de>
parents:
882
diff
changeset
|
346 */ |
812
188a9faf96e0
Added Errorhandling for AJAX-Requests, especially Authentication Issues.
Dustin Demuth <dustin@intevation.de>
parents:
809
diff
changeset
|
347 reload: function(btn) { |
188a9faf96e0
Added Errorhandling for AJAX-Requests, especially Authentication Issues.
Dustin Demuth <dustin@intevation.de>
parents:
809
diff
changeset
|
348 if (btn === 'yes') { |
188a9faf96e0
Added Errorhandling for AJAX-Requests, especially Authentication Issues.
Dustin Demuth <dustin@intevation.de>
parents:
809
diff
changeset
|
349 location.reload(); |
188a9faf96e0
Added Errorhandling for AJAX-Requests, especially Authentication Issues.
Dustin Demuth <dustin@intevation.de>
parents:
809
diff
changeset
|
350 } |
809
3bc19188fc3a
Added some todos, Enhanced Proge-Generation Success Msg.
Dustin Demuth <dustin@intevation.de>
parents:
807
diff
changeset
|
351 } |
760
2e7e1a8bf79f
Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
352 }); |