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){
type: 'POST',
url: g_sMainServiceLocalUrl,
data: sData,
error: function(jqXHR, textStatus, errorThrown){
error: function(){
editor.asc_fireCallback("asc_onError",c_oAscError.ID.Unknown,c_oAscError.Level.Critical);
if(fCallback)
fCallback();
},
success: function(msg){
var incomeObject = JSON.parse(msg);
var incomeObject = JSON.parse(msg), rData;
switch (incomeObject["type"]) {
case "updateversion":
case "open":
if ("updateversion" == incomeObject["type"]){
editor.SetViewMode(true);
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();
}
editor.asc_fireCallback("asc_onDocumentUpdateVersion", function () {
editor.SetViewMode(true);
_onOpenCommand(fCallback, incomeObject);
});
break;
break;
case "open":
_onOpenCommand(fCallback, incomeObject);
break;
case "needparams":
//todo dialog
var rData = {
rData = {
"id":documentId,
"userid": documentUserId,
"format": documentFormat,
......@@ -7339,7 +7310,7 @@ function sendCommand(editor, fCallback, rdata){
"codepage": documentFormatSaveTxtCodepage,
"embeddedfonts": editor.isUseEmbeddedCutFonts};
sendCommand(editor, fCallback, rData)
sendCommand(editor, fCallback, rData);
break;
case "waitopen":
if (incomeObject["data"])
......@@ -7347,7 +7318,7 @@ function sendCommand(editor, fCallback, rdata){
editor._lastConvertProgress = incomeObject["data"] / 2;
editor.sync_SendProgress(editor._lastConvertProgress);
}
var rData = {
rData = {
"id": documentId,
"userid": documentUserId,
"format": documentFormat,
......@@ -7358,7 +7329,7 @@ function sendCommand(editor, fCallback, rdata){
setTimeout( function(){sendCommand(editor, fCallback, rData)}, 3000);
break;
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);
if(fCallback)
fCallback(incomeObject);
......@@ -7372,7 +7343,7 @@ function sendCommand(editor, fCallback, rdata){
break;
case "waitsave":
{
var rData = {
rData = {
"id":documentId,
"userid": documentUserId,
"vkey": documentVKey,
......@@ -7406,15 +7377,14 @@ function sendCommand(editor, fCallback, rdata){
break;
}
}
})
}
});
}
function sendTrack(fCallback, url, rdata){
asc_ajax({
type: 'POST',
url: url,
data: rdata,
error: function(jqXHR, textStatus, errorThrown){
error: function(){
if(fCallback)
fCallback();
},
......@@ -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)
{
var sData;
var oAdditionalData = {};
oAdditionalData["c"] = "save";
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