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

Bug 30376 - [Copy&Paste] JS ошибка "a.CoAuthoringApi.openDocument" после копирования изображения

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@64731 954022d7-b5bf-4e40-9824-e11837661b57
parent 5f0c8899
...@@ -2391,6 +2391,32 @@ function Editor_Paste_Exec(api, pastebin, nodeDisplay, onlyBinary) ...@@ -2391,6 +2391,32 @@ function Editor_Paste_Exec(api, pastebin, nodeDisplay, onlyBinary)
function trimString( str ){ function trimString( str ){
return str.replace(/^\s+|\s+$/g, '') ; return str.replace(/^\s+|\s+$/g, '') ;
}; };
function sendImgUrls(api, images, callback) {
var rData = {"id": documentId, "c": "imgurls", "vkey": documentVKey, "userid": documentUserId, "saveindex": g_oDocumentUrls.getMaxIndex(), "data": images};
api.sync_StartAction(c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.LoadImage);
api.fCurCallback = function (input) {
api.sync_EndAction(c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.LoadImage);
if (null != input && "imgurls" == input["type"]) {
if ("ok" == input["status"]) {
var data = input["data"];
var urls = {};
for (var i = 0, length = data.length; i < length; ++i) {
var elem = data[i];
if (null != elem.url) {
urls[elem.path] = elem.url;
}
}
g_oDocumentUrls.addUrls(urls);
callback(data);
} else {
api.asc_fireCallback("asc_onError", g_fMapAscServerErrorToAscError(parseInt(input["data"])), c_oAscError.Level.NoCritical);
}
} else {
api.asc_fireCallback("asc_onError", c_oAscError.ID.Unknown, c_oAscError.Level.NoCritical);
}
};
sendCommand2(api, null, rData);
}
function PasteProcessor(api, bUploadImage, bUploadFonts, bNested, pasteInExcel) function PasteProcessor(api, bUploadImage, bUploadFonts, bNested, pasteInExcel)
{ {
this.oRootNode = null; this.oRootNode = null;
...@@ -2893,50 +2919,25 @@ PasteProcessor.prototype = ...@@ -2893,50 +2919,25 @@ PasteProcessor.prototype =
{ {
aImagesToDownload.push(aContentExcel.arrImages[i].Url); aImagesToDownload.push(aContentExcel.arrImages[i].Url);
} }
sendImgUrls(oThis.api, aImagesToDownload, function (data) {
var rData = {"id":documentId, "c":"imgurls", "vkey": documentVKey, "userid": documentUserId, "saveindex": g_oDocumentUrls.getMaxIndex(), "data": aImagesToDownload}; var image_map = {};
oThis.api.sync_StartAction(c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.LoadImage); for (var i = 0, length = data.length; i < length; ++i) {
sendCommand2(function(incomeObject){ var elem = data[i];
if(incomeObject && "imgurls" == incomeObject.type) if (null != elem.url) {
{ var name = g_oDocumentUrls.imagePath2Local(elem.path);
var oFromTo = JSON.parse(incomeObject.data); var imageElem = aContentExcel.arrImages[i];
if (null != imageElem) {
var arr_images =[]; imageElem.SetUrl(name);
var image_map = {}; }
image_map[i] = name;
for(var i = 0, length = aImagesToDownload.length; i < length; ++i) } else {
{ image_map[i] = aImagesToDownload[i];
var sFrom = aImagesToDownload[i]; }
var sTo = oFromTo[sFrom]; }
if(sTo) var aContent = oThis._convertExcelBinary(aContentExcel);
arr_images.push(sTo); oThis.aContent = aContent.content;
} oThis.api.pre_Paste(aContent.fonts, image_map, fPrepasteCallback);
for(var i = 0, length = aContentExcel.arrImages.length; i < length; ++i) });
{
var imageElem = aContentExcel.arrImages[i];
if(null != imageElem)
{
var sNewSrc = oFromTo[imageElem.Url];
if(null != sNewSrc)
{
image_map[sNewSrc] = sNewSrc;
imageElem.SetUrl(sNewSrc);
}
else
{
image_map[imageElem.Url] = imageElem.Url;
}
}
}
}
var aContent = oThis._convertExcelBinary(aContentExcel);
oThis.aContent = aContent.content;
oThis.api.sync_EndAction(c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.LoadImage);
oThis.api.pre_Paste(aContent.fonts, image_map, fPrepasteCallback);
}, _sendCommandCallback, rData);
} }
else else
{ {
...@@ -3002,38 +3003,22 @@ PasteProcessor.prototype = ...@@ -3002,38 +3003,22 @@ PasteProcessor.prototype =
} }
else else
{ {
var rData = {"id":documentId, "c":"imgurls", "vkey": documentVKey, "userid": documentUserId, "saveindex": g_oDocumentUrls.getMaxIndex(), "data": aImagesToDownload}; sendImgUrls(oThis.api, aImagesToDownload, function (data) {
oThis.api.sync_StartAction(c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.LoadImage); for (var i = 0, length = data.length; i < length; ++i) {
this.api.fCurCallback = function(input) { var elem = data[i];
if(null != input && "imgurls" == input["type"]){ if (null != elem.url) {
if("ok" == input["status"]) { var name = g_oDocumentUrls.imagePath2Local(elem.path);
var data = input["data"]; var imageElem = aContent.aPastedImages[i];
var urls = {}; if (null != imageElem) {
for(var i = 0, length = data.length; i < length; ++i) imageElem.SetUrl(name);
{ }
var elem = data[i]; aContent.images[i] = name;
if(elem.url) } else {
{ aContent.images[i] = aImagesToDownload[i];
urls[elem.path] = elem.url; }
var name = g_oDocumentUrls.imagePath2Local(elem.path); }
aContent.images[i] = name; oThis.api.pre_Paste(aContent.fonts, aContent.images, fPrepasteCallback);
var imageElem = aContent.aPastedImages[i]; });
if(null != imageElem) {
imageElem.SetUrl(name);
}
}
}
g_oDocumentUrls.addUrls(urls);
oThis.api.pre_Paste(aContent.fonts, aContent.images, fPrepasteCallback);
} else {
oThis.asc_fireCallback("asc_onError", g_fMapAscServerErrorToAscError(parseInt(input["data"])), c_oAscError.Level.NoCritical);
}
} else {
oThis.asc_fireCallback("asc_onError",c_oAscError.ID.Unknown,c_oAscError.Level.NoCritical);
}
oThis.api.sync_EndAction(c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.LoadImage);
};
sendCommand2( this.api, null, rData );
} }
} }
else else
...@@ -3124,68 +3109,30 @@ PasteProcessor.prototype = ...@@ -3124,68 +3109,30 @@ PasteProcessor.prototype =
} }
} }
} }
sendImgUrls(oThis.api, aImagesToDownload, function (data) {
var rData = {"id":documentId, "c":"imgurls", "vkey": documentVKey, "userid": documentUserId, "saveindex": g_oDocumentUrls.getMaxIndex(), "data": aImagesToDownload}; var image_map = {};
oThis.api.sync_StartAction(c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.LoadImage); for (var i = 0, length = data.length; i < length; ++i) {
sendCommand2(function(incomeObject){ var elem = data[i];
if (null != elem.url) {
if(incomeObject && "imgurls" == incomeObject.type) var name = g_oDocumentUrls.imagePath2Local(elem.path);
{ var imageElem = objects.arrImages[i];
var oFromTo = JSON.parse(incomeObject.data); if (null != imageElem) {
//для вставки graphicFrame в виде картинки(если было при копировании выделено несколько графических объектов)
var arr_images =[]; if (imageElem.base64) {
var image_map = {}; imageElem.base64 = name;
} else {
for(var i = 0, length = aImagesToDownload.length; i < length; ++i) imageElem.SetUrl(name);
{ }
var sFrom = aImagesToDownload[i]; }
var sTo = oFromTo[sFrom]; image_map[i] = name;
if(sTo) } else {
arr_images.push(sTo); image_map[i] = aImagesToDownload[i];
} }
for(var i = 0, length = objects.arrImages.length; i < length; ++i) }
{ aContent = oThis._convertExcelBinary(null, arr_shapes);
var imageElem = objects.arrImages[i]; oThis.aContent = aContent.content;
if(null != imageElem) oThis.api.pre_Paste(aContent.fonts, image_map, fPrepasteCallback);
{ });
//для вставки graphicFrame в виде картинки(если было при копировании выделено несколько графических объектов)
if(imageElem.base64)
{
var sNewSrc = oFromTo[imageElem.base64];
if(null != sNewSrc)
{
image_map[sNewSrc] = sNewSrc;
imageElem.base64 = sNewSrc;
}
else
{
image_map[imageElem.base64] = imageElem.base64;
}
}
else
{
var sNewSrc = oFromTo[imageElem.Url];
if(null != sNewSrc)
{
image_map[sNewSrc] = sNewSrc;
imageElem.SetUrl(sNewSrc);
}
else
{
image_map[imageElem.Url] = imageElem.Url;
}
}
}
}
}
aContent = oThis._convertExcelBinary(null, arr_shapes);
oThis.aContent = aContent.content;
oThis.api.sync_EndAction(c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.LoadImage);
oThis.api.pre_Paste(aContent.fonts, image_map, fPrepasteCallback);
}, _sendCommandCallback, rData);
return; return;
} }
} }
...@@ -3388,43 +3335,23 @@ PasteProcessor.prototype = ...@@ -3388,43 +3335,23 @@ PasteProcessor.prototype =
aImagesToDownload.push(i); aImagesToDownload.push(i);
if(aImagesToDownload.length > 0) if(aImagesToDownload.length > 0)
{ {
var rData = {"id":documentId, "c":"imgurls", "vkey": documentVKey, "userid": documentUserId, "saveindex": g_oDocumentUrls.getMaxIndex(), "data": aImagesToDownload}; sendImgUrls(oThis.api, aImagesToDownload, function (data) {
oThis.api.sync_StartAction(c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.LoadImage); var image_map = {};
sendCommand2(function(incomeObject){ for (var i = 0, length = data.length; i < length; ++i) {
if(incomeObject && "imgurls" == incomeObject.type) var elem = data[i];
{ if (null != elem.url) {
var oFromTo = JSON.parse(incomeObject.data); var name = g_oDocumentUrls.imagePath2Local(elem.path);
var imageElem = objects.arrImages[i];
var arr_images =[]; if (null != imageElem) {
var image_map = {}; imageElem.SetUrl(name);
for(var i = 0, length = objects.arrImages.length; i < length; ++i)
{
var sFrom = objects.arrImages[i].Url;
var sTo = oFromTo[sFrom];
if(sTo)
arr_images.push(sTo);
}
for(var i = 0, length = objects.arrImages.length; i < length; ++i)
{
var imageElem = objects.arrImages[i];
if(null != imageElem)
{
var sNewSrc = oFromTo[imageElem.Url];
if(null != sNewSrc)
{
image_map[sNewSrc] = sNewSrc;
imageElem.SetUrl(sNewSrc);
}
else
{
image_map[imageElem.Url] = imageElem.Url;
}
}
}
} }
oThis.api.sync_EndAction(c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.LoadImage); image_map[i] = name;
oThis.api.pre_Paste(fonts, image_map, paste_callback); } else {
}, _sendCommandCallback, rData); image_map[i] = aImagesToDownload[i];
}
}
oThis.api.pre_Paste(fonts, image_map, paste_callback);
});
} }
else else
{ {
...@@ -3694,41 +3621,23 @@ PasteProcessor.prototype = ...@@ -3694,41 +3621,23 @@ PasteProcessor.prototype =
aImagesToDownload.push(i); aImagesToDownload.push(i);
if(aImagesToDownload.length > 0) if(aImagesToDownload.length > 0)
{ {
var rData = {"id":documentId, "c":"imgurls", "vkey": documentVKey, "userid": documentUserId, "saveindex": g_oDocumentUrls.getMaxIndex(), "data": aImagesToDownload}; sendImgUrls(oThis.api, aImagesToDownload, function (data) {
oThis.api.sync_StartAction(c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.LoadImage); var image_map = {};
sendCommand2(function(incomeObject){ for (var i = 0, length = data.length; i < length; ++i) {
if(incomeObject && "imgurls" == incomeObject.type) var elem = data[i];
{ if (null != elem.url) {
var oFromTo = JSON.parse(incomeObject.data); var name = g_oDocumentUrls.imagePath2Local(elem.path);
var imageElem = objects.arrImages[i];
var image_map = {}; if (null != imageElem) {
for(var i = 0, length = objects.arrImages.length; i < length; ++i) imageElem.SetUrl(name);
{
var sFrom = objects.arrImages[i].Url;
var sTo = oFromTo[sFrom];
}
for(var i = 0, length = objects.arrImages.length; i < length; ++i)
{
var imageElem = objects.arrImages[i];
if(null != imageElem)
{
var sNewSrc = oFromTo[imageElem.Url];
if(null != sNewSrc)
{
image_map[sNewSrc] = sNewSrc;
imageElem.SetUrl(sNewSrc);
}
else
{
image_map[imageElem.Url] = imageElem.Url;
}
}
}
} }
image_map[i] = name;
oThis.api.sync_EndAction(c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.LoadImage); } else {
oThis.api.pre_Paste(fonts, image_map, paste_callback); image_map[i] = aImagesToDownload[i];
}, _sendCommandCallback, rData); }
}
oThis.api.pre_Paste(fonts, image_map, paste_callback);
});
} }
else else
{ {
...@@ -3795,25 +3704,23 @@ PasteProcessor.prototype = ...@@ -3795,25 +3704,23 @@ PasteProcessor.prototype =
var aImagesToDownload = []; var aImagesToDownload = [];
for(var i in images) for(var i in images)
aImagesToDownload.push(i); aImagesToDownload.push(i);
var oPrepeareImages = {};
if(aImagesToDownload.length > 0) if(aImagesToDownload.length > 0)
{ {
var rData = {"id":documentId, "c":"imgurls", "vkey": documentVKey, "userid": documentUserId, "saveindex": g_oDocumentUrls.getMaxIndex(), "data": aImagesToDownload}; sendImgUrls(oThis.api, aImagesToDownload, function (data) {
oThis.api.sync_StartAction(c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.LoadImage); var image_map = {};
sendCommand2(function(incomeObject){ for (var i = 0, length = data.length; i < length; ++i) {
if(incomeObject && "imgurls" == incomeObject.type) var elem = data[i];
{ var sFrom = aImagesToDownload[i];
var oFromTo = JSON.parse(incomeObject.data); if (null != elem.url) {
for(var i = 0, length = aImagesToDownload.length; i < length; ++i) var name = g_oDocumentUrls.imagePath2Local(elem.path);
{ oThis.oImages[sFrom] = name;
var sFrom = aImagesToDownload[i]; image_map[i] = name;
var sTo = oFromTo[sFrom]; } else {
if(sTo) image_map[i] = sFrom;
{ oThis.oImages[sFrom] = sTo; oPrepeareImages[i] = sTo; } } }
} }
oThis.api.sync_EndAction(c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.LoadImage); oThis.api.pre_Paste(fonts, image_map, paste_callback);
oThis.api.pre_Paste(fonts, oPrepeareImages, paste_callback); });
}, _sendCommandCallback, rData);
} }
else else
{ {
...@@ -3943,63 +3850,38 @@ PasteProcessor.prototype = ...@@ -3943,63 +3850,38 @@ PasteProcessor.prototype =
aImagesToDownload.push(i); aImagesToDownload.push(i);
if(aImagesToDownload.length > 0) if(aImagesToDownload.length > 0)
{ {
var rData = {"id":documentId, "c":"imgurls", "vkey": documentVKey, "userid": documentUserId, "saveindex": g_oDocumentUrls.getMaxIndex(), "data": aImagesToDownload}; sendImgUrls(oThis.api, aImagesToDownload, function (data) {
oThis.api.sync_StartAction(c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.LoadImage); var image_map = {};
sendCommand2(function(incomeObject){ for (var i = 0, length = data.length; i < length; ++i) {
if(incomeObject && "imgurls" == incomeObject.type) var elem = data[i];
{ if (null != elem.url) {
var oFromTo = JSON.parse(incomeObject.data); var name = g_oDocumentUrls.imagePath2Local(elem.path);
var imageElem = aContent.aPastedImages[i];
var arr_images =[]; if (null != imageElem) {
var image_map = {}; imageElem.SetUrl(name);
for(var i = 0, length = aContent.images.length; i < length; ++i) }
{ image_map[i] = name;
var sFrom = aContent.images[i]; } else {
var sTo = oFromTo[sFrom]; image_map[i] = aImagesToDownload[i];
if(sTo) }
arr_images.push(sTo); }
} //ковертим изображения в презентационный формат
for(var i = 0, length = aContent.images.length; i < length; ++i) for (var i = 0; i < presentationSelectedContent.Drawings.length; i++) {
{ if (!(presentationSelectedContent.Drawings[i].Drawing instanceof CGraphicFrame)) {
var imageElem = aContent.aPastedImages[i]; if (presentationSelectedContent.Drawings[i].Drawing.setBDeleted2) {
if(null != imageElem) presentationSelectedContent.Drawings[i].Drawing.setBDeleted2(true);
{ }
var sNewSrc = oFromTo[imageElem.Url]; else {
if(null != sNewSrc) presentationSelectedContent.Drawings[i].Drawing.setBDeleted(true);
{ }
image_map[sNewSrc] = sNewSrc; presentationSelectedContent.Drawings[i].Drawing = presentationSelectedContent.Drawings[i].Drawing.convertToPPTX(oThis.oDocument.DrawingDocument);
imageElem.SetUrl(sNewSrc); checkBlipFillRasterImages(presentationSelectedContent.Drawings[i].Drawing);
} }
else }
{
image_map[imageElem.Url] = imageElem.Url;
}
}
}
}
//ковертим изображения в презентационный формат
for(var i = 0; i < presentationSelectedContent.Drawings.length; i++)
{
if(!(presentationSelectedContent.Drawings[i].Drawing instanceof CGraphicFrame))
{
if(presentationSelectedContent.Drawings[i].Drawing.setBDeleted2)
{
presentationSelectedContent.Drawings[i].Drawing.setBDeleted2(true);
}
else
{
presentationSelectedContent.Drawings[i].Drawing.setBDeleted(true);
}
presentationSelectedContent.Drawings[i].Drawing = presentationSelectedContent.Drawings[i].Drawing.convertToPPTX(oThis.oDocument.DrawingDocument);
checkBlipFillRasterImages(presentationSelectedContent.Drawings[i].Drawing);
}
}
oThis.api.sync_EndAction(c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.LoadImage); oThis.api.pre_Paste(fonts, image_map, paste_callback);
oThis.api.pre_Paste(fonts, image_map, paste_callback); });
}, _sendCommandCallback, rData);
} }
else else
{ {
...@@ -4081,43 +3963,23 @@ PasteProcessor.prototype = ...@@ -4081,43 +3963,23 @@ PasteProcessor.prototype =
if(images.length > 0) if(images.length > 0)
{ {
var rData = {"id":documentId, "c":"imgurls", "vkey": documentVKey, "userid": documentUserId, "saveindex": g_oDocumentUrls.getMaxIndex(), "data": images}; sendImgUrls(oThis.api, images, function (data) {
oThis.api.sync_StartAction(c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.LoadImage); var image_map = {};
sendCommand2(function(incomeObject){ for (var i = 0, length = data.length; i < length; ++i) {
if(incomeObject && "imgurls" == incomeObject.type) var elem = data[i];
{ if (null != elem.url) {
var oFromTo = JSON.parse(incomeObject.data); var name = g_oDocumentUrls.imagePath2Local(elem.path);
var imageElem = arrImages[i];
var arr_images =[]; if (null != imageElem) {
var image_map = {}; imageElem.SetUrl(name);
for(var i = 0, length = arrImages.length; i < length; ++i) }
{ image_map[i] = name;
var sFrom = arrImages[i].Url; } else {
var sTo = oFromTo[sFrom]; image_map[i] = images[i];
if(sTo) }
arr_images.push(sTo); }
} oThis.api.pre_Paste(fonts, image_map, paste_callback);
for(var i = 0, length = arrImages.length; i < length; ++i) });
{
var imageElem = arrImages[i];
if(null != imageElem)
{
var sNewSrc = oFromTo[imageElem.Url];
if(null != sNewSrc)
{
image_map[sNewSrc] = sNewSrc;
imageElem.SetUrl(sNewSrc);
}
else
{
image_map[imageElem.Url] = imageElem.Url;
}
}
}
}
oThis.api.sync_EndAction(c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.LoadImage);
oThis.api.pre_Paste(fonts, image_map, paste_callback);
}, _sendCommandCallback, rData);
} }
else else
{ {
...@@ -4263,44 +4125,24 @@ PasteProcessor.prototype = ...@@ -4263,44 +4125,24 @@ PasteProcessor.prototype =
var aContent = oThis.aContent; var aContent = oThis.aContent;
if(aImagesToDownload.length > 0) if(aImagesToDownload.length > 0)
{ {
var rData = {"id":documentId, "c":"imgurls", "vkey": documentVKey, "userid": documentUserId, "saveindex": g_oDocumentUrls.getMaxIndex(), "data": aImagesToDownload}; sendImgUrls(oThis.api, aImagesToDownload, function (data) {
oThis.api.sync_StartAction(c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.LoadImage); var image_map = {};
sendCommand2(function(incomeObject){ for (var i = 0, length = data.length; i < length; ++i) {
if(incomeObject && "imgurls" == incomeObject.type) var elem = data[i];
{ if (null != elem.url) {
var oFromTo = JSON.parse(incomeObject.data); var name = g_oDocumentUrls.imagePath2Local(elem.path);
var imageElem = aContent.aPastedImages[i];
var arr_images =[]; if (null != imageElem) {
var image_map = {}; imageElem.SetUrl(name);
for(var i = 0, length = aContent.images.length; i < length; ++i) }
{ image_map[i] = name;
var sFrom = aContent.images[i]; } else {
var sTo = oFromTo[sFrom]; image_map[i] = aImagesToDownload[i];
if(sTo) }
arr_images.push(sTo); }
} oThis.api.pre_Paste(fonts, image_map, paste_callback);
for(var i = 0, length = aContent.images.length; i < length; ++i) });
{
var imageElem = aContent.aPastedImages[i];
if(null != imageElem)
{
var sNewSrc = oFromTo[imageElem.Url];
if(null != sNewSrc)
{
image_map[sNewSrc] = sNewSrc;
imageElem.SetUrl(sNewSrc);
}
else
{
image_map[imageElem.Url] = imageElem.Url;
}
}
}
}
oThis.api.sync_EndAction(c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.LoadImage);
oThis.api.pre_Paste(fonts, image_map, paste_callback);
}, _sendCommandCallback, rData);
} }
else else
{ {
...@@ -4957,42 +4799,23 @@ PasteProcessor.prototype = ...@@ -4957,42 +4799,23 @@ PasteProcessor.prototype =
else if(!g_oDocumentUrls.getImageLocal(src)) else if(!g_oDocumentUrls.getImageLocal(src))
aImagesToDownload.push(src); aImagesToDownload.push(src);
} }
var oPrepeareImages = {};
if(aImagesToDownload.length > 0) if(aImagesToDownload.length > 0)
{ {
var rData = {"id":documentId, "c":"imgurls", "vkey": documentVKey, "userid": documentUserId, "saveindex": g_oDocumentUrls.getMaxIndex(), "data": aImagesToDownload}; sendImgUrls(oThis.api, aImagesToDownload, function (data) {
this.api.fCurCallback = function(input) { var image_map = {};
if(null != input && "imgurls" == input["type"]){ for (var i = 0, length = data.length; i < length; ++i) {
if("ok" ==input["status"]) { var elem = data[i];
var data = input["data"]; var sFrom = aImagesToDownload[i];
var urls = {}; if (null != elem.url) {
for(var i = 0, length = aImagesToDownload.length; i < length; ++i) var name = g_oDocumentUrls.imagePath2Local(elem.path);
{ oThis.oImages[sFrom] = name;
var sFrom = aImagesToDownload[i]; image_map[i] = name;
var elem = data[i]; } else {
if(elem.url) image_map[i] = sFrom;
{ }
urls[elem.path] = elem.url; }
if (_mapLocal[sFrom] !== undefined) oThis.api.pre_Paste(aPrepeareFonts, image_map, fCallback);
sFrom = _mapLocal[sFrom]; });
var name = g_oDocumentUrls.imagePath2Local(elem.path);
oThis.oImages[sFrom] = name;
oPrepeareImages[i] = name;
}
}
g_oDocumentUrls.addUrls(urls);
oThis.api.pre_Paste(aPrepeareFonts, oPrepeareImages, fCallback);
} else {
oThis.asc_fireCallback("asc_onError", g_fMapAscServerErrorToAscError(parseInt(input["data"])), c_oAscError.Level.NoCritical);
}
} else {
oThis.asc_fireCallback("asc_onError",c_oAscError.ID.Unknown,c_oAscError.Level.NoCritical);
}
oThis.api.sync_EndAction(c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.LoadImage);
};
//плашка для отправки изображений на сервер
oThis.api.sync_StartAction(c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.LoadImage);
sendCommand2( this.api, null, rData );
} }
else else
this.api.pre_Paste(aPrepeareFonts, this.oImages, fCallback); this.api.pre_Paste(aPrepeareFonts, this.oImages, fCallback);
......
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