Commit 8c8aa8cb authored by Alexander.Trofimov's avatar Alexander.Trofimov

ConvertationError -> ConvertationOpenError, ConvertationSaveError

parent 727117d2
...@@ -757,7 +757,7 @@ var editor; ...@@ -757,7 +757,7 @@ var editor;
} }
}; };
spreadsheet_api.prototype._asc_save2 = function() { spreadsheet_api.prototype._asc_save2 = function () {
var oBinaryFileWriter = new AscCommonExcel.BinaryFileWriter(this.wbModel); var oBinaryFileWriter = new AscCommonExcel.BinaryFileWriter(this.wbModel);
var dataContainer = {data: null, part: null, index: 0, count: 0}; var dataContainer = {data: null, part: null, index: 0, count: 0};
dataContainer.data = oBinaryFileWriter.Write(); dataContainer.data = oBinaryFileWriter.Write();
...@@ -768,10 +768,11 @@ var editor; ...@@ -768,10 +768,11 @@ var editor;
oAdditionalData["userid"] = this.documentUserId; oAdditionalData["userid"] = this.documentUserId;
oAdditionalData["jwt"] = this.CoAuthoringApi.get_jwt(); oAdditionalData["jwt"] = this.CoAuthoringApi.get_jwt();
oAdditionalData["outputformat"] = filetype; oAdditionalData["outputformat"] = filetype;
oAdditionalData["title"] = AscCommon.changeFileExtention(this.documentTitle, AscCommon.getExtentionByFormat(filetype)); oAdditionalData["title"] =
AscCommon.changeFileExtention(this.documentTitle, AscCommon.getExtentionByFormat(filetype));
oAdditionalData["savetype"] = AscCommon.c_oAscSaveTypes.CompleteAll; oAdditionalData["savetype"] = AscCommon.c_oAscSaveTypes.CompleteAll;
var t = this; var t = this;
t.fCurCallback = function(incomeObject) { t.fCurCallback = function (incomeObject) {
if (null != input && "save" == input["type"]) { if (null != input && "save" == input["type"]) {
if ('ok' == input["status"]) { if ('ok' == input["status"]) {
var url = input["data"]; var url = input["data"];
...@@ -781,13 +782,15 @@ var editor; ...@@ -781,13 +782,15 @@ var editor;
t.handlers.trigger("asc_onError", c_oAscError.ID.Unknown, c_oAscError.Level.NoCritical); t.handlers.trigger("asc_onError", c_oAscError.ID.Unknown, c_oAscError.Level.NoCritical);
} }
} else { } else {
t.handlers.trigger("asc_onError", mapAscServerErrorToAscError(parseInt(input["data"])), c_oAscError.Level.NoCritical); t.handlers.trigger("asc_onError",
mapAscServerErrorToAscError(parseInt(input["data"]), AscCommon.c_oAscAdvancedOptionsAction.Save),
c_oAscError.Level.NoCritical);
} }
} else { } else {
t.handlers.trigger("asc_onError", c_oAscError.ID.Unknown, c_oAscError.Level.NoCritical); t.handlers.trigger("asc_onError", c_oAscError.ID.Unknown, c_oAscError.Level.NoCritical);
} }
}; };
AscCommon.saveWithParts(function(fCallback1, oAdditionalData1, dataContainer1) { AscCommon.saveWithParts(function (fCallback1, oAdditionalData1, dataContainer1) {
sendCommand(t, fCallback1, oAdditionalData1, dataContainer1); sendCommand(t, fCallback1, oAdditionalData1, dataContainer1);
}, t.fCurCallback, null, oAdditionalData, dataContainer); }, t.fCurCallback, null, oAdditionalData, dataContainer);
}; };
...@@ -851,7 +854,7 @@ var editor; ...@@ -851,7 +854,7 @@ var editor;
t.processSavedFile(url, options.downloadType); t.processSavedFile(url, options.downloadType);
} }
} else { } else {
error = mapAscServerErrorToAscError(parseInt(input["data"])); error = mapAscServerErrorToAscError(parseInt(input["data"]), AscCommon.c_oAscAdvancedOptionsAction.Save);
} }
} }
if (c_oAscError.ID.No != error) { if (c_oAscError.ID.No != error) {
...@@ -2196,17 +2199,18 @@ var editor; ...@@ -2196,17 +2199,18 @@ var editor;
return ret; return ret;
}; };
spreadsheet_api.prototype.asc_addImageDrawingObject = function(imageUrl) { spreadsheet_api.prototype.asc_addImageDrawingObject = function (imageUrl) {
var rData = { var rData = {
"id": this.documentId, "id": this.documentId,
"userid": this.documentUserId, "userid": this.documentUserId,
"c": "imgurl", "c": "imgurl",
"saveindex": g_oDocumentUrls.getMaxIndex(), "saveindex": g_oDocumentUrls.getMaxIndex(),
"data": imageUrl}; "data": imageUrl
};
var t = this; var t = this;
this.sync_StartAction(c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.UploadImage); this.sync_StartAction(c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.UploadImage);
this.fCurCallback = function(input) { this.fCurCallback = function (input) {
if (null != input && "imgurl" == input["type"]) { if (null != input && "imgurl" == input["type"]) {
if ("ok" == input["status"]) { if ("ok" == input["status"]) {
var data = input["data"]; var data = input["data"];
...@@ -2229,7 +2233,8 @@ var editor; ...@@ -2229,7 +2233,8 @@ var editor;
t.handlers.trigger("asc_onError", c_oAscError.ID.Unknown, c_oAscError.Level.NoCritical); t.handlers.trigger("asc_onError", c_oAscError.ID.Unknown, c_oAscError.Level.NoCritical);
} }
} else { } else {
t.handlers.trigger("asc_onError", mapAscServerErrorToAscError(parseInt(input["data"])), c_oAscError.Level.NoCritical); t.handlers.trigger("asc_onError", mapAscServerErrorToAscError(parseInt(input["data"])),
c_oAscError.Level.NoCritical);
} }
} else { } else {
t.handlers.trigger("asc_onError", c_oAscError.ID.Unknown, c_oAscError.Level.NoCritical); t.handlers.trigger("asc_onError", c_oAscError.ID.Unknown, c_oAscError.Level.NoCritical);
......
...@@ -645,42 +645,31 @@ ...@@ -645,42 +645,31 @@
t.sendEvent('asc_onError', errorCode, c_oAscError.Level.NoCritical); t.sendEvent('asc_onError', errorCode, c_oAscError.Level.NoCritical);
} }
}; };
this.CoAuthoringApi.onDocumentOpen = function(inputWrap) this.CoAuthoringApi.onDocumentOpen = function (inputWrap) {
{ if (inputWrap["data"]) {
if (inputWrap["data"])
{
var input = inputWrap["data"]; var input = inputWrap["data"];
switch (input["type"]) switch (input["type"]) {
{
case 'reopen': case 'reopen':
case 'open': case 'open':
switch (input["status"]) switch (input["status"]) {
{
case "updateversion": case "updateversion":
case "ok": case "ok":
var urls = input["data"]; var urls = input["data"];
AscCommon.g_oDocumentUrls.init(urls); AscCommon.g_oDocumentUrls.init(urls);
if (null != urls['Editor.bin']) if (null != urls['Editor.bin']) {
{ if ('ok' === input["status"] || t.getViewMode()) {
if ('ok' === input["status"] || t.getViewMode())
{
t._onOpenCommand(urls['Editor.bin']); t._onOpenCommand(urls['Editor.bin']);
} } else {
else t.sendEvent("asc_onDocumentUpdateVersion", function () {
{ if (t.isCoAuthoringEnable) {
t.sendEvent("asc_onDocumentUpdateVersion", function()
{
if (t.isCoAuthoringEnable)
{
t.asc_coAuthoringDisconnect(); t.asc_coAuthoringDisconnect();
} }
t._onOpenCommand(urls['Editor.bin']); t._onOpenCommand(urls['Editor.bin']);
}) })
} }
} } else {
else t.sendEvent("asc_onError", c_oAscError.ID.ConvertationOpenError,
{ c_oAscError.Level.Critical);
t.sendEvent("asc_onError", c_oAscError.ID.ConvertationError, c_oAscError.Level.Critical);
} }
break; break;
case "needparams": case "needparams":
...@@ -690,18 +679,17 @@ ...@@ -690,18 +679,17 @@
t._onNeedParams(null, true); t._onNeedParams(null, true);
break; break;
case "err": case "err":
t.sendEvent("asc_onError", AscCommon.mapAscServerErrorToAscError(parseInt(input["data"])), c_oAscError.Level.Critical); t.sendEvent("asc_onError",
AscCommon.mapAscServerErrorToAscError(parseInt(input["data"]),
Asc.c_oAscError.ID.ConvertationOpenError), c_oAscError.Level.Critical);
break; break;
} }
break; break;
default: default:
if (t.fCurCallback) if (t.fCurCallback) {
{
t.fCurCallback(input); t.fCurCallback(input);
t.fCurCallback = null; t.fCurCallback = null;
} } else {
else
{
t.sendEvent("asc_onError", c_oAscError.ID.Unknown, c_oAscError.Level.NoCritical); t.sendEvent("asc_onError", c_oAscError.ID.Unknown, c_oAscError.Level.NoCritical);
} }
break; break;
......
...@@ -88,7 +88,7 @@ ...@@ -88,7 +88,7 @@
No : 0, No : 0,
Unknown : -1, Unknown : -1,
ConvertationTimeout : -2, ConvertationTimeout : -2,
ConvertationError : -3,
DownloadError : -4, DownloadError : -4,
UnexpectedGuid : -5, UnexpectedGuid : -5,
Database : -6, Database : -6,
...@@ -1080,7 +1080,6 @@ ...@@ -1080,7 +1080,6 @@
prot['No'] = prot.No; prot['No'] = prot.No;
prot['Unknown'] = prot.Unknown; prot['Unknown'] = prot.Unknown;
prot['ConvertationTimeout'] = prot.ConvertationTimeout; prot['ConvertationTimeout'] = prot.ConvertationTimeout;
prot['ConvertationError'] = prot.ConvertationError;
prot['ConvertationOpenError'] = prot.ConvertationOpenError; prot['ConvertationOpenError'] = prot.ConvertationOpenError;
prot['ConvertationSaveError'] = prot.ConvertationSaveError; prot['ConvertationSaveError'] = prot.ConvertationSaveError;
prot['DownloadError'] = prot.DownloadError; prot['DownloadError'] = prot.DownloadError;
......
...@@ -367,43 +367,73 @@ function openFileCommand(binUrl, changesUrl, Signature, callback) { ...@@ -367,43 +367,73 @@ function openFileCommand(binUrl, changesUrl, Signature, callback) {
}); });
} }
function mapAscServerErrorToAscError(nServerError) { function mapAscServerErrorToAscError(nServerError, nAction) {
var nRes = Asc.c_oAscError.ID.Unknown; var nRes = Asc.c_oAscError.ID.Unknown;
switch (nServerError) { switch (nServerError) {
case c_oAscServerError.NoError : nRes = Asc.c_oAscError.ID.No; break; case c_oAscServerError.NoError :
case c_oAscServerError.TaskQueue : nRes = Asc.c_oAscError.ID.No;
case c_oAscServerError.TaskResult : nRes = Asc.c_oAscError.ID.Database; break; break;
case c_oAscServerError.ConvertDownload : nRes = Asc.c_oAscError.ID.DownloadError; break; case c_oAscServerError.TaskQueue :
case c_oAscServerError.ConvertTimeout : nRes = Asc.c_oAscError.ID.ConvertationTimeout; break; case c_oAscServerError.TaskResult :
case c_oAscServerError.ConvertDRM : nRes = Asc.c_oAscError.ID.Database;
case c_oAscServerError.ConvertPASSWORD : nRes = Asc.c_oAscError.ID.ConvertationPassword; break; break;
case c_oAscServerError.ConvertCONVERT_CORRUPTED : case c_oAscServerError.ConvertDownload :
case c_oAscServerError.ConvertLIBREOFFICE : nRes = Asc.c_oAscError.ID.DownloadError;
case c_oAscServerError.ConvertPARAMS : break;
case c_oAscServerError.ConvertNEED_PARAMS : case c_oAscServerError.ConvertTimeout :
case c_oAscServerError.ConvertUnknownFormat : nRes = Asc.c_oAscError.ID.ConvertationTimeout;
case c_oAscServerError.ConvertReadFile : break;
case c_oAscServerError.Convert : nRes = Asc.c_oAscError.ID.ConvertationError; break; case c_oAscServerError.ConvertDRM :
case c_oAscServerError.UploadContentLength : nRes = Asc.c_oAscError.ID.UplImageSize; break; case c_oAscServerError.ConvertPASSWORD :
case c_oAscServerError.UploadExtension : nRes = Asc.c_oAscError.ID.UplImageExt; break; nRes = Asc.c_oAscError.ID.ConvertationPassword;
case c_oAscServerError.UploadCountFiles : nRes = Asc.c_oAscError.ID.UplImageFileCount; break; break;
case c_oAscServerError.VKey : nRes = Asc.c_oAscError.ID.FileVKey; break; case c_oAscServerError.ConvertCONVERT_CORRUPTED :
case c_oAscServerError.VKeyEncrypt : nRes = Asc.c_oAscError.ID.VKeyEncrypt; break; case c_oAscServerError.ConvertLIBREOFFICE :
case c_oAscServerError.VKeyKeyExpire : nRes = Asc.c_oAscError.ID.KeyExpire; break; case c_oAscServerError.ConvertPARAMS :
case c_oAscServerError.VKeyUserCountExceed : nRes = Asc.c_oAscError.ID.UserCountExceed; break; case c_oAscServerError.ConvertNEED_PARAMS :
case c_oAscServerError.Storage : case c_oAscServerError.ConvertUnknownFormat :
case c_oAscServerError.StorageFileNoFound : case c_oAscServerError.ConvertReadFile :
case c_oAscServerError.StorageRead : case c_oAscServerError.Convert :
case c_oAscServerError.StorageWrite : nRes =
case c_oAscServerError.StorageRemoveDir : AscCommon.c_oAscAdvancedOptionsAction.Save === nAction ? Asc.c_oAscError.ID.ConvertationSaveError :
case c_oAscServerError.StorageCreateDir : Asc.c_oAscError.ID.ConvertationOpenError;
case c_oAscServerError.StorageGetInfo : break;
case c_oAscServerError.Upload : case c_oAscServerError.UploadContentLength :
case c_oAscServerError.ReadRequestStream : nRes = Asc.c_oAscError.ID.UplImageSize;
case c_oAscServerError.Unknown : nRes = Asc.c_oAscError.ID.Unknown; break; break;
case c_oAscServerError.UploadExtension :
nRes = Asc.c_oAscError.ID.UplImageExt;
break;
case c_oAscServerError.UploadCountFiles :
nRes = Asc.c_oAscError.ID.UplImageFileCount;
break;
case c_oAscServerError.VKey :
nRes = Asc.c_oAscError.ID.FileVKey;
break;
case c_oAscServerError.VKeyEncrypt :
nRes = Asc.c_oAscError.ID.VKeyEncrypt;
break;
case c_oAscServerError.VKeyKeyExpire :
nRes = Asc.c_oAscError.ID.KeyExpire;
break;
case c_oAscServerError.VKeyUserCountExceed :
nRes = Asc.c_oAscError.ID.UserCountExceed;
break;
case c_oAscServerError.Storage :
case c_oAscServerError.StorageFileNoFound :
case c_oAscServerError.StorageRead :
case c_oAscServerError.StorageWrite :
case c_oAscServerError.StorageRemoveDir :
case c_oAscServerError.StorageCreateDir :
case c_oAscServerError.StorageGetInfo :
case c_oAscServerError.Upload :
case c_oAscServerError.ReadRequestStream :
case c_oAscServerError.Unknown :
nRes = Asc.c_oAscError.ID.Unknown;
break;
}
return nRes;
} }
return nRes;
}
function joinUrls(base, relative) { function joinUrls(base, relative) {
//http://stackoverflow.com/questions/14780350/convert-relative-path-to-absolute-using-javascript //http://stackoverflow.com/questions/14780350/convert-relative-path-to-absolute-using-javascript
......
...@@ -6150,7 +6150,8 @@ background-repeat: no-repeat;\ ...@@ -6150,7 +6150,8 @@ background-repeat: no-repeat;\
} }
else else
{ {
error = mapAscServerErrorToAscError(parseInt(input["data"])); error = mapAscServerErrorToAscError(parseInt(input["data"]),
AscCommon.c_oAscAdvancedOptionsAction.Save);
} }
} }
if (c_oAscError.ID.No != error) if (c_oAscError.ID.No != error)
......
...@@ -152,13 +152,10 @@ Asc['asc_docs_api'].prototype.asc_sendMailMergeData = function(oData) ...@@ -152,13 +152,10 @@ Asc['asc_docs_api'].prototype.asc_sendMailMergeData = function(oData)
this._downloadAs("sendmm", Asc.c_oAscFileType.TXT, actionType, options, function(input) { this._downloadAs("sendmm", Asc.c_oAscFileType.TXT, actionType, options, function(input) {
if (null != input && "sendmm" == input["type"]) if (null != input && "sendmm" == input["type"])
{ {
if ("ok" == input["status"]) if ("ok" != input["status"])
{ {
; t.sendEvent("asc_onError", AscCommon.mapAscServerErrorToAscError(parseInt(input["data"])),
} c_oAscError.Level.NoCritical);
else
{
t.sendEvent("asc_onError", AscCommon.mapAscServerErrorToAscError(parseInt(input["data"])), c_oAscError.Level.NoCritical);
} }
} }
else else
......
...@@ -7634,7 +7634,8 @@ background-repeat: no-repeat;\ ...@@ -7634,7 +7634,8 @@ background-repeat: no-repeat;\
} }
else else
{ {
error = mapAscServerErrorToAscError(parseInt(input["data"])); error = mapAscServerErrorToAscError(parseInt(input["data"]),
AscCommon.c_oAscAdvancedOptionsAction.Save);
} }
} }
if (c_oAscError.ID.No != error) if (c_oAscError.ID.No != error)
......
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