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

ConvertationError -> ConvertationOpenError, ConvertationSaveError

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