Mercurial > lada > lada-client
annotate app/view/widget/base/FieldSet.js @ 1139:143ab8fa13dc
Added 'readonly' data field.
author | Raimund Renkert <raimund.renkert@intevation.de> |
---|---|
date | Thu, 26 May 2016 14:04:37 +0200 |
parents | 777bf66dbb11 |
children | 3e078af76b58 |
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; |
720
c2a6f7caa71b
Fix for ErrorMessages in FieldSets for IE8 IE9
Dustin Demuth <dustin@intevation.de>
parents:
717
diff
changeset
|
32 this.plainTitle = this.title; |
548
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
33 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
|
34 var imgId = Ext.id(); |
548
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
35 if (error) { |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
36 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
|
37 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
|
38 this.plainTitle); |
548
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
39 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
|
40 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
|
41 Ext.create('Ext.tip.ToolTip', { |
720
c2a6f7caa71b
Fix for ErrorMessages in FieldSets for IE8 IE9
Dustin Demuth <dustin@intevation.de>
parents:
717
diff
changeset
|
42 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
|
43 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
|
44 }); |
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
|
45 } |
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 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
|
47 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
|
48 } |
548
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
49 } |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
50 return; |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
51 } |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
52 if (warning) { |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
53 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
|
54 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
|
55 this.plainTitle); |
548
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
56 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
|
57 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
|
58 Ext.create('Ext.tip.ToolTip', { |
720
c2a6f7caa71b
Fix for ErrorMessages in FieldSets for IE8 IE9
Dustin Demuth <dustin@intevation.de>
parents:
717
diff
changeset
|
59 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
|
60 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
|
61 }); |
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
|
62 } |
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 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
|
64 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
|
65 } |
548
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
66 } |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
67 return; |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
68 } |
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 |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
71 clearMessages: function() { |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
72 if (this.plainTitle !== '') { |
720
c2a6f7caa71b
Fix for ErrorMessages in FieldSets for IE8 IE9
Dustin Demuth <dustin@intevation.de>
parents:
717
diff
changeset
|
73 this.setTitle(this.plainTitle); |
548
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
74 this.getEl().dom.style['border-color'] = this.origColor; |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
75 } |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
76 } |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
77 }); |