raimund@548: /* Copyright (C) 2013 by Bundesamt fuer Strahlenschutz
raimund@548: * Software engineering by Intevation GmbH
raimund@548: *
raimund@548: * This file is Free Software under the GNU GPL (v>=3)
raimund@548: * and comes with ABSOLUTELY NO WARRANTY! Check out
raimund@548: * the documentation coming with IMIS-Labordaten-Application for details.
raimund@548: */
raimund@548:
raimund@548: Ext.define('Lada.view.widget.base.FieldSet', {
raimund@548: extend: 'Ext.form.FieldSet',
raimund@548: alias: 'widget.fset',
raimund@548:
raimund@548: plainTitle: '',
raimund@548: origColor: '',
raimund@633: errorText: '',
raimund@633: warningText: '',
raimund@548:
raimund@548: showWarningOrError: function(warning, warningText, error, errorText) {
raimund@548: var ndx = 0;
raimund@548: if (this.collapsible === true) {
raimund@548: ndx = 1;
raimund@548: }
raimund@633: if (this.errorText && this.errorText !== '') {
raimund@633: this.errorText += '\n';
raimund@633: }
raimund@633: this.errorText += errorText;
raimund@633: if (this.warningText && this.warningText !== '') {
raimund@633: this.warningText += '\n';
raimund@633: }
raimund@633: this.warningText += warningText;
raimund@548: this.plainTitle = this.getEl().dom.firstChild
raimund@548: .firstChild.firstChild
raimund@548: .children[ndx].innerHTML;
raimund@548: this.origColor = this.getEl().dom.style['border-color'];
raimund@548: if (error) {
raimund@548: this.getEl().dom.style['border-color'] = '#FF0000';
raimund@548: this.getEl().dom.firstChild.firstChild.firstChild
raimund@548: .children[ndx].innerHTML =
raimund@632: ' ' +
raimund@548: this.plainTitle;
raimund@548: if (errorText) {
raimund@548: Ext.create('Ext.tip.ToolTip', {
raimund@548: target: this.getEl().dom.firstChild.firstChild.firstChild.children[ndx],
raimund@548: html: errorText
raimund@548: });
raimund@548: }
raimund@548: return;
raimund@548: }
raimund@548: if (warning) {
raimund@548: this.getEl().dom.style['border-color'] = '#FFE25D';
raimund@548: this.getEl().dom.firstChild.firstChild.firstChild
raimund@548: .children[ndx].innerHTML =
raimund@632: ' ' +
raimund@548: this.plainTitle;
raimund@548: if (warningText) {
raimund@548: Ext.create('Ext.tip.ToolTip', {
raimund@548: target: this.getEl().dom.firstChild.firstChild.firstChild.children[ndx],
raimund@548: html: warningText
raimund@548: });
raimund@548: }
raimund@548: return;
raimund@548: }
raimund@548: },
raimund@548:
raimund@548: clearMessages: function() {
raimund@548: var ndx = 0;
raimund@548: if (this.collapsible === true) {
raimund@548: ndx = 1;
raimund@548: }
raimund@548: if (this.plainTitle !== '') {
raimund@548: this.getEl().dom.firstChild
raimund@548: .firstChild.firstChild
raimund@548: .children[ndx].innerHTML = this.plainTitle;
raimund@548: this.getEl().dom.style['border-color'] = this.origColor;
raimund@548: }
raimund@548: }
raimund@548: });