Commit 2ab5b938 authored by Sergey.Konovalov's avatar Sergey.Konovalov Committed by Alexander.Trofimov

Удаление закешированных файлов при экспорте и предварительной конвертации.

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@48590 954022d7-b5bf-4e40-9824-e11837661b57
parent a05b5c56
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
<script type="text/javascript" src="../downloaderfiles.js"></script> <script type="text/javascript" src="../downloaderfiles.js"></script>
<script type="text/javascript"> <script type="text/javascript">
function load(){ function load(){
getFile(decodeURI(location.search.substring(1).split("file=")[1])); getFile(decodeURIComponent(location.search.substring(1).split("file=")[1]));
} }
</script> </script>
</head> </head>
......
...@@ -64,6 +64,7 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS"; ...@@ -64,6 +64,7 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
this.documentId = undefined; this.documentId = undefined;
this.documentUrl = "null"; this.documentUrl = "null";
this.documentTitle = "null"; this.documentTitle = "null";
this.documentTitleWithoutExtention = "null";
this.documentFormat = "null"; this.documentFormat = "null";
this.documentVKey = null; this.documentVKey = null;
this.documentOrigin = ""; this.documentOrigin = "";
...@@ -357,6 +358,12 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS"; ...@@ -357,6 +358,12 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
this.chartEditor = c_DocInfo["ChartEditor"]; this.chartEditor = c_DocInfo["ChartEditor"];
this.documentOpenOptions = c_DocInfo["Options"]; 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 = new asc_user();
this.User.asc_setId(c_DocInfo["UserId"]); this.User.asc_setId(c_DocInfo["UserId"]);
...@@ -413,10 +420,7 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS"; ...@@ -413,10 +420,7 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
this.advancedOptionsAction = c_oAscAdvancedOptionsAction.Save; this.advancedOptionsAction = c_oAscAdvancedOptionsAction.Save;
this._asc_downloadAs(typeFile, function(incomeObject){ this._asc_downloadAs(typeFile, function(incomeObject){
if(null != incomeObject && "save" == incomeObject.type) if(null != incomeObject && "save" == incomeObject.type)
{ that.asc_processSavedFile(incomeObject.data, false);
var outputData = JSON.parse(incomeObject.data);
that.asc_processSavedFile(outputData.url, false);
}
// Меняем тип состояния (на никакое) // Меняем тип состояния (на никакое)
that.advancedOptionsAction = c_oAscAdvancedOptionsAction.None; that.advancedOptionsAction = c_oAscAdvancedOptionsAction.None;
that.asc_EndAction(c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.DownloadAs); 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"; ...@@ -593,10 +597,7 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
} else if (this.advancedOptionsAction === c_oAscAdvancedOptionsAction.Save) } else if (this.advancedOptionsAction === c_oAscAdvancedOptionsAction.Save)
this._asc_downloadAs(c_oAscFileType.CSV, function(incomeObject){ this._asc_downloadAs(c_oAscFileType.CSV, function(incomeObject){
if(null != incomeObject && "save" == incomeObject.type) if(null != incomeObject && "save" == incomeObject.type)
{ t.asc_processSavedFile(incomeObject.data, false);
var outputData = JSON.parse(incomeObject.data);
t.asc_processSavedFile(outputData.url, false);
}
// Меняем тип состояния (на никакое) // Меняем тип состояния (на никакое)
t.advancedOptionsAction = c_oAscAdvancedOptionsAction.None; t.advancedOptionsAction = c_oAscAdvancedOptionsAction.None;
t.asc_EndAction(c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.DownloadAs); 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"; ...@@ -607,28 +608,13 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
asc_processSavedFile: function(url, bInner) asc_processSavedFile: function(url, bInner)
{ {
if(bInner) if(bInner)
{ this.handlers.trigger("asc_onSaveUrl", url, function(hasError){});
var urlAbs = this.documentOrigin + g_sResourceServiceLocalUrl + encodeURIComponent(url);
this.handlers.trigger("asc_onSaveUrl", urlAbs, function(hasError){});
}
else else
{ {
var urlAbs = g_sResourceServiceLocalUrl + encodeURIComponent(url); if( this.isMobileVersion )
var nIndex = this.documentTitle.lastIndexOf("."); window.open("../Common/MobileDownloader/download.html?file="+encodeURIComponent(url),"_parent","",false);
if(-1 != nIndex) else
{ getFile(url);
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);
}
} }
}, },
// Опции страницы (для печати) // Опции страницы (для печати)
...@@ -760,7 +746,7 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS"; ...@@ -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); setTimeout(function(){oThis._asc_sendCommand(callback, JSON.stringify(rData));}, 3000);
break; break;
case "waitsave": 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); setTimeout(function(){oThis._asc_sendCommand(callback, JSON.stringify(rData));}, 3000);
break; break;
case "savepart": case "savepart":
...@@ -817,10 +803,7 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS"; ...@@ -817,10 +803,7 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
oAdditionalData["savetype"] = "completeall"; oAdditionalData["savetype"] = "completeall";
this._asc_sendCommand (/*callback*/ function(incomeObject){ this._asc_sendCommand (/*callback*/ function(incomeObject){
if(null != incomeObject && "save" == incomeObject.type) if(null != incomeObject && "save" == incomeObject.type)
{ that.asc_processSavedFile(incomeObject.data, true);
var outputData = JSON.parse(incomeObject.data);
that.asc_processSavedFile(outputData.url, true);
}
}, "mnuSaveAs" + this.cCharDelimiter + JSON.stringify(oAdditionalData) + this.cCharDelimiter + data); }, "mnuSaveAs" + this.cCharDelimiter + JSON.stringify(oAdditionalData) + this.cCharDelimiter + data);
}, },
......
...@@ -8,6 +8,7 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS"; ...@@ -8,6 +8,7 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
var documentId = undefined; var documentId = undefined;
var documentUrl = 'null'; var documentUrl = 'null';
var documentTitle = 'null'; var documentTitle = 'null';
var documentTitleWithoutExtention = 'null';
var documentFormat = 'null'; var documentFormat = 'null';
var documentVKey = null; var documentVKey = null;
var documentOrigin = ""; var documentOrigin = "";
...@@ -372,6 +373,12 @@ asc_docs_api.prototype.LoadDocument = function(c_DocInfo) ...@@ -372,6 +373,12 @@ asc_docs_api.prototype.LoadDocument = function(c_DocInfo)
documentTitle = c_DocInfo.get_Title(); documentTitle = c_DocInfo.get_Title();
documentFormat = c_DocInfo.get_Format(); 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(); documentVKey = c_DocInfo.get_VKey();
// documentOrigin = c_DocInfo.get_Origin(); // documentOrigin = c_DocInfo.get_Origin();
var sProtocol = window.location.protocol; var sProtocol = window.location.protocol;
...@@ -854,10 +861,7 @@ asc_docs_api.prototype.asc_Print = function(){ ...@@ -854,10 +861,7 @@ asc_docs_api.prototype.asc_Print = function(){
var editor = this; var editor = this;
_downloadAs(this, c_oAscFileType.PDF, function(incomeObject){ _downloadAs(this, c_oAscFileType.PDF, function(incomeObject){
if(null != incomeObject && "save" == incomeObject.type) if(null != incomeObject && "save" == incomeObject.type)
{ editor.processSavedFile(incomeObject.data, false);
var outputData = JSON.parse(incomeObject.data);
editor.processSavedFile(outputData.url, false);
}
editor.sync_EndAction(c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.Print);}, true); editor.sync_EndAction(c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.Print);}, true);
} }
asc_docs_api.prototype.Undo = function(){ asc_docs_api.prototype.Undo = function(){
...@@ -897,10 +901,7 @@ asc_docs_api.prototype.asc_Save = function(){ ...@@ -897,10 +901,7 @@ asc_docs_api.prototype.asc_Save = function(){
var sData = "mnuSaveAs" + cCharDelimiter + JSON.stringify(oAdditionalData) + cCharDelimiter + data; var sData = "mnuSaveAs" + cCharDelimiter + JSON.stringify(oAdditionalData) + cCharDelimiter + data;
sendCommand(editor, function(incomeObject){ sendCommand(editor, function(incomeObject){
if(null != incomeObject && "save" == incomeObject.type) if(null != incomeObject && "save" == incomeObject.type)
{ editor.processSavedFile(incomeObject.data, true);
var outputData = JSON.parse(incomeObject.data);
editor.processSavedFile(outputData.url, true);
}
}, sData); }, sData);
} }
} }
...@@ -913,28 +914,13 @@ asc_docs_api.prototype.asc_OnSaveEnd = function(isDocumentSaved){ ...@@ -913,28 +914,13 @@ asc_docs_api.prototype.asc_OnSaveEnd = function(isDocumentSaved){
} }
asc_docs_api.prototype.processSavedFile = function(url, bInner){ asc_docs_api.prototype.processSavedFile = function(url, bInner){
if(bInner) if(bInner)
{ editor.asc_fireCallback("asc_onSaveUrl", url, function(hasError){});
var urlAbs = documentOrigin + g_sResourceServiceLocalUrl + encodeURIComponent(url);
editor.asc_fireCallback("asc_onSaveUrl", urlAbs, function(hasError){});
}
else else
{ {
var urlAbs = g_sResourceServiceLocalUrl + encodeURIComponent(url); if( editor.isMobileVersion )
var nIndex = documentTitle.lastIndexOf("."); window.open("../Common/MobileDownloader/download.html?file="+encodeURIComponent(url),"_parent","",false);
if(-1 != nIndex) else
{ getFile(url);
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);
}
} }
} }
asc_docs_api.prototype.asc_DownloadAs = function(typeFile){//передаем число соответствующее своему формату. asc_docs_api.prototype.asc_DownloadAs = function(typeFile){//передаем число соответствующее своему формату.
...@@ -942,10 +928,7 @@ asc_docs_api.prototype.asc_DownloadAs = function(typeFile){//передаем ч ...@@ -942,10 +928,7 @@ asc_docs_api.prototype.asc_DownloadAs = function(typeFile){//передаем ч
var editor = this; var editor = this;
_downloadAs(this, typeFile, function(incomeObject){ _downloadAs(this, typeFile, function(incomeObject){
if(null != incomeObject && "save" == incomeObject.type) if(null != incomeObject && "save" == incomeObject.type)
{ editor.processSavedFile(incomeObject.data, false);
var outputData = JSON.parse(incomeObject.data);
editor.processSavedFile(outputData.url, false);
}
editor.sync_EndAction(c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.DownloadAs);}, true); editor.sync_EndAction(c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.DownloadAs);}, true);
} }
asc_docs_api.prototype.Resize = function(){ asc_docs_api.prototype.Resize = function(){
...@@ -3878,7 +3861,7 @@ function sendCommand(editor, fCallback, rdata){ ...@@ -3878,7 +3861,7 @@ function sendCommand(editor, fCallback, rdata){
fCallback(incomeObject); fCallback(incomeObject);
break; break;
case "waitsave": 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); setTimeout( function(){sendCommand(editor, fCallback, JSON.stringify(rData))}, 3000);
break; break;
case "savepart": case "savepart":
......
...@@ -6,6 +6,7 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS"; ...@@ -6,6 +6,7 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
var documentId = undefined; var documentId = undefined;
var documentUrl = 'null'; var documentUrl = 'null';
var documentTitle = 'null'; var documentTitle = 'null';
var documentTitleWithoutExtention = 'null';
var documentFormat = 'null'; var documentFormat = 'null';
var documentVKey = null; var documentVKey = null;
var documentOrigin = ""; var documentOrigin = "";
...@@ -772,6 +773,12 @@ asc_docs_api.prototype.LoadDocument = function(c_DocInfo) ...@@ -772,6 +773,12 @@ asc_docs_api.prototype.LoadDocument = function(c_DocInfo)
documentTitle = this.DocInfo.get_Title(); documentTitle = this.DocInfo.get_Title();
documentFormat = this.DocInfo.get_Format(); 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(); documentVKey = this.DocInfo.get_VKey();
// documentOrigin = this.DocInfo.get_Origin(); // documentOrigin = this.DocInfo.get_Origin();
var sProtocol = window.location.protocol; var sProtocol = window.location.protocol;
...@@ -2173,10 +2180,7 @@ asc_docs_api.prototype.asc_Print = function() ...@@ -2173,10 +2180,7 @@ asc_docs_api.prototype.asc_Print = function()
else else
_downloadAs(this, c_oAscFileType.PDF, function(incomeObject){ _downloadAs(this, c_oAscFileType.PDF, function(incomeObject){
if(null != incomeObject && "save" == incomeObject.type) if(null != incomeObject && "save" == incomeObject.type)
{ editor.processSavedFile(incomeObject.data, false);
var outputData = JSON.parse(incomeObject.data);
editor.processSavedFile(outputData.url, false);
}
editor.sync_EndAction(c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.Print);}, true); editor.sync_EndAction(c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.Print);}, true);
} }
} }
...@@ -2274,10 +2278,7 @@ function OnSave_Callback(e) ...@@ -2274,10 +2278,7 @@ function OnSave_Callback(e)
var sData = "mnuSaveAs" + cCharDelimiter + JSON.stringify(oAdditionalData) + cCharDelimiter + data; var sData = "mnuSaveAs" + cCharDelimiter + JSON.stringify(oAdditionalData) + cCharDelimiter + data;
sendCommand(editor, function(incomeObject){ sendCommand(editor, function(incomeObject){
if(null != incomeObject && "save" == incomeObject.type) if(null != incomeObject && "save" == incomeObject.type)
{ editor.processSavedFile(incomeObject.data, true);
var outputData = JSON.parse(incomeObject.data);
editor.processSavedFile(outputData.url, true);
}
}, sData); }, sData);
} }
} else { } else {
...@@ -2296,10 +2297,7 @@ asc_docs_api.prototype.asc_DownloadAs = function(typeFile){//передаем ч ...@@ -2296,10 +2297,7 @@ asc_docs_api.prototype.asc_DownloadAs = function(typeFile){//передаем ч
var editor = this; var editor = this;
_downloadAs(this, typeFile, function(incomeObject){ _downloadAs(this, typeFile, function(incomeObject){
if(null != incomeObject && "save" == incomeObject.type) if(null != incomeObject && "save" == incomeObject.type)
{ editor.processSavedFile(incomeObject.data, false);
var outputData = JSON.parse(incomeObject.data);
editor.processSavedFile(outputData.url, false);
}
editor.sync_EndAction(c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.DownloadAs);}, true); editor.sync_EndAction(c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.DownloadAs);}, true);
} }
asc_docs_api.prototype.Resize = function(){ asc_docs_api.prototype.Resize = function(){
...@@ -2343,26 +2341,14 @@ asc_docs_api.prototype.processSavedFile = function(url, bInner) ...@@ -2343,26 +2341,14 @@ asc_docs_api.prototype.processSavedFile = function(url, bInner)
{ {
if(bInner) if(bInner)
{ {
var urlAbs = documentOrigin + g_sResourceServiceLocalUrl + encodeURIComponent(url); this.asc_fireCallback("asc_onSaveUrl", url, function(hasError){});
this.asc_fireCallback("asc_onSaveUrl", urlAbs, function(hasError){});
} }
else else
{ {
var urlAbs = g_sResourceServiceLocalUrl + encodeURIComponent(url); if( this.isMobileVersion )
var nIndex = documentTitle.lastIndexOf("."); window.open("/Common/MobileDownloader/download.html?file="+encodeURIComponent(url),"_parent","",false);
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);
}
else else
getFile(urlAbs); getFile(url);
} }
} }
asc_docs_api.prototype.startGetDocInfo = function(){ asc_docs_api.prototype.startGetDocInfo = function(){
...@@ -6466,7 +6452,7 @@ function sendCommand(editor, fCallback, rdata){ ...@@ -6466,7 +6452,7 @@ function sendCommand(editor, fCallback, rdata){
break; break;
case "waitsave": 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); setTimeout( function(){sendCommand(editor, fCallback, JSON.stringify(rData))}, 3000);
} }
break; break;
......
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