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