Commit 3880a364 authored by Alexander.Trofimov's avatar Alexander.Trofimov Committed by Alexander.Trofimov

Объединил asc_mapAscServerErrorToAscError и _mapAscServerErrorToAscError....

Объединил asc_mapAscServerErrorToAscError и _mapAscServerErrorToAscError. Перенес их в editorscommon.js

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@63194 954022d7-b5bf-4e40-9824-e11837661b57
parent 365503e4
......@@ -1126,7 +1126,7 @@ function DrawingObjects() {
worksheet.model.workbook.handlers.trigger("asc_onEndAction", c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.LoadImage);
}
else {
worksheet.model.workbook.handlers.trigger("asc_onError", api.asc_mapAscServerErrorToAscError(data["error"]), c_oAscError.Level.NoCritical);
worksheet.model.workbook.handlers.trigger("asc_onError", g_fMapAscServerErrorToAscError(data["error"]), c_oAscError.Level.NoCritical);
worksheet.model.workbook.handlers.trigger("asc_onEndAction", c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.LoadImage);
}
}
......@@ -3031,7 +3031,7 @@ function DrawingObjects() {
if(c_oAscServerError.NoError != nError)
{
bNeedSubmit = false;
worksheet.model.workbook.handlers.trigger("asc_onError", api.asc_mapAscServerErrorToAscError(nError), c_oAscError.Level.NoCritical);
worksheet.model.workbook.handlers.trigger("asc_onError", g_fMapAscServerErrorToAscError(nError), c_oAscError.Level.NoCritical);
}
}
if(bNeedSubmit)
......
......@@ -132,6 +132,39 @@ function sendCommand2 (fCallback, callback, rdata) {
});
}
function g_fMapAscServerErrorToAscError (nServerError) {
var nRes = c_oAscError.ID.Unknown;
switch (nServerError) {
case c_oAscServerError.NoError : nRes = c_oAscError.ID.No; break;
case c_oAscServerError.TaskQueue :
case c_oAscServerError.TaskResult : nRes = c_oAscError.ID.Database; break;
case c_oAscServerError.ConvertDownload : nRes = c_oAscError.ID.DownloadError; break;
case c_oAscServerError.ConvertTimeout : nRes = c_oAscError.ID.ConvertationTimeout; break;
case c_oAscServerError.ConvertMS_OFFCRYPTO : nRes = c_oAscError.ID.ConvertationPassword; break;
case c_oAscServerError.ConvertUnknownFormat :
case c_oAscServerError.ConvertReadFile :
case c_oAscServerError.Convert : nRes = c_oAscError.ID.ConvertationError; break;
case c_oAscServerError.UploadContentLength : nRes = c_oAscError.ID.UplImageSize; break;
case c_oAscServerError.UploadExtension : nRes = c_oAscError.ID.UplImageExt; break;
case c_oAscServerError.UploadCountFiles : nRes = c_oAscError.ID.UplImageFileCount; break;
case c_oAscServerError.VKey : nRes = c_oAscError.ID.FileVKey; break;
case c_oAscServerError.VKeyEncrypt : nRes = c_oAscError.ID.VKeyEncrypt; break;
case c_oAscServerError.VKeyKeyExpire : nRes = c_oAscError.ID.KeyExpire; break;
case c_oAscServerError.VKeyUserCountExceed : nRes = 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 = c_oAscError.ID.Unknown; break;
}
return nRes;
}
function fSortAscending( a, b ) {
return a - b;
}
......
......@@ -224,7 +224,7 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
xhr.send(fd);
}
} else
this.handlers.trigger("asc_onError", this.asc_mapAscServerErrorToAscError(nError), c_oAscError.Level.NoCritical);
this.handlers.trigger("asc_onError", g_fMapAscServerErrorToAscError(nError), c_oAscError.Level.NoCritical);
};
spreadsheet_api.prototype.asc_CheckGuiControlColors = function() {
......@@ -999,7 +999,7 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
//todo передалеть работу с callback
if("getsettings" == rdata["c"] || "open" == rdata["c"] || "chopen" == rdata["c"] || "create" == rdata["c"])
nErrorLevel = c_oAscError.Level.Critical;
this.handlers.trigger("asc_onError", this.asc_mapAscServerErrorToAscError(errorId), nErrorLevel);
this.handlers.trigger("asc_onError", g_fMapAscServerErrorToAscError(errorId), nErrorLevel);
if(fCallback)
fCallback({returnCode: nErrorLevel, val:errorId});
break;
......@@ -3554,40 +3554,6 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
window['appBridge']['dummyCommandLoadDocumentFromDisk'] ();
}
};
spreadsheet_api.prototype.asc_mapAscServerErrorToAscError = function(nServerError)
{
var nRes = c_oAscError.ID.Unknown;
switch(nServerError)
{
case c_oAscServerError.NoError : nRes = c_oAscError.ID.No;break;
case c_oAscServerError.TaskQueue :
case c_oAscServerError.TaskResult : nRes = c_oAscError.ID.Database;break;
case c_oAscServerError.ConvertDownload : nRes = c_oAscError.ID.DownloadError;break;
case c_oAscServerError.ConvertTimeout : nRes = c_oAscError.ID.ConvertationTimeout;break;
case c_oAscServerError.ConvertMS_OFFCRYPTO : nRes = c_oAscError.ID.ConvertationPassword;break;
case c_oAscServerError.ConvertUnknownFormat :
case c_oAscServerError.ConvertReadFile :
case c_oAscServerError.Convert : nRes = c_oAscError.ID.ConvertationError;break;
case c_oAscServerError.UploadContentLength : nRes = c_oAscError.ID.UplImageSize;break;
case c_oAscServerError.UploadExtension : nRes = c_oAscError.ID.UplImageExt;break;
case c_oAscServerError.UploadCountFiles : nRes = c_oAscError.ID.UplImageFileCount;break;
case c_oAscServerError.VKey : nRes = c_oAscError.ID.FileVKey;break;
case c_oAscServerError.VKeyEncrypt : nRes = c_oAscError.ID.VKeyEncrypt;break;
case c_oAscServerError.VKeyKeyExpire : nRes = c_oAscError.ID.KeyExpire;break;
case c_oAscServerError.VKeyUserCountExceed : nRes = 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 = c_oAscError.ID.Unknown;break;
}
return nRes;
};
spreadsheet_api.prototype.asc_nativeOpenFile = function(base64File, version)
{
......@@ -3977,7 +3943,6 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
prot["asc_formatPainter"] = prot.asc_formatPainter;
prot["asc_onMouseUp"] = prot.asc_onMouseUp;
prot["asc_mapAscServerErrorToAscError"] = prot.asc_mapAscServerErrorToAscError;
prot["asc_selectFunction"] = prot.asc_selectFunction;
prot["asc_insertHyperlink"] = prot.asc_insertHyperlink;
......
......@@ -214,7 +214,7 @@ function asc_docs_api(name)
xhr.send(fd);
}
else
oThis.asc_fireCallback("asc_onError",_mapAscServerErrorToAscError(nError),c_oAscError.Level.NoCritical);
oThis.asc_fireCallback("asc_onError", g_fMapAscServerErrorToAscError(nError), c_oAscError.Level.NoCritical);
};
}
}
......@@ -3035,7 +3035,7 @@ asc_docs_api.prototype.AddImage = function(){
if(c_oAscServerError.NoError != nError)
{
bNeedSubmit = false;
oThis.asc_fireCallback("asc_onError",_mapAscServerErrorToAscError(nError),c_oAscError.Level.NoCritical);
oThis.asc_fireCallback("asc_onError", g_fMapAscServerErrorToAscError(nError), c_oAscError.Level.NoCritical);
}
}
if(bNeedSubmit)
......@@ -4728,7 +4728,7 @@ asc_docs_api.prototype.OnHandleMessage = function(event)
this.AddImageUrl(urls[0]);
}
else
this.sync_ErrorCallback(_mapAscServerErrorToAscError(data["error"]), c_oAscError.Level.NoCritical);
this.sync_ErrorCallback(g_fMapAscServerErrorToAscError(data["error"]), c_oAscError.Level.NoCritical);
editor.sync_EndAction(c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.UploadImage);
}
......@@ -5156,7 +5156,7 @@ function _sendCommandCallback (fCallback, error, result, rdata) {
//todo передалеть работу с callback
if("getsettings" == rdata["c"] || "open" == rdata["c"] || "chopen" == rdata["c"] || "create" == rdata["c"])
nErrorLevel = c_oAscError.Level.Critical;
editor.asc_fireCallback("asc_onError",_mapAscServerErrorToAscError(parseInt(result["data"])),nErrorLevel);
editor.asc_fireCallback("asc_onError", g_fMapAscServerErrorToAscError(parseInt(result["data"])), nErrorLevel);
if(fCallback)
fCallback(result);
break;
......@@ -5234,40 +5234,6 @@ function _getFullImageSrc(src)
else
return src;
}
function _mapAscServerErrorToAscError(nServerError)
{
var nRes = c_oAscError.ID.Unknown;
switch(nServerError)
{
case c_oAscServerError.NoError : nRes = c_oAscError.ID.No;break;
case c_oAscServerError.TaskQueue :
case c_oAscServerError.TaskResult : nRes = c_oAscError.ID.Database;break;
case c_oAscServerError.ConvertDownload : nRes = c_oAscError.ID.DownloadError;break;
case c_oAscServerError.ConvertTimeout : nRes = c_oAscError.ID.ConvertationTimeout;break;
case c_oAscServerError.ConvertMS_OFFCRYPTO : nRes = c_oAscError.ID.ConvertationPassword;break;
case c_oAscServerError.ConvertUnknownFormat :
case c_oAscServerError.ConvertReadFile :
case c_oAscServerError.Convert : nRes = c_oAscError.ID.ConvertationError;break;
case c_oAscServerError.UploadContentLength : nRes = c_oAscError.ID.UplImageSize;break;
case c_oAscServerError.UploadExtension : nRes = c_oAscError.ID.UplImageExt;break;
case c_oAscServerError.UploadCountFiles : nRes = c_oAscError.ID.UplImageFileCount;break;
case c_oAscServerError.VKey : nRes = c_oAscError.ID.FileVKey;break;
case c_oAscServerError.VKeyEncrypt : nRes = c_oAscError.ID.VKeyEncrypt;break;
case c_oAscServerError.VKeyKeyExpire : nRes = c_oAscError.ID.KeyExpire;break;
case c_oAscServerError.VKeyUserCountExceed : nRes = 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 = c_oAscError.ID.Unknown;break;
}
return nRes;
}
//test
window["asc_docs_api"] = asc_docs_api;
......
......@@ -564,7 +564,7 @@ function asc_docs_api(name)
xhr.send(fd);
}
else
oThis.asc_fireCallback("asc_onError",_mapAscServerErrorToAscError(nError),c_oAscError.Level.NoCritical);
oThis.asc_fireCallback("asc_onError", g_fMapAscServerErrorToAscError(nError), c_oAscError.Level.NoCritical);
};
}
}
......@@ -2279,7 +2279,7 @@ asc_docs_api.prototype.asc_Print = function()
editor.processSavedFile(incomeObject["data"], false);
else{
if(null != incomeObject && "err" == incomeObject["type"])
editor.asc_fireCallback("asc_onError", _mapAscServerErrorToAscError(parseInt(incomeObject["data"])), c_oAscError.Level.NoCritical);
editor.asc_fireCallback("asc_onError", g_fMapAscServerErrorToAscError(parseInt(incomeObject["data"])), c_oAscError.Level.NoCritical);
else
editor.asc_fireCallback("asc_onError", c_oAscError.ID.Unknown, c_oAscError.Level.NoCritical);
}
......@@ -2291,7 +2291,7 @@ asc_docs_api.prototype.asc_Print = function()
editor.processSavedFile(incomeObject["data"], false);
else{
if(null != incomeObject && "err" == incomeObject["type"])
editor.asc_fireCallback("asc_onError", _mapAscServerErrorToAscError(parseInt(incomeObject["data"])), c_oAscError.Level.NoCritical);
editor.asc_fireCallback("asc_onError", g_fMapAscServerErrorToAscError(parseInt(incomeObject["data"])), c_oAscError.Level.NoCritical);
else
editor.asc_fireCallback("asc_onError", c_oAscError.ID.Unknown, c_oAscError.Level.NoCritical);
}
......@@ -2456,7 +2456,7 @@ asc_docs_api.prototype.asc_DownloadAs = function(typeFile) {//передаем
t.processSavedFile(incomeObject["data"], false);
else{
if(null != incomeObject && "err" == incomeObject["type"])
t.asc_fireCallback("asc_onError", _mapAscServerErrorToAscError(parseInt(incomeObject["data"])), c_oAscError.Level.NoCritical);
t.asc_fireCallback("asc_onError", g_fMapAscServerErrorToAscError(parseInt(incomeObject["data"])), c_oAscError.Level.NoCritical);
else
t.asc_fireCallback("asc_onError", c_oAscError.ID.Unknown, c_oAscError.Level.NoCritical);
}
......@@ -4790,7 +4790,7 @@ asc_docs_api.prototype.AddImage = function(){
if(c_oAscServerError.NoError != nError)
{
bNeedSubmit = false;
oThis.asc_fireCallback("asc_onError",_mapAscServerErrorToAscError(nError),c_oAscError.Level.NoCritical);
oThis.asc_fireCallback("asc_onError", g_fMapAscServerErrorToAscError(nError), c_oAscError.Level.NoCritical);
}
}
if(bNeedSubmit)
......@@ -6875,7 +6875,7 @@ asc_docs_api.prototype.OnHandleMessage = function(event)
this.AddImageUrl(urls[0]);
}
else
this.sync_ErrorCallback(_mapAscServerErrorToAscError(data["error"]), c_oAscError.Level.NoCritical);
this.sync_ErrorCallback(g_fMapAscServerErrorToAscError(data["error"]), c_oAscError.Level.NoCritical);
editor.sync_EndAction(c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.UploadImage);
}
......@@ -7068,7 +7068,7 @@ function _sendCommandCallback (fCallback, error, result, rdata) {
//todo передалеть работу с callback
if("getsettings" == rdata["c"] || "open" == rdata["c"] || "chopen" == rdata["c"] || "create" == rdata["c"])
nErrorLevel = c_oAscError.Level.Critical;
editor.asc_fireCallback("asc_onError", _mapAscServerErrorToAscError(parseInt(result["data"])), nErrorLevel);
editor.asc_fireCallback("asc_onError", g_fMapAscServerErrorToAscError(parseInt(result["data"])), nErrorLevel);
}
if(fCallback)
fCallback(result);
......@@ -7199,40 +7199,6 @@ function _getFullImageSrc(src)
else
return src;
}
function _mapAscServerErrorToAscError(nServerError)
{
var nRes = c_oAscError.ID.Unknown;
switch(nServerError)
{
case c_oAscServerError.NoError : nRes = c_oAscError.ID.No;break;
case c_oAscServerError.TaskQueue :
case c_oAscServerError.TaskResult : nRes = c_oAscError.ID.Database;break;
case c_oAscServerError.ConvertDownload : nRes = c_oAscError.ID.DownloadError;break;
case c_oAscServerError.ConvertTimeout : nRes = c_oAscError.ID.ConvertationTimeout;break;
case c_oAscServerError.ConvertMS_OFFCRYPTO : nRes = c_oAscError.ID.ConvertationPassword;break;
case c_oAscServerError.ConvertUnknownFormat :
case c_oAscServerError.ConvertReadFile :
case c_oAscServerError.Convert : nRes = c_oAscError.ID.ConvertationError;break;
case c_oAscServerError.UploadContentLength : nRes = c_oAscError.ID.UplImageSize;break;
case c_oAscServerError.UploadExtension : nRes = c_oAscError.ID.UplImageExt;break;
case c_oAscServerError.UploadCountFiles : nRes = c_oAscError.ID.UplImageFileCount;break;
case c_oAscServerError.VKey : nRes = c_oAscError.ID.FileVKey;break;
case c_oAscServerError.VKeyEncrypt : nRes = c_oAscError.ID.VKeyEncrypt;break;
case c_oAscServerError.VKeyKeyExpire : nRes = c_oAscError.ID.KeyExpire;break;
case c_oAscServerError.VKeyUserCountExceed : nRes = 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 = c_oAscError.ID.Unknown;break;
}
return nRes;
}
function CErrorData()
{
......
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