From 9957e5d77c5d4ef11ef55dc4b2fdbd6aeea34097 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Mon, 26 Jun 2017 17:13:42 +0300 Subject: [PATCH] [SSE] Fix merge with new-toolbar. --- apps/spreadsheeteditor/main/app.js | 33 +--------- .../main/app/controller/Main.js | 65 ++++++++++++++----- apps/spreadsheeteditor/main/app_dev.js | 33 +--------- apps/spreadsheeteditor/main/locale/en.json | 22 +++++++ 4 files changed, 75 insertions(+), 78 deletions(-) diff --git a/apps/spreadsheeteditor/main/app.js b/apps/spreadsheeteditor/main/app.js index 3f3f6a2ecd..d38cfe1aca 100644 --- a/apps/spreadsheeteditor/main/app.js +++ b/apps/spreadsheeteditor/main/app.js @@ -190,37 +190,8 @@ require([ app.start(); }); }, function(err) { - if (err.requireType == 'timeout' && !reqerr) { - var getUrlParams = function() { - var e, - a = /\+/g, // Regex for replacing addition symbol with a space - r = /([^&=]+)=?([^&]*)/g, - d = function (s) { return decodeURIComponent(s.replace(a, " ")); }, - q = window.location.search.substring(1), - urlParams = {}; - - while (e = r.exec(q)) - urlParams[d(e[1])] = d(e[2]); - - return urlParams; - }; - - var encodeUrlParam = function(str) { - return str.replace(/&/g, '&') - .replace(/"/g, '"') - .replace(/'/g, ''') - .replace(//g, '>'); - }; - - var lang = (getUrlParams()["lang"] || 'en').split("-")[0]; - - if ( lang == 'de') reqerr = 'Die Verbindung ist zu langsam, einige Komponenten konnten nicht geladen werden. Aktualisieren Sie bitte die Seite.'; - else if ( lang == 'es') reqerr = 'La conexión es muy lenta, algunos de los componentes no han podido cargar. Por favor recargue la página.'; - else if ( lang == 'fr') reqerr = 'La connexion est trop lente, certains des composants n\'ons pas pu être chargé. Veuillez recharger la page.'; - else if ( lang == 'ru') reqerr = 'Слишком медленное соединение, не удается загрузить некоторые компоненты. Пожалуйста, обновите страницу.'; - else reqerr = 'The connection is too slow, some of the components could not be loaded. Please reload the page.'; - + if (err.requireType == 'timeout' && !reqerr && window.requireTimeourError) { + reqerr = window.requireTimeourError(); window.alert(reqerr); window.location.reload(); } diff --git a/apps/spreadsheeteditor/main/app/controller/Main.js b/apps/spreadsheeteditor/main/app/controller/Main.js index 4518fdb87b..3a279619d3 100644 --- a/apps/spreadsheeteditor/main/app/controller/Main.js +++ b/apps/spreadsheeteditor/main/app/controller/Main.js @@ -102,6 +102,7 @@ define([ onLaunch: function() { // $(document.body).css('position', 'absolute'); + var me = this; this._state = {isDisconnected: false, usersCount: 1, fastCoauth: true, lostEditingRights: false, licenseWarning: false}; @@ -118,9 +119,32 @@ define([ if (value===null) value = window.devicePixelRatio > 1 ? '1' : '3'; // Initialize api + var styleNames = ['Normal', 'Neutral', 'Bad', 'Good', 'Input', 'Output', 'Calculation', 'Check Cell', 'Explanatory Text', 'Note', 'Linked Cell', 'Warning Text', + 'Heading 1', 'Heading 2', 'Heading 3', 'Heading 4', 'Title', 'Total', 'Currency', 'Percent', 'Comma'], + translate = { + 'Series': this.txtSeries, + 'Diagram Title': this.txtDiagramTitle, + 'X Axis': this.txtXAxis, + 'Y Axis': this.txtYAxis, + 'Your text here': this.txtArt + }; + styleNames.forEach(function(item){ + translate[item] = me['txtStyle_' + item.replace(/ /g, '_')] || item; + }); + translate['Currency [0]'] = me.txtStyle_Currency + ' [0]'; + translate['Comma [0]'] = me.txtStyle_Comma + ' [0]'; + + for (var i=1; i<7; i++) { + translate['Accent'+i] = me.txtAccent + i; + translate['20% - Accent'+i] = '20% - ' + me.txtAccent + i; + translate['40% - Accent'+i] = '40% - ' + me.txtAccent + i; + translate['60% - Accent'+i] = '60% - ' + me.txtAccent + i; + } + this.api = new Asc.spreadsheet_api({ 'id-view' : 'editor_sdk', - 'id-input' : 'ce-cell-content' + 'id-input' : 'ce-cell-content', + 'translate': translate }); this.api.asc_setFontRenderingMode(parseInt(value)); @@ -159,7 +183,6 @@ define([ this.getApplication().getController('Viewport').setApi(this.api); - var me = this; // Syncronize focus with api $(document.body).on('focus', 'input, textarea:not(#ce-cell-content)', function(e) { if (me.isAppDisabled === true) return; @@ -851,19 +874,6 @@ define([ },this)); } - if (this.api) { - var translateChart = new Asc.asc_CChartTranslate(); - translateChart.asc_setTitle(this.txtDiagramTitle); - translateChart.asc_setXAxis(this.txtXAxis); - translateChart.asc_setYAxis(this.txtYAxis); - translateChart.asc_setSeries(this.txtSeries); - this.api.asc_setChartTranslate(translateChart); - - var translateArt = new Asc.asc_TextArtTranslate(); - translateArt.asc_setDefaultText(this.txtArt); - this.api.asc_setTextArtTranslate(translateArt); - } - if (!this.appOptions.isEditMailMerge && !this.appOptions.isEditDiagram) { this.api.asc_registerCallback('asc_onSendThemeColors', _.bind(this.onSendThemeColors, this)); this.api.asc_registerCallback('asc_onDownloadUrl', _.bind(this.onDownloadUrl, this)); @@ -1936,6 +1946,7 @@ define([ isViewer: itemVar.isViewer, EditorsSupport: itemVar.EditorsSupport, isVisual: itemVar.isVisual, + isCustomWindow: itemVar.isCustomWindow, isModal: itemVar.isModal, isInsideMode: itemVar.isInsideMode, initDataType: itemVar.initDataType, @@ -2105,7 +2116,29 @@ define([ errorAccessDeny: 'You are trying to perform an action you do not have rights for.
Please contact your Document Server administrator.', titleServerVersion: 'Editor updated', errorServerVersion: 'The editor version has been updated. The page will be reloaded to apply the changes.', - errorLockedCellPivot: 'You cannot change data inside a pivot table.' + errorLockedCellPivot: 'You cannot change data inside a pivot table.', + txtAccent: 'Accent', + txtStyle_Normal: 'Normal', + txtStyle_Heading_1: 'Heading 1', + txtStyle_Heading_2: 'Heading 2', + txtStyle_Heading_3: 'Heading 3', + txtStyle_Heading_4: 'Heading 4', + txtStyle_Title: 'Title', + txtStyle_Neutral: 'Neutral', + txtStyle_Bad: 'Bad', + txtStyle_Good: 'Good', + txtStyle_Input: 'Input', + txtStyle_Output: 'Output', + txtStyle_Calculation: 'Calculation', + txtStyle_Check_Cell: 'Check Cell', + txtStyle_Explanatory_Text: 'Explanatory Text', + txtStyle_Note: 'Note', + txtStyle_Linked_Cell: 'Linked Cell', + txtStyle_Warning_Text: 'Warning Text', + txtStyle_Total: 'Total', + txtStyle_Currency: 'Currency', + txtStyle_Percent: 'Percent', + txtStyle_Comma: 'Comma' } })(), SSE.Controllers.Main || {})) }); diff --git a/apps/spreadsheeteditor/main/app_dev.js b/apps/spreadsheeteditor/main/app_dev.js index 5e2f4d2eb0..f541535a30 100644 --- a/apps/spreadsheeteditor/main/app_dev.js +++ b/apps/spreadsheeteditor/main/app_dev.js @@ -181,37 +181,8 @@ require([ app.start(); }); }, function(err) { - if (err.requireType == 'timeout' && !reqerr) { - var getUrlParams = function() { - var e, - a = /\+/g, // Regex for replacing addition symbol with a space - r = /([^&=]+)=?([^&]*)/g, - d = function (s) { return decodeURIComponent(s.replace(a, " ")); }, - q = window.location.search.substring(1), - urlParams = {}; - - while (e = r.exec(q)) - urlParams[d(e[1])] = d(e[2]); - - return urlParams; - }; - - var encodeUrlParam = function(str) { - return str.replace(/&/g, '&') - .replace(/"/g, '"') - .replace(/'/g, ''') - .replace(//g, '>'); - }; - - var lang = (getUrlParams()["lang"] || 'en').split("-")[0]; - - if ( lang == 'de') reqerr = 'Die Verbindung ist zu langsam, einige Komponenten konnten nicht geladen werden. Aktualisieren Sie bitte die Seite.'; - else if ( lang == 'es') reqerr = 'La conexión es muy lenta, algunos de los componentes no han podido cargar. Por favor recargue la página.'; - else if ( lang == 'fr') reqerr = 'La connexion est trop lente, certains des composants n\'ons pas pu être chargé. Veuillez recharger la page.'; - else if ( lang == 'ru') reqerr = 'Слишком медленное соединение, не удается загрузить некоторые компоненты. Пожалуйста, обновите страницу.'; - else reqerr = 'The connection is too slow, some of the components could not be loaded. Please reload the page.'; - + if (err.requireType == 'timeout' && !reqerr && window.requireTimeourError) { + reqerr = window.requireTimeourError(); window.alert(reqerr); window.location.reload(); } diff --git a/apps/spreadsheeteditor/main/locale/en.json b/apps/spreadsheeteditor/main/locale/en.json index d0f1c3a9df..0a5e2fd834 100644 --- a/apps/spreadsheeteditor/main/locale/en.json +++ b/apps/spreadsheeteditor/main/locale/en.json @@ -365,6 +365,28 @@ "SSE.Controllers.Main.warnLicenseExp": "Your license has expired.
Please update your license and refresh the page.", "SSE.Controllers.Main.warnNoLicense": "You are using an open source version of ONLYOFFICE. The version has limitations for concurrent connections to the document server (20 connections at a time).
If you need more please consider purchasing a commercial license.", "SSE.Controllers.Main.warnProcessRightsChange": "You have been denied the right to edit the file.", + "SSE.Controllers.Main.txtAccent": "Accent", + "SSE.Controllers.Main.txtStyle_Normal": "Normal", + "SSE.Controllers.Main.txtStyle_Heading_1": "Heading 1", + "SSE.Controllers.Main.txtStyle_Heading_2": "Heading 2", + "SSE.Controllers.Main.txtStyle_Heading_3": "Heading 3", + "SSE.Controllers.Main.txtStyle_Heading_4": "Heading 4", + "SSE.Controllers.Main.txtStyle_Title": "Title", + "SSE.Controllers.Main.txtStyle_Neutral": "Neutral", + "SSE.Controllers.Main.txtStyle_Bad": "Bad", + "SSE.Controllers.Main.txtStyle_Good": "Good", + "SSE.Controllers.Main.txtStyle_Input": "Input", + "SSE.Controllers.Main.txtStyle_Output": "Output", + "SSE.Controllers.Main.txtStyle_Calculation": "Calculation", + "SSE.Controllers.Main.txtStyle_Check_Cell": "Check Cell", + "SSE.Controllers.Main.txtStyle_Explanatory_Text": "Explanatory Text", + "SSE.Controllers.Main.txtStyle_Note": "Note", + "SSE.Controllers.Main.txtStyle_Linked_Cell": "Linked Cell", + "SSE.Controllers.Main.txtStyle_Warning_Text": "Warning Text", + "SSE.Controllers.Main.txtStyle_Total": "Total", + "SSE.Controllers.Main.txtStyle_Currency": "Currency", + "SSE.Controllers.Main.txtStyle_Percent": "Percent", + "SSE.Controllers.Main.txtStyle_Comma": "Comma", "SSE.Controllers.Print.strAllSheets": "All Sheets", "SSE.Controllers.Print.textWarning": "Warning", "SSE.Controllers.Print.warnCheckMargings": "Margins are incorrect",