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"; ...@@ -728,23 +728,21 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
}, },
_asc_sendCommand: function (callback, rdata) { _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 var sTemp = rdata["data"];
if(null != rdata.data && "string" === typeof(rdata.data) && rdata.data.length > g_nMaxJsonLength / 2) rdata["data"] = null;
{ sData = "mnuSaveAs" + cCharDelimiter + JSON.stringify(rdata) + cCharDelimiter + sTemp;
var sData = rdata.data;
rdata.data = null;
rdata = "mnuSaveAs" + cCharDelimiter + JSON.stringify(rdata) + cCharDelimiter + sData;
}
else
rdata = JSON.stringify(rdata);
} }
else
sData = JSON.stringify(rdata);
var oThis = this; var oThis = this;
asc_ajax({ asc_ajax({
type: 'POST', type: 'POST',
url: g_sMainServiceLocalUrl, url: g_sMainServiceLocalUrl,
data: rdata, data: sData,
error: function(jqXHR, textStatus, errorThrown){ error: function(jqXHR, textStatus, errorThrown){
var result = {returnCode: c_oAscError.Level.Critical, val:c_oAscError.ID.Unknown}; 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); 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"; ...@@ -865,8 +863,12 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
callback(incomeObject); callback(incomeObject);
break; break;
case "err": case "err":
result = {returnCode: c_oAscError.Level.Critical, val:parseInt(incomeObject["data"])}; var nErrorLevel = c_oAscError.Level.NoCritical;
oThis.handlers.trigger("asc_onError", asc_mapAscServerErrorToAscError(parseInt(incomeObject["data"])), c_oAscError.Level.Critical); //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) if(callback)
callback(result); callback(result);
break; break;
...@@ -953,10 +955,11 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS"; ...@@ -953,10 +955,11 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
oAdditionalData["outputformat"] = c_oAscFileType.INNER; oAdditionalData["outputformat"] = c_oAscFileType.INNER;
oAdditionalData["innersave"] = true; oAdditionalData["innersave"] = true;
oAdditionalData["savetype"] = "completeall"; oAdditionalData["savetype"] = "completeall";
oAdditionalData["data"] = data;
this._asc_sendCommand (/*callback*/ function(incomeObject){ this._asc_sendCommand (/*callback*/ function(incomeObject){
if(null != incomeObject && "save" == incomeObject["type"]) if(null != incomeObject && "save" == incomeObject["type"])
that.asc_processSavedFile(incomeObject["data"], true); 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:"", ...}) _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"; ...@@ -1023,7 +1026,8 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
return; 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) { ...@@ -1713,11 +1713,11 @@ asc_docs_api.prototype.onSaveCallback = function (e) {
oAdditionalData["outputformat"] = c_oAscFileType.INNER; oAdditionalData["outputformat"] = c_oAscFileType.INNER;
oAdditionalData["innersave"] = true; oAdditionalData["innersave"] = true;
oAdditionalData["savetype"] = "completeall"; oAdditionalData["savetype"] = "completeall";
var sData = "mnuSaveAs" + cCharDelimiter + JSON.stringify(oAdditionalData) + cCharDelimiter + data; oAdditionalData["data"] = data;
sendCommand(editor, function(incomeObject){ sendCommand(editor, function(incomeObject){
if(null != incomeObject && "save" == incomeObject["type"]) if(null != incomeObject && "save" == incomeObject["type"])
editor.processSavedFile(incomeObject["data"], true); editor.processSavedFile(incomeObject["data"], true);
}, sData); }, oAdditionalData);
// Пересылаем свои изменения (ToDo) // Пересылаем свои изменения (ToDo)
CollaborativeEditing.Send_Changes(); CollaborativeEditing.Send_Changes();
...@@ -4822,22 +4822,20 @@ function getURLParameter(name) { ...@@ -4822,22 +4822,20 @@ function getURLParameter(name) {
return (RegExp(name + '=' + '(.+?)(&|$)').exec(location.search)||[,null])[1]; return (RegExp(name + '=' + '(.+?)(&|$)').exec(location.search)||[,null])[1];
}; };
function sendCommand(editor, fCallback, rdata){ 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 var sTemp = rdata["data"];
if(null != rdata.data && "string" === typeof(rdata.data) && rdata.data.length > g_nMaxJsonLength / 2) rdata["data"] = null;
{ sData = "mnuSaveAs" + cCharDelimiter + JSON.stringify(rdata) + cCharDelimiter + sTemp;
var sData = rdata.data;
rdata.data = null;
rdata = "mnuSaveAs" + cCharDelimiter + JSON.stringify(rdata) + cCharDelimiter + sData;
}
else
rdata = JSON.stringify(rdata);
} }
else
sData = JSON.stringify(rdata);
asc_ajax({ asc_ajax({
type: 'POST', type: 'POST',
url: g_sMainServiceLocalUrl, url: g_sMainServiceLocalUrl,
data: rdata, data: sData,
error: function(jqXHR, textStatus, errorThrown){ error: function(jqXHR, textStatus, errorThrown){
editor.asc_fireCallback("asc_onError",c_oAscError.ID.Unknown,c_oAscError.Level.Critical); editor.asc_fireCallback("asc_onError",c_oAscError.ID.Unknown,c_oAscError.Level.Critical);
if(fCallback) if(fCallback)
...@@ -4909,7 +4907,11 @@ function sendCommand(editor, fCallback, rdata){ ...@@ -4909,7 +4907,11 @@ function sendCommand(editor, fCallback, rdata){
fCallback(incomeObject); fCallback(incomeObject);
break; break;
case "err": 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) if(fCallback)
fCallback(incomeObject); fCallback(incomeObject);
break; break;
...@@ -4955,36 +4957,25 @@ function _downloadAs(editor, filetype, fCallback, bStart, sSaveKey) ...@@ -4955,36 +4957,25 @@ function _downloadAs(editor, filetype, fCallback, bStart, sSaveKey)
if(dd.isComleteRenderer2()) if(dd.isComleteRenderer2())
{ {
if(false == bStart) if(false == bStart)
{
oAdditionalData["savetype"] = "complete"; oAdditionalData["savetype"] = "complete";
sData = "mnuSaveAs" + cCharDelimiter + JSON.stringify(oAdditionalData) + cCharDelimiter + dd.ToRendererPart();
}
else else
{
oAdditionalData["savetype"] = "completeall"; oAdditionalData["savetype"] = "completeall";
sData = "mnuSaveAs" + cCharDelimiter + JSON.stringify(oAdditionalData) + cCharDelimiter + dd.ToRendererPart();
}
} }
else else
{ {
if(false == bStart) if(false == bStart)
{
oAdditionalData["savetype"] = "part"; oAdditionalData["savetype"] = "part";
sData = "mnuSaveAs" + cCharDelimiter + JSON.stringify(oAdditionalData) + cCharDelimiter + dd.ToRendererPart();
}
else else
{
oAdditionalData["savetype"] = "partstart"; 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 else
{ {
oAdditionalData["savetype"] = "completeall"; oAdditionalData["savetype"] = "completeall";
sData = "mnuSaveAs" + cCharDelimiter + JSON.stringify(oAdditionalData) + cCharDelimiter + editor.WordControl.SaveDocument(); oAdditionalData["data"] = editor.WordControl.SaveDocument();
sendCommand(editor, fCallback, sData); sendCommand(editor, fCallback, oAdditionalData);
} }
}; };
......
...@@ -2579,12 +2579,11 @@ function OnSave_Callback(e) ...@@ -2579,12 +2579,11 @@ function OnSave_Callback(e)
////uncoment to save changes only instead send file complete ////uncoment to save changes only instead send file complete
//var data = JSON.stringify( CollaborativeEditing.Get_SelfChanges() ); //var data = JSON.stringify( CollaborativeEditing.Get_SelfChanges() );
//oAdditionalData["savetype"] = "changes"; //oAdditionalData["savetype"] = "changes";
oAdditionalData["data"] = data;
var sData = "mnuSaveAs" + cCharDelimiter + JSON.stringify(oAdditionalData) + cCharDelimiter + data;
sendCommand(editor, function(incomeObject){ sendCommand(editor, function(incomeObject){
if(null != incomeObject && "save" == incomeObject["type"]) if(null != incomeObject && "save" == incomeObject["type"])
editor.processSavedFile(incomeObject["data"], true); editor.processSavedFile(incomeObject["data"], true);
}, sData); }, oAdditionalData);
} }
// Пересылаем свои изменения // Пересылаем свои изменения
...@@ -6779,22 +6778,20 @@ function _onSpellCheck_Callback2 (response) ...@@ -6779,22 +6778,20 @@ function _onSpellCheck_Callback2 (response)
}) })
};*/ };*/
function sendCommand(editor, fCallback, rdata){ 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 var sTemp = rdata["data"];
if(null != rdata.data && "string" === typeof(rdata.data) && rdata.data.length > g_nMaxJsonLength / 2) rdata["data"] = null;
{ sData = "mnuSaveAs" + cCharDelimiter + JSON.stringify(rdata) + cCharDelimiter + sTemp;
var sData = rdata.data;
rdata.data = null;
rdata = "mnuSaveAs" + cCharDelimiter + JSON.stringify(rdata) + cCharDelimiter + sData;
}
else
rdata = JSON.stringify(rdata);
} }
else
sData = JSON.stringify(rdata);
asc_ajax({ asc_ajax({
type: 'POST', type: 'POST',
url: g_sMainServiceLocalUrl, url: g_sMainServiceLocalUrl,
data: rdata, data: sData,
error: function(jqXHR, textStatus, errorThrown){ error: function(jqXHR, textStatus, errorThrown){
editor.asc_fireCallback("asc_onError",c_oAscError.ID.Unknown,c_oAscError.Level.Critical); editor.asc_fireCallback("asc_onError",c_oAscError.ID.Unknown,c_oAscError.Level.Critical);
if(fCallback) if(fCallback)
...@@ -6877,7 +6874,11 @@ function sendCommand(editor, fCallback, rdata){ ...@@ -6877,7 +6874,11 @@ function sendCommand(editor, fCallback, rdata){
fCallback(incomeObject); fCallback(incomeObject);
break; break;
case "err": 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) if(fCallback)
fCallback(incomeObject); fCallback(incomeObject);
break; break;
...@@ -6923,37 +6924,26 @@ function _downloadAs(editor, filetype, fCallback, bStart, sSaveKey) ...@@ -6923,37 +6924,26 @@ function _downloadAs(editor, filetype, fCallback, bStart, sSaveKey)
if(dd.isComleteRenderer2()) if(dd.isComleteRenderer2())
{ {
if(false == bStart) if(false == bStart)
{
oAdditionalData["savetype"] = "complete"; oAdditionalData["savetype"] = "complete";
sData = "mnuSaveAs" + cCharDelimiter + JSON.stringify(oAdditionalData) + cCharDelimiter + dd.ToRendererPart();
}
else else
{
oAdditionalData["savetype"] = "completeall"; oAdditionalData["savetype"] = "completeall";
sData = "mnuSaveAs" + cCharDelimiter + JSON.stringify(oAdditionalData) + cCharDelimiter + dd.ToRendererPart();
}
} }
else else
{ {
if(false == bStart) if(false == bStart)
{
oAdditionalData["savetype"] = "part"; oAdditionalData["savetype"] = "part";
sData = "mnuSaveAs" + cCharDelimiter + JSON.stringify(oAdditionalData) + cCharDelimiter + dd.ToRendererPart();
}
else else
{
oAdditionalData["savetype"] = "partstart"; 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 else
{ {
var oBinaryFileWriter = new BinaryFileWriter(editor.WordControl.m_oLogicDocument); var oBinaryFileWriter = new BinaryFileWriter(editor.WordControl.m_oLogicDocument);
oAdditionalData["savetype"] = "completeall"; oAdditionalData["savetype"] = "completeall";
sData = "mnuSaveAs" + cCharDelimiter + JSON.stringify(oAdditionalData) + cCharDelimiter + oBinaryFileWriter.Write(); oAdditionalData["data"] = oBinaryFileWriter.Write();
sendCommand(editor, fCallback, sData); 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