Commit f146c68b authored by Sergey.Konovalov's avatar Sergey.Konovalov Committed by Alexander.Trofimov

Bug 20732 - Ошибка при загрузке SVG, EMF и WMF файлов по ссылке и закрытие редактора

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@51186 954022d7-b5bf-4e40-9824-e11837661b57
parent 2b77c8ff
This diff is collapsed.
......@@ -728,23 +728,21 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
},
_asc_sendCommand: function (callback, rdata) {
if("string" !== typeof(rdata))
var sData;
//json не должен превышать размера g_nMaxJsonLength, иначе при его чтении будет exception
if(null != rdata["data"] && "string" === typeof(rdata["data"]) && rdata["data"].length > g_nMaxJsonLengthChecked)
{
//json не должен превышать размера g_nMaxJsonLength, иначе при его чтении будет exception
if(null != rdata.data && "string" === typeof(rdata.data) && rdata.data.length > g_nMaxJsonLength / 2)
{
var sData = rdata.data;
rdata.data = null;
rdata = "mnuSaveAs" + cCharDelimiter + JSON.stringify(rdata) + cCharDelimiter + sData;
}
else
rdata = JSON.stringify(rdata);
var sTemp = rdata["data"];
rdata["data"] = null;
sData = "mnuSaveAs" + cCharDelimiter + JSON.stringify(rdata) + cCharDelimiter + sTemp;
}
else
sData = JSON.stringify(rdata);
var oThis = this;
asc_ajax({
type: 'POST',
url: g_sMainServiceLocalUrl,
data: rdata,
data: sData,
error: function(jqXHR, textStatus, errorThrown){
var result = {returnCode: c_oAscError.Level.Critical, val:c_oAscError.ID.Unknown};
oThis.handlers.trigger("asc_onError", c_oAscError.ID.Unknown, c_oAscError.Level.Critical);
......@@ -865,8 +863,12 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
callback(incomeObject);
break;
case "err":
result = {returnCode: c_oAscError.Level.Critical, val:parseInt(incomeObject["data"])};
oThis.handlers.trigger("asc_onError", asc_mapAscServerErrorToAscError(parseInt(incomeObject["data"])), c_oAscError.Level.Critical);
var nErrorLevel = c_oAscError.Level.NoCritical;
//todo передалеть работу с callback
if("getsettings" == rdata["c"] || "open" == rdata["c"] || "chopen" == rdata["c"] || "create" == rdata["c"])
nErrorLevel = c_oAscError.Level.Critical;
result = {returnCode: nErrorLevel, val:parseInt(incomeObject["data"])};
oThis.handlers.trigger("asc_onError", asc_mapAscServerErrorToAscError(parseInt(incomeObject["data"])), nErrorLevel);
if(callback)
callback(result);
break;
......@@ -953,10 +955,11 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
oAdditionalData["outputformat"] = c_oAscFileType.INNER;
oAdditionalData["innersave"] = true;
oAdditionalData["savetype"] = "completeall";
oAdditionalData["data"] = data;
this._asc_sendCommand (/*callback*/ function(incomeObject){
if(null != incomeObject && "save" == incomeObject["type"])
that.asc_processSavedFile(incomeObject["data"], true);
}, "mnuSaveAs" + this.cCharDelimiter + JSON.stringify(oAdditionalData) + this.cCharDelimiter + data);
}, oAdditionalData);
},
_asc_downloadAs: function (sFormat, fCallback, bStart, options, sSaveKey) { //fCallback({returnCode:"", ...})
......@@ -1023,7 +1026,8 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
return;
}
}
this._asc_sendCommand (fCallback, "mnuSaveAs" + this.cCharDelimiter + JSON.stringify(oAdditionalData) + this.cCharDelimiter + data);
oAdditionalData["data"] = data;
this._asc_sendCommand (fCallback, oAdditionalData);
},
......
......@@ -1713,11 +1713,11 @@ asc_docs_api.prototype.onSaveCallback = function (e) {
oAdditionalData["outputformat"] = c_oAscFileType.INNER;
oAdditionalData["innersave"] = true;
oAdditionalData["savetype"] = "completeall";
var sData = "mnuSaveAs" + cCharDelimiter + JSON.stringify(oAdditionalData) + cCharDelimiter + data;
oAdditionalData["data"] = data;
sendCommand(editor, function(incomeObject){
if(null != incomeObject && "save" == incomeObject["type"])
editor.processSavedFile(incomeObject["data"], true);
}, sData);
}, oAdditionalData);
// Пересылаем свои изменения (ToDo)
CollaborativeEditing.Send_Changes();
......@@ -4822,22 +4822,20 @@ function getURLParameter(name) {
return (RegExp(name + '=' + '(.+?)(&|$)').exec(location.search)||[,null])[1];
};
function sendCommand(editor, fCallback, rdata){
if("string" !== typeof(rdata))
var sData;
//json не должен превышать размера g_nMaxJsonLength, иначе при его чтении будет exception
if(null != rdata["data"] && "string" === typeof(rdata["data"]) && rdata["data"].length > g_nMaxJsonLengthChecked)
{
//json не должен превышать размера g_nMaxJsonLength, иначе при его чтении будет exception
if(null != rdata.data && "string" === typeof(rdata.data) && rdata.data.length > g_nMaxJsonLength / 2)
{
var sData = rdata.data;
rdata.data = null;
rdata = "mnuSaveAs" + cCharDelimiter + JSON.stringify(rdata) + cCharDelimiter + sData;
}
else
rdata = JSON.stringify(rdata);
var sTemp = rdata["data"];
rdata["data"] = null;
sData = "mnuSaveAs" + cCharDelimiter + JSON.stringify(rdata) + cCharDelimiter + sTemp;
}
else
sData = JSON.stringify(rdata);
asc_ajax({
type: 'POST',
url: g_sMainServiceLocalUrl,
data: rdata,
data: sData,
error: function(jqXHR, textStatus, errorThrown){
editor.asc_fireCallback("asc_onError",c_oAscError.ID.Unknown,c_oAscError.Level.Critical);
if(fCallback)
......@@ -4909,7 +4907,11 @@ function sendCommand(editor, fCallback, rdata){
fCallback(incomeObject);
break;
case "err":
editor.asc_fireCallback("asc_onError",_mapAscServerErrorToAscError(parseInt(incomeObject["data"])),c_oAscError.Level.Critical);
var nErrorLevel = c_oAscError.Level.NoCritical;
//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(incomeObject["data"])),nErrorLevel);
if(fCallback)
fCallback(incomeObject);
break;
......@@ -4955,36 +4957,25 @@ function _downloadAs(editor, filetype, fCallback, bStart, sSaveKey)
if(dd.isComleteRenderer2())
{
if(false == bStart)
{
oAdditionalData["savetype"] = "complete";
sData = "mnuSaveAs" + cCharDelimiter + JSON.stringify(oAdditionalData) + cCharDelimiter + dd.ToRendererPart();
}
else
{
oAdditionalData["savetype"] = "completeall";
sData = "mnuSaveAs" + cCharDelimiter + JSON.stringify(oAdditionalData) + cCharDelimiter + dd.ToRendererPart();
}
}
else
{
if(false == bStart)
{
oAdditionalData["savetype"] = "part";
sData = "mnuSaveAs" + cCharDelimiter + JSON.stringify(oAdditionalData) + cCharDelimiter + dd.ToRendererPart();
}
else
{
oAdditionalData["savetype"] = "partstart";
sData = "mnuSaveAs" + cCharDelimiter + JSON.stringify(oAdditionalData) + cCharDelimiter + dd.ToRendererPart();
}
}
sendCommand(editor, fCallback, sData);
oAdditionalData["data"] = dd.ToRendererPart();
sendCommand(editor, fCallback, oAdditionalData);
}
else
{
oAdditionalData["savetype"] = "completeall";
sData = "mnuSaveAs" + cCharDelimiter + JSON.stringify(oAdditionalData) + cCharDelimiter + editor.WordControl.SaveDocument();
sendCommand(editor, fCallback, sData);
oAdditionalData["data"] = editor.WordControl.SaveDocument();
sendCommand(editor, fCallback, oAdditionalData);
}
};
......
......@@ -2579,12 +2579,11 @@ function OnSave_Callback(e)
////uncoment to save changes only instead send file complete
//var data = JSON.stringify( CollaborativeEditing.Get_SelfChanges() );
//oAdditionalData["savetype"] = "changes";
var sData = "mnuSaveAs" + cCharDelimiter + JSON.stringify(oAdditionalData) + cCharDelimiter + data;
oAdditionalData["data"] = data;
sendCommand(editor, function(incomeObject){
if(null != incomeObject && "save" == incomeObject["type"])
editor.processSavedFile(incomeObject["data"], true);
}, sData);
}, oAdditionalData);
}
// Пересылаем свои изменения
......@@ -6779,22 +6778,20 @@ function _onSpellCheck_Callback2 (response)
})
};*/
function sendCommand(editor, fCallback, rdata){
if("string" !== typeof(rdata))
var sData;
//json не должен превышать размера g_nMaxJsonLength, иначе при его чтении будет exception
if(null != rdata["data"] && "string" === typeof(rdata["data"]) && rdata["data"].length > g_nMaxJsonLengthChecked)
{
//json не должен превышать размера g_nMaxJsonLength, иначе при его чтении будет exception
if(null != rdata.data && "string" === typeof(rdata.data) && rdata.data.length > g_nMaxJsonLength / 2)
{
var sData = rdata.data;
rdata.data = null;
rdata = "mnuSaveAs" + cCharDelimiter + JSON.stringify(rdata) + cCharDelimiter + sData;
}
else
rdata = JSON.stringify(rdata);
var sTemp = rdata["data"];
rdata["data"] = null;
sData = "mnuSaveAs" + cCharDelimiter + JSON.stringify(rdata) + cCharDelimiter + sTemp;
}
else
sData = JSON.stringify(rdata);
asc_ajax({
type: 'POST',
url: g_sMainServiceLocalUrl,
data: rdata,
data: sData,
error: function(jqXHR, textStatus, errorThrown){
editor.asc_fireCallback("asc_onError",c_oAscError.ID.Unknown,c_oAscError.Level.Critical);
if(fCallback)
......@@ -6877,7 +6874,11 @@ function sendCommand(editor, fCallback, rdata){
fCallback(incomeObject);
break;
case "err":
editor.asc_fireCallback("asc_onError", _mapAscServerErrorToAscError(parseInt(incomeObject["data"])), c_oAscError.Level.Critical);
var nErrorLevel = c_oAscError.Level.NoCritical;
//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(incomeObject["data"])), nErrorLevel);
if(fCallback)
fCallback(incomeObject);
break;
......@@ -6923,37 +6924,26 @@ function _downloadAs(editor, filetype, fCallback, bStart, sSaveKey)
if(dd.isComleteRenderer2())
{
if(false == bStart)
{
oAdditionalData["savetype"] = "complete";
sData = "mnuSaveAs" + cCharDelimiter + JSON.stringify(oAdditionalData) + cCharDelimiter + dd.ToRendererPart();
}
else
{
oAdditionalData["savetype"] = "completeall";
sData = "mnuSaveAs" + cCharDelimiter + JSON.stringify(oAdditionalData) + cCharDelimiter + dd.ToRendererPart();
}
}
else
{
if(false == bStart)
{
oAdditionalData["savetype"] = "part";
sData = "mnuSaveAs" + cCharDelimiter + JSON.stringify(oAdditionalData) + cCharDelimiter + dd.ToRendererPart();
}
else
{
oAdditionalData["savetype"] = "partstart";
sData = "mnuSaveAs" + cCharDelimiter + JSON.stringify(oAdditionalData) + cCharDelimiter + dd.ToRendererPart();
}
}
sendCommand(editor, fCallback, sData);
oAdditionalData["data"] = dd.ToRendererPart();
sendCommand(editor, fCallback, oAdditionalData);
}
else
{
var oBinaryFileWriter = new BinaryFileWriter(editor.WordControl.m_oLogicDocument);
oAdditionalData["savetype"] = "completeall";
sData = "mnuSaveAs" + cCharDelimiter + JSON.stringify(oAdditionalData) + cCharDelimiter + oBinaryFileWriter.Write();
sendCommand(editor, fCallback, sData);
oAdditionalData["data"] = oBinaryFileWriter.Write();
sendCommand(editor, fCallback, oAdditionalData);
}
};
......
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