Commit 85c39deb authored by Julia Radzhabova's avatar Julia Radzhabova

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

В конфиг редакторов добавлен параметр location: передается двухбуквенный код страны, по которому определяется метрика по-умолчанию (us, ca - дюймы).
parent dec3dbc9
......@@ -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,
......
......@@ -251,6 +251,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,
......@@ -264,6 +265,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) {
......
......@@ -227,6 +227,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;
......@@ -243,6 +244,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) {
......@@ -1040,7 +1044,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));
......@@ -1579,7 +1583,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();
......
......@@ -340,7 +340,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");
......
......@@ -210,6 +210,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;
......@@ -224,6 +225,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) {
......@@ -808,7 +812,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));
......@@ -1250,7 +1254,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();
......
......@@ -274,7 +274,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");
......
......@@ -234,6 +234,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;
......@@ -262,6 +263,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) {
......@@ -859,7 +863,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 = {};
......@@ -1541,7 +1545,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();
},
......
......@@ -653,7 +653,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