From 2ab5b9388a78c090947bf81c782a7bc2e39ee033 Mon Sep 17 00:00:00 2001 From: "Sergey.Konovalov" <Sergey.Konovalov@OnlyOffice.com> Date: Tue, 6 Aug 2013 16:31:02 +0000 Subject: [PATCH] =?UTF-8?q?=D0=A3=D0=B4=D0=B0=D0=BB=D0=B5=D0=BD=D0=B8?= =?UTF-8?q?=D0=B5=20=D0=B7=D0=B0=D0=BA=D0=B5=D1=88=D0=B8=D1=80=D0=BE=D0=B2?= =?UTF-8?q?=D0=B0=D0=BD=D0=BD=D1=8B=D1=85=20=D1=84=D0=B0=D0=B9=D0=BB=D0=BE?= =?UTF-8?q?=D0=B2=20=D0=BF=D1=80=D0=B8=20=D1=8D=D0=BA=D1=81=D0=BF=D0=BE?= =?UTF-8?q?=D1=80=D1=82=D0=B5=20=D0=B8=20=D0=BF=D1=80=D0=B5=D0=B4=D0=B2?= =?UTF-8?q?=D0=B0=D1=80=D0=B8=D1=82=D0=B5=D0=BB=D1=8C=D0=BD=D0=BE=D0=B9=20?= =?UTF-8?q?=D0=BA=D0=BE=D0=BD=D0=B2=D0=B5=D1=80=D1=82=D0=B0=D1=86=D0=B8?= =?UTF-8?q?=D0=B8.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@48590 954022d7-b5bf-4e40-9824-e11837661b57 --- Common/MobileDownloader/download.html | 2 +- Excel/api.js | 49 +++++++++------------------ PowerPoint/api.js | 49 +++++++++------------------ Word/api.js | 44 ++++++++---------------- 4 files changed, 48 insertions(+), 96 deletions(-) diff --git a/Common/MobileDownloader/download.html b/Common/MobileDownloader/download.html index 4457ef3a9..5111603f8 100644 --- a/Common/MobileDownloader/download.html +++ b/Common/MobileDownloader/download.html @@ -9,7 +9,7 @@ <script type="text/javascript" src="../downloaderfiles.js"></script> <script type="text/javascript"> function load(){ - getFile(decodeURI(location.search.substring(1).split("file=")[1])); + getFile(decodeURIComponent(location.search.substring(1).split("file=")[1])); } </script> </head> diff --git a/Excel/api.js b/Excel/api.js index 7ed407041..76d1731d5 100644 --- a/Excel/api.js +++ b/Excel/api.js @@ -64,6 +64,7 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS"; this.documentId = undefined; this.documentUrl = "null"; this.documentTitle = "null"; + this.documentTitleWithoutExtention = "null"; this.documentFormat = "null"; this.documentVKey = null; this.documentOrigin = ""; @@ -357,6 +358,12 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS"; this.chartEditor = c_DocInfo["ChartEditor"]; this.documentOpenOptions = c_DocInfo["Options"]; + var nIndex = this.documentTitle.lastIndexOf("."); + if(-1 != nIndex) + this.documentTitleWithoutExtention = this.documentTitle.substring(0, nIndex); + else + this.documentTitleWithoutExtention = this.documentTitle; + // Ð’Ñ‹ÑтавлÑем Ð¿Ð¾Ð»ÑŒÐ·Ð¾Ð²Ð°Ñ‚ÐµÐ»Ñ this.User = new asc_user(); this.User.asc_setId(c_DocInfo["UserId"]); @@ -413,10 +420,7 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS"; this.advancedOptionsAction = c_oAscAdvancedOptionsAction.Save; this._asc_downloadAs(typeFile, function(incomeObject){ if(null != incomeObject && "save" == incomeObject.type) - { - var outputData = JSON.parse(incomeObject.data); - that.asc_processSavedFile(outputData.url, false); - } + that.asc_processSavedFile(incomeObject.data, false); // МенÑем тип ÑоÑтоÑÐ½Ð¸Ñ (на никакое) that.advancedOptionsAction = c_oAscAdvancedOptionsAction.None; that.asc_EndAction(c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.DownloadAs); @@ -593,10 +597,7 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS"; } else if (this.advancedOptionsAction === c_oAscAdvancedOptionsAction.Save) this._asc_downloadAs(c_oAscFileType.CSV, function(incomeObject){ if(null != incomeObject && "save" == incomeObject.type) - { - var outputData = JSON.parse(incomeObject.data); - t.asc_processSavedFile(outputData.url, false); - } + t.asc_processSavedFile(incomeObject.data, false); // МенÑем тип ÑоÑтоÑÐ½Ð¸Ñ (на никакое) t.advancedOptionsAction = c_oAscAdvancedOptionsAction.None; t.asc_EndAction(c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.DownloadAs); @@ -607,28 +608,13 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS"; asc_processSavedFile: function(url, bInner) { if(bInner) - { - var urlAbs = this.documentOrigin + g_sResourceServiceLocalUrl + encodeURIComponent(url); - this.handlers.trigger("asc_onSaveUrl", urlAbs, function(hasError){}); - } + this.handlers.trigger("asc_onSaveUrl", url, function(hasError){}); else { - var urlAbs = g_sResourceServiceLocalUrl + encodeURIComponent(url); - var nIndex = this.documentTitle.lastIndexOf("."); - if(-1 != nIndex) - { - var nIndexFormat = url.lastIndexOf("."); - var sDocumentFilename = this.documentTitle.substring(0, nIndex); - urlAbs += "&filename=" + encodeURIComponent(sDocumentFilename); - if(-1 != nIndexFormat) - urlAbs += url.substring(nIndexFormat); - } - if( this.isMobileVersion ){ - window.open("../../../sdk/Common/MobileDownloader/download.html?file="+urlAbs,"_parent","",false); - } - else { - getFile(urlAbs); - } + if( this.isMobileVersion ) + window.open("../Common/MobileDownloader/download.html?file="+encodeURIComponent(url),"_parent","",false); + else + getFile(url); } }, // Опции Ñтраницы (Ð´Ð»Ñ Ð¿ÐµÑ‡Ð°Ñ‚Ð¸) @@ -760,7 +746,7 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS"; setTimeout(function(){oThis._asc_sendCommand(callback, JSON.stringify(rData));}, 3000); break; case "waitsave": - var rData = {"id":oThis.documentId, "format": oThis.documentFormat, "c":"chsave", "data":incomeObject.data}; + var rData = {"id": oThis.documentId, "title": oThis.documentTitleWithoutExtention, "c": "chsave", "data": incomeObject.data}; setTimeout(function(){oThis._asc_sendCommand(callback, JSON.stringify(rData));}, 3000); break; case "savepart": @@ -817,10 +803,7 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS"; oAdditionalData["savetype"] = "completeall"; this._asc_sendCommand (/*callback*/ function(incomeObject){ if(null != incomeObject && "save" == incomeObject.type) - { - var outputData = JSON.parse(incomeObject.data); - that.asc_processSavedFile(outputData.url, true); - } + that.asc_processSavedFile(incomeObject.data, true); }, "mnuSaveAs" + this.cCharDelimiter + JSON.stringify(oAdditionalData) + this.cCharDelimiter + data); }, diff --git a/PowerPoint/api.js b/PowerPoint/api.js index 51aacf893..0c4a36bbf 100644 --- a/PowerPoint/api.js +++ b/PowerPoint/api.js @@ -8,6 +8,7 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS"; var documentId = undefined; var documentUrl = 'null'; var documentTitle = 'null'; +var documentTitleWithoutExtention = 'null'; var documentFormat = 'null'; var documentVKey = null; var documentOrigin = ""; @@ -372,6 +373,12 @@ asc_docs_api.prototype.LoadDocument = function(c_DocInfo) documentTitle = c_DocInfo.get_Title(); documentFormat = c_DocInfo.get_Format(); + var nIndex = documentTitle.lastIndexOf("."); + if(-1 != nIndex) + documentTitleWithoutExtention = documentTitle.substring(0, nIndex); + else + documentTitleWithoutExtention = documentTitle; + documentVKey = c_DocInfo.get_VKey(); // documentOrigin = c_DocInfo.get_Origin(); var sProtocol = window.location.protocol; @@ -854,10 +861,7 @@ asc_docs_api.prototype.asc_Print = function(){ var editor = this; _downloadAs(this, c_oAscFileType.PDF, function(incomeObject){ if(null != incomeObject && "save" == incomeObject.type) - { - var outputData = JSON.parse(incomeObject.data); - editor.processSavedFile(outputData.url, false); - } + editor.processSavedFile(incomeObject.data, false); editor.sync_EndAction(c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.Print);}, true); } asc_docs_api.prototype.Undo = function(){ @@ -897,10 +901,7 @@ asc_docs_api.prototype.asc_Save = function(){ var sData = "mnuSaveAs" + cCharDelimiter + JSON.stringify(oAdditionalData) + cCharDelimiter + data; sendCommand(editor, function(incomeObject){ if(null != incomeObject && "save" == incomeObject.type) - { - var outputData = JSON.parse(incomeObject.data); - editor.processSavedFile(outputData.url, true); - } + editor.processSavedFile(incomeObject.data, true); }, sData); } } @@ -913,28 +914,13 @@ asc_docs_api.prototype.asc_OnSaveEnd = function(isDocumentSaved){ } asc_docs_api.prototype.processSavedFile = function(url, bInner){ if(bInner) - { - var urlAbs = documentOrigin + g_sResourceServiceLocalUrl + encodeURIComponent(url); - editor.asc_fireCallback("asc_onSaveUrl", urlAbs, function(hasError){}); - } + editor.asc_fireCallback("asc_onSaveUrl", url, function(hasError){}); else { - var urlAbs = g_sResourceServiceLocalUrl + encodeURIComponent(url); - var nIndex = documentTitle.lastIndexOf("."); - if(-1 != nIndex) - { - var nIndexFormat = url.lastIndexOf("."); - var sDocumentFilename = documentTitle.substring(0, nIndex); - urlAbs += "&filename=" + encodeURIComponent(sDocumentFilename); - if(-1 != nIndexFormat) - urlAbs += url.substring(nIndexFormat); - } - if( editor.isMobileVersion ){ - window.open("../../../sdk/Common/MobileDownloader/download.html?file="+urlAbs,"_parent","",false); - } - else { - getFile(urlAbs); - } + if( editor.isMobileVersion ) + window.open("../Common/MobileDownloader/download.html?file="+encodeURIComponent(url),"_parent","",false); + else + getFile(url); } } asc_docs_api.prototype.asc_DownloadAs = function(typeFile){//передаем чиÑло ÑоответÑтвующее Ñвоему формату. @@ -942,10 +928,7 @@ asc_docs_api.prototype.asc_DownloadAs = function(typeFile){//передаем ч var editor = this; _downloadAs(this, typeFile, function(incomeObject){ if(null != incomeObject && "save" == incomeObject.type) - { - var outputData = JSON.parse(incomeObject.data); - editor.processSavedFile(outputData.url, false); - } + editor.processSavedFile(incomeObject.data, false); editor.sync_EndAction(c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.DownloadAs);}, true); } asc_docs_api.prototype.Resize = function(){ @@ -3878,7 +3861,7 @@ function sendCommand(editor, fCallback, rdata){ fCallback(incomeObject); break; case "waitsave": - var rData = {"id":documentId, "format": documentFormat, "c":"chsave", "data": incomeObject.data}; + var rData = {"id":documentId, "title": documentTitleWithoutExtention, "c":"chsave", "data": incomeObject.data}; setTimeout( function(){sendCommand(editor, fCallback, JSON.stringify(rData))}, 3000); break; case "savepart": diff --git a/Word/api.js b/Word/api.js index e382ee5ce..30032cecc 100644 --- a/Word/api.js +++ b/Word/api.js @@ -6,6 +6,7 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS"; var documentId = undefined; var documentUrl = 'null'; var documentTitle = 'null'; +var documentTitleWithoutExtention = 'null'; var documentFormat = 'null'; var documentVKey = null; var documentOrigin = ""; @@ -772,6 +773,12 @@ asc_docs_api.prototype.LoadDocument = function(c_DocInfo) documentTitle = this.DocInfo.get_Title(); documentFormat = this.DocInfo.get_Format(); + var nIndex = documentTitle.lastIndexOf("."); + if(-1 != nIndex) + documentTitleWithoutExtention = documentTitle.substring(0, nIndex); + else + documentTitleWithoutExtention = documentTitle; + documentVKey = this.DocInfo.get_VKey(); // documentOrigin = this.DocInfo.get_Origin(); var sProtocol = window.location.protocol; @@ -2173,10 +2180,7 @@ asc_docs_api.prototype.asc_Print = function() else _downloadAs(this, c_oAscFileType.PDF, function(incomeObject){ if(null != incomeObject && "save" == incomeObject.type) - { - var outputData = JSON.parse(incomeObject.data); - editor.processSavedFile(outputData.url, false); - } + editor.processSavedFile(incomeObject.data, false); editor.sync_EndAction(c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.Print);}, true); } } @@ -2274,10 +2278,7 @@ function OnSave_Callback(e) var sData = "mnuSaveAs" + cCharDelimiter + JSON.stringify(oAdditionalData) + cCharDelimiter + data; sendCommand(editor, function(incomeObject){ if(null != incomeObject && "save" == incomeObject.type) - { - var outputData = JSON.parse(incomeObject.data); - editor.processSavedFile(outputData.url, true); - } + editor.processSavedFile(incomeObject.data, true); }, sData); } } else { @@ -2296,10 +2297,7 @@ asc_docs_api.prototype.asc_DownloadAs = function(typeFile){//передаем ч var editor = this; _downloadAs(this, typeFile, function(incomeObject){ if(null != incomeObject && "save" == incomeObject.type) - { - var outputData = JSON.parse(incomeObject.data); - editor.processSavedFile(outputData.url, false); - } + editor.processSavedFile(incomeObject.data, false); editor.sync_EndAction(c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.DownloadAs);}, true); } asc_docs_api.prototype.Resize = function(){ @@ -2343,26 +2341,14 @@ asc_docs_api.prototype.processSavedFile = function(url, bInner) { if(bInner) { - var urlAbs = documentOrigin + g_sResourceServiceLocalUrl + encodeURIComponent(url); - this.asc_fireCallback("asc_onSaveUrl", urlAbs, function(hasError){}); + this.asc_fireCallback("asc_onSaveUrl", url, function(hasError){}); } else { - var urlAbs = g_sResourceServiceLocalUrl + encodeURIComponent(url); - var nIndex = documentTitle.lastIndexOf("."); - if(-1 != nIndex) - { - var nIndexFormat = url.lastIndexOf("."); - var sDocumentFilename = documentTitle.substring(0, nIndex); - urlAbs += "&filename=" + encodeURIComponent(sDocumentFilename); - if(-1 != nIndexFormat) - urlAbs += url.substring(nIndexFormat); - } - if( this.isMobileVersion ){ - window.open("../../../../Common/MobileDownloader/download.html?file="+urlAbs,"_parent","",false); - } + if( this.isMobileVersion ) + window.open("/Common/MobileDownloader/download.html?file="+encodeURIComponent(url),"_parent","",false); else - getFile(urlAbs); + getFile(url); } } asc_docs_api.prototype.startGetDocInfo = function(){ @@ -6466,7 +6452,7 @@ function sendCommand(editor, fCallback, rdata){ break; case "waitsave": { - var rData = {"id":documentId, "format": documentFormat, "c":"chsave", "data": incomeObject.data}; + var rData = {"id":documentId, "title": documentTitleWithoutExtention, "c":"chsave", "data": incomeObject.data}; setTimeout( function(){sendCommand(editor, fCallback, JSON.stringify(rData))}, 3000); } break; -- 2.30.9