Commit c78f3753 authored by Alexander.Trofimov's avatar Alexander.Trofimov Committed by Alexander.Trofimov

Добавил тип состояния в Word. Убрал передачу параметра запроса в ответ.

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@63199 954022d7-b5bf-4e40-9824-e11837661b57
parent 668d34c7
......@@ -116,16 +116,16 @@ function sendCommand2 (fCallback, callback, rdata) {
url: g_sMainServiceLocalUrl,
data: sData,
contentType: sRequestContentType,
error: function () { callback(fCallback, true, undefined, rdata); },
error: function () { callback(fCallback, true); },
success: function (msg) {
if (!msg || msg.length < 1) {
//result = {returnCode: c_oAscError.Level.Critical, val:c_oAscError.ID.Unknown};
//oThis.handlers.trigger("asc_onError", c_oAscError.ID.Unknown, c_oAscError.Level.Critical);
//if(callback)
// callback(result);
callback(fCallback, true, undefined, rdata);
callback(fCallback, true);
} else {
callback(fCallback, false, JSON.parse(msg), rdata);
callback(fCallback, false, JSON.parse(msg));
}
},
dataType: 'text'
......
......@@ -412,6 +412,9 @@ function asc_docs_api(name)
this.mailMergeFileData = null;
// Тип состояния на данный момент (сохранение, открытие или никакое)
this.advancedOptionsAction = c_oAscAdvancedOptionsAction.None;
// CoAuthoring and Chat
this.User = undefined;
this.CoAuthoringApi = new CDocsCoApi();
......@@ -758,7 +761,11 @@ asc_docs_api.prototype.asc_getEditorPermissions = function() {
};
var t = this;
sendCommand2(function (response) {t.asc_getEditorPermissionsCallback(response);}, _sendCommandCallback, rData);
this.advancedOptionsAction = c_oAscAdvancedOptionsAction.Perm;
sendCommand2(function (response) {
t.advancedOptionsAction = c_oAscAdvancedOptionsAction.None;
t.asc_getEditorPermissionsCallback(response);
}, _sendCommandCallback, rData);
} else {
var asc_CAscEditorPermissions = window["Asc"].asc_CAscEditorPermissions;
this.asc_fireCallback("asc_onGetEditorPermissions", new asc_CAscEditorPermissions());
......@@ -888,6 +895,9 @@ asc_docs_api.prototype.LoadDocument = function(c_DocInfo)
window["AscDesktopEditor"]["SetDocumentName"](this.DocumentName);
}
// Меняем тип состояния (на открытие)
this.advancedOptionsAction = c_oAscAdvancedOptionsAction.Open;
if (this.DocInfo.get_OfflineApp() === true)
{
this.OfflineAppDocumentStartLoad();
......@@ -6284,6 +6294,9 @@ asc_docs_api.prototype.OpenDocumentEndCallback = function()
{
window['qtDocBridge']['documentContentReady'] ();
}
// Меняем тип состояния (на никакое)
this.advancedOptionsAction = c_oAscAdvancedOptionsAction.None;
};
asc_docs_api.prototype.UpdateInterfaceState = function()
......@@ -6986,12 +6999,11 @@ window["asc_nativeOnSpellCheck"] = function (response)
editor.SpellCheckApi.onSpellCheck(response);
};
function _sendCommandCallback (fCallback, error, result, rdata) {
function _sendCommandCallback (fCallback, error, result) {
if (error || !result) {
if("save" != rdata["c"] && "chsave" != rdata["c"])
if (c_oAscAdvancedOptionsAction.Save !== editor.advancedOptionsAction)
editor.asc_fireCallback("asc_onError",c_oAscError.ID.Unknown,c_oAscError.Level.Critical);
if(fCallback)
fCallback();
if (fCallback) fCallback();
return;
}
......@@ -7042,8 +7054,7 @@ function _sendCommandCallback (fCallback, error, result, rdata) {
setTimeout( function(){sendCommand2(fCallback, _sendCommandCallback, rData)}, 3000);
break;
case "save":
if(fCallback)
fCallback(result);
if (fCallback) fCallback(result);
break;
case "waitsave":
{
......@@ -7059,23 +7070,21 @@ function _sendCommandCallback (fCallback, error, result, rdata) {
}
break;
case "getsettings":
if(fCallback)
fCallback(result);
if (fCallback) fCallback(result);
break;
case "err":
if("save" != rdata["c"] && "chsave" != rdata["c"]){
if (c_oAscAdvancedOptionsAction.Save !== editor.advancedOptionsAction) {
var nErrorLevel = c_oAscError.Level.NoCritical;
//todo передалеть работу с callback
if("getsettings" == rdata["c"] || "open" == rdata["c"] || "chopen" == rdata["c"] || "create" == rdata["c"])
if (c_oAscAdvancedOptionsAction.Perm === editor.advancedOptionsAction ||
c_oAscAdvancedOptionsAction.Open === editor.advancedOptionsAction)
nErrorLevel = c_oAscError.Level.Critical;
editor.asc_fireCallback("asc_onError", g_fMapAscServerErrorToAscError(parseInt(result["data"])), nErrorLevel);
editor.asc_fireCallback("asc_onError", g_fMapAscServerErrorToAscError(result["data"] >> 0), nErrorLevel);
}
if(fCallback)
fCallback(result);
if (fCallback) fCallback(result);
break;
default:
if(fCallback)
fCallback(result);
if (fCallback) fCallback(result);
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