annotate app/view/widget/base/FieldSet.js @ 633:1e1534482bfd

Allow multiple warning- or error-messages in a fieldset.
author Raimund Renkert <raimund.renkert@intevation.de>
date Mon, 16 Mar 2015 17:23:27 +0100
parents fead63bb5fb4
children f124d24c8ade
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
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
9 Ext.define('Lada.view.widget.base.FieldSet', {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
10 extend: 'Ext.form.FieldSet',
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
11 alias: 'widget.fset',
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
12
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
13 plainTitle: '',
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
14 origColor: '',
633
1e1534482bfd Allow multiple warning- or error-messages in a fieldset.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 632
diff changeset
15 errorText: '',
1e1534482bfd Allow multiple warning- or error-messages in a fieldset.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 632
diff changeset
16 warningText: '',
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
17
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
18 showWarningOrError: function(warning, warningText, error, errorText) {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
19 var ndx = 0;
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
20 if (this.collapsible === true) {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
21 ndx = 1;
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
22 }
633
1e1534482bfd Allow multiple warning- or error-messages in a fieldset.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 632
diff changeset
23 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
24 this.errorText += '\n';
1e1534482bfd Allow multiple warning- or error-messages in a fieldset.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 632
diff changeset
25 }
1e1534482bfd Allow multiple warning- or error-messages in a fieldset.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 632
diff changeset
26 this.errorText += errorText;
1e1534482bfd Allow multiple warning- or error-messages in a fieldset.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 632
diff changeset
27 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
28 this.warningText += '\n';
1e1534482bfd Allow multiple warning- or error-messages in a fieldset.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 632
diff changeset
29 }
1e1534482bfd Allow multiple warning- or error-messages in a fieldset.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 632
diff changeset
30 this.warningText += warningText;
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
31 this.plainTitle = this.getEl().dom.firstChild
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
32 .firstChild.firstChild
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
33 .children[ndx].innerHTML;
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
34 this.origColor = this.getEl().dom.style['border-color'];
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';
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
37 this.getEl().dom.firstChild.firstChild.firstChild
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
38 .children[ndx].innerHTML =
632
fead63bb5fb4 Updated images for errors and warnings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 548
diff changeset
39 '<img src="resources/img/emblem-important.png" width="13" height="13" /> ' +
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
40 this.plainTitle;
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
41 if (errorText) {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
42 Ext.create('Ext.tip.ToolTip', {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
43 target: this.getEl().dom.firstChild.firstChild.firstChild.children[ndx],
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
44 html: errorText
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
45 });
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
46 }
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
47 return;
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
48 }
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
49 if (warning) {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
50 this.getEl().dom.style['border-color'] = '#FFE25D';
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
51 this.getEl().dom.firstChild.firstChild.firstChild
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
52 .children[ndx].innerHTML =
632
fead63bb5fb4 Updated images for errors and warnings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 548
diff changeset
53 '<img src="resources/img/dialog-warning.png" width="13" height="13" /> ' +
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
54 this.plainTitle;
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
55 if (warningText) {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
56 Ext.create('Ext.tip.ToolTip', {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
57 target: this.getEl().dom.firstChild.firstChild.firstChild.children[ndx],
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
58 html: warningText
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
59 });
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
60 }
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
61 return;
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
62 }
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
63 },
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
64
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
65 clearMessages: function() {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
66 var ndx = 0;
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
67 if (this.collapsible === true) {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
68 ndx = 1;
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 if (this.plainTitle !== '') {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
71 this.getEl().dom.firstChild
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
72 .firstChild.firstChild
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
73 .children[ndx].innerHTML = this.plainTitle;
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 });

http://lada.wald.intevation.org