Commit 7bf15f88 authored by Julia Radzhabova's avatar Julia Radzhabova

В конфиг редакторов добавлен параметр location: передается двухбуквенный код...

В конфиг редакторов добавлен параметр location: передается двухбуквенный код страны, по которому определяется метрика по-умолчанию (us, ca - дюймы).
parent 386a14c2
......@@ -46,6 +46,7 @@
editorConfig: {
mode: 'view or edit',
lang: <language code>,
location: <location>,
canCoAuthoring: <can coauthoring documents>,
canAutosave: <can autosave documents>,
canBackToFolder: <can return to folder> - deprecated. use "customization.goback" parameter,
......
......@@ -259,6 +259,7 @@ Common.Utils.Metric = new(function() {
};
me.currentMetric = me.c_MetricUnits.pt;
me.metricName = ['cm', 'pt', '\"'];
me.defaultMetric = me.c_MetricUnits.cm;
return {
c_MetricUnits: me.c_MetricUnits,
......@@ -272,6 +273,14 @@ Common.Utils.Metric = new(function() {
return me.currentMetric;
},
setDefaultMetric: function(value) {
me.defaultMetric = value;
},
getDefaultMetric: function() {
return me.defaultMetric;
},
fnRecalcToMM: function(value) {
// value in pt/cm/inch. need to convert to mm
if (value!==null && value!==undefined) {
......
......@@ -235,6 +235,7 @@ define([
this.appOptions.recent = this.editorConfig.recent;
this.appOptions.createUrl = this.editorConfig.createUrl;
this.appOptions.lang = this.editorConfig.lang;
this.appOptions.location = (typeof (this.editorConfig.location) == 'string') ? this.editorConfig.location.toLowerCase() : '';
this.appOptions.sharingSettingsUrl = this.editorConfig.sharingSettingsUrl;
this.appOptions.fileChoiceUrl = this.editorConfig.fileChoiceUrl;
this.appOptions.mergeFolderUrl = this.editorConfig.mergeFolderUrl;
......@@ -251,6 +252,9 @@ define([
if (this.editorConfig.lang)
this.api.asc_setLocale(this.editorConfig.lang);
if (this.appOptions.location == 'us' || this.appOptions.location == 'ca')
Common.Utils.Metric.setDefaultMetric(Common.Utils.Metric.c_MetricUnits.inch);
},
loadDocument: function(data) {
......@@ -1048,7 +1052,7 @@ define([
}
var value = Common.localStorage.getItem('de-settings-unit');
value = (value!==null) ? parseInt(value) : Common.Utils.Metric.c_MetricUnits.cm;
value = (value!==null) ? parseInt(value) : Common.Utils.Metric.getDefaultMetric();
Common.Utils.Metric.setCurrentMetric(value);
me.api.asc_SetDocumentUnits((value==Common.Utils.Metric.c_MetricUnits.inch) ? Asc.c_oAscDocumentUnits.Inch : ((value==Common.Utils.Metric.c_MetricUnits.pt) ? Asc.c_oAscDocumentUnits.Point : Asc.c_oAscDocumentUnits.Millimeter));
......@@ -1587,7 +1591,7 @@ define([
unitsChanged: function(m) {
var value = Common.localStorage.getItem("de-settings-unit");
value = (value!==null) ? parseInt(value) : Common.Utils.Metric.c_MetricUnits.cm;
value = (value!==null) ? parseInt(value) : Common.Utils.Metric.getDefaultMetric();
Common.Utils.Metric.setCurrentMetric(value);
this.api.asc_SetDocumentUnits((value==Common.Utils.Metric.c_MetricUnits.inch) ? Asc.c_oAscDocumentUnits.Inch : ((value==Common.Utils.Metric.c_MetricUnits.pt) ? Asc.c_oAscDocumentUnits.Point : Asc.c_oAscDocumentUnits.Millimeter));
this.getApplication().getController('RightMenu').updateMetricUnit();
......
......@@ -348,7 +348,7 @@ define([
value = Common.localStorage.getItem("de-settings-unit");
item = this.cmbUnit.store.findWhere({value: parseInt(value)});
this.cmbUnit.setValue(item ? parseInt(item.get('value')) : 0);
this.cmbUnit.setValue(item ? parseInt(item.get('value')) : Common.Utils.Metric.getDefaultMetric());
this._oldUnits = this.cmbUnit.getValue();
value = Common.localStorage.getItem("de-settings-autosave");
......
......@@ -218,6 +218,7 @@ define([
this.appOptions.recent = this.editorConfig.recent;
this.appOptions.createUrl = this.editorConfig.createUrl;
this.appOptions.lang = this.editorConfig.lang;
this.appOptions.location = (typeof (this.editorConfig.location) == 'string') ? this.editorConfig.location.toLowerCase() : '';
this.appOptions.sharingSettingsUrl = this.editorConfig.sharingSettingsUrl;
this.appOptions.canAnalytics = false;
this.appOptions.customization = this.editorConfig.customization;
......@@ -232,6 +233,9 @@ define([
if (this.editorConfig.lang)
this.api.asc_setLocale(this.editorConfig.lang);
if (this.appOptions.location == 'us' || this.appOptions.location == 'ca')
Common.Utils.Metric.setDefaultMetric(Common.Utils.Metric.c_MetricUnits.inch);
},
loadDocument: function(data) {
......@@ -816,7 +820,7 @@ define([
}
var value = Common.localStorage.getItem('pe-settings-unit');
value = (value!==null) ? parseInt(value) : Common.Utils.Metric.c_MetricUnits.cm;
value = (value!==null) ? parseInt(value) : Common.Utils.Metric.getDefaultMetric();
Common.Utils.Metric.setCurrentMetric(value);
me.api.asc_SetDocumentUnits((value==Common.Utils.Metric.c_MetricUnits.inch) ? Asc.c_oAscDocumentUnits.Inch : ((value==Common.Utils.Metric.c_MetricUnits.pt) ? Asc.c_oAscDocumentUnits.Point : Asc.c_oAscDocumentUnits.Millimeter));
......@@ -1258,7 +1262,7 @@ define([
unitsChanged: function(m) {
var value = Common.localStorage.getItem("pe-settings-unit");
value = (value!==null) ? parseInt(value) : Common.Utils.Metric.c_MetricUnits.cm;
value = (value!==null) ? parseInt(value) : Common.Utils.Metric.getDefaultMetric();
Common.Utils.Metric.setCurrentMetric(value);
this.api.asc_SetDocumentUnits((value==Common.Utils.Metric.c_MetricUnits.inch) ? Asc.c_oAscDocumentUnits.Inch : ((value==Common.Utils.Metric.c_MetricUnits.pt) ? Asc.c_oAscDocumentUnits.Point : Asc.c_oAscDocumentUnits.Millimeter));
this.getApplication().getController('RightMenu').updateMetricUnit();
......
......@@ -282,7 +282,7 @@ define([
value = Common.localStorage.getItem("pe-settings-unit");
item = this.cmbUnit.store.findWhere({value: parseInt(value)});
this.cmbUnit.setValue(item ? parseInt(item.get('value')) : 0);
this.cmbUnit.setValue(item ? parseInt(item.get('value')) : Common.Utils.Metric.getDefaultMetric());
this._oldUnits = this.cmbUnit.getValue();
value = Common.localStorage.getItem("pe-settings-autosave");
......
......@@ -242,6 +242,7 @@ define([
this.appOptions.recent = this.editorConfig.recent;
this.appOptions.createUrl = this.editorConfig.createUrl;
this.appOptions.lang = this.editorConfig.lang;
this.appOptions.location = (typeof (this.editorConfig.location) == 'string') ? this.editorConfig.location.toLowerCase() : '';
this.appOptions.canAutosave = false;
this.appOptions.canAnalytics = false;
this.appOptions.sharingSettingsUrl = this.editorConfig.sharingSettingsUrl;
......@@ -270,6 +271,9 @@ define([
} else
value = SSE.Views.FormulaLang.get(value);
if (value) this.api.asc_setLocalization(value);
if (this.appOptions.location == 'us' || this.appOptions.location == 'ca')
Common.Utils.Metric.setDefaultMetric(Common.Utils.Metric.c_MetricUnits.inch);
},
loadDocument: function(data) {
......@@ -867,7 +871,7 @@ define([
}
var value = Common.localStorage.getItem('sse-settings-unit');
Common.Utils.Metric.setCurrentMetric((value!==null) ? parseInt(value) : Common.Utils.Metric.c_MetricUnits.cm);
Common.Utils.Metric.setCurrentMetric((value!==null) ? parseInt(value) : Common.Utils.Metric.getDefaultMetric());
if (!me.appOptions.isEditMailMerge && !me.appOptions.isEditDiagram) {
var options = {};
......@@ -1549,7 +1553,7 @@ define([
unitsChanged: function(m) {
var value = Common.localStorage.getItem("sse-settings-unit");
Common.Utils.Metric.setCurrentMetric((value!==null) ? parseInt(value) : Common.Utils.Metric.c_MetricUnits.cm);
Common.Utils.Metric.setCurrentMetric((value!==null) ? parseInt(value) : Common.Utils.Metric.getDefaultMetric());
this.getApplication().getController('RightMenu').updateMetricUnit();
this.getApplication().getController('Print').getView('MainSettingsPrint').updateMetricUnit();
},
......
......@@ -661,7 +661,7 @@ define([
value = Common.localStorage.getItem("sse-settings-unit");
item = this.cmbUnit.store.findWhere({value: parseInt(value)});
this.cmbUnit.setValue(item ? parseInt(item.get('value')) : 0);
this.cmbUnit.setValue(item ? parseInt(item.get('value')) : Common.Utils.Metric.getDefaultMetric());
this._oldUnits = this.cmbUnit.getValue();
value = Common.localStorage.getItem("sse-settings-autosave");
......
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