annotate app/view/window/GenProbenFromMessprogramm.js @ 1198:3b6f40541ac6

Remove wrong period check. The validity period can be e.g. from November till February, thus spanning over turn of the year and allowing a from value greater than to value (in terms of day of year).
author Tom Gottfried <tom@intevation.de>
date Fri, 23 Sep 2016 16:32:30 +0200
parents 39d98891881c
children 95d24315d68e
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
8054232535ba More JSduck
Dustin Demuth <dustin@intevation.de>
parents: 890
diff changeset
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() {
1191
62f374ea7ab7 Use UTC date in messprogramm to generate probe objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1162
diff changeset
55 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
56 var startUTC = Date.UTC(
62f374ea7ab7 Use UTC date in messprogramm to generate probe objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1162
diff changeset
57 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
58 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
59 var endUTC = Date.UTC(
62f374ea7ab7 Use UTC date in messprogramm to generate probe objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1162
diff changeset
60 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
61 var jsondata = {
2e7e1a8bf79f Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
62 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
63 start: startUTC,
62f374ea7ab7 Use UTC date in messprogramm to generate probe objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1162
diff changeset
64 end: endUTC
760
2e7e1a8bf79f Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
65 };
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 Ext.Ajax.request({
999
f73ca04d73a7 Refactored Server URL
Dustin Demuth <dustin@intevation.de>
parents: 920
diff changeset
68 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
69 method: 'POST',
2e7e1a8bf79f Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
70 jsonData: jsondata,
809
3bc19188fc3a Added some todos, Enhanced Proge-Generation Success Msg.
Dustin Demuth <dustin@intevation.de>
parents: 807
diff changeset
71 success: 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);
1162
b98e3af27424 Show generated objects in grid when using messprogramm to create proben
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1118
diff changeset
73 var radio = Ext.ComponentQuery.query('modeswitcher')[0].down('radiofield[inputValue=proben]');
b98e3af27424 Show generated objects in grid when using messprogramm to create proben
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1118
diff changeset
74 radio.setValue(true);
b98e3af27424 Show generated objects in grid when using messprogramm to create proben
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1118
diff changeset
75
b98e3af27424 Show generated objects in grid when using messprogramm to create proben
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1118
diff changeset
76 var contentPanel = Ext.ComponentQuery.query('panel[name=main]')[0].down('panel[name=contentpanel]');
b98e3af27424 Show generated objects in grid when using messprogramm to create proben
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1118
diff changeset
77 contentPanel.removeAll(); //clear the panel: make space for new grids
b98e3af27424 Show generated objects in grid when using messprogramm to create proben
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1118
diff changeset
78 var gridstore = Ext.create('Lada.store.Proben');
b98e3af27424 Show generated objects in grid when using messprogramm to create proben
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1118
diff changeset
79 var frgrid = Ext.create('Lada.view.grid.ProbeList', {
b98e3af27424 Show generated objects in grid when using messprogramm to create proben
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1118
diff changeset
80 plugins: [{
b98e3af27424 Show generated objects in grid when using messprogramm to create proben
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1118
diff changeset
81 ptype: 'gridrowexpander',
b98e3af27424 Show generated objects in grid when using messprogramm to create proben
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1118
diff changeset
82 gridType: 'Lada.view.grid.Messung',
b98e3af27424 Show generated objects in grid when using messprogramm to create proben
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1118
diff changeset
83 expandOnDblClick: false,
b98e3af27424 Show generated objects in grid when using messprogramm to create proben
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1118
diff changeset
84 gridConfig: {
b98e3af27424 Show generated objects in grid when using messprogramm to create proben
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1118
diff changeset
85 bottomBar: false
b98e3af27424 Show generated objects in grid when using messprogramm to create proben
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1118
diff changeset
86 }
b98e3af27424 Show generated objects in grid when using messprogramm to create proben
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1118
diff changeset
87 }]
b98e3af27424 Show generated objects in grid when using messprogramm to create proben
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1118
diff changeset
88 });
b98e3af27424 Show generated objects in grid when using messprogramm to create proben
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1118
diff changeset
89
b98e3af27424 Show generated objects in grid when using messprogramm to create proben
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1118
diff changeset
90 var columns = [{
b98e3af27424 Show generated objects in grid when using messprogramm to create proben
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1118
diff changeset
91 header: i18n.getMsg('prnId'),
b98e3af27424 Show generated objects in grid when using messprogramm to create proben
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1118
diff changeset
92 dataIndex: 'probeIdAlt'
b98e3af27424 Show generated objects in grid when using messprogramm to create proben
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1118
diff changeset
93 }, {
b98e3af27424 Show generated objects in grid when using messprogramm to create proben
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1118
diff changeset
94 header: i18n.getMsg('netzbetreiberId'),
b98e3af27424 Show generated objects in grid when using messprogramm to create proben
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1118
diff changeset
95 dataIndex: 'netzbetreiberId',
b98e3af27424 Show generated objects in grid when using messprogramm to create proben
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1118
diff changeset
96 renderer: function(value) {
b98e3af27424 Show generated objects in grid when using messprogramm to create proben
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1118
diff changeset
97 var r = '';
b98e3af27424 Show generated objects in grid when using messprogramm to create proben
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1118
diff changeset
98 if (!value || value === '') {
b98e3af27424 Show generated objects in grid when using messprogramm to create proben
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1118
diff changeset
99 r = 'Error';
b98e3af27424 Show generated objects in grid when using messprogramm to create proben
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1118
diff changeset
100 }
b98e3af27424 Show generated objects in grid when using messprogramm to create proben
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1118
diff changeset
101 var store = Ext.data.StoreManager.get('netzbetreiber');
b98e3af27424 Show generated objects in grid when using messprogramm to create proben
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1118
diff changeset
102 var record = store.getById(value);
b98e3af27424 Show generated objects in grid when using messprogramm to create proben
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1118
diff changeset
103 if (record) {
b98e3af27424 Show generated objects in grid when using messprogramm to create proben
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1118
diff changeset
104 r = record.get('netzbetreiber');
b98e3af27424 Show generated objects in grid when using messprogramm to create proben
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1118
diff changeset
105 }
b98e3af27424 Show generated objects in grid when using messprogramm to create proben
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1118
diff changeset
106 return r;
b98e3af27424 Show generated objects in grid when using messprogramm to create proben
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1118
diff changeset
107 }
b98e3af27424 Show generated objects in grid when using messprogramm to create proben
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1118
diff changeset
108 }, {
b98e3af27424 Show generated objects in grid when using messprogramm to create proben
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1118
diff changeset
109 header: i18n.getMsg('mstId'),
b98e3af27424 Show generated objects in grid when using messprogramm to create proben
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1118
diff changeset
110 dataIndex: 'mstId',
b98e3af27424 Show generated objects in grid when using messprogramm to create proben
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1118
diff changeset
111 renderer: function(value) {
b98e3af27424 Show generated objects in grid when using messprogramm to create proben
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1118
diff changeset
112 var r = '';
b98e3af27424 Show generated objects in grid when using messprogramm to create proben
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1118
diff changeset
113 if (!value || value === '') {
b98e3af27424 Show generated objects in grid when using messprogramm to create proben
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1118
diff changeset
114 r = 'Error';
b98e3af27424 Show generated objects in grid when using messprogramm to create proben
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1118
diff changeset
115 }
b98e3af27424 Show generated objects in grid when using messprogramm to create proben
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1118
diff changeset
116 var store = Ext.data.StoreManager.get('messstellen');
b98e3af27424 Show generated objects in grid when using messprogramm to create proben
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1118
diff changeset
117 var record = store.getById(value);
b98e3af27424 Show generated objects in grid when using messprogramm to create proben
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1118
diff changeset
118 if (record) {
b98e3af27424 Show generated objects in grid when using messprogramm to create proben
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1118
diff changeset
119 r = record.get('messStelle');
b98e3af27424 Show generated objects in grid when using messprogramm to create proben
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1118
diff changeset
120 }
b98e3af27424 Show generated objects in grid when using messprogramm to create proben
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1118
diff changeset
121 return r;
b98e3af27424 Show generated objects in grid when using messprogramm to create proben
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1118
diff changeset
122 }
b98e3af27424 Show generated objects in grid when using messprogramm to create proben
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1118
diff changeset
123 }, {
b98e3af27424 Show generated objects in grid when using messprogramm to create proben
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1118
diff changeset
124 header: i18n.getMsg('datenbasisId'),
b98e3af27424 Show generated objects in grid when using messprogramm to create proben
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1118
diff changeset
125 dataIndex: 'datenbasisId',
b98e3af27424 Show generated objects in grid when using messprogramm to create proben
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1118
diff changeset
126 renderer: function(value) {
b98e3af27424 Show generated objects in grid when using messprogramm to create proben
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1118
diff changeset
127 var r = '';
b98e3af27424 Show generated objects in grid when using messprogramm to create proben
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1118
diff changeset
128 if (!value || value === '') {
b98e3af27424 Show generated objects in grid when using messprogramm to create proben
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1118
diff changeset
129 r = value;
b98e3af27424 Show generated objects in grid when using messprogramm to create proben
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1118
diff changeset
130 }
b98e3af27424 Show generated objects in grid when using messprogramm to create proben
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1118
diff changeset
131 var store = Ext.data.StoreManager.get('datenbasis');
b98e3af27424 Show generated objects in grid when using messprogramm to create proben
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1118
diff changeset
132 var record = store.getById(value);
b98e3af27424 Show generated objects in grid when using messprogramm to create proben
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1118
diff changeset
133 if (record) {
b98e3af27424 Show generated objects in grid when using messprogramm to create proben
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1118
diff changeset
134 r = record.get('datenbasis');
b98e3af27424 Show generated objects in grid when using messprogramm to create proben
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1118
diff changeset
135 }
b98e3af27424 Show generated objects in grid when using messprogramm to create proben
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1118
diff changeset
136 return r;
b98e3af27424 Show generated objects in grid when using messprogramm to create proben
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1118
diff changeset
137 }
b98e3af27424 Show generated objects in grid when using messprogramm to create proben
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1118
diff changeset
138 }, {
b98e3af27424 Show generated objects in grid when using messprogramm to create proben
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1118
diff changeset
139 header: i18n.getMsg('baId'),
b98e3af27424 Show generated objects in grid when using messprogramm to create proben
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1118
diff changeset
140 dataIndex: 'baId',
b98e3af27424 Show generated objects in grid when using messprogramm to create proben
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1118
diff changeset
141 renderer: function(value) {
b98e3af27424 Show generated objects in grid when using messprogramm to create proben
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1118
diff changeset
142 var r = '';
b98e3af27424 Show generated objects in grid when using messprogramm to create proben
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1118
diff changeset
143 if (!value || value === '') {
b98e3af27424 Show generated objects in grid when using messprogramm to create proben
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1118
diff changeset
144 r = '';
b98e3af27424 Show generated objects in grid when using messprogramm to create proben
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1118
diff changeset
145 }
b98e3af27424 Show generated objects in grid when using messprogramm to create proben
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1118
diff changeset
146 var store = Ext.create('Ext.data.Store', {
b98e3af27424 Show generated objects in grid when using messprogramm to create proben
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1118
diff changeset
147 fields: ['betriebsartId', 'betriebsart'],
b98e3af27424 Show generated objects in grid when using messprogramm to create proben
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1118
diff changeset
148 data: [{
b98e3af27424 Show generated objects in grid when using messprogramm to create proben
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1118
diff changeset
149 'betriebsartId': '1',
b98e3af27424 Show generated objects in grid when using messprogramm to create proben
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1118
diff changeset
150 'betriebsart': 'Normal-/Routinebetrieb'
b98e3af27424 Show generated objects in grid when using messprogramm to create proben
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1118
diff changeset
151 }, {
b98e3af27424 Show generated objects in grid when using messprogramm to create proben
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1118
diff changeset
152 'betriebsartId': '2',
b98e3af27424 Show generated objects in grid when using messprogramm to create proben
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1118
diff changeset
153 'betriebsart': 'Störfall/Intensivbetrieb'
b98e3af27424 Show generated objects in grid when using messprogramm to create proben
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1118
diff changeset
154 }]
b98e3af27424 Show generated objects in grid when using messprogramm to create proben
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1118
diff changeset
155 });
b98e3af27424 Show generated objects in grid when using messprogramm to create proben
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1118
diff changeset
156 var record = store.getById(value);
b98e3af27424 Show generated objects in grid when using messprogramm to create proben
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1118
diff changeset
157 if (record) {
b98e3af27424 Show generated objects in grid when using messprogramm to create proben
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1118
diff changeset
158 r = record.get('betriebsart');
b98e3af27424 Show generated objects in grid when using messprogramm to create proben
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1118
diff changeset
159 }
b98e3af27424 Show generated objects in grid when using messprogramm to create proben
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1118
diff changeset
160 return r;
b98e3af27424 Show generated objects in grid when using messprogramm to create proben
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1118
diff changeset
161 }
b98e3af27424 Show generated objects in grid when using messprogramm to create proben
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1118
diff changeset
162 }, {
b98e3af27424 Show generated objects in grid when using messprogramm to create proben
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1118
diff changeset
163 header: i18n.getMsg('probenartId'),
b98e3af27424 Show generated objects in grid when using messprogramm to create proben
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1118
diff changeset
164 dataIndex: 'probenartId',
b98e3af27424 Show generated objects in grid when using messprogramm to create proben
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1118
diff changeset
165 renderer: function(value) {
b98e3af27424 Show generated objects in grid when using messprogramm to create proben
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1118
diff changeset
166 var r = '';
b98e3af27424 Show generated objects in grid when using messprogramm to create proben
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1118
diff changeset
167 if (!value || value === '') {
b98e3af27424 Show generated objects in grid when using messprogramm to create proben
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1118
diff changeset
168 r = value;
b98e3af27424 Show generated objects in grid when using messprogramm to create proben
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1118
diff changeset
169 }
b98e3af27424 Show generated objects in grid when using messprogramm to create proben
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1118
diff changeset
170 var store = Ext.data.StoreManager.get('probenarten');
b98e3af27424 Show generated objects in grid when using messprogramm to create proben
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1118
diff changeset
171 var record = store.getById(value);
b98e3af27424 Show generated objects in grid when using messprogramm to create proben
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1118
diff changeset
172 if (record) {
b98e3af27424 Show generated objects in grid when using messprogramm to create proben
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1118
diff changeset
173 r = record.get('probenart');
b98e3af27424 Show generated objects in grid when using messprogramm to create proben
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1118
diff changeset
174 }
b98e3af27424 Show generated objects in grid when using messprogramm to create proben
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1118
diff changeset
175 return r;
b98e3af27424 Show generated objects in grid when using messprogramm to create proben
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1118
diff changeset
176 }
b98e3af27424 Show generated objects in grid when using messprogramm to create proben
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1118
diff changeset
177 }, {
b98e3af27424 Show generated objects in grid when using messprogramm to create proben
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1118
diff changeset
178 header: i18n.getMsg('sollVon'),
b98e3af27424 Show generated objects in grid when using messprogramm to create proben
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1118
diff changeset
179 dataIndex: 'solldatumBeginn',
b98e3af27424 Show generated objects in grid when using messprogramm to create proben
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1118
diff changeset
180 renderer: function(value) {
b98e3af27424 Show generated objects in grid when using messprogramm to create proben
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1118
diff changeset
181 console.log(value);
b98e3af27424 Show generated objects in grid when using messprogramm to create proben
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1118
diff changeset
182 if (!value) {
b98e3af27424 Show generated objects in grid when using messprogramm to create proben
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1118
diff changeset
183 return '';
b98e3af27424 Show generated objects in grid when using messprogramm to create proben
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1118
diff changeset
184 }
b98e3af27424 Show generated objects in grid when using messprogramm to create proben
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1118
diff changeset
185 return Ext.Date.format(value, 'd.m.Y');
b98e3af27424 Show generated objects in grid when using messprogramm to create proben
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1118
diff changeset
186 }
b98e3af27424 Show generated objects in grid when using messprogramm to create proben
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1118
diff changeset
187 }, {
b98e3af27424 Show generated objects in grid when using messprogramm to create proben
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1118
diff changeset
188 header: i18n.getMsg('sollBis'),
b98e3af27424 Show generated objects in grid when using messprogramm to create proben
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1118
diff changeset
189 dataIndex: 'solldatumEnde',
b98e3af27424 Show generated objects in grid when using messprogramm to create proben
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1118
diff changeset
190 renderer: function(value) {
b98e3af27424 Show generated objects in grid when using messprogramm to create proben
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1118
diff changeset
191 if (!value) {
b98e3af27424 Show generated objects in grid when using messprogramm to create proben
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1118
diff changeset
192 return '';
b98e3af27424 Show generated objects in grid when using messprogramm to create proben
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1118
diff changeset
193 }
b98e3af27424 Show generated objects in grid when using messprogramm to create proben
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1118
diff changeset
194 return Ext.Date.format(value, 'd.m.Y');
b98e3af27424 Show generated objects in grid when using messprogramm to create proben
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1118
diff changeset
195 }
b98e3af27424 Show generated objects in grid when using messprogramm to create proben
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1118
diff changeset
196 }];
b98e3af27424 Show generated objects in grid when using messprogramm to create proben
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1118
diff changeset
197 frgrid.reconfigure(gridstore, columns);
b98e3af27424 Show generated objects in grid when using messprogramm to create proben
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1118
diff changeset
198
b98e3af27424 Show generated objects in grid when using messprogramm to create proben
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1118
diff changeset
199 gridstore.loadData(json.data);
b98e3af27424 Show generated objects in grid when using messprogramm to create proben
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1118
diff changeset
200 contentPanel.add(frgrid);
809
3bc19188fc3a Added some todos, Enhanced Proge-Generation Success Msg.
Dustin Demuth <dustin@intevation.de>
parents: 807
diff changeset
201 Ext.Msg.show({
3bc19188fc3a Added some todos, Enhanced Proge-Generation Success Msg.
Dustin Demuth <dustin@intevation.de>
parents: 807
diff changeset
202 title: i18n.getMsg('success'),
3bc19188fc3a Added some todos, Enhanced Proge-Generation Success Msg.
Dustin Demuth <dustin@intevation.de>
parents: 807
diff changeset
203 autoScroll: true,
3bc19188fc3a Added some todos, Enhanced Proge-Generation Success Msg.
Dustin Demuth <dustin@intevation.de>
parents: 807
diff changeset
204 msg: me.evalResponse(json),
882
f1e964b3aad6 Trailing Commas
Dustin Demuth <dustin@intevation.de>
parents: 861
diff changeset
205 buttons: Ext.Msg.OK
809
3bc19188fc3a Added some todos, Enhanced Proge-Generation Success Msg.
Dustin Demuth <dustin@intevation.de>
parents: 807
diff changeset
206 });
859
6249b731d438 Close messprogramm windows on probe generation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 855
diff changeset
207 me.close();
760
2e7e1a8bf79f Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
208 },
809
3bc19188fc3a Added some todos, Enhanced Proge-Generation Success Msg.
Dustin Demuth <dustin@intevation.de>
parents: 807
diff changeset
209 failure: function(response) {
855
dff2798390f8 Better Error handling
Dustin Demuth <dustin@intevation.de>
parents: 834
diff changeset
210 var json = null;
dff2798390f8 Better Error handling
Dustin Demuth <dustin@intevation.de>
parents: 834
diff changeset
211 try {
dff2798390f8 Better Error handling
Dustin Demuth <dustin@intevation.de>
parents: 834
diff changeset
212 json = Ext.JSON.decode(response.responseText);
dff2798390f8 Better Error handling
Dustin Demuth <dustin@intevation.de>
parents: 834
diff changeset
213 }
dff2798390f8 Better Error handling
Dustin Demuth <dustin@intevation.de>
parents: 834
diff changeset
214 catch(err){
dff2798390f8 Better Error handling
Dustin Demuth <dustin@intevation.de>
parents: 834
diff changeset
215 Ext.Msg.alert(Lada.getApplication().bundle.getMsg('err.msg.generic.title'),
dff2798390f8 Better Error handling
Dustin Demuth <dustin@intevation.de>
parents: 834
diff changeset
216 Lada.getApplication().bundle.getMsg('err.msg.response.body'));
dff2798390f8 Better Error handling
Dustin Demuth <dustin@intevation.de>
parents: 834
diff changeset
217 }
809
3bc19188fc3a Added some todos, Enhanced Proge-Generation Success Msg.
Dustin Demuth <dustin@intevation.de>
parents: 807
diff changeset
218 if (json) {
3bc19188fc3a Added some todos, Enhanced Proge-Generation Success Msg.
Dustin Demuth <dustin@intevation.de>
parents: 807
diff changeset
219 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
220 formPanel.setMessages(json.errors, json.warnings);
3bc19188fc3a Added some todos, Enhanced Proge-Generation Success Msg.
Dustin Demuth <dustin@intevation.de>
parents: 807
diff changeset
221 }
920
f220ba587c89 Adopted Client to SSO, detect a Sessiontimeout and reload the application
Dustin Demuth <dustin@intevation.de>
parents: 891
diff changeset
222 /*
f220ba587c89 Adopted Client to SSO, detect a Sessiontimeout and reload the application
Dustin Demuth <dustin@intevation.de>
parents: 891
diff changeset
223 SSO will send a 302 if the Client is not authenticated
f220ba587c89 Adopted Client to SSO, detect a Sessiontimeout and reload the application
Dustin Demuth <dustin@intevation.de>
parents: 891
diff changeset
224 unfortunately this seems to be filtered by the browser.
f220ba587c89 Adopted Client to SSO, detect a Sessiontimeout and reload the application
Dustin Demuth <dustin@intevation.de>
parents: 891
diff changeset
225 We assume that a 302 was send when the follwing statement
f220ba587c89 Adopted Client to SSO, detect a Sessiontimeout and reload the application
Dustin Demuth <dustin@intevation.de>
parents: 891
diff changeset
226 is true.
f220ba587c89 Adopted Client to SSO, detect a Sessiontimeout and reload the application
Dustin Demuth <dustin@intevation.de>
parents: 891
diff changeset
227 */
f220ba587c89 Adopted Client to SSO, detect a Sessiontimeout and reload the application
Dustin Demuth <dustin@intevation.de>
parents: 891
diff changeset
228 if (response.status == 0 && response.responseText === "") {
812
188a9faf96e0 Added Errorhandling for AJAX-Requests, especially Authentication Issues.
Dustin Demuth <dustin@intevation.de>
parents: 809
diff changeset
229 Ext.MessageBox.confirm('Erneutes Login erforderlich',
920
f220ba587c89 Adopted Client to SSO, detect a Sessiontimeout and reload the application
Dustin Demuth <dustin@intevation.de>
parents: 891
diff changeset
230 'Ihre Session ist abgelaufen.<br/>'+
812
188a9faf96e0 Added Errorhandling for AJAX-Requests, especially Authentication Issues.
Dustin Demuth <dustin@intevation.de>
parents: 809
diff changeset
231 '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
232 'Alle ungesicherten Daten gehen dabei verloren.<br/>' +
920
f220ba587c89 Adopted Client to SSO, detect a Sessiontimeout and reload the application
Dustin Demuth <dustin@intevation.de>
parents: 891
diff changeset
233 'Soll die Anwendung jetzt neu geladen werden?', this.reload);
812
188a9faf96e0 Added Errorhandling for AJAX-Requests, especially Authentication Issues.
Dustin Demuth <dustin@intevation.de>
parents: 809
diff changeset
234 }
920
f220ba587c89 Adopted Client to SSO, detect a Sessiontimeout and reload the application
Dustin Demuth <dustin@intevation.de>
parents: 891
diff changeset
235 // further error handling
f220ba587c89 Adopted Client to SSO, detect a Sessiontimeout and reload the application
Dustin Demuth <dustin@intevation.de>
parents: 891
diff changeset
236 if(json.message){
812
188a9faf96e0 Added Errorhandling for AJAX-Requests, especially Authentication Issues.
Dustin Demuth <dustin@intevation.de>
parents: 809
diff changeset
237 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
238 +' #'+json.message,
3bc19188fc3a Added some todos, Enhanced Proge-Generation Success Msg.
Dustin Demuth <dustin@intevation.de>
parents: 807
diff changeset
239 Lada.getApplication().bundle.getMsg(json.message));
3bc19188fc3a Added some todos, Enhanced Proge-Generation Success Msg.
Dustin Demuth <dustin@intevation.de>
parents: 807
diff changeset
240 } else {
812
188a9faf96e0 Added Errorhandling for AJAX-Requests, especially Authentication Issues.
Dustin Demuth <dustin@intevation.de>
parents: 809
diff changeset
241 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
242 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
243 }
3bc19188fc3a Added some todos, Enhanced Proge-Generation Success Msg.
Dustin Demuth <dustin@intevation.de>
parents: 807
diff changeset
244 } else {
812
188a9faf96e0 Added Errorhandling for AJAX-Requests, especially Authentication Issues.
Dustin Demuth <dustin@intevation.de>
parents: 809
diff changeset
245 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
246 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
247 }
760
2e7e1a8bf79f Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
248 }
2e7e1a8bf79f Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
249 });
2e7e1a8bf79f Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
250 }
2e7e1a8bf79f Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
251 }];
834
2214aea9fd3a Patched correct file of r. 832
Dustin Demuth <dustin@intevation.de>
parents: 833
diff changeset
252 this.width = 350;
2214aea9fd3a Patched correct file of r. 832
Dustin Demuth <dustin@intevation.de>
parents: 833
diff changeset
253 this.height = 250;
760
2e7e1a8bf79f Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
254
2e7e1a8bf79f Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
255 // 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
256 this.on({
2e7e1a8bf79f Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
257 activate: function(){
2e7e1a8bf79f Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
258 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
259 },
2e7e1a8bf79f Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
260 deactivate: function(){
2e7e1a8bf79f Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
261 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
262 },
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
263 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
264 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
265 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
266 }
760
2e7e1a8bf79f Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
267 }
2e7e1a8bf79f Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
268 });
2e7e1a8bf79f Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
269
2e7e1a8bf79f Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
270 // 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
271 // 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
272 // 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
273 this.items = [{
2e7e1a8bf79f Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
274 border: 0,
2e7e1a8bf79f Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
275 autoScroll: true,
2e7e1a8bf79f Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
276 items: [{
807
18697326c862 Less ugly
Dustin Demuth <dustin@intevation.de>
parents: 761
diff changeset
277 xtype: 'panel',
18697326c862 Less ugly
Dustin Demuth <dustin@intevation.de>
parents: 761
diff changeset
278 border: 0,
18697326c862 Less ugly
Dustin Demuth <dustin@intevation.de>
parents: 761
diff changeset
279 margin: 5,
18697326c862 Less ugly
Dustin Demuth <dustin@intevation.de>
parents: 761
diff changeset
280 layout: 'fit',
18697326c862 Less ugly
Dustin Demuth <dustin@intevation.de>
parents: 761
diff changeset
281 html: '<p>'
18697326c862 Less ugly
Dustin Demuth <dustin@intevation.de>
parents: 761
diff changeset
282 + i18n.getMsg('nameofmessprogramm')
18697326c862 Less ugly
Dustin Demuth <dustin@intevation.de>
parents: 761
diff changeset
283 + '<br/>'
18697326c862 Less ugly
Dustin Demuth <dustin@intevation.de>
parents: 761
diff changeset
284 + this.record.get('name')
18697326c862 Less ugly
Dustin Demuth <dustin@intevation.de>
parents: 761
diff changeset
285 + '</p>'
760
2e7e1a8bf79f Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
286 }, {
807
18697326c862 Less ugly
Dustin Demuth <dustin@intevation.de>
parents: 761
diff changeset
287 xtype: 'panel',
18697326c862 Less ugly
Dustin Demuth <dustin@intevation.de>
parents: 761
diff changeset
288 border: 0,
18697326c862 Less ugly
Dustin Demuth <dustin@intevation.de>
parents: 761
diff changeset
289 margin: 5,
18697326c862 Less ugly
Dustin Demuth <dustin@intevation.de>
parents: 761
diff changeset
290 layout: 'fit',
18697326c862 Less ugly
Dustin Demuth <dustin@intevation.de>
parents: 761
diff changeset
291 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
292 }, {
1105
953b359748bb change time range format in GenProbenFromMessprogramm
Michael Stanko <mstanko@bfs.de>
parents: 999
diff changeset
293 xtype: 'datefield',
760
2e7e1a8bf79f Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
294 fieldLabel: i18n.getMsg('from'),
2e7e1a8bf79f Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
295 labelWidth: 90,
807
18697326c862 Less ugly
Dustin Demuth <dustin@intevation.de>
parents: 761
diff changeset
296 margin: 5,
1105
953b359748bb change time range format in GenProbenFromMessprogramm
Michael Stanko <mstanko@bfs.de>
parents: 999
diff changeset
297 width: 200,
760
2e7e1a8bf79f Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
298 name: 'start',
1105
953b359748bb change time range format in GenProbenFromMessprogramm
Michael Stanko <mstanko@bfs.de>
parents: 999
diff changeset
299 format: 'd.m.Y',
760
2e7e1a8bf79f Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
300 period: 'start'
2e7e1a8bf79f Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
301 }, {
1105
953b359748bb change time range format in GenProbenFromMessprogramm
Michael Stanko <mstanko@bfs.de>
parents: 999
diff changeset
302 xtype: 'datefield',
760
2e7e1a8bf79f Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
303 fieldLabel: i18n.getMsg('to'),
2e7e1a8bf79f Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
304 labelWidth: 90,
807
18697326c862 Less ugly
Dustin Demuth <dustin@intevation.de>
parents: 761
diff changeset
305 margin: 5,
1105
953b359748bb change time range format in GenProbenFromMessprogramm
Michael Stanko <mstanko@bfs.de>
parents: 999
diff changeset
306 width: 200,
760
2e7e1a8bf79f Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
307 name: 'end',
1105
953b359748bb change time range format in GenProbenFromMessprogramm
Michael Stanko <mstanko@bfs.de>
parents: 999
diff changeset
308 format: 'd.m.Y',
760
2e7e1a8bf79f Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
309 period: 'end'
2e7e1a8bf79f Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
310 }]
2e7e1a8bf79f Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
311 }];
2e7e1a8bf79f Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
312 this.callParent(arguments);
2e7e1a8bf79f Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
313 },
2e7e1a8bf79f Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
314
2e7e1a8bf79f Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
315 /**
890
def27cdd0dfa Added Documentation to Windows
Dustin Demuth <dustin@intevation.de>
parents: 882
diff changeset
316 * Initiatlise the Data
760
2e7e1a8bf79f Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
317 */
2e7e1a8bf79f Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
318 initData: function() {
2e7e1a8bf79f Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
319 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
320 me = this;
2e7e1a8bf79f Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
321 },
809
3bc19188fc3a Added some todos, Enhanced Proge-Generation Success Msg.
Dustin Demuth <dustin@intevation.de>
parents: 807
diff changeset
322
3bc19188fc3a Added some todos, Enhanced Proge-Generation Success Msg.
Dustin Demuth <dustin@intevation.de>
parents: 807
diff changeset
323 /**
3bc19188fc3a Added some todos, Enhanced Proge-Generation Success Msg.
Dustin Demuth <dustin@intevation.de>
parents: 807
diff changeset
324 * 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
325 */
3bc19188fc3a Added some todos, Enhanced Proge-Generation Success Msg.
Dustin Demuth <dustin@intevation.de>
parents: 807
diff changeset
326 evalResponse: function(response) {
3bc19188fc3a Added some todos, Enhanced Proge-Generation Success Msg.
Dustin Demuth <dustin@intevation.de>
parents: 807
diff changeset
327 var i18n = Lada.getApplication().bundle;
3bc19188fc3a Added some todos, Enhanced Proge-Generation Success Msg.
Dustin Demuth <dustin@intevation.de>
parents: 807
diff changeset
328 var r = '';
812
188a9faf96e0 Added Errorhandling for AJAX-Requests, especially Authentication Issues.
Dustin Demuth <dustin@intevation.de>
parents: 809
diff changeset
329 r += response.data.length;
809
3bc19188fc3a Added some todos, Enhanced Proge-Generation Success Msg.
Dustin Demuth <dustin@intevation.de>
parents: 807
diff changeset
330 r += ' ' + i18n.getMsg('probecreated');
3bc19188fc3a Added some todos, Enhanced Proge-Generation Success Msg.
Dustin Demuth <dustin@intevation.de>
parents: 807
diff changeset
331 r += '<br/>';
3bc19188fc3a Added some todos, Enhanced Proge-Generation Success Msg.
Dustin Demuth <dustin@intevation.de>
parents: 807
diff changeset
332 return r;
812
188a9faf96e0 Added Errorhandling for AJAX-Requests, especially Authentication Issues.
Dustin Demuth <dustin@intevation.de>
parents: 809
diff changeset
333 },
188a9faf96e0 Added Errorhandling for AJAX-Requests, especially Authentication Issues.
Dustin Demuth <dustin@intevation.de>
parents: 809
diff changeset
334
890
def27cdd0dfa Added Documentation to Windows
Dustin Demuth <dustin@intevation.de>
parents: 882
diff changeset
335 /**
def27cdd0dfa Added Documentation to Windows
Dustin Demuth <dustin@intevation.de>
parents: 882
diff changeset
336 * Reload the Application
def27cdd0dfa Added Documentation to Windows
Dustin Demuth <dustin@intevation.de>
parents: 882
diff changeset
337 */
812
188a9faf96e0 Added Errorhandling for AJAX-Requests, especially Authentication Issues.
Dustin Demuth <dustin@intevation.de>
parents: 809
diff changeset
338 reload: function(btn) {
188a9faf96e0 Added Errorhandling for AJAX-Requests, especially Authentication Issues.
Dustin Demuth <dustin@intevation.de>
parents: 809
diff changeset
339 if (btn === 'yes') {
188a9faf96e0 Added Errorhandling for AJAX-Requests, especially Authentication Issues.
Dustin Demuth <dustin@intevation.de>
parents: 809
diff changeset
340 location.reload();
188a9faf96e0 Added Errorhandling for AJAX-Requests, especially Authentication Issues.
Dustin Demuth <dustin@intevation.de>
parents: 809
diff changeset
341 }
809
3bc19188fc3a Added some todos, Enhanced Proge-Generation Success Msg.
Dustin Demuth <dustin@intevation.de>
parents: 807
diff changeset
342 }
760
2e7e1a8bf79f Added a Window and Buttons to generate Proben from a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
343 });

http://lada.wald.intevation.org