annotate app/view/window/GenProbenFromMessprogramm.js @ 887:786c8b7e5ecc

Removed obsolete store listeners.
author Raimund Renkert <raimund.renkert@intevation.de>
date Thu, 23 Jul 2015 16:22:31 +0200
parents f1e964b3aad6
children def27cdd0dfa
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({
831
e3bd911b576b Fixed url for 'proben generieren' request.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 819
diff changeset
56 url: 'lada-server/probe/messprogramm',
760
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),
882
f1e964b3aad6 Trailing Commas
Dustin Demuth <dustin@intevation.de>
parents: 861
diff changeset
68 buttons: Ext.Msg.OK
809
3bc19188fc3a Added some todos, Enhanced Proge-Generation Success Msg.
Dustin Demuth <dustin@intevation.de>
parents: 807
diff changeset
69 });
859
6249b731d438 Close messprogramm windows on probe generation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 855
diff changeset
70 me.close();
760
2e7e1a8bf79f Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
71 },
809
3bc19188fc3a Added some todos, Enhanced Proge-Generation Success Msg.
Dustin Demuth <dustin@intevation.de>
parents: 807
diff changeset
72 failure: function(response) {
855
dff2798390f8 Better Error handling
Dustin Demuth <dustin@intevation.de>
parents: 834
diff changeset
73 var json = null;
dff2798390f8 Better Error handling
Dustin Demuth <dustin@intevation.de>
parents: 834
diff changeset
74 try {
dff2798390f8 Better Error handling
Dustin Demuth <dustin@intevation.de>
parents: 834
diff changeset
75 json = Ext.JSON.decode(response.responseText);
dff2798390f8 Better Error handling
Dustin Demuth <dustin@intevation.de>
parents: 834
diff changeset
76 }
dff2798390f8 Better Error handling
Dustin Demuth <dustin@intevation.de>
parents: 834
diff changeset
77 catch(err){
dff2798390f8 Better Error handling
Dustin Demuth <dustin@intevation.de>
parents: 834
diff changeset
78 Ext.Msg.alert(Lada.getApplication().bundle.getMsg('err.msg.generic.title'),
dff2798390f8 Better Error handling
Dustin Demuth <dustin@intevation.de>
parents: 834
diff changeset
79 Lada.getApplication().bundle.getMsg('err.msg.response.body'));
dff2798390f8 Better Error handling
Dustin Demuth <dustin@intevation.de>
parents: 834
diff changeset
80 }
809
3bc19188fc3a Added some todos, Enhanced Proge-Generation Success Msg.
Dustin Demuth <dustin@intevation.de>
parents: 807
diff changeset
81 if (json) {
3bc19188fc3a Added some todos, Enhanced Proge-Generation Success Msg.
Dustin Demuth <dustin@intevation.de>
parents: 807
diff changeset
82 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
83 formPanel.setMessages(json.errors, json.warnings);
3bc19188fc3a Added some todos, Enhanced Proge-Generation Success Msg.
Dustin Demuth <dustin@intevation.de>
parents: 807
diff changeset
84 }
812
188a9faf96e0 Added Errorhandling for AJAX-Requests, especially Authentication Issues.
Dustin Demuth <dustin@intevation.de>
parents: 809
diff changeset
85 // 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
86 // TODO i18n
188a9faf96e0 Added Errorhandling for AJAX-Requests, especially Authentication Issues.
Dustin Demuth <dustin@intevation.de>
parents: 809
diff changeset
87 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
88 /* 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
89 * redirect in the data */
809
3bc19188fc3a Added some todos, Enhanced Proge-Generation Success Msg.
Dustin Demuth <dustin@intevation.de>
parents: 807
diff changeset
90
812
188a9faf96e0 Added Errorhandling for AJAX-Requests, especially Authentication Issues.
Dustin Demuth <dustin@intevation.de>
parents: 809
diff changeset
91 /* 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
92 * 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
93 * handle it here with relaunch. */
188a9faf96e0 Added Errorhandling for AJAX-Requests, especially Authentication Issues.
Dustin Demuth <dustin@intevation.de>
parents: 809
diff changeset
94 Ext.MessageBox.confirm('Erneutes Login erforderlich',
188a9faf96e0 Added Errorhandling for AJAX-Requests, especially Authentication Issues.
Dustin Demuth <dustin@intevation.de>
parents: 809
diff changeset
95 '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
96 '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
97 'Alle ungesicherten Daten gehen dabei verloren.<br/>' +
819
00072c3c926e reload works now.
Dustin Demuth <dustin@intevation.de>
parents: 818
diff changeset
98 '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
99 }
188a9faf96e0 Added Errorhandling for AJAX-Requests, especially Authentication Issues.
Dustin Demuth <dustin@intevation.de>
parents: 809
diff changeset
100 else if(json.message){
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 +' #'+json.message,
3bc19188fc3a Added some todos, Enhanced Proge-Generation Success Msg.
Dustin Demuth <dustin@intevation.de>
parents: 807
diff changeset
103 Lada.getApplication().bundle.getMsg(json.message));
3bc19188fc3a Added some todos, Enhanced Proge-Generation Success Msg.
Dustin Demuth <dustin@intevation.de>
parents: 807
diff changeset
104 } else {
812
188a9faf96e0 Added Errorhandling for AJAX-Requests, especially Authentication Issues.
Dustin Demuth <dustin@intevation.de>
parents: 809
diff changeset
105 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
106 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
107 }
3bc19188fc3a Added some todos, Enhanced Proge-Generation Success Msg.
Dustin Demuth <dustin@intevation.de>
parents: 807
diff changeset
108 } else {
812
188a9faf96e0 Added Errorhandling for AJAX-Requests, especially Authentication Issues.
Dustin Demuth <dustin@intevation.de>
parents: 809
diff changeset
109 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
110 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
111 }
760
2e7e1a8bf79f Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
112 }
2e7e1a8bf79f Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
113 });
2e7e1a8bf79f Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
114 }
2e7e1a8bf79f Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
115 }];
834
2214aea9fd3a Patched correct file of r. 832
Dustin Demuth <dustin@intevation.de>
parents: 833
diff changeset
116 this.width = 350;
2214aea9fd3a Patched correct file of r. 832
Dustin Demuth <dustin@intevation.de>
parents: 833
diff changeset
117 this.height = 250;
760
2e7e1a8bf79f Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
118
2e7e1a8bf79f Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
119 // 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
120 this.on({
2e7e1a8bf79f Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
121 activate: function(){
2e7e1a8bf79f Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
122 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
123 },
2e7e1a8bf79f Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
124 deactivate: function(){
2e7e1a8bf79f Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
125 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
126 },
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
127 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
128 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
129 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
130 }
760
2e7e1a8bf79f Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
131 }
2e7e1a8bf79f Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
132 });
2e7e1a8bf79f Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
133
2e7e1a8bf79f Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
134 // 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
135 // 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
136 // 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
137 this.items = [{
2e7e1a8bf79f Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
138 border: 0,
2e7e1a8bf79f Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
139 autoScroll: true,
2e7e1a8bf79f Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
140 items: [{
807
18697326c862 Less ugly
Dustin Demuth <dustin@intevation.de>
parents: 761
diff changeset
141 xtype: 'panel',
18697326c862 Less ugly
Dustin Demuth <dustin@intevation.de>
parents: 761
diff changeset
142 border: 0,
18697326c862 Less ugly
Dustin Demuth <dustin@intevation.de>
parents: 761
diff changeset
143 margin: 5,
18697326c862 Less ugly
Dustin Demuth <dustin@intevation.de>
parents: 761
diff changeset
144 layout: 'fit',
18697326c862 Less ugly
Dustin Demuth <dustin@intevation.de>
parents: 761
diff changeset
145 html: '<p>'
18697326c862 Less ugly
Dustin Demuth <dustin@intevation.de>
parents: 761
diff changeset
146 + i18n.getMsg('nameofmessprogramm')
18697326c862 Less ugly
Dustin Demuth <dustin@intevation.de>
parents: 761
diff changeset
147 + '<br/>'
18697326c862 Less ugly
Dustin Demuth <dustin@intevation.de>
parents: 761
diff changeset
148 + this.record.get('name')
18697326c862 Less ugly
Dustin Demuth <dustin@intevation.de>
parents: 761
diff changeset
149 + '</p>'
760
2e7e1a8bf79f Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
150 }, {
807
18697326c862 Less ugly
Dustin Demuth <dustin@intevation.de>
parents: 761
diff changeset
151 xtype: 'panel',
18697326c862 Less ugly
Dustin Demuth <dustin@intevation.de>
parents: 761
diff changeset
152 border: 0,
18697326c862 Less ugly
Dustin Demuth <dustin@intevation.de>
parents: 761
diff changeset
153 margin: 5,
18697326c862 Less ugly
Dustin Demuth <dustin@intevation.de>
parents: 761
diff changeset
154 layout: 'fit',
18697326c862 Less ugly
Dustin Demuth <dustin@intevation.de>
parents: 761
diff changeset
155 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
156 }, {
2e7e1a8bf79f Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
157 xtype: 'datetime',
2e7e1a8bf79f Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
158 fieldLabel: i18n.getMsg('from'),
2e7e1a8bf79f Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
159 labelWidth: 90,
807
18697326c862 Less ugly
Dustin Demuth <dustin@intevation.de>
parents: 761
diff changeset
160 margin: 5,
834
2214aea9fd3a Patched correct file of r. 832
Dustin Demuth <dustin@intevation.de>
parents: 833
diff changeset
161 width: 300,
760
2e7e1a8bf79f Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
162 name: 'start',
2e7e1a8bf79f Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
163 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
164 period: 'start'
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 xtype: 'datetime',
2e7e1a8bf79f Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
167 fieldLabel: i18n.getMsg('to'),
2e7e1a8bf79f Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
168 labelWidth: 90,
807
18697326c862 Less ugly
Dustin Demuth <dustin@intevation.de>
parents: 761
diff changeset
169 margin: 5,
834
2214aea9fd3a Patched correct file of r. 832
Dustin Demuth <dustin@intevation.de>
parents: 833
diff changeset
170 width: 300,
760
2e7e1a8bf79f Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
171 name: 'end',
2e7e1a8bf79f Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
172 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
173 period: 'end'
2e7e1a8bf79f Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
174 }]
2e7e1a8bf79f Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
175 }];
2e7e1a8bf79f Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
176 this.callParent(arguments);
2e7e1a8bf79f Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
177 },
2e7e1a8bf79f Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
178
2e7e1a8bf79f Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
179 /**
2e7e1a8bf79f Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
180 * Init
2e7e1a8bf79f Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
181 */
2e7e1a8bf79f Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
182 initData: function() {
2e7e1a8bf79f Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
183 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
184 me = this;
2e7e1a8bf79f Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
185 },
809
3bc19188fc3a Added some todos, Enhanced Proge-Generation Success Msg.
Dustin Demuth <dustin@intevation.de>
parents: 807
diff changeset
186
3bc19188fc3a Added some todos, Enhanced Proge-Generation Success Msg.
Dustin Demuth <dustin@intevation.de>
parents: 807
diff changeset
187 /**
3bc19188fc3a Added some todos, Enhanced Proge-Generation Success Msg.
Dustin Demuth <dustin@intevation.de>
parents: 807
diff changeset
188 * 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
189 */
3bc19188fc3a Added some todos, Enhanced Proge-Generation Success Msg.
Dustin Demuth <dustin@intevation.de>
parents: 807
diff changeset
190 evalResponse: function(response) {
3bc19188fc3a Added some todos, Enhanced Proge-Generation Success Msg.
Dustin Demuth <dustin@intevation.de>
parents: 807
diff changeset
191 var i18n = Lada.getApplication().bundle;
3bc19188fc3a Added some todos, Enhanced Proge-Generation Success Msg.
Dustin Demuth <dustin@intevation.de>
parents: 807
diff changeset
192 var r = '';
812
188a9faf96e0 Added Errorhandling for AJAX-Requests, especially Authentication Issues.
Dustin Demuth <dustin@intevation.de>
parents: 809
diff changeset
193 r += response.data.length;
809
3bc19188fc3a Added some todos, Enhanced Proge-Generation Success Msg.
Dustin Demuth <dustin@intevation.de>
parents: 807
diff changeset
194 r += ' ' + i18n.getMsg('probecreated');
3bc19188fc3a Added some todos, Enhanced Proge-Generation Success Msg.
Dustin Demuth <dustin@intevation.de>
parents: 807
diff changeset
195 r += '<br/>';
3bc19188fc3a Added some todos, Enhanced Proge-Generation Success Msg.
Dustin Demuth <dustin@intevation.de>
parents: 807
diff changeset
196 r += i18n.getMsg('probeids');
3bc19188fc3a Added some todos, Enhanced Proge-Generation Success Msg.
Dustin Demuth <dustin@intevation.de>
parents: 807
diff changeset
197 var i;
3bc19188fc3a Added some todos, Enhanced Proge-Generation Success Msg.
Dustin Demuth <dustin@intevation.de>
parents: 807
diff changeset
198 for (i in response.data){
3bc19188fc3a Added some todos, Enhanced Proge-Generation Success Msg.
Dustin Demuth <dustin@intevation.de>
parents: 807
diff changeset
199 r += '<br/>';
3bc19188fc3a Added some todos, Enhanced Proge-Generation Success Msg.
Dustin Demuth <dustin@intevation.de>
parents: 807
diff changeset
200 r += response.data[i].probeIdAlt
3bc19188fc3a Added some todos, Enhanced Proge-Generation Success Msg.
Dustin Demuth <dustin@intevation.de>
parents: 807
diff changeset
201 }
3bc19188fc3a Added some todos, Enhanced Proge-Generation Success Msg.
Dustin Demuth <dustin@intevation.de>
parents: 807
diff changeset
202 return r;
812
188a9faf96e0 Added Errorhandling for AJAX-Requests, especially Authentication Issues.
Dustin Demuth <dustin@intevation.de>
parents: 809
diff changeset
203 },
188a9faf96e0 Added Errorhandling for AJAX-Requests, especially Authentication Issues.
Dustin Demuth <dustin@intevation.de>
parents: 809
diff changeset
204
188a9faf96e0 Added Errorhandling for AJAX-Requests, especially Authentication Issues.
Dustin Demuth <dustin@intevation.de>
parents: 809
diff changeset
205 reload: function(btn) {
188a9faf96e0 Added Errorhandling for AJAX-Requests, especially Authentication Issues.
Dustin Demuth <dustin@intevation.de>
parents: 809
diff changeset
206 if (btn === 'yes') {
188a9faf96e0 Added Errorhandling for AJAX-Requests, especially Authentication Issues.
Dustin Demuth <dustin@intevation.de>
parents: 809
diff changeset
207 location.reload();
188a9faf96e0 Added Errorhandling for AJAX-Requests, especially Authentication Issues.
Dustin Demuth <dustin@intevation.de>
parents: 809
diff changeset
208 }
809
3bc19188fc3a Added some todos, Enhanced Proge-Generation Success Msg.
Dustin Demuth <dustin@intevation.de>
parents: 807
diff changeset
209 }
760
2e7e1a8bf79f Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
210 });

http://lada.wald.intevation.org