Commit 462a4a21 authored by Alexander.Trofimov's avatar Alexander.Trofimov Committed by Alexander.Trofimov

Добавил событие asc_onDocumentUpdateVersion - эвент о том, что файл собрался и...

Добавил событие asc_onDocumentUpdateVersion - эвент о том, что файл собрался и не может больше редактироваться
Баг http://bugzserver/show_bug.cgi?id=25052 и http://bugzserver/show_bug.cgi?id=25810

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@57814 954022d7-b5bf-4e40-9824-e11837661b57
parent 3e4d744e
...@@ -7279,55 +7279,26 @@ function sendCommand(editor, fCallback, rdata){ ...@@ -7279,55 +7279,26 @@ function sendCommand(editor, fCallback, rdata){
type: 'POST', type: 'POST',
url: g_sMainServiceLocalUrl, url: g_sMainServiceLocalUrl,
data: sData, data: sData,
error: function(jqXHR, textStatus, errorThrown){ error: function(){
editor.asc_fireCallback("asc_onError",c_oAscError.ID.Unknown,c_oAscError.Level.Critical); editor.asc_fireCallback("asc_onError",c_oAscError.ID.Unknown,c_oAscError.Level.Critical);
if(fCallback) if(fCallback)
fCallback(); fCallback();
}, },
success: function(msg){ success: function(msg){
var incomeObject = JSON.parse(msg); var incomeObject = JSON.parse(msg), rData;
switch (incomeObject["type"]) { switch (incomeObject["type"]) {
case "updateversion": case "updateversion":
case "open": editor.asc_fireCallback("asc_onDocumentUpdateVersion", function () {
if ("updateversion" == incomeObject["type"]){ editor.SetViewMode(true);
editor.SetViewMode(true); _onOpenCommand(fCallback, incomeObject);
editor.asc_fireCallback("asc_onError",c_oAscError.ID.FileRequest,c_oAscError.Level.Critical);
}
var sJsonUrl = g_sResourceServiceLocalUrl + incomeObject["data"];
asc_ajax({
url: sJsonUrl,
dataType: "text",
success: function(result, textStatus) {
//получаем url к папке с файлом
var url;
var nIndex = sJsonUrl.lastIndexOf("/");
if(-1 != nIndex)
url = sJsonUrl.substring(0, nIndex + 1);
else
url = sJsonUrl;
var bIsViewer = false;
if(result.length > 0)
{
if(c_oSerFormat.Signature != result.substring(0, c_oSerFormat.Signature.length))
bIsViewer = true;
}
if(true == bIsViewer)
editor.OpenDocument(url, result);
else
editor.OpenDocument2(url, result);
if(fCallback)
fCallback(incomeObject);
},
error:function(){
editor.asc_fireCallback("asc_onError",c_oAscError.ID.Unknown,c_oAscError.Level.Critical);
if(fCallback)
fCallback();
}
}); });
break; break;
case "open":
_onOpenCommand(fCallback, incomeObject);
break;
case "needparams": case "needparams":
//todo dialog //todo dialog
var rData = { rData = {
"id":documentId, "id":documentId,
"userid": documentUserId, "userid": documentUserId,
"format": documentFormat, "format": documentFormat,
...@@ -7339,7 +7310,7 @@ function sendCommand(editor, fCallback, rdata){ ...@@ -7339,7 +7310,7 @@ function sendCommand(editor, fCallback, rdata){
"codepage": documentFormatSaveTxtCodepage, "codepage": documentFormatSaveTxtCodepage,
"embeddedfonts": editor.isUseEmbeddedCutFonts}; "embeddedfonts": editor.isUseEmbeddedCutFonts};
sendCommand(editor, fCallback, rData) sendCommand(editor, fCallback, rData);
break; break;
case "waitopen": case "waitopen":
if (incomeObject["data"]) if (incomeObject["data"])
...@@ -7347,7 +7318,7 @@ function sendCommand(editor, fCallback, rdata){ ...@@ -7347,7 +7318,7 @@ function sendCommand(editor, fCallback, rdata){
editor._lastConvertProgress = incomeObject["data"] / 2; editor._lastConvertProgress = incomeObject["data"] / 2;
editor.sync_SendProgress(editor._lastConvertProgress); editor.sync_SendProgress(editor._lastConvertProgress);
} }
var rData = { rData = {
"id": documentId, "id": documentId,
"userid": documentUserId, "userid": documentUserId,
"format": documentFormat, "format": documentFormat,
...@@ -7358,7 +7329,7 @@ function sendCommand(editor, fCallback, rdata){ ...@@ -7358,7 +7329,7 @@ function sendCommand(editor, fCallback, rdata){
setTimeout( function(){sendCommand(editor, fCallback, rData)}, 3000); setTimeout( function(){sendCommand(editor, fCallback, rData)}, 3000);
break; break;
case "changes": case "changes":
//var rData = {"id":documentId, "c":"sfc", "outputformat": c_oAscFileType.DOCX}; //rData = {"id":documentId, "c":"sfc", "outputformat": c_oAscFileType.DOCX};
//sendCommand(editor, fCallback, rData); //sendCommand(editor, fCallback, rData);
if(fCallback) if(fCallback)
fCallback(incomeObject); fCallback(incomeObject);
...@@ -7372,7 +7343,7 @@ function sendCommand(editor, fCallback, rdata){ ...@@ -7372,7 +7343,7 @@ function sendCommand(editor, fCallback, rdata){
break; break;
case "waitsave": case "waitsave":
{ {
var rData = { rData = {
"id":documentId, "id":documentId,
"userid": documentUserId, "userid": documentUserId,
"vkey": documentVKey, "vkey": documentVKey,
...@@ -7406,15 +7377,14 @@ function sendCommand(editor, fCallback, rdata){ ...@@ -7406,15 +7377,14 @@ function sendCommand(editor, fCallback, rdata){
break; break;
} }
} }
}) });
}
}
function sendTrack(fCallback, url, rdata){ function sendTrack(fCallback, url, rdata){
asc_ajax({ asc_ajax({
type: 'POST', type: 'POST',
url: url, url: url,
data: rdata, data: rdata,
error: function(jqXHR, textStatus, errorThrown){ error: function(){
if(fCallback) if(fCallback)
fCallback(); fCallback();
}, },
...@@ -7425,9 +7395,41 @@ function sendTrack(fCallback, url, rdata){ ...@@ -7425,9 +7395,41 @@ function sendTrack(fCallback, url, rdata){
} }
}) })
} }
function _onOpenCommand(fCallback, incomeObject) {
var sJsonUrl = g_sResourceServiceLocalUrl + incomeObject["data"];
asc_ajax({
url: sJsonUrl,
dataType: "text",
success: function(result) {
//получаем url к папке с файлом
var url;
var nIndex = sJsonUrl.lastIndexOf("/");
if(-1 != nIndex)
url = sJsonUrl.substring(0, nIndex + 1);
else
url = sJsonUrl;
var bIsViewer = false;
if(result.length > 0)
{
if(c_oSerFormat.Signature != result.substring(0, c_oSerFormat.Signature.length))
bIsViewer = true;
}
if(true == bIsViewer)
editor.OpenDocument(url, result);
else
editor.OpenDocument2(url, result);
if(fCallback)
fCallback(incomeObject);
},
error:function(){
editor.asc_fireCallback("asc_onError",c_oAscError.ID.Unknown,c_oAscError.Level.Critical);
if(fCallback)
fCallback();
}
});
}
function _downloadAs(editor, filetype, fCallback, bStart, sSaveKey) function _downloadAs(editor, filetype, fCallback, bStart, sSaveKey)
{ {
var sData;
var oAdditionalData = {}; var oAdditionalData = {};
oAdditionalData["c"] = "save"; oAdditionalData["c"] = "save";
oAdditionalData["id"] = documentId; oAdditionalData["id"] = documentId;
......
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