Commit 6369c32b authored by Julia Radzhabova's avatar Julia Radzhabova

Bug 32194.

parent 20ef76ed
......@@ -76,6 +76,7 @@ define([
this.handler = _options.handler;
this.toggleGroup = _options.toggleGroup;
this.contentWidth = _options.contentWidth;
this.storageName = _options.storageName;
Common.UI.Window.prototype.initialize.call(this, _options);
},
......@@ -143,6 +144,37 @@ define([
return false;
},
setActiveCategory: function(index) {
if (this.btnsCategory.length<1) return;
var btnActive = this.btnsCategory[(index>=0 && index<this.btnsCategory.length) ? index : 0];
if (!btnActive.isVisible() || btnActive.isDisabled()) {
for (var i = 0; i<this.btnsCategory.length; i++){
var btn = this.btnsCategory[i];
if (btn.isVisible() && !btn.isDisabled()) {
btnActive = btn;
break;
}
}
}
btnActive.toggle(true);
this.onCategoryClick(btnActive);
},
getActiveCategory: function() {
var index = -1;
this.btnsCategory.forEach(function(btn, idx){
if (btn.pressed) index = idx;
});
return index;
},
close: function(suppressevent) {
if (this.storageName)
Common.localStorage.setItem(this.storageName, this.getActiveCategory());
Common.UI.Window.prototype.close.call(this, suppressevent);
},
cancelButtonText: 'Cancel',
okButtonText : 'Ok'
}, Common.Views.AdvancedSettingsWindow || {}));
......
......@@ -61,7 +61,8 @@ define([
options: {
contentWidth: 320,
height : 380,
toggleGroup : 'dropcap-adv-settings-group'
toggleGroup : 'dropcap-adv-settings-group',
storageName: 'de-dropcap-settings-adv-category'
},
initialize : function(options) {
......@@ -742,26 +743,13 @@ define([
this._UpdateTableBordersStyle(ct, border, size, color, this.Borders);
}, this);
var btnCategoryFrame, btnCategoryDropcap;
_.each(this.btnsCategory, function(btn) {
if (btn.options.contentTarget == 'id-adv-dropcap-frame')
btnCategoryFrame = btn;
else if(btn.options.contentTarget == 'id-adv-dropcap-dropcap')
btnCategoryDropcap = btn;
});
this.content_panels.filter('.active').removeClass('active');
if (!this.isFrame) {
btnCategoryFrame.hide();
btnCategoryDropcap.toggle(true, true);
$("#" + btnCategoryDropcap.options.contentTarget).addClass('active');
} else {
btnCategoryDropcap.hide();
btnCategoryFrame.toggle(true, true);
$("#" + btnCategoryFrame.options.contentTarget).addClass('active');
if (this.isFrame)
this.setHeight(500);
this.btnsCategory[(this.isFrame) ? 1 : 0].setVisible(false);
if (this.storageName) {
var value = Common.localStorage.getItem(this.storageName);
this.setActiveCategory((value!==null) ? parseInt(value) : 0);
}
},
......
......@@ -54,7 +54,8 @@ define([ 'text!documenteditor/main/app/template/ImageSettingsAdvanced.templat
toggleGroup: 'image-adv-settings-group',
sizeOriginal: {width: 0, height: 0},
sizeMax: {width: 55.88, height: 55.88},
properties: null
properties: null,
storageName: 'de-img-settings-adv-category'
},
initialize : function(options) {
......@@ -1067,25 +1068,10 @@ define([ 'text!documenteditor/main/app/template/ImageSettingsAdvanced.templat
afterRender: function() {
this.updateMetricUnit();
this._setDefaults(this._originalProps);
var btnCategoryShapeSize, btnCategoryImageSize;
_.each(this.btnsCategory, function(btn) {
if (btn.options.contentTarget == 'id-adv-image-width')
btnCategoryImageSize = btn;
else if(btn.options.contentTarget == 'id-adv-shape-size')
btnCategoryShapeSize = btn;
});
this.content_panels.filter('.active').removeClass('active');
if (this._objectType == Asc.c_oAscTypeSelectElement.Shape) {
btnCategoryImageSize.hide();
btnCategoryShapeSize.toggle(true, true);
$("#" + btnCategoryShapeSize.options.contentTarget).addClass('active');
} else {
btnCategoryShapeSize.hide();
btnCategoryImageSize.toggle(true, true);
$("#" + btnCategoryImageSize.options.contentTarget).addClass('active');
this.btnsCategory[(this._objectType == Asc.c_oAscTypeSelectElement.Shape) ? 0 : 1].setVisible(false);
if (this.storageName) {
var value = Common.localStorage.getItem(this.storageName);
this.setActiveCategory((value!==null) ? parseInt(value) : 0);
}
},
......
......@@ -54,7 +54,8 @@ define([ 'text!documenteditor/main/app/template/ParagraphSettingsAdvanced.tem
options: {
contentWidth: 325,
height: 394,
toggleGroup: 'paragraph-adv-settings-group'
toggleGroup: 'paragraph-adv-settings-group',
storageName: 'de-para-settings-adv-category'
},
initialize : function(options) {
......@@ -768,6 +769,11 @@ define([ 'text!documenteditor/main/app/template/ParagraphSettingsAdvanced.tem
}
this._UpdateTableBordersStyle(ct, border, size, color, this.Borders);
}, this);
if (this.storageName) {
var value = Common.localStorage.getItem(this.storageName);
this.setActiveCategory((value!==null) ? parseInt(value) : 0);
}
},
onStrikeChange: function(field, newValue, oldValue, eOpts){
......
......@@ -55,7 +55,8 @@ define([ 'text!documenteditor/main/app/template/TableSettingsAdvanced.templat
options: {
contentWidth: 340,
height: 436,
toggleGroup: 'table-adv-settings-group'
toggleGroup: 'table-adv-settings-group',
storageName: 'de-table-settings-adv-category'
},
initialize : function(options) {
......@@ -1133,6 +1134,11 @@ define([ 'text!documenteditor/main/app/template/TableSettingsAdvanced.templat
}
this._UpdateTableBordersStyle(ct, border, size, color, (this._allTable) ? this.TableBorders : this.CellBorders, (this._allTable) ? this.ChangedTableBorders : this.ChangedCellBorders);
}, this);
if (this.storageName) {
var value = Common.localStorage.getItem(this.storageName);
this.setActiveCategory((value!==null) ? parseInt(value) : 0);
}
},
getSettings: function() {
......
......@@ -50,7 +50,8 @@ define([ 'text!presentationeditor/main/app/template/ImageSettingsAdvanced.tem
contentWidth: 340,
height: 235,
sizeOriginal: {width: 0, height: 0},
sizeMax: {width: 55.88, height: 55.88}
sizeMax: {width: 55.88, height: 55.88},
storageName: 'pe-img-settings-adv-category'
},
initialize : function(options) {
......@@ -183,6 +184,10 @@ define([ 'text!presentationeditor/main/app/template/ImageSettingsAdvanced.tem
afterRender: function() {
this.updateMetricUnit();
this._setDefaults(this._originalProps);
if (this.storageName) {
var value = Common.localStorage.getItem(this.storageName);
this.setActiveCategory((value!==null) ? parseInt(value) : 0);
}
},
_setDefaults: function(props) {
......
......@@ -51,7 +51,8 @@ define([ 'text!presentationeditor/main/app/template/ParagraphSettingsAdvanced
options: {
contentWidth: 320,
height: 394,
toggleGroup: 'paragraph-adv-settings-group'
toggleGroup: 'paragraph-adv-settings-group',
storageName: 'pe-para-settings-adv-category'
},
initialize : function(options) {
......@@ -370,6 +371,10 @@ define([ 'text!presentationeditor/main/app/template/ParagraphSettingsAdvanced
afterRender: function() {
this.updateMetricUnit();
this._setDefaults(this._originalProps);
if (this.storageName) {
var value = Common.localStorage.getItem(this.storageName);
this.setActiveCategory((value!==null) ? parseInt(value) : 0);
}
},
onStrikeChange: function(field, newValue, oldValue, eOpts){
......
......@@ -52,7 +52,8 @@ define([ 'text!presentationeditor/main/app/template/ShapeSettingsAdvanced.tem
toggleGroup: 'shape-adv-settings-group',
sizeOriginal: {width: 0, height: 0},
sizeMax: {width: 55.88, height: 55.88},
properties: null
properties: null,
storageName: 'pe-shape-settings-adv-category'
},
initialize : function(options) {
......@@ -412,6 +413,10 @@ define([ 'text!presentationeditor/main/app/template/ShapeSettingsAdvanced.tem
afterRender: function() {
this.updateMetricUnit();
this._setDefaults(this._originalProps);
if (this.storageName) {
var value = Common.localStorage.getItem(this.storageName);
this.setActiveCategory((value!==null) ? parseInt(value) : 0);
}
},
_setDefaults: function(props) {
......
......@@ -48,7 +48,8 @@ define([ 'text!presentationeditor/main/app/template/TableSettingsAdvanced.tem
options: {
alias: 'TableSettingsAdvanced',
contentWidth: 280,
height: 385
height: 385,
storageName: 'pe-table-settings-adv-category'
},
initialize : function(options) {
......@@ -304,6 +305,10 @@ define([ 'text!presentationeditor/main/app/template/TableSettingsAdvanced.tem
afterRender: function() {
this.updateMetricUnit();
this._setDefaults(this._originalProps);
if (this.storageName) {
var value = Common.localStorage.getItem(this.storageName);
this.setActiveCategory((value!==null) ? parseInt(value) : 0);
}
},
getSettings: function() {
......
......@@ -50,7 +50,8 @@ define([ 'text!spreadsheeteditor/main/app/template/ChartSettingsDlg.template'
options: {
contentWidth: 322,
height: 535,
toggleGroup: 'chart-settings-dlg-group'
toggleGroup: 'chart-settings-dlg-group',
storageName: 'sse-chart-settings-adv-category'
},
initialize : function(options) {
......@@ -806,6 +807,10 @@ define([ 'text!spreadsheeteditor/main/app/template/ChartSettingsDlg.template'
this.updateChartStyles(this.api.asc_getChartPreviews(this._state.ChartType));
this._setDefaults(this.chartSettings);
if (this.storageName) {
var value = Common.localStorage.getItem(this.storageName);
this.setActiveCategory((value!==null) ? parseInt(value) : 0);
}
},
onSelectType: function(btn, picker, itemView, record) {
......@@ -1148,8 +1153,7 @@ define([ 'text!spreadsheeteditor/main/app/template/ChartSettingsDlg.template'
} else
this.txtDataRange.showError([this.txtEmpty]);
this.btnsCategory[0].toggle(true);
this.onCategoryClick(this.btnsCategory[0]);
this.setActiveCategory(0);
if (isvalid == Asc.c_oAscError.ID.StockChartError) {
Common.UI.warning({msg: this.errorStockChart});
} else if (isvalid == Asc.c_oAscError.ID.MaxDataSeriesError) {
......
......@@ -51,7 +51,8 @@ define([ 'text!spreadsheeteditor/main/app/template/ParagraphSettingsAdvanced.
options: {
contentWidth: 320,
height: 394,
toggleGroup: 'paragraph-adv-settings-group'
toggleGroup: 'paragraph-adv-settings-group',
storageName: 'sse-para-settings-adv-category'
},
initialize : function(options) {
......@@ -369,6 +370,10 @@ define([ 'text!spreadsheeteditor/main/app/template/ParagraphSettingsAdvanced.
afterRender: function() {
this.updateMetricUnit();
this._setDefaults(this._originalProps);
if (this.storageName) {
var value = Common.localStorage.getItem(this.storageName);
this.setActiveCategory((value!==null) ? parseInt(value) : 0);
}
},
onStrikeChange: function(field, newValue, oldValue, eOpts){
......
......@@ -52,7 +52,8 @@ define([ 'text!spreadsheeteditor/main/app/template/ShapeSettingsAdvanced.temp
toggleGroup: 'shape-adv-settings-group',
sizeOriginal: {width: 0, height: 0},
sizeMax: {width: 55.88, height: 55.88},
properties: null
properties: null,
storageName: 'sse-shape-settings-adv-category'
},
initialize : function(options) {
......@@ -436,6 +437,10 @@ define([ 'text!spreadsheeteditor/main/app/template/ShapeSettingsAdvanced.temp
afterRender: function() {
this.updateMetricUnit();
this._setDefaults(this._originalProps);
if (this.storageName) {
var value = Common.localStorage.getItem(this.storageName);
this.setActiveCategory((value!==null) ? parseInt(value) : 0);
}
},
_setDefaults: function(props) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment