annotate app/view/widget/base/FieldSet.js @ 1236:cfc24d2ae268

Fix error handling in ImportResponse window.
author Tom Gottfried <tom@intevation.de>
date Mon, 31 Oct 2016 13:54:00 +0100
parents 26019a2273f6
children c8827424723b
rev   line source
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
1 /* Copyright (C) 2013 by Bundesamt fuer Strahlenschutz
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
2 * Software engineering by Intevation GmbH
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
3 *
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
4 * This file is Free Software under the GNU GPL (v>=3)
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
5 * and comes with ABSOLUTELY NO WARRANTY! Check out
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
6 * the documentation coming with IMIS-Labordaten-Application for details.
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
7 */
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
8
892
777bf66dbb11 even more jsduck... for widgets this time
Dustin Demuth <dustin@intevation.de>
parents: 721
diff changeset
9 /**
777bf66dbb11 even more jsduck... for widgets this time
Dustin Demuth <dustin@intevation.de>
parents: 721
diff changeset
10 * This Widget extends a Fieldset
777bf66dbb11 even more jsduck... for widgets this time
Dustin Demuth <dustin@intevation.de>
parents: 721
diff changeset
11 */
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
12 Ext.define('Lada.view.widget.base.FieldSet', {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
13 extend: 'Ext.form.FieldSet',
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
14 alias: 'widget.fset',
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
15
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
16 plainTitle: '',
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
17 origColor: '',
633
1e1534482bfd Allow multiple warning- or error-messages in a fieldset.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 632
diff changeset
18 errorText: '',
1e1534482bfd Allow multiple warning- or error-messages in a fieldset.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 632
diff changeset
19 warningText: '',
717
f124d24c8ade Datevalidation. When editing a timeperiod in a Probeform it is validated wheter begindate is before enddate. This only happens when the blur-event is fired. ToDo: Listen to Events from the Übernehmen Button of the DateTimePicker, ToDo: Somehow the ErrorMessages are not Cleared correctly when the form is restored.
Dustin Demuth <dustin@intevation.de>
parents: 633
diff changeset
20 tooltip: null,
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
21
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
22 showWarningOrError: function(warning, warningText, error, errorText) {
717
f124d24c8ade Datevalidation. When editing a timeperiod in a Probeform it is validated wheter begindate is before enddate. This only happens when the blur-event is fired. ToDo: Listen to Events from the Übernehmen Button of the DateTimePicker, ToDo: Somehow the ErrorMessages are not Cleared correctly when the form is restored.
Dustin Demuth <dustin@intevation.de>
parents: 633
diff changeset
23 this.clearMessages(); //Clear Errors and Warning first
633
1e1534482bfd Allow multiple warning- or error-messages in a fieldset.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 632
diff changeset
24 if (this.errorText && this.errorText !== '') {
1e1534482bfd Allow multiple warning- or error-messages in a fieldset.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 632
diff changeset
25 this.errorText += '\n';
1e1534482bfd Allow multiple warning- or error-messages in a fieldset.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 632
diff changeset
26 }
1e1534482bfd Allow multiple warning- or error-messages in a fieldset.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 632
diff changeset
27 this.errorText += errorText;
1e1534482bfd Allow multiple warning- or error-messages in a fieldset.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 632
diff changeset
28 if (this.warningText && this.warningText !== '') {
1e1534482bfd Allow multiple warning- or error-messages in a fieldset.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 632
diff changeset
29 this.warningText += '\n';
1e1534482bfd Allow multiple warning- or error-messages in a fieldset.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 632
diff changeset
30 }
1e1534482bfd Allow multiple warning- or error-messages in a fieldset.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 632
diff changeset
31 this.warningText += warningText;
1193
3e078af76b58 Do not try to display an undefined title.
Tom Gottfried <tom@intevation.de>
parents: 892
diff changeset
32
3e078af76b58 Do not try to display an undefined title.
Tom Gottfried <tom@intevation.de>
parents: 892
diff changeset
33 if (this.title) {
3e078af76b58 Do not try to display an undefined title.
Tom Gottfried <tom@intevation.de>
parents: 892
diff changeset
34 this.plainTitle = this.title;
3e078af76b58 Do not try to display an undefined title.
Tom Gottfried <tom@intevation.de>
parents: 892
diff changeset
35 }
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
36 this.origColor = this.getEl().dom.style['border-color'];
720
c2a6f7caa71b Fix for ErrorMessages in FieldSets for IE8 IE9
Dustin Demuth <dustin@intevation.de>
parents: 717
diff changeset
37 var imgId = Ext.id();
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
38 if (error) {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
39 this.getEl().dom.style['border-color'] = '#FF0000';
720
c2a6f7caa71b Fix for ErrorMessages in FieldSets for IE8 IE9
Dustin Demuth <dustin@intevation.de>
parents: 717
diff changeset
40 this.setTitle('<img src="resources/img/emblem-important.png" width="13" height="13" id="'+ imgId +'"/> '+
c2a6f7caa71b Fix for ErrorMessages in FieldSets for IE8 IE9
Dustin Demuth <dustin@intevation.de>
parents: 717
diff changeset
41 this.plainTitle);
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
42 if (errorText) {
717
f124d24c8ade Datevalidation. When editing a timeperiod in a Probeform it is validated wheter begindate is before enddate. This only happens when the blur-event is fired. ToDo: Listen to Events from the Übernehmen Button of the DateTimePicker, ToDo: Somehow the ErrorMessages are not Cleared correctly when the form is restored.
Dustin Demuth <dustin@intevation.de>
parents: 633
diff changeset
43 if (!this.tooltip) {
f124d24c8ade Datevalidation. When editing a timeperiod in a Probeform it is validated wheter begindate is before enddate. This only happens when the blur-event is fired. ToDo: Listen to Events from the Übernehmen Button of the DateTimePicker, ToDo: Somehow the ErrorMessages are not Cleared correctly when the form is restored.
Dustin Demuth <dustin@intevation.de>
parents: 633
diff changeset
44 Ext.create('Ext.tip.ToolTip', {
720
c2a6f7caa71b Fix for ErrorMessages in FieldSets for IE8 IE9
Dustin Demuth <dustin@intevation.de>
parents: 717
diff changeset
45 target: imgId,
717
f124d24c8ade Datevalidation. When editing a timeperiod in a Probeform it is validated wheter begindate is before enddate. This only happens when the blur-event is fired. ToDo: Listen to Events from the Übernehmen Button of the DateTimePicker, ToDo: Somehow the ErrorMessages are not Cleared correctly when the form is restored.
Dustin Demuth <dustin@intevation.de>
parents: 633
diff changeset
46 html: errorText
f124d24c8ade Datevalidation. When editing a timeperiod in a Probeform it is validated wheter begindate is before enddate. This only happens when the blur-event is fired. ToDo: Listen to Events from the Übernehmen Button of the DateTimePicker, ToDo: Somehow the ErrorMessages are not Cleared correctly when the form is restored.
Dustin Demuth <dustin@intevation.de>
parents: 633
diff changeset
47 });
f124d24c8ade Datevalidation. When editing a timeperiod in a Probeform it is validated wheter begindate is before enddate. This only happens when the blur-event is fired. ToDo: Listen to Events from the Übernehmen Button of the DateTimePicker, ToDo: Somehow the ErrorMessages are not Cleared correctly when the form is restored.
Dustin Demuth <dustin@intevation.de>
parents: 633
diff changeset
48 }
f124d24c8ade Datevalidation. When editing a timeperiod in a Probeform it is validated wheter begindate is before enddate. This only happens when the blur-event is fired. ToDo: Listen to Events from the Übernehmen Button of the DateTimePicker, ToDo: Somehow the ErrorMessages are not Cleared correctly when the form is restored.
Dustin Demuth <dustin@intevation.de>
parents: 633
diff changeset
49 else {
f124d24c8ade Datevalidation. When editing a timeperiod in a Probeform it is validated wheter begindate is before enddate. This only happens when the blur-event is fired. ToDo: Listen to Events from the Übernehmen Button of the DateTimePicker, ToDo: Somehow the ErrorMessages are not Cleared correctly when the form is restored.
Dustin Demuth <dustin@intevation.de>
parents: 633
diff changeset
50 tooltip.html = errorText;
f124d24c8ade Datevalidation. When editing a timeperiod in a Probeform it is validated wheter begindate is before enddate. This only happens when the blur-event is fired. ToDo: Listen to Events from the Übernehmen Button of the DateTimePicker, ToDo: Somehow the ErrorMessages are not Cleared correctly when the form is restored.
Dustin Demuth <dustin@intevation.de>
parents: 633
diff changeset
51 }
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
52 }
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
53 return;
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
54 }
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
55 if (warning) {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
56 this.getEl().dom.style['border-color'] = '#FFE25D';
720
c2a6f7caa71b Fix for ErrorMessages in FieldSets for IE8 IE9
Dustin Demuth <dustin@intevation.de>
parents: 717
diff changeset
57 this.setTitle('<img src="resources/img/dialog-warning.png" width="13" height="13" id="'+ imgId +'"/> '+
c2a6f7caa71b Fix for ErrorMessages in FieldSets for IE8 IE9
Dustin Demuth <dustin@intevation.de>
parents: 717
diff changeset
58 this.plainTitle);
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
59 if (warningText) {
717
f124d24c8ade Datevalidation. When editing a timeperiod in a Probeform it is validated wheter begindate is before enddate. This only happens when the blur-event is fired. ToDo: Listen to Events from the Übernehmen Button of the DateTimePicker, ToDo: Somehow the ErrorMessages are not Cleared correctly when the form is restored.
Dustin Demuth <dustin@intevation.de>
parents: 633
diff changeset
60 if (!this.tooltip) {
f124d24c8ade Datevalidation. When editing a timeperiod in a Probeform it is validated wheter begindate is before enddate. This only happens when the blur-event is fired. ToDo: Listen to Events from the Übernehmen Button of the DateTimePicker, ToDo: Somehow the ErrorMessages are not Cleared correctly when the form is restored.
Dustin Demuth <dustin@intevation.de>
parents: 633
diff changeset
61 Ext.create('Ext.tip.ToolTip', {
720
c2a6f7caa71b Fix for ErrorMessages in FieldSets for IE8 IE9
Dustin Demuth <dustin@intevation.de>
parents: 717
diff changeset
62 target: Ext.get(imgId),
717
f124d24c8ade Datevalidation. When editing a timeperiod in a Probeform it is validated wheter begindate is before enddate. This only happens when the blur-event is fired. ToDo: Listen to Events from the Übernehmen Button of the DateTimePicker, ToDo: Somehow the ErrorMessages are not Cleared correctly when the form is restored.
Dustin Demuth <dustin@intevation.de>
parents: 633
diff changeset
63 html: warningText
f124d24c8ade Datevalidation. When editing a timeperiod in a Probeform it is validated wheter begindate is before enddate. This only happens when the blur-event is fired. ToDo: Listen to Events from the Übernehmen Button of the DateTimePicker, ToDo: Somehow the ErrorMessages are not Cleared correctly when the form is restored.
Dustin Demuth <dustin@intevation.de>
parents: 633
diff changeset
64 });
f124d24c8ade Datevalidation. When editing a timeperiod in a Probeform it is validated wheter begindate is before enddate. This only happens when the blur-event is fired. ToDo: Listen to Events from the Übernehmen Button of the DateTimePicker, ToDo: Somehow the ErrorMessages are not Cleared correctly when the form is restored.
Dustin Demuth <dustin@intevation.de>
parents: 633
diff changeset
65 }
f124d24c8ade Datevalidation. When editing a timeperiod in a Probeform it is validated wheter begindate is before enddate. This only happens when the blur-event is fired. ToDo: Listen to Events from the Übernehmen Button of the DateTimePicker, ToDo: Somehow the ErrorMessages are not Cleared correctly when the form is restored.
Dustin Demuth <dustin@intevation.de>
parents: 633
diff changeset
66 else {
f124d24c8ade Datevalidation. When editing a timeperiod in a Probeform it is validated wheter begindate is before enddate. This only happens when the blur-event is fired. ToDo: Listen to Events from the Übernehmen Button of the DateTimePicker, ToDo: Somehow the ErrorMessages are not Cleared correctly when the form is restored.
Dustin Demuth <dustin@intevation.de>
parents: 633
diff changeset
67 tooltip.html = warningText;
f124d24c8ade Datevalidation. When editing a timeperiod in a Probeform it is validated wheter begindate is before enddate. This only happens when the blur-event is fired. ToDo: Listen to Events from the Übernehmen Button of the DateTimePicker, ToDo: Somehow the ErrorMessages are not Cleared correctly when the form is restored.
Dustin Demuth <dustin@intevation.de>
parents: 633
diff changeset
68 }
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
69 }
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
70 return;
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
71 }
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
72 },
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
73
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
74 clearMessages: function() {
1196
47991f0d7837 Clear messages regardless of whether title is an empty string.
Tom Gottfried <tom@intevation.de>
parents: 1193
diff changeset
75 this.setTitle(this.plainTitle);
1201
26019a2273f6 Display of probe forms failed due to getEl() returning undefined
Tom Gottfried <tom@intevation.de>
parents: 1196
diff changeset
76 if (this.getEl()) {
26019a2273f6 Display of probe forms failed due to getEl() returning undefined
Tom Gottfried <tom@intevation.de>
parents: 1196
diff changeset
77 this.getEl().dom.style['border-color'] = this.origColor;
26019a2273f6 Display of probe forms failed due to getEl() returning undefined
Tom Gottfried <tom@intevation.de>
parents: 1196
diff changeset
78 }
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
79 }
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
80 });

http://lada.wald.intevation.org