Mercurial > lada > lada-client
annotate app/view/window/GenProbenFromMessprogramm.js @ 823:5ed0e6273888
Only enable delete button in grids when an entry was selected
author | Dustin Demuth <dustin@intevation.de> |
---|---|
date | Fri, 29 May 2015 14:03:18 +0200 |
parents | 00072c3c926e |
children | e3bd911b576b |
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 |
2e7e1a8bf79f
Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
9 /* |
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 |
2e7e1a8bf79f
Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
16 collapsible: true, |
2e7e1a8bf79f
Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
17 maximizable: true, |
2e7e1a8bf79f
Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
18 autoShow: true, |
2e7e1a8bf79f
Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
19 autoScroll: true, |
2e7e1a8bf79f
Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
20 layout: 'fit', |
2e7e1a8bf79f
Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
21 constrain: true, |
2e7e1a8bf79f
Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
22 |
2e7e1a8bf79f
Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
23 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
|
24 parentWindow: null, |
760
2e7e1a8bf79f
Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
25 |
2e7e1a8bf79f
Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
26 initComponent: function() { |
2e7e1a8bf79f
Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
27 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
|
28 |
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
|
29 // 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
|
30 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
|
31 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
|
32 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
|
33 }, |
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
|
34 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
|
35 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
|
36 } |
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 }); |
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 |
760
2e7e1a8bf79f
Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
39 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
|
40 var me = this; |
2e7e1a8bf79f
Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
41 this.buttons = [{ |
2e7e1a8bf79f
Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
42 text: i18n.getMsg('cancel'), |
2e7e1a8bf79f
Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
43 scope: this, |
2e7e1a8bf79f
Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
44 handler: this.close |
2e7e1a8bf79f
Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
45 }, { |
2e7e1a8bf79f
Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
46 text: i18n.getMsg('generateproben'), |
2e7e1a8bf79f
Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
47 handler: function() { |
2e7e1a8bf79f
Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
48 var jsondata = { |
2e7e1a8bf79f
Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
49 id: me.record.id, |
761
975183ab775e
Sending Date as timestamp
Dustin Demuth <dustin@intevation.de>
parents:
760
diff
changeset
|
50 start: new Date(me.down('datetime [name=start]').getValue()).valueOf(), |
975183ab775e
Sending Date as timestamp
Dustin Demuth <dustin@intevation.de>
parents:
760
diff
changeset
|
51 end: new Date(me.down('datetime [name=end]').getValue()).valueOf() |
760
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 |
2e7e1a8bf79f
Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
54 |
2e7e1a8bf79f
Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
55 Ext.Ajax.request({ |
2e7e1a8bf79f
Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
56 url: '/lada-server/probe/messprogramm', |
2e7e1a8bf79f
Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
57 method: 'POST', |
2e7e1a8bf79f
Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
58 headers: { |
2e7e1a8bf79f
Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
59 'X-OPENID-PARAMS': Lada.openIDParams |
2e7e1a8bf79f
Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
60 }, |
2e7e1a8bf79f
Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
61 jsonData: jsondata, |
809
3bc19188fc3a
Added some todos, Enhanced Proge-Generation Success Msg.
Dustin Demuth <dustin@intevation.de>
parents:
807
diff
changeset
|
62 success: function(response) { |
3bc19188fc3a
Added some todos, Enhanced Proge-Generation Success Msg.
Dustin Demuth <dustin@intevation.de>
parents:
807
diff
changeset
|
63 var json = Ext.JSON.decode(response.responseText); |
3bc19188fc3a
Added some todos, Enhanced Proge-Generation Success Msg.
Dustin Demuth <dustin@intevation.de>
parents:
807
diff
changeset
|
64 Ext.Msg.show({ |
3bc19188fc3a
Added some todos, Enhanced Proge-Generation Success Msg.
Dustin Demuth <dustin@intevation.de>
parents:
807
diff
changeset
|
65 title: i18n.getMsg('success'), |
3bc19188fc3a
Added some todos, Enhanced Proge-Generation Success Msg.
Dustin Demuth <dustin@intevation.de>
parents:
807
diff
changeset
|
66 autoScroll: true, |
3bc19188fc3a
Added some todos, Enhanced Proge-Generation Success Msg.
Dustin Demuth <dustin@intevation.de>
parents:
807
diff
changeset
|
67 msg: me.evalResponse(json), |
3bc19188fc3a
Added some todos, Enhanced Proge-Generation Success Msg.
Dustin Demuth <dustin@intevation.de>
parents:
807
diff
changeset
|
68 buttons: Ext.Msg.OK, |
3bc19188fc3a
Added some todos, Enhanced Proge-Generation Success Msg.
Dustin Demuth <dustin@intevation.de>
parents:
807
diff
changeset
|
69 }); |
760
2e7e1a8bf79f
Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
70 }, |
809
3bc19188fc3a
Added some todos, Enhanced Proge-Generation Success Msg.
Dustin Demuth <dustin@intevation.de>
parents:
807
diff
changeset
|
71 failure: function(response) { |
3bc19188fc3a
Added some todos, Enhanced Proge-Generation Success Msg.
Dustin Demuth <dustin@intevation.de>
parents:
807
diff
changeset
|
72 var json = Ext.JSON.decode(response.responseText); |
3bc19188fc3a
Added some todos, Enhanced Proge-Generation Success Msg.
Dustin Demuth <dustin@intevation.de>
parents:
807
diff
changeset
|
73 if (json) { |
3bc19188fc3a
Added some todos, Enhanced Proge-Generation Success Msg.
Dustin Demuth <dustin@intevation.de>
parents:
807
diff
changeset
|
74 if(json.errors.totalCount > 0 || json.warnings.totalCount > 0){ |
3bc19188fc3a
Added some todos, Enhanced Proge-Generation Success Msg.
Dustin Demuth <dustin@intevation.de>
parents:
807
diff
changeset
|
75 formPanel.setMessages(json.errors, json.warnings); |
3bc19188fc3a
Added some todos, Enhanced Proge-Generation Success Msg.
Dustin Demuth <dustin@intevation.de>
parents:
807
diff
changeset
|
76 } |
812
188a9faf96e0
Added Errorhandling for AJAX-Requests, especially Authentication Issues.
Dustin Demuth <dustin@intevation.de>
parents:
809
diff
changeset
|
77 // TODO Move this handling of 699 and 698 to a more central place! |
188a9faf96e0
Added Errorhandling for AJAX-Requests, especially Authentication Issues.
Dustin Demuth <dustin@intevation.de>
parents:
809
diff
changeset
|
78 // TODO i18n |
188a9faf96e0
Added Errorhandling for AJAX-Requests, especially Authentication Issues.
Dustin Demuth <dustin@intevation.de>
parents:
809
diff
changeset
|
79 if (json.message === "699" || json.message === "698") { |
188a9faf96e0
Added Errorhandling for AJAX-Requests, especially Authentication Issues.
Dustin Demuth <dustin@intevation.de>
parents:
809
diff
changeset
|
80 /* This is the unauthorized message with the authentication |
188a9faf96e0
Added Errorhandling for AJAX-Requests, especially Authentication Issues.
Dustin Demuth <dustin@intevation.de>
parents:
809
diff
changeset
|
81 * redirect in the data */ |
809
3bc19188fc3a
Added some todos, Enhanced Proge-Generation Success Msg.
Dustin Demuth <dustin@intevation.de>
parents:
807
diff
changeset
|
82 |
812
188a9faf96e0
Added Errorhandling for AJAX-Requests, especially Authentication Issues.
Dustin Demuth <dustin@intevation.de>
parents:
809
diff
changeset
|
83 /* We decided to handle this with a redirect to the identity |
188a9faf96e0
Added Errorhandling for AJAX-Requests, especially Authentication Issues.
Dustin Demuth <dustin@intevation.de>
parents:
809
diff
changeset
|
84 * provider. In which case we have no other option then to |
188a9faf96e0
Added Errorhandling for AJAX-Requests, especially Authentication Issues.
Dustin Demuth <dustin@intevation.de>
parents:
809
diff
changeset
|
85 * handle it here with relaunch. */ |
188a9faf96e0
Added Errorhandling for AJAX-Requests, especially Authentication Issues.
Dustin Demuth <dustin@intevation.de>
parents:
809
diff
changeset
|
86 Ext.MessageBox.confirm('Erneutes Login erforderlich', |
188a9faf96e0
Added Errorhandling for AJAX-Requests, especially Authentication Issues.
Dustin Demuth <dustin@intevation.de>
parents:
809
diff
changeset
|
87 'Der Server konnte die Anfrage nicht authentifizieren.<br/>'+ |
188a9faf96e0
Added Errorhandling for AJAX-Requests, especially Authentication Issues.
Dustin Demuth <dustin@intevation.de>
parents:
809
diff
changeset
|
88 'Für ein erneutes Login muss die Anwendung neu geladen werden.<br/>' + |
188a9faf96e0
Added Errorhandling for AJAX-Requests, especially Authentication Issues.
Dustin Demuth <dustin@intevation.de>
parents:
809
diff
changeset
|
89 'Alle ungesicherten Daten gehen dabei verloren.<br/>' + |
819 | 90 'Soll die Anwendung jetzt neu geladen werden?', me.reload); |
812
188a9faf96e0
Added Errorhandling for AJAX-Requests, especially Authentication Issues.
Dustin Demuth <dustin@intevation.de>
parents:
809
diff
changeset
|
91 } |
188a9faf96e0
Added Errorhandling for AJAX-Requests, especially Authentication Issues.
Dustin Demuth <dustin@intevation.de>
parents:
809
diff
changeset
|
92 else if(json.message){ |
188a9faf96e0
Added Errorhandling for AJAX-Requests, especially Authentication Issues.
Dustin Demuth <dustin@intevation.de>
parents:
809
diff
changeset
|
93 Ext.Msg.alert(Lada.getApplication().bundle.getMsg('err.msg.generic.title') |
809
3bc19188fc3a
Added some todos, Enhanced Proge-Generation Success Msg.
Dustin Demuth <dustin@intevation.de>
parents:
807
diff
changeset
|
94 +' #'+json.message, |
3bc19188fc3a
Added some todos, Enhanced Proge-Generation Success Msg.
Dustin Demuth <dustin@intevation.de>
parents:
807
diff
changeset
|
95 Lada.getApplication().bundle.getMsg(json.message)); |
3bc19188fc3a
Added some todos, Enhanced Proge-Generation Success Msg.
Dustin Demuth <dustin@intevation.de>
parents:
807
diff
changeset
|
96 } else { |
812
188a9faf96e0
Added Errorhandling for AJAX-Requests, especially Authentication Issues.
Dustin Demuth <dustin@intevation.de>
parents:
809
diff
changeset
|
97 Ext.Msg.alert(Lada.getApplication().bundle.getMsg('err.msg.generic.title'), |
809
3bc19188fc3a
Added some todos, Enhanced Proge-Generation Success Msg.
Dustin Demuth <dustin@intevation.de>
parents:
807
diff
changeset
|
98 Lada.getApplication().bundle.getMsg('err.msg.generic.body')); |
3bc19188fc3a
Added some todos, Enhanced Proge-Generation Success Msg.
Dustin Demuth <dustin@intevation.de>
parents:
807
diff
changeset
|
99 } |
3bc19188fc3a
Added some todos, Enhanced Proge-Generation Success Msg.
Dustin Demuth <dustin@intevation.de>
parents:
807
diff
changeset
|
100 } else { |
812
188a9faf96e0
Added Errorhandling for AJAX-Requests, especially Authentication Issues.
Dustin Demuth <dustin@intevation.de>
parents:
809
diff
changeset
|
101 Ext.Msg.alert(Lada.getApplication().bundle.getMsg('err.msg.generic.title'), |
809
3bc19188fc3a
Added some todos, Enhanced Proge-Generation Success Msg.
Dustin Demuth <dustin@intevation.de>
parents:
807
diff
changeset
|
102 Lada.getApplication().bundle.getMsg('err.msg.response.body')); |
3bc19188fc3a
Added some todos, Enhanced Proge-Generation Success Msg.
Dustin Demuth <dustin@intevation.de>
parents:
807
diff
changeset
|
103 } |
760
2e7e1a8bf79f
Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
104 } |
2e7e1a8bf79f
Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
105 }); |
2e7e1a8bf79f
Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
106 } |
2e7e1a8bf79f
Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
107 }]; |
2e7e1a8bf79f
Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
108 this.width = 400; |
2e7e1a8bf79f
Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
109 this.height = 300; |
2e7e1a8bf79f
Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
110 |
2e7e1a8bf79f
Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
111 // 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
|
112 this.on({ |
2e7e1a8bf79f
Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
113 activate: function(){ |
2e7e1a8bf79f
Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
114 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
|
115 }, |
2e7e1a8bf79f
Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
116 deactivate: function(){ |
2e7e1a8bf79f
Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
117 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
|
118 }, |
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
|
119 close: 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
|
120 this.parentWindow.probenWindow = null; |
760
2e7e1a8bf79f
Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
121 } |
2e7e1a8bf79f
Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
122 }); |
2e7e1a8bf79f
Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
123 |
2e7e1a8bf79f
Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
124 // 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
|
125 // 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
|
126 // 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
|
127 this.items = [{ |
2e7e1a8bf79f
Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
128 border: 0, |
2e7e1a8bf79f
Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
129 autoScroll: true, |
2e7e1a8bf79f
Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
130 items: [{ |
807 | 131 xtype: 'panel', |
132 border: 0, | |
133 margin: 5, | |
134 layout: 'fit', | |
135 html: '<p>' | |
136 + i18n.getMsg('nameofmessprogramm') | |
137 + '<br/>' | |
138 + this.record.get('name') | |
139 + '</p>' | |
760
2e7e1a8bf79f
Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
140 }, { |
807 | 141 xtype: 'panel', |
142 border: 0, | |
143 margin: 5, | |
144 layout: 'fit', | |
145 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
|
146 }, { |
2e7e1a8bf79f
Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
147 xtype: 'datetime', |
2e7e1a8bf79f
Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
148 fieldLabel: i18n.getMsg('from'), |
2e7e1a8bf79f
Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
149 labelWidth: 90, |
807 | 150 margin: 5, |
760
2e7e1a8bf79f
Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
151 name: 'start', |
2e7e1a8bf79f
Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
152 format: 'd.m.Y H:i', |
2e7e1a8bf79f
Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
153 period: 'start' |
2e7e1a8bf79f
Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
154 }, { |
2e7e1a8bf79f
Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
155 xtype: 'datetime', |
2e7e1a8bf79f
Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
156 fieldLabel: i18n.getMsg('to'), |
2e7e1a8bf79f
Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
157 labelWidth: 90, |
807 | 158 margin: 5, |
760
2e7e1a8bf79f
Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
159 name: 'end', |
2e7e1a8bf79f
Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
160 format: 'd.m.Y H:i', |
2e7e1a8bf79f
Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
161 period: 'end' |
2e7e1a8bf79f
Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
162 }] |
2e7e1a8bf79f
Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
163 }]; |
2e7e1a8bf79f
Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
164 this.callParent(arguments); |
2e7e1a8bf79f
Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
165 }, |
2e7e1a8bf79f
Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
166 |
2e7e1a8bf79f
Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
167 /** |
2e7e1a8bf79f
Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
168 * Init |
2e7e1a8bf79f
Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
169 */ |
2e7e1a8bf79f
Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
170 initData: function() { |
2e7e1a8bf79f
Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
171 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
|
172 me = this; |
2e7e1a8bf79f
Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
173 }, |
809
3bc19188fc3a
Added some todos, Enhanced Proge-Generation Success Msg.
Dustin Demuth <dustin@intevation.de>
parents:
807
diff
changeset
|
174 |
3bc19188fc3a
Added some todos, Enhanced Proge-Generation Success Msg.
Dustin Demuth <dustin@intevation.de>
parents:
807
diff
changeset
|
175 /** |
3bc19188fc3a
Added some todos, Enhanced Proge-Generation Success Msg.
Dustin Demuth <dustin@intevation.de>
parents:
807
diff
changeset
|
176 * 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
|
177 */ |
3bc19188fc3a
Added some todos, Enhanced Proge-Generation Success Msg.
Dustin Demuth <dustin@intevation.de>
parents:
807
diff
changeset
|
178 evalResponse: function(response) { |
3bc19188fc3a
Added some todos, Enhanced Proge-Generation Success Msg.
Dustin Demuth <dustin@intevation.de>
parents:
807
diff
changeset
|
179 var i18n = Lada.getApplication().bundle; |
3bc19188fc3a
Added some todos, Enhanced Proge-Generation Success Msg.
Dustin Demuth <dustin@intevation.de>
parents:
807
diff
changeset
|
180 var r = ''; |
812
188a9faf96e0
Added Errorhandling for AJAX-Requests, especially Authentication Issues.
Dustin Demuth <dustin@intevation.de>
parents:
809
diff
changeset
|
181 r += response.data.length; |
809
3bc19188fc3a
Added some todos, Enhanced Proge-Generation Success Msg.
Dustin Demuth <dustin@intevation.de>
parents:
807
diff
changeset
|
182 r += ' ' + i18n.getMsg('probecreated'); |
3bc19188fc3a
Added some todos, Enhanced Proge-Generation Success Msg.
Dustin Demuth <dustin@intevation.de>
parents:
807
diff
changeset
|
183 r += '<br/>'; |
3bc19188fc3a
Added some todos, Enhanced Proge-Generation Success Msg.
Dustin Demuth <dustin@intevation.de>
parents:
807
diff
changeset
|
184 r += i18n.getMsg('probeids'); |
3bc19188fc3a
Added some todos, Enhanced Proge-Generation Success Msg.
Dustin Demuth <dustin@intevation.de>
parents:
807
diff
changeset
|
185 var i; |
3bc19188fc3a
Added some todos, Enhanced Proge-Generation Success Msg.
Dustin Demuth <dustin@intevation.de>
parents:
807
diff
changeset
|
186 for (i in response.data){ |
3bc19188fc3a
Added some todos, Enhanced Proge-Generation Success Msg.
Dustin Demuth <dustin@intevation.de>
parents:
807
diff
changeset
|
187 r += '<br/>'; |
3bc19188fc3a
Added some todos, Enhanced Proge-Generation Success Msg.
Dustin Demuth <dustin@intevation.de>
parents:
807
diff
changeset
|
188 r += response.data[i].probeIdAlt |
3bc19188fc3a
Added some todos, Enhanced Proge-Generation Success Msg.
Dustin Demuth <dustin@intevation.de>
parents:
807
diff
changeset
|
189 } |
3bc19188fc3a
Added some todos, Enhanced Proge-Generation Success Msg.
Dustin Demuth <dustin@intevation.de>
parents:
807
diff
changeset
|
190 return r; |
812
188a9faf96e0
Added Errorhandling for AJAX-Requests, especially Authentication Issues.
Dustin Demuth <dustin@intevation.de>
parents:
809
diff
changeset
|
191 }, |
188a9faf96e0
Added Errorhandling for AJAX-Requests, especially Authentication Issues.
Dustin Demuth <dustin@intevation.de>
parents:
809
diff
changeset
|
192 |
188a9faf96e0
Added Errorhandling for AJAX-Requests, especially Authentication Issues.
Dustin Demuth <dustin@intevation.de>
parents:
809
diff
changeset
|
193 reload: function(btn) { |
188a9faf96e0
Added Errorhandling for AJAX-Requests, especially Authentication Issues.
Dustin Demuth <dustin@intevation.de>
parents:
809
diff
changeset
|
194 if (btn === 'yes') { |
188a9faf96e0
Added Errorhandling for AJAX-Requests, especially Authentication Issues.
Dustin Demuth <dustin@intevation.de>
parents:
809
diff
changeset
|
195 location.reload(); |
188a9faf96e0
Added Errorhandling for AJAX-Requests, especially Authentication Issues.
Dustin Demuth <dustin@intevation.de>
parents:
809
diff
changeset
|
196 } |
809
3bc19188fc3a
Added some todos, Enhanced Proge-Generation Success Msg.
Dustin Demuth <dustin@intevation.de>
parents:
807
diff
changeset
|
197 } |
760
2e7e1a8bf79f
Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
198 }); |