Commit 3b2cf7e2 authored by Alexander.Trofimov's avatar Alexander.Trofimov Committed by Alexander.Trofimov

При открытии выставляем состояние c_oAscAdvancedOptionsAction.Open и его проверяем при ошибке.

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@63195 954022d7-b5bf-4e40-9824-e11837661b57
parent 3880a364
...@@ -900,7 +900,7 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS"; ...@@ -900,7 +900,7 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
return this.wbModel.getWorksheet(sheetIndex).PagePrintOptions; return this.wbModel.getWorksheet(sheetIndex).PagePrintOptions;
}; };
spreadsheet_api.prototype._sendCommandCallback = function (fCallback, error, result, rdata) { spreadsheet_api.prototype._sendCommandCallback = function (fCallback, error, result) {
if (error || !result) { if (error || !result) {
this.handlers.trigger("asc_onError", c_oAscError.ID.Unknown, c_oAscError.Level.Critical); this.handlers.trigger("asc_onError", c_oAscError.ID.Unknown, c_oAscError.Level.Critical);
if(fCallback) if(fCallback)
...@@ -964,8 +964,7 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS"; ...@@ -964,8 +964,7 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
this.handlers.trigger("asc_onAdvancedOptions", new asc.asc_CAdvancedOptions(c_oAscAdvancedOptionsID.CSV,cp), this.advancedOptionsAction); this.handlers.trigger("asc_onAdvancedOptions", new asc.asc_CAdvancedOptions(c_oAscAdvancedOptionsID.CSV,cp), this.advancedOptionsAction);
break; break;
case "save": case "save":
if(fCallback) if(fCallback) fCallback(result);
fCallback(result);
break; break;
case "waitopen": case "waitopen":
rData = { rData = {
...@@ -990,22 +989,19 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS"; ...@@ -990,22 +989,19 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
setTimeout(function(){sendCommand2(fCallback, t.fCallbackSendCommand, rData);}, 3000); setTimeout(function(){sendCommand2(fCallback, t.fCallbackSendCommand, rData);}, 3000);
break; break;
case "getsettings": case "getsettings":
if(fCallback) if(fCallback) fCallback(result);
fCallback(result);
break; break;
case "err": case "err":
var nErrorLevel = c_oAscError.Level.NoCritical; var nErrorLevel = c_oAscError.Level.NoCritical;
var errorId = result["data"] >> 0; var errorId = result["data"] >> 0;
//todo передалеть работу с callback //todo передалеть работу с callback
if("getsettings" == rdata["c"] || "open" == rdata["c"] || "chopen" == rdata["c"] || "create" == rdata["c"]) if (c_oAscAdvancedOptionsAction.Open === this.advancedOptionsAction)
nErrorLevel = c_oAscError.Level.Critical; nErrorLevel = c_oAscError.Level.Critical;
this.handlers.trigger("asc_onError", g_fMapAscServerErrorToAscError(errorId), nErrorLevel); this.handlers.trigger("asc_onError", g_fMapAscServerErrorToAscError(errorId), nErrorLevel);
if(fCallback) if (fCallback) fCallback({returnCode: nErrorLevel, val:errorId});
fCallback({returnCode: nErrorLevel, val:errorId});
break; break;
default: default:
if(fCallback) if(fCallback) fCallback(result);
fCallback(result);
break; break;
} }
}; };
...@@ -1070,37 +1066,39 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS"; ...@@ -1070,37 +1066,39 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
}; };
spreadsheet_api.prototype._asc_open = function (fCallback) { //fCallback({returnCode:"", val:obj, ...}) spreadsheet_api.prototype._asc_open = function (fCallback) { //fCallback({returnCode:"", val:obj, ...})
if (this.chartEditor) { if (!this.chartEditor) {
} else if (!this.documentId || !this.documentUrl) { // Меняем тип состояния (на открытие)
// Назначим id-сами, если он не пришел (для открытия тестового документа) this.advancedOptionsAction = c_oAscAdvancedOptionsAction.Open;
if (!this.documentId)
this.documentId = '9876543210'; if (!this.documentId || !this.documentUrl) {
this._OfflineAppDocumentStartLoad(fCallback); // Назначим id-сами, если он не пришел (для открытия тестового документа)
} else { if (!this.documentId)
var v = { this.documentId = '9876543210';
"c" : '', this._OfflineAppDocumentStartLoad(fCallback);
"id" : this.documentId,
"userid" : this.documentUserId,
"format" : this.documentFormat,
"vkey" : this.documentVKey,
"editorid" : c_oEditorId.Spreadsheet,
"url" : this.documentUrl,
"title" : this.documentTitle,
"embeddedfonts" : this.isUseEmbeddedCutFonts,
"viewmode" : this.asc_getViewerMode()
};
if (false && this.documentOpenOptions && this.documentOpenOptions["isEmpty"]) {
var sEmptyWorkbook = getEmptyWorkbook();
v["c"] = "create";
v["data"] = sEmptyWorkbook;
sendCommand2(fCallback, this.fCallbackSendCommand, v);
var wb = this.asc_OpenDocument(g_sResourceServiceLocalUrl + this.documentId + "/", sEmptyWorkbook);
fCallback({returnCode: 0, val:wb});
} else { } else {
// Меняем тип состояния (на открытие) var v = {
this.advancedOptionsAction = c_oAscAdvancedOptionsAction.Open; "c" : '',
v["c"] = "open"; "id" : this.documentId,
sendCommand2(fCallback, this.fCallbackSendCommand, v); "userid" : this.documentUserId,
"format" : this.documentFormat,
"vkey" : this.documentVKey,
"editorid" : c_oEditorId.Spreadsheet,
"url" : this.documentUrl,
"title" : this.documentTitle,
"embeddedfonts" : this.isUseEmbeddedCutFonts,
"viewmode" : this.asc_getViewerMode()
};
if (false && this.documentOpenOptions && this.documentOpenOptions["isEmpty"]) {
var sEmptyWorkbook = getEmptyWorkbook();
v["c"] = "create";
v["data"] = sEmptyWorkbook;
sendCommand2(fCallback, this.fCallbackSendCommand, v);
var wb = this.asc_OpenDocument(g_sResourceServiceLocalUrl + this.documentId + "/", sEmptyWorkbook);
fCallback({returnCode: 0, val:wb});
} else {
v["c"] = "open";
sendCommand2(fCallback, this.fCallbackSendCommand, v);
}
} }
} }
}; };
......
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