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

подготовка для drag&drop нескольких картинок.

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@54196 954022d7-b5bf-4e40-9824-e11837661b57
parent f22f812c
...@@ -3291,9 +3291,10 @@ function DrawingObjects() { ...@@ -3291,9 +3291,10 @@ function DrawingObjects() {
var sheetId = null; var sheetId = null;
if (null != data["input"]) if (null != data["input"])
sheetId = data["input"]["sheetId"]; sheetId = data["input"]["sheetId"];
var url = data["url"]; var urls = data["urls"];
if (sheetId == worksheet.model.getId()) { if (urls && urls.length > 0 && sheetId == worksheet.model.getId()) {
var url = urls[0];
if ( api.isImageChangeUrl || api.isShapeImageChangeUrl ) if ( api.isImageChangeUrl || api.isShapeImageChangeUrl )
_this.editImageDrawingObject(url); _this.editImageDrawingObject(url);
else else
......
This diff is collapsed.
...@@ -180,10 +180,10 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS"; ...@@ -180,10 +180,10 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
worksheet = this.wbModel.getWorksheet(this.wbModel.getActive()); worksheet = this.wbModel.getWorksheet(this.wbModel.getActive());
if (null != worksheet) { if (null != worksheet) {
this.handlers.trigger("asc_onStartAction", c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.LoadImage); this.handlers.trigger("asc_onStartAction", c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.LoadImage);
var file = files[0];
var xhr = new XMLHttpRequest(); var xhr = new XMLHttpRequest();
var fd = new FormData(); var fd = new FormData();
fd.append('file', file); for(var i = 0, length = files.length; i < length; i++)
fd.append('file[' + i + ']', files[i]);
xhr.open('POST', g_sUploadServiceLocalUrl+'?key=' + this.documentId + '&sheetId=' + worksheet.getId()); xhr.open('POST', g_sUploadServiceLocalUrl+'?key=' + this.documentId + '&sheetId=' + worksheet.getId());
xhr.onreadystatechange = function() { xhr.onreadystatechange = function() {
if (4 == this.readyState) { if (4 == this.readyState) {
......
...@@ -171,10 +171,10 @@ function asc_docs_api(name) ...@@ -171,10 +171,10 @@ function asc_docs_api(name)
if(c_oAscServerError.NoError == nError) if(c_oAscServerError.NoError == nError)
{ {
oThis.sync_StartAction(c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.UploadImage); oThis.sync_StartAction(c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.UploadImage);
var file = files[0];
var xhr = new XMLHttpRequest(); var xhr = new XMLHttpRequest();
var fd = new FormData(); var fd = new FormData();
fd.append('file', file); for(var i = 0, length = files.length; i < length; i++)
fd.append('file[' + i + ']', files[i]);
xhr.open('POST', g_sUploadServiceLocalUrl+'?key='+documentId); xhr.open('POST', g_sUploadServiceLocalUrl+'?key='+documentId);
xhr.onreadystatechange = function(){ xhr.onreadystatechange = function(){
if(4 == this.readyState) if(4 == this.readyState)
...@@ -4558,15 +4558,19 @@ asc_docs_api.prototype.OnHandleMessage = function(event) ...@@ -4558,15 +4558,19 @@ asc_docs_api.prototype.OnHandleMessage = function(event)
if (null != event && null != event.data) if (null != event && null != event.data)
{ {
var data = JSON.parse(event.data); var data = JSON.parse(event.data);
if(null != data && null != data.type) if(null != data && null != data["type"])
{ {
if(PostMessageType.UploadImage == data.type) if(PostMessageType.UploadImage == data["type"])
{ {
editor.sync_EndAction(c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.UploadImage); editor.sync_EndAction(c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.UploadImage);
if(c_oAscServerError.NoError == data.error) if(c_oAscServerError.NoError == data["error"])
this.AddImageUrl(data.url); {
var urls = data["urls"];
if(urls && urls.length > 0)
this.AddImageUrl(urls[0]);
}
else else
this.sync_ErrorCallback(_mapAscServerErrorToAscError(data.error), c_oAscError.Level.NoCritical); this.sync_ErrorCallback(_mapAscServerErrorToAscError(data["error"]), c_oAscError.Level.NoCritical);
} }
} }
} }
......
...@@ -668,10 +668,10 @@ function asc_docs_api(name) ...@@ -668,10 +668,10 @@ function asc_docs_api(name)
if(c_oAscServerError.NoError == nError) if(c_oAscServerError.NoError == nError)
{ {
oThis.sync_StartAction(c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.UploadImage); oThis.sync_StartAction(c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.UploadImage);
var file = files[0];
var xhr = new XMLHttpRequest(); var xhr = new XMLHttpRequest();
var fd = new FormData(); var fd = new FormData();
fd.append('file', file); for(var i = 0, length = files.length; i < length; i++)
fd.append('file[' + i + ']', files[i]);
xhr.open('POST', g_sUploadServiceLocalUrl+'?key='+documentId); xhr.open('POST', g_sUploadServiceLocalUrl+'?key='+documentId);
xhr.onreadystatechange = function(){ xhr.onreadystatechange = function(){
if(4 == this.readyState) if(4 == this.readyState)
...@@ -6789,15 +6789,19 @@ asc_docs_api.prototype.OnHandleMessage = function(event) ...@@ -6789,15 +6789,19 @@ asc_docs_api.prototype.OnHandleMessage = function(event)
try try
{ {
var data = JSON.parse(event.data); var data = JSON.parse(event.data);
if(null != data && null != data.type) if(null != data && null != data["type"])
{ {
if(PostMessageType.UploadImage == data.type) if(PostMessageType.UploadImage == data["type"])
{ {
editor.sync_EndAction(c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.UploadImage); editor.sync_EndAction(c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.UploadImage);
if(c_oAscServerError.NoError == data.error) if(c_oAscServerError.NoError == data["error"])
this.AddImageUrl(data.url); {
var urls = data["urls"];
if(urls && urls.length > 0)
this.AddImageUrl(urls[0]);
}
else else
this.sync_ErrorCallback(_mapAscServerErrorToAscError(data.error), c_oAscError.Level.NoCritical); this.sync_ErrorCallback(_mapAscServerErrorToAscError(data["error"]), c_oAscError.Level.NoCritical);
} }
} }
} }
......
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