[SSE] Show errors when set combo chart type
This commit is contained in:
parent
5794800988
commit
ca01b519f9
|
@ -204,6 +204,8 @@ define([
|
||||||
Common.NotificationCenter.on('goback', _.bind(this.goBack, this));
|
Common.NotificationCenter.on('goback', _.bind(this.goBack, this));
|
||||||
Common.NotificationCenter.on('download:advanced', _.bind(this.onAdvancedOptions, this));
|
Common.NotificationCenter.on('download:advanced', _.bind(this.onAdvancedOptions, this));
|
||||||
Common.NotificationCenter.on('showmessage', _.bind(this.onExternalMessage, this));
|
Common.NotificationCenter.on('showmessage', _.bind(this.onExternalMessage, this));
|
||||||
|
Common.NotificationCenter.on('showerror', _.bind(this.onError, this));
|
||||||
|
|
||||||
|
|
||||||
this.isShowOpenDialog = false;
|
this.isShowOpenDialog = false;
|
||||||
|
|
||||||
|
@ -1601,6 +1603,10 @@ define([
|
||||||
config.msg = this.errorCompare;
|
config.msg = this.errorCompare;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case Asc.c_oAscError.ID.ComboSeriesError:
|
||||||
|
config.msg = this.errorComboSeries;
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
config.msg = (typeof id == 'string') ? id : this.errorDefaultMessage.replace('%1', id);
|
config.msg = (typeof id == 'string') ? id : this.errorDefaultMessage.replace('%1', id);
|
||||||
break;
|
break;
|
||||||
|
@ -2712,7 +2718,8 @@ define([
|
||||||
textRemember: 'Remember my choice',
|
textRemember: 'Remember my choice',
|
||||||
warnLicenseLimitedRenewed: 'License needs to be renewed.<br>You have a limited access to document editing functionality.<br>Please contact your administrator to get full access',
|
warnLicenseLimitedRenewed: 'License needs to be renewed.<br>You have a limited access to document editing functionality.<br>Please contact your administrator to get full access',
|
||||||
warnLicenseLimitedNoAccess: 'License expired.<br>You have no access to document editing functionality.<br>Please contact your administrator.',
|
warnLicenseLimitedNoAccess: 'License expired.<br>You have no access to document editing functionality.<br>Please contact your administrator.',
|
||||||
saveErrorTextDesktop: 'This file cannot be saved or created.<br>Possible reasons are: <br>1. The file is read-only. <br>2. The file is being edited by other users. <br>3. The disk is full or corrupted.'
|
saveErrorTextDesktop: 'This file cannot be saved or created.<br>Possible reasons are: <br>1. The file is read-only. <br>2. The file is being edited by other users. <br>3. The disk is full or corrupted.',
|
||||||
|
errorComboSeries: 'To create a combination chart, select at least two series of data.'
|
||||||
}
|
}
|
||||||
})(), DE.Controllers.Main || {}))
|
})(), DE.Controllers.Main || {}))
|
||||||
});
|
});
|
|
@ -2050,11 +2050,12 @@ define([
|
||||||
}
|
}
|
||||||
|
|
||||||
if (chart) {
|
if (chart) {
|
||||||
var props = new Asc.asc_CImgProperty();
|
var isCombo = (type==Asc.c_oAscChartTypeSettings.comboBarLine || type==Asc.c_oAscChartTypeSettings.comboBarLineSecondary ||
|
||||||
chart.changeType(type);
|
type==Asc.c_oAscChartTypeSettings.comboAreaBar || type==Asc.c_oAscChartTypeSettings.comboCustom);
|
||||||
props.put_ChartProperties(chart);
|
if (isCombo && chart.getSeries().length<2) {
|
||||||
this.api.ImgApply(props);
|
Common.NotificationCenter.trigger('showerror', Asc.c_oAscError.ID.ComboSeriesError, Asc.c_oAscError.Level.NoCritical);
|
||||||
|
} else
|
||||||
|
chart.changeType(type);
|
||||||
Common.NotificationCenter.trigger('edit:complete', this.toolbar);
|
Common.NotificationCenter.trigger('edit:complete', this.toolbar);
|
||||||
} else {
|
} else {
|
||||||
if (!this.diagramEditor)
|
if (!this.diagramEditor)
|
||||||
|
|
|
@ -386,14 +386,17 @@ define([
|
||||||
rawData = record;
|
rawData = record;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.btnChartType.setIconCls('svgicon ' + 'chart-' + rawData.iconCls);
|
|
||||||
this._state.ChartType = -1;
|
|
||||||
|
|
||||||
if (this.api && !this._noApply && this.chartProps) {
|
if (this.api && !this._noApply && this.chartProps) {
|
||||||
var props = new Asc.asc_CImgProperty();
|
var isCombo = (rawData.type==Asc.c_oAscChartTypeSettings.comboBarLine || rawData.type==Asc.c_oAscChartTypeSettings.comboBarLineSecondary ||
|
||||||
this.chartProps.changeType(rawData.type);
|
rawData.type==Asc.c_oAscChartTypeSettings.comboAreaBar || rawData.type==Asc.c_oAscChartTypeSettings.comboCustom);
|
||||||
props.put_ChartProperties(this.chartProps);
|
if (isCombo && this.chartProps.getSeries().length<2) {
|
||||||
this.api.ImgApply(props);
|
Common.NotificationCenter.trigger('showerror', Asc.c_oAscError.ID.ComboSeriesError, Asc.c_oAscError.Level.NoCritical);
|
||||||
|
this.mnuChartTypePicker.selectRecord(this.mnuChartTypePicker.store.findWhere({type: this.chartProps.getType()}), true);
|
||||||
|
} else {
|
||||||
|
this.btnChartType.setIconCls('svgicon ' + 'chart-' + rawData.iconCls);
|
||||||
|
this._state.ChartType = -1;
|
||||||
|
this.chartProps.changeType(rawData.type);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
this.fireEvent('editcomplete', this);
|
this.fireEvent('editcomplete', this);
|
||||||
},
|
},
|
||||||
|
|
|
@ -184,6 +184,7 @@ define([
|
||||||
Common.NotificationCenter.on('api:disconnect', _.bind(this.onCoAuthoringDisconnect, this));
|
Common.NotificationCenter.on('api:disconnect', _.bind(this.onCoAuthoringDisconnect, this));
|
||||||
Common.NotificationCenter.on('goback', _.bind(this.goBack, this));
|
Common.NotificationCenter.on('goback', _.bind(this.goBack, this));
|
||||||
Common.NotificationCenter.on('showmessage', _.bind(this.onExternalMessage, this));
|
Common.NotificationCenter.on('showmessage', _.bind(this.onExternalMessage, this));
|
||||||
|
Common.NotificationCenter.on('showerror', _.bind(this.onError, this));
|
||||||
|
|
||||||
this.isShowOpenDialog = false;
|
this.isShowOpenDialog = false;
|
||||||
|
|
||||||
|
@ -1273,6 +1274,10 @@ define([
|
||||||
config.maxwidth = 600;
|
config.maxwidth = 600;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case Asc.c_oAscError.ID.ComboSeriesError:
|
||||||
|
config.msg = this.errorComboSeries;
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
config.msg = (typeof id == 'string') ? id : this.errorDefaultMessage.replace('%1', id);
|
config.msg = (typeof id == 'string') ? id : this.errorDefaultMessage.replace('%1', id);
|
||||||
break;
|
break;
|
||||||
|
@ -2355,7 +2360,8 @@ define([
|
||||||
textRemember: 'Remember my choice',
|
textRemember: 'Remember my choice',
|
||||||
warnLicenseLimitedRenewed: 'License needs to be renewed.<br>You have a limited access to document editing functionality.<br>Please contact your administrator to get full access',
|
warnLicenseLimitedRenewed: 'License needs to be renewed.<br>You have a limited access to document editing functionality.<br>Please contact your administrator to get full access',
|
||||||
warnLicenseLimitedNoAccess: 'License expired.<br>You have no access to document editing functionality.<br>Please contact your administrator.',
|
warnLicenseLimitedNoAccess: 'License expired.<br>You have no access to document editing functionality.<br>Please contact your administrator.',
|
||||||
saveErrorTextDesktop: 'This file cannot be saved or created.<br>Possible reasons are: <br>1. The file is read-only. <br>2. The file is being edited by other users. <br>3. The disk is full or corrupted.'
|
saveErrorTextDesktop: 'This file cannot be saved or created.<br>Possible reasons are: <br>1. The file is read-only. <br>2. The file is being edited by other users. <br>3. The disk is full or corrupted.',
|
||||||
|
errorComboSeries: 'To create a combination chart, select at least two series of data.'
|
||||||
}
|
}
|
||||||
})(), PE.Controllers.Main || {}))
|
})(), PE.Controllers.Main || {}))
|
||||||
});
|
});
|
||||||
|
|
|
@ -1687,17 +1687,19 @@ define([
|
||||||
if (selectedElements && _.isArray(selectedElements)) {
|
if (selectedElements && _.isArray(selectedElements)) {
|
||||||
for (var i = 0; i< selectedElements.length; i++) {
|
for (var i = 0; i< selectedElements.length; i++) {
|
||||||
if (Asc.c_oAscTypeSelectElement.Chart == selectedElements[i].get_ObjectType()) {
|
if (Asc.c_oAscTypeSelectElement.Chart == selectedElements[i].get_ObjectType()) {
|
||||||
chart = true;
|
chart = selectedElements[i].get_ObjectValue();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (chart) {
|
if (chart) {
|
||||||
var props = new Asc.CAscChartProp();
|
var isCombo = (type==Asc.c_oAscChartTypeSettings.comboBarLine || type==Asc.c_oAscChartTypeSettings.comboBarLineSecondary ||
|
||||||
props.changeType(type);
|
type==Asc.c_oAscChartTypeSettings.comboAreaBar || type==Asc.c_oAscChartTypeSettings.comboCustom);
|
||||||
this.api.ChartApply(props);
|
if (isCombo && chart.get_ChartProperties() && chart.get_ChartProperties().getSeries().length<2) {
|
||||||
|
Common.NotificationCenter.trigger('showerror', Asc.c_oAscError.ID.ComboSeriesError, Asc.c_oAscError.Level.NoCritical);
|
||||||
|
} else
|
||||||
|
chart.changeType(type);
|
||||||
Common.NotificationCenter.trigger('edit:complete', this.toolbar);
|
Common.NotificationCenter.trigger('edit:complete', this.toolbar);
|
||||||
} else {
|
} else {
|
||||||
if (!this.diagramEditor)
|
if (!this.diagramEditor)
|
||||||
|
|
|
@ -108,8 +108,9 @@ define([
|
||||||
this.disableControls(this._locked);
|
this.disableControls(this._locked);
|
||||||
|
|
||||||
if (props){
|
if (props){
|
||||||
this._originalProps = new Asc.CAscChartProp(props);
|
this._originalProps = props;
|
||||||
this._noApply = true;
|
this._noApply = true;
|
||||||
|
this.chartProps = props.get_ChartProperties();
|
||||||
|
|
||||||
var value = props.get_SeveralCharts() || this._locked;
|
var value = props.get_SeveralCharts() || this._locked;
|
||||||
if (this._state.SeveralCharts!==value) {
|
if (this._state.SeveralCharts!==value) {
|
||||||
|
@ -320,13 +321,18 @@ define([
|
||||||
rawData = record;
|
rawData = record;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.btnChartType.setIconCls('svgicon ' + 'chart-' + rawData.iconCls);
|
|
||||||
this._state.ChartType = -1;
|
|
||||||
|
|
||||||
if (this.api && !this._noApply) {
|
if (this.api && !this._noApply) {
|
||||||
var props = new Asc.CAscChartProp();
|
var isCombo = (rawData.type==Asc.c_oAscChartTypeSettings.comboBarLine || rawData.type==Asc.c_oAscChartTypeSettings.comboBarLineSecondary ||
|
||||||
props.changeType(rawData.type);
|
rawData.type==Asc.c_oAscChartTypeSettings.comboAreaBar || rawData.type==Asc.c_oAscChartTypeSettings.comboCustom);
|
||||||
this.api.ChartApply(props);
|
|
||||||
|
if (isCombo && this.chartProps.getSeries().length<2) {
|
||||||
|
Common.NotificationCenter.trigger('showerror', Asc.c_oAscError.ID.ComboSeriesError, Asc.c_oAscError.Level.NoCritical);
|
||||||
|
this.mnuChartTypePicker.selectRecord(this.mnuChartTypePicker.store.findWhere({type: this._originalProps.getType()}), true);
|
||||||
|
} else {
|
||||||
|
this.btnChartType.setIconCls('svgicon ' + 'chart-' + rawData.iconCls);
|
||||||
|
this._state.ChartType = -1;
|
||||||
|
this._originalProps.changeType(rawData.type);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
this.fireEvent('editcomplete', this);
|
this.fireEvent('editcomplete', this);
|
||||||
},
|
},
|
||||||
|
|
|
@ -1028,8 +1028,20 @@ define([
|
||||||
if (isvalid == Asc.c_oAscError.ID.No) {
|
if (isvalid == Asc.c_oAscError.ID.No) {
|
||||||
(ischartedit) ? me.api.asc_editChartDrawingObject(props) : me.api.asc_addChartDrawingObject(props);
|
(ischartedit) ? me.api.asc_editChartDrawingObject(props) : me.api.asc_addChartDrawingObject(props);
|
||||||
} else {
|
} else {
|
||||||
|
var msg = me.txtInvalidRange;
|
||||||
|
switch (isvalid) {
|
||||||
|
case isvalid == Asc.c_oAscError.ID.StockChartError:
|
||||||
|
msg = me.errorStockChart;
|
||||||
|
break;
|
||||||
|
case isvalid == Asc.c_oAscError.ID.MaxDataSeriesError:
|
||||||
|
msg = me.errorMaxRows;
|
||||||
|
break;
|
||||||
|
case isvalid == Asc.c_oAscError.ID.ComboSeriesError:
|
||||||
|
msg = me.errorComboSeries;
|
||||||
|
break;
|
||||||
|
}
|
||||||
Common.UI.warning({
|
Common.UI.warning({
|
||||||
msg: (isvalid == Asc.c_oAscError.ID.StockChartError) ? me.errorStockChart : ((isvalid == Asc.c_oAscError.ID.MaxDataSeriesError) ? me.errorMaxRows : me.txtInvalidRange),
|
msg: msg,
|
||||||
callback: function() {
|
callback: function() {
|
||||||
_.defer(function(btn) {
|
_.defer(function(btn) {
|
||||||
Common.NotificationCenter.trigger('edit:complete', me.toolbar);
|
Common.NotificationCenter.trigger('edit:complete', me.toolbar);
|
||||||
|
@ -4012,7 +4024,8 @@ define([
|
||||||
txtTable_TableStyleLight: 'Table Style Light',
|
txtTable_TableStyleLight: 'Table Style Light',
|
||||||
textInsert: 'Insert',
|
textInsert: 'Insert',
|
||||||
txtInsertCells: 'Insert Cells',
|
txtInsertCells: 'Insert Cells',
|
||||||
txtDeleteCells: 'Delete Cells'
|
txtDeleteCells: 'Delete Cells',
|
||||||
|
errorComboSeries: 'To create a combination chart, select at least two series of data.'
|
||||||
|
|
||||||
}, SSE.Controllers.Toolbar || {}));
|
}, SSE.Controllers.Toolbar || {}));
|
||||||
});
|
});
|
|
@ -278,15 +278,21 @@ define([
|
||||||
} else {
|
} else {
|
||||||
rawData = record;
|
rawData = record;
|
||||||
}
|
}
|
||||||
|
var isCombo = rawData.type==Asc.c_oAscChartTypeSettings.comboBarLine || rawData.type==Asc.c_oAscChartTypeSettings.comboBarLineSecondary ||
|
||||||
|
rawData.type==Asc.c_oAscChartTypeSettings.comboAreaBar || rawData.type==Asc.c_oAscChartTypeSettings.comboCustom,
|
||||||
|
series = isCombo ? this.chartSettings.getSeries() : [];
|
||||||
|
if (isCombo && series.length<2) {
|
||||||
|
Common.UI.warning({msg: this.errorComboSeries, maxwidth: 600});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
this.btnChartType.setIconCls('svgicon ' + 'chart-' + rawData.iconCls);
|
this.btnChartType.setIconCls('svgicon ' + 'chart-' + rawData.iconCls);
|
||||||
this.currentChartType = rawData.type;
|
this.currentChartType = rawData.type;
|
||||||
this.chartSettings.changeType(this.currentChartType);
|
this.chartSettings.changeType(this.currentChartType);
|
||||||
this.ShowHideSettings(this.currentChartType);
|
this.ShowHideSettings(this.currentChartType);
|
||||||
if (this.currentChartType==Asc.c_oAscChartTypeSettings.comboBarLine || this.currentChartType==Asc.c_oAscChartTypeSettings.comboBarLineSecondary ||
|
if (isCombo)
|
||||||
this.currentChartType==Asc.c_oAscChartTypeSettings.comboAreaBar || this.currentChartType==Asc.c_oAscChartTypeSettings.comboCustom) {
|
this.updateSeriesList(series);
|
||||||
this.updateSeriesList(this.chartSettings.getSeries());
|
else
|
||||||
} else
|
|
||||||
this.updateChartStyles(this.api.asc_getChartPreviews(this.currentChartType));
|
this.updateChartStyles(this.api.asc_getChartPreviews(this.currentChartType));
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -437,7 +443,8 @@ define([
|
||||||
textStyle: 'Style',
|
textStyle: 'Style',
|
||||||
textSeries: 'Series',
|
textSeries: 'Series',
|
||||||
textSecondary: 'Secondary Axis',
|
textSecondary: 'Secondary Axis',
|
||||||
errorSecondaryAxis: 'The selected chart type requires the secondary axis that an existing chart is using. Select another chart type.'
|
errorSecondaryAxis: 'The selected chart type requires the secondary axis that an existing chart is using. Select another chart type.',
|
||||||
|
errorComboSeries: 'To create a combination chart, select at least two series of data.'
|
||||||
|
|
||||||
}, SSE.Views.ChartTypeDialog || {}))
|
}, SSE.Views.ChartTypeDialog || {}))
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue