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: '',
dustin@717: tooltip: null,
raimund@548:
raimund@548: showWarningOrError: function(warning, warningText, error, errorText) {
dustin@717: this.clearMessages(); //Clear Errors and Warning first
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;
dustin@720: this.plainTitle = this.title;
raimund@548: this.origColor = this.getEl().dom.style['border-color'];
dustin@720: var imgId = Ext.id();
raimund@548: if (error) {
raimund@548: this.getEl().dom.style['border-color'] = '#FF0000';
dustin@720: this.setTitle(' '+
dustin@720: this.plainTitle);
raimund@548: if (errorText) {
dustin@717: if (!this.tooltip) {
dustin@717: Ext.create('Ext.tip.ToolTip', {
dustin@720: target: imgId,
dustin@717: html: errorText
dustin@717: });
dustin@717: }
dustin@717: else {
dustin@717: tooltip.html = errorText;
dustin@717: }
raimund@548: }
raimund@548: return;
raimund@548: }
raimund@548: if (warning) {
raimund@548: this.getEl().dom.style['border-color'] = '#FFE25D';
dustin@720: this.setTitle(' '+
dustin@720: this.plainTitle);
raimund@548: if (warningText) {
dustin@717: if (!this.tooltip) {
dustin@717: Ext.create('Ext.tip.ToolTip', {
dustin@720: target: Ext.get(imgId),
dustin@717: html: warningText
dustin@717: });
dustin@717: }
dustin@717: else {
dustin@717: tooltip.html = warningText;
dustin@717: }
raimund@548: }
raimund@548: return;
raimund@548: }
raimund@548: },
raimund@548:
raimund@548: clearMessages: function() {
raimund@548: if (this.plainTitle !== '') {
dustin@720: this.setTitle(this.plainTitle);
raimund@548: this.getEl().dom.style['border-color'] = this.origColor;
raimund@548: }
raimund@548: }
raimund@548: });