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 @@
<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>
......
......@@ -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);
},
......
......@@ -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":
......
......@@ -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;
......
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