From 7bf15f88c6325d72f6c2c19db846fee551e81914 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Fri, 8 Apr 2016 11:55:15 +0300 Subject: [PATCH] =?UTF-8?q?=D0=92=20=D0=BA=D0=BE=D0=BD=D1=84=D0=B8=D0=B3?= =?UTF-8?q?=20=D1=80=D0=B5=D0=B4=D0=B0=D0=BA=D1=82=D0=BE=D1=80=D0=BE=D0=B2?= =?UTF-8?q?=20=D0=B4=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5=D0=BD=20=D0=BF?= =?UTF-8?q?=D0=B0=D1=80=D0=B0=D0=BC=D0=B5=D1=82=D1=80=20location:=20=D0=BF?= =?UTF-8?q?=D0=B5=D1=80=D0=B5=D0=B4=D0=B0=D0=B5=D1=82=D1=81=D1=8F=20=D0=B4?= =?UTF-8?q?=D0=B2=D1=83=D1=85=D0=B1=D1=83=D0=BA=D0=B2=D0=B5=D0=BD=D0=BD?= =?UTF-8?q?=D1=8B=D0=B9=20=D0=BA=D0=BE=D0=B4=20=D1=81=D1=82=D1=80=D0=B0?= =?UTF-8?q?=D0=BD=D1=8B,=20=D0=BF=D0=BE=20=D0=BA=D0=BE=D1=82=D0=BE=D1=80?= =?UTF-8?q?=D0=BE=D0=BC=D1=83=20=D0=BE=D0=BF=D1=80=D0=B5=D0=B4=D0=B5=D0=BB?= =?UTF-8?q?=D1=8F=D0=B5=D1=82=D1=81=D1=8F=20=D0=BC=D0=B5=D1=82=D1=80=D0=B8?= =?UTF-8?q?=D0=BA=D0=B0=20=D0=BF=D0=BE-=D1=83=D0=BC=D0=BE=D0=BB=D1=87?= =?UTF-8?q?=D0=B0=D0=BD=D0=B8=D1=8E=20(us,=20ca=20-=20=D0=B4=D1=8E=D0=B9?= =?UTF-8?q?=D0=BC=D1=8B).?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/api/documents/api.js | 1 + apps/common/main/lib/util/utils.js | 9 +++++++++ apps/documenteditor/main/app/controller/Main.js | 8 ++++++-- apps/documenteditor/main/app/view/FileMenuPanels.js | 2 +- apps/presentationeditor/main/app/controller/Main.js | 8 ++++++-- apps/presentationeditor/main/app/view/FileMenuPanels.js | 2 +- apps/spreadsheeteditor/main/app/controller/Main.js | 8 ++++++-- apps/spreadsheeteditor/main/app/view/FileMenuPanels.js | 2 +- 8 files changed, 31 insertions(+), 9 deletions(-) diff --git a/apps/api/documents/api.js b/apps/api/documents/api.js index c9e29f643e..cd018fa5b2 100644 --- a/apps/api/documents/api.js +++ b/apps/api/documents/api.js @@ -46,6 +46,7 @@ editorConfig: { mode: 'view or edit', lang: , + location: , canCoAuthoring: , canAutosave: , canBackToFolder: - deprecated. use "customization.goback" parameter, diff --git a/apps/common/main/lib/util/utils.js b/apps/common/main/lib/util/utils.js index 03ef2a714b..94152cb50f 100644 --- a/apps/common/main/lib/util/utils.js +++ b/apps/common/main/lib/util/utils.js @@ -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) { diff --git a/apps/documenteditor/main/app/controller/Main.js b/apps/documenteditor/main/app/controller/Main.js index 85ae7ecc56..21c6102212 100644 --- a/apps/documenteditor/main/app/controller/Main.js +++ b/apps/documenteditor/main/app/controller/Main.js @@ -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(); diff --git a/apps/documenteditor/main/app/view/FileMenuPanels.js b/apps/documenteditor/main/app/view/FileMenuPanels.js index 50d43f8ffb..1ae7915c0f 100644 --- a/apps/documenteditor/main/app/view/FileMenuPanels.js +++ b/apps/documenteditor/main/app/view/FileMenuPanels.js @@ -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"); diff --git a/apps/presentationeditor/main/app/controller/Main.js b/apps/presentationeditor/main/app/controller/Main.js index 3b4dd3f3fe..b6c40b7ba0 100644 --- a/apps/presentationeditor/main/app/controller/Main.js +++ b/apps/presentationeditor/main/app/controller/Main.js @@ -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(); diff --git a/apps/presentationeditor/main/app/view/FileMenuPanels.js b/apps/presentationeditor/main/app/view/FileMenuPanels.js index 34cdfd28a3..f6657bc130 100644 --- a/apps/presentationeditor/main/app/view/FileMenuPanels.js +++ b/apps/presentationeditor/main/app/view/FileMenuPanels.js @@ -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"); diff --git a/apps/spreadsheeteditor/main/app/controller/Main.js b/apps/spreadsheeteditor/main/app/controller/Main.js index b7a9af4740..240ed93d4a 100644 --- a/apps/spreadsheeteditor/main/app/controller/Main.js +++ b/apps/spreadsheeteditor/main/app/controller/Main.js @@ -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(); }, diff --git a/apps/spreadsheeteditor/main/app/view/FileMenuPanels.js b/apps/spreadsheeteditor/main/app/view/FileMenuPanels.js index db78c10161..3fa2daa317 100644 --- a/apps/spreadsheeteditor/main/app/view/FileMenuPanels.js +++ b/apps/spreadsheeteditor/main/app/view/FileMenuPanels.js @@ -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");