Commit 024db4fb authored by Boris Kocherov's avatar Boris Kocherov Committed by Boris Kocherov

erp5_officejs_ooffice: use jio storrage for save document images

disable "image upload blocking" on image jio save (probably it wrong)
use modified jio_putAttachment to save image:
* if attachId undefined then attachId = mimeType,sha1hashOfFile
* not save in jio storage if attach with checksumm already exist
* return attachId
* allow dataUri instead blob
use modified jio_getAttachment allow get attachment as dataUrl or
blobUrl (ooffice use blobUrl)
fixed double loading of textures
parent da18f539
...@@ -80,26 +80,6 @@ var c_oAscError = Asc.c_oAscError; ...@@ -80,26 +80,6 @@ var c_oAscError = Asc.c_oAscError;
cp['encodings'] = AscCommon.getEncodingParams(); cp['encodings'] = AscCommon.getEncodingParams();
this.handlers.trigger("asc_onAdvancedOptions", new AscCommon.asc_CAdvancedOptions(Asc.c_oAscAdvancedOptionsID.CSV, cp), AscCommon.c_oAscAdvancedOptionsAction.Open); this.handlers.trigger("asc_onAdvancedOptions", new AscCommon.asc_CAdvancedOptions(Asc.c_oAscAdvancedOptionsID.CSV, cp), AscCommon.c_oAscAdvancedOptionsAction.Open);
}; };
asc['spreadsheet_api'].prototype.asc_addImageDrawingObject = function(url)
{
var _url = window["AscDesktopEditor"]["LocalFileGetImageUrl"](url);
var ws = this.wb.getWorksheet();
if (ws)
{
var _url = window["AscDesktopEditor"]["LocalFileGetImageUrl"](url);
ws.objectRender.addImageDrawingObject(AscCommon.g_oDocumentUrls.getImageUrl(_url) , null);
}
};
asc['spreadsheet_api'].prototype.asc_showImageFileDialog = function()
{
window["AscDesktopEditor"]["LocalFileGetImageUrlFromOpenFileDialog"]();
};
asc['spreadsheet_api'].prototype.asc_addImage = function()
{
window["AscDesktopEditor"]["LocalFileGetImageUrlFromOpenFileDialog"]();
};
})(jQuery, window); })(jQuery, window);
window["Asc"]['spreadsheet_api'].prototype.asc_setAdvancedOptions = function(idOption, option) window["Asc"]['spreadsheet_api'].prototype.asc_setAdvancedOptions = function(idOption, option)
......
...@@ -214,7 +214,7 @@ ...@@ -214,7 +214,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>953.23434.41933.62634</string> </value> <value> <string>954.50388.65053.3771</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -232,7 +232,7 @@ ...@@ -232,7 +232,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1471768475.46</float> <float>1477145750.33</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -8453,32 +8453,32 @@ function InitDragAndDrop (oHtmlElement, callback) { ...@@ -8453,32 +8453,32 @@ function InitDragAndDrop (oHtmlElement, callback) {
} }
} }
function UploadImageFiles (files, documentId, documentUserId, callback) { function UploadImageFiles (files, documentId, documentUserId, callback) {
if (files.length > 0) { if (files.length > 0) {
var file = files[0]; var file = files[0],
var xhr = new XMLHttpRequest(); reader = new FileReader();
xhr.open('POST', sUploadServiceLocalUrl + '/' + documentId + '/' + documentUserId + '/' + g_oDocumentUrls.getMaxIndex(), true); reader.addEventListener('load', function () {
xhr.setRequestHeader('Content-Type', file.type || 'application/octet-stream'); Common.Gateway.jio_putAttachment(documentId, undefined, reader.result)
xhr.onreadystatechange = function() { .push(function (image_url) {
if (4 == this.readyState) { callback(Asc.c_oAscError.ID.No, 'jio:' + image_url);
if((this.status == 200 || this.status == 1223)) { })
var urls = JSON.parse(this.responseText); .push(undefined, function (error) {
g_oDocumentUrls.addUrls(urls); console.log(error);
var firstUrl; callback(Asc.c_oAscError.ID.Unknown);
for (var i in urls) { });
if (urls.hasOwnProperty(i)) { });
firstUrl = urls[i]; reader.readAsDataURL(file);
break; //// not worked. throw csp error
} //Common.Gateway.jio_putAttachment(documentId, undefined, URL.createObjectURL(file))
} // .push(function (image_url) {
callback(Asc.c_oAscError.ID.No, firstUrl); // callback(Asc.c_oAscError.ID.No, 'jio:' + image_url);
} else // })
callback(Asc.c_oAscError.ID.Unknown); // .push(undefined, function (error) {
} // callback(Asc.c_oAscError.ID.Unknown);
}; // throw error;
xhr.send(file); // });
} else { } else {
callback(Asc.c_oAscError.ID.Unknown); callback(Asc.c_oAscError.ID.Unknown);
} }
} }
function ValidateUploadImage( files ) { function ValidateUploadImage( files ) {
var nRes = c_oAscServerError.NoError; var nRes = c_oAscServerError.NoError;
...@@ -10234,7 +10234,7 @@ CUserCacheColor.prototype.init = function(nColor) { ...@@ -10234,7 +10234,7 @@ CUserCacheColor.prototype.init = function(nColor) {
if (window['AscNotLoadAllScript']) { if (window['AscNotLoadAllScript']) {
callback(); callback();
} else { } else {
loadScript('./sdkjs/' + sdkName + '/sdk-all-dev.js', callback); loadScript('./../../../../sdkjs/' + sdkName + '/sdk-all.js', callback);
} }
} }
...@@ -14766,7 +14766,6 @@ var c_oAscPopUpSelectorType = { ...@@ -14766,7 +14766,6 @@ var c_oAscPopUpSelectorType = {
} }
else else
{ {
this.sync_StartAction(c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.UploadImage);
AscCommon.UploadImageFiles(files, this.documentId, this.documentUserId, function(error, url) AscCommon.UploadImageFiles(files, this.documentId, this.documentUserId, function(error, url)
{ {
if (c_oAscError.ID.No !== error) if (c_oAscError.ID.No !== error)
...@@ -14777,7 +14776,6 @@ var c_oAscPopUpSelectorType = { ...@@ -14777,7 +14776,6 @@ var c_oAscPopUpSelectorType = {
{ {
t._addImageUrl(url); t._addImageUrl(url);
} }
t.sync_EndAction(c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.UploadImage);
}); });
} }
}; };
...@@ -14936,13 +14934,16 @@ var c_oAscPopUpSelectorType = { ...@@ -14936,13 +14934,16 @@ var c_oAscPopUpSelectorType = {
baseEditorsApi.prototype.sendStandartTextures = function() baseEditorsApi.prototype.sendStandartTextures = function()
{ {
var _count = AscCommon.g_oUserTexturePresets.length; var _count = AscCommon.g_oUserTexturePresets.length;
var arr = new Array(_count); var arr = new Array(_count),
b_LoadImage = this._editorNameById() === 'cell';
for (var i = 0; i < _count; ++i) for (var i = 0; i < _count; ++i)
{ {
arr[i] = new AscCommon.asc_CTexture(); arr[i] = new AscCommon.asc_CTexture();
arr[i].Id = i; arr[i].Id = i;
arr[i].Image = AscCommon.g_oUserTexturePresets[i]; arr[i].Image = AscCommon.g_oUserTexturePresets[i];
this.ImageLoader.LoadImage(AscCommon.g_oUserTexturePresets[i], 1); if (b_LoadImage) {
this.ImageLoader.LoadImage(AscCommon.g_oUserTexturePresets[i], 1);
}
} }
this.sendEvent('asc_onInitStandartTextures', arr); this.sendEvent('asc_onInitStandartTextures', arr);
...@@ -17301,48 +17302,32 @@ var editor; ...@@ -17301,48 +17302,32 @@ var editor;
return ws.objectRender.editChartDrawingObject(chart); return ws.objectRender.editChartDrawingObject(chart);
}; };
spreadsheet_api.prototype.asc_addImageDrawingObject = function(imageUrl) { spreadsheet_api.prototype.asc_addImageDrawingObject = function(imageUrl, callback) {
var rData = {
"id": this.documentId,
"userid": this.documentUserId,
"vkey": this.documentVKey,
"c": "imgurl",
"saveindex": g_oDocumentUrls.getMaxIndex(),
"data": imageUrl};
var t = this; var t = this;
this.sync_StartAction(c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.UploadImage); if (!callback) {
this.fCurCallback = function(input) { callback = function (url) {
if (null != input && "imgurl" == input["type"]) { //g_oDocumentUrls.addUrls(urls);
if ("ok" == input["status"]) { var ws = t.wb.getWorksheet();
var data = input["data"]; ws.objectRender.addImageDrawingObject('jio:' + url, null);
var urls = {}; };
var firstUrl; }
for (var i = 0; i < data.length; ++i) { //this.sync_StartAction(c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.UploadImage);
var elem = data[i]; return new RSVP.Queue()
if (elem.url) { .push(function () {
if (!firstUrl) { return imageUrl;
firstUrl = elem.url; })
} .push(AscCommon.downloadUrlAsBlob)
urls[elem.path] = elem.url; .push(AscCommon.readBlobAsDataURL)
} .push(function (dataUrl) {
} return Common.Gateway.jio_putAttachment(t.documentId, undefined, dataUrl);
g_oDocumentUrls.addUrls(urls); })
if (firstUrl) { .push(callback)
var ws = t.wb.getWorksheet(); //.push(function () {t.sync_EndAction(c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.UploadImage);})
ws.objectRender.addImageDrawingObject(firstUrl, null); .push(undefined, function (error) {
} else { console.log(error);
t.handlers.trigger("asc_onError", c_oAscError.ID.Unknown, c_oAscError.Level.NoCritical);
}
} else {
t.handlers.trigger("asc_onError", mapAscServerErrorToAscError(parseInt(input["data"])), c_oAscError.Level.NoCritical);
}
} else {
t.handlers.trigger("asc_onError", c_oAscError.ID.Unknown, c_oAscError.Level.NoCritical); t.handlers.trigger("asc_onError", c_oAscError.ID.Unknown, c_oAscError.Level.NoCritical);
} //t.sync_EndAction(c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.UploadImage);
t.sync_EndAction(c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.UploadImage); });
};
sendCommand(this, null, rData);
}; };
spreadsheet_api.prototype.asc_showImageFileDialog = function() { spreadsheet_api.prototype.asc_showImageFileDialog = function() {
...@@ -17550,47 +17535,10 @@ var editor; ...@@ -17550,47 +17535,10 @@ var editor;
return; return;
} }
var rData = { this.asc_addImageDrawingObject(sImageUrl, function (url) {
"id": this.documentId, fReplaceCallback('jio:' + url);
"userid": this.documentUserId, ws.objectRender.setGraphicObjectProps(props);
"vkey": this.documentVKey, });
"c": "imgurl",
"saveindex": g_oDocumentUrls.getMaxIndex(),
"data": sImageUrl};
var t = this;
this.sync_StartAction(c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.UploadImage);
this.fCurCallback = function(input) {
if (null != input && "imgurl" == input["type"]) {
if ("ok" == input["status"]) {
var data = input["data"];
var urls = {};
var firstUrl;
for (var i = 0; i < data.length; ++i) {
var elem = data[i];
if (elem.url) {
if (!firstUrl) {
firstUrl = elem.url;
}
urls[elem.path] = elem.url;
}
}
g_oDocumentUrls.addUrls(urls);
if (firstUrl) {
fReplaceCallback(firstUrl);
ws.objectRender.setGraphicObjectProps(props);
} else {
t.handlers.trigger("asc_onError", c_oAscError.ID.Unknown, c_oAscError.Level.NoCritical);
}
} else {
t.handlers.trigger("asc_onError", mapAscServerErrorToAscError(parseInt(input["data"])), c_oAscError.Level.NoCritical);
}
} else {
t.handlers.trigger("asc_onError", c_oAscError.ID.Unknown, c_oAscError.Level.NoCritical);
}
t.sync_EndAction(c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.UploadImage);
};
sendCommand(this, null, rData);
} }
else{ else{
ws.objectRender.setGraphicObjectProps(props); ws.objectRender.setGraphicObjectProps(props);
...@@ -18693,6 +18641,39 @@ AscCommon.baseEditorsApi.prototype._onEndPermissions = function() ...@@ -18693,6 +18641,39 @@ AscCommon.baseEditorsApi.prototype._onEndPermissions = function()
}; };
"use strict"; "use strict";
AscCommon.readBlobAsDataURL = function (blob) {
var fr = new FileReader();
return new RSVP.Promise(function (resolve, reject, notify) {
fr.addEventListener("load", function () {
resolve(fr.result);
});
fr.addEventListener("error", reject);
fr.addEventListener("progress", notify);
fr.readAsDataURL(blob);
}, function () {
fr.abort();
});
};
AscCommon.downloadUrlAsBlob = function (url) {
var xhr = new XMLHttpRequest();
return new RSVP.Promise(function (resolve, reject) {
xhr.open("GET", url);
xhr.responseType = "blob";//force the HTTP response, response-type header to be blob
xhr.onload = function () {
if (this.status === 200) {
resolve(xhr.response);
} else {
reject(this.status)
}
};
xhr.onerror = reject;
xhr.send();
}, function () {
xhr.abort();
});
};
AscCommon.baseEditorsApi.prototype.jio_open = function () { AscCommon.baseEditorsApi.prototype.jio_open = function () {
var t = this; var t = this;
Common.Gateway.jio_get(t.documentId) Common.Gateway.jio_get(t.documentId)
......
...@@ -214,7 +214,7 @@ ...@@ -214,7 +214,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>953.23427.23974.28945</string> </value> <value> <string>954.52999.30462.56268</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -232,7 +232,7 @@ ...@@ -232,7 +232,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1471768543.79</float> <float>1477302267.48</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -160,7 +160,7 @@ ...@@ -160,7 +160,7 @@
this.fonts_streams = []; this.fonts_streams = [];
// теперь вся информация о всех возможных шрифтах. Они во всех редакторах должны быть одни и те же // теперь вся информация о всех возможных шрифтах. Они во всех редакторах должны быть одни и те же
this.fontFilesPath = "../ooffice_fonts"; this.fontFilesPath = "../../../ooffice_fonts";
this.fontFiles = AscFonts.g_font_files; this.fontFiles = AscFonts.g_font_files;
this.fontInfos = AscFonts.g_font_infos; this.fontInfos = AscFonts.g_font_infos;
this.map_font_index = AscFonts.g_map_font_index; this.map_font_index = AscFonts.g_map_font_index;
...@@ -189,7 +189,7 @@ ...@@ -189,7 +189,7 @@
this.Api = _api; this.Api = _api;
this.embedded_cut_manager.Api = _api; this.embedded_cut_manager.Api = _api;
}; };
this.LoadEmbeddedFonts = function(url, _fonts) this.LoadEmbeddedFonts = function(url, _fonts)
{ {
this.embeddedFilesPath = url; this.embeddedFilesPath = url;
...@@ -458,7 +458,7 @@ ...@@ -458,7 +458,7 @@
oThis.Api.OpenDocumentProgress.CurrentFont++; oThis.Api.OpenDocumentProgress.CurrentFont++;
oThis.Api.SendOpenProgress(); oThis.Api.SendOpenProgress();
} }
oThis.fonts_loading_after_style[oThis.fonts_loading_after_style.length] = oThis.fonts_loading[0]; oThis.fonts_loading_after_style[oThis.fonts_loading_after_style.length] = oThis.fonts_loading[0];
oThis.fonts_loading.shift(); oThis.fonts_loading.shift();
oThis._LoadFonts(); oThis._LoadFonts();
...@@ -533,7 +533,7 @@ ...@@ -533,7 +533,7 @@
{ {
this.embeddedFontFiles[font_index].SetStreamIndex(stream_index); this.embeddedFontFiles[font_index].SetStreamIndex(stream_index);
}; };
function CGlobalImageLoader() function CGlobalImageLoader()
{ {
this.map_image_index = {}; this.map_image_index = {};
...@@ -561,137 +561,105 @@ ...@@ -561,137 +561,105 @@
} }
} }
}; };
this.LoadDocumentImages = function(_images, isUrl) this.LoadDocumentImages = function (_images, isUrl) {
{ var oThis = this,
// сначала заполним массив images = [];
if (this.ThemeLoader == null) if (this.ThemeLoader === null)
this.Api.asyncImagesDocumentStartLoaded(); this.Api.asyncImagesDocumentStartLoaded();
else else
this.ThemeLoader.asyncImagesStartLoaded(); this.ThemeLoader.asyncImagesStartLoaded();
if (!this.bIsAsyncLoadDocumentImages) {
this.images_loading = []; for (var id in _images) {
images.push(AscCommon.getFullImageSrc2(_images[id]));
for (var id in _images) }
{ return RSVP.all(images.map(function (image_id) {
this.images_loading[this.images_loading.length] = AscCommon.getFullImageSrc2(_images[id]); return oThis._LoadImage(image_id)
} .push(function () {
if (oThis.bIsLoadDocumentFirst === true) {
if (!this.bIsAsyncLoadDocumentImages) oThis.Api.OpenDocumentProgress.CurrentImage++;
{ oThis.Api.SendOpenProgress();
this._LoadImages(); }
}
else });
{ }))
var _len = this.images_loading.length; .then(function () {
for (var i = 0; i < _len; i++) if (oThis.ThemeLoader === null)
{ oThis.Api.asyncImagesDocumentEndLoaded();
this.LoadImageAsync(i); else
oThis.ThemeLoader.asyncImagesEndLoaded();
});
} else {
for (var id in _images) {
this._LoadImage(AscCommon.getFullImageSrc2(_images[id]))
.push(function (oImage) {
oThis.Api.asyncImageEndLoadedBackground(oImage);
});
} }
this.images_loading.splice(0, _len); if (this.ThemeLoader === null)
if (this.ThemeLoader == null)
this.Api.asyncImagesDocumentEndLoaded(); this.Api.asyncImagesDocumentEndLoaded();
else else
this.ThemeLoader.asyncImagesEndLoaded(); this.ThemeLoader.asyncImagesEndLoaded();
} }
}; };
var oThis = this; this._LoadImage = function (image_id, Type) {
this._LoadImages = function() var start = image_id.slice(0, 4),
{ queue,
if (0 == this.images_loading.length) oThis = this;
{ if (0 === start.indexOf('jio:')) {
if (this.ThemeLoader == null) queue = Common.Gateway.jio_getAttachment(this.Api.documentId, image_id.slice(4), 'asBlobURL')
this.Api.asyncImagesDocumentEndLoaded(); .push(undefined, function (error) {
else console.log(error);
this.ThemeLoader.asyncImagesEndLoaded(); return "";
});
return; } else {
} queue = new RSVP.Queue().push(function () {
return image_id;
var _id = this.images_loading[0]; });
var oImage = new CImage(_id); }
oImage.Status = ImageLoadStatus.Loading; queue.push(function (url) {
oImage.Image = new Image(); if (url === "") {
oThis.map_image_index[oImage.src] = oImage; url = image_id;
oImage.Image.onload = function(){
oImage.Status = ImageLoadStatus.Complete;
if (oThis.bIsLoadDocumentFirst === true)
{
oThis.Api.OpenDocumentProgress.CurrentImage++;
oThis.Api.SendOpenProgress();
} }
return new RSVP.Promise(function (resolve, reject) {
oThis.images_loading.shift(); var oImage = new CImage(image_id);
oThis._LoadImages(); oImage.Type = Type;
}; oImage.Status = ImageLoadStatus.Loading;
oImage.Image.onerror = function(){ oImage.Image = new Image();
oImage.Status = ImageLoadStatus.Complete; oThis.map_image_index[image_id] = oImage;
oImage.Image = null; oImage.Image.onload = function () {
oImage.Status = ImageLoadStatus.Complete;
if (oThis.bIsLoadDocumentFirst === true) resolve(oImage);
{ };
oThis.Api.OpenDocumentProgress.CurrentImage++; oImage.Image.onerror = function () {
oThis.Api.SendOpenProgress(); oImage.Image = null;
} oImage.Status = ImageLoadStatus.Complete;
resolve(oImage);
oThis.images_loading.shift(); };
oThis._LoadImages(); //oImage.Image.crossOrigin = 'anonymous';
}; oImage.Image.src = url;
//oImage.Image.crossOrigin = 'anonymous'; });
oImage.Image.src = oImage.src; });
return queue;
}; };
this.LoadImage = function(src, Type) this.LoadImage = function(src, Type) {
{ var _image = this.map_image_index[src],
var _image = this.map_image_index[src]; oThis = this;
if (undefined != _image) if (undefined !== _image)
return _image; return _image;
this.Api.asyncImageStartLoaded(); this.Api.asyncImageStartLoaded();
this._LoadImage(src, Type)
.push(function (oImage) {
oThis.Api.asyncImageEndLoaded(oImage);
});
var oImage = new CImage(src);
oImage.Type = Type;
oImage.Image = new Image();
oImage.Status = ImageLoadStatus.Loading;
oThis.map_image_index[oImage.src] = oImage;
oImage.Image.onload = function(){
oImage.Status = ImageLoadStatus.Complete;
oThis.Api.asyncImageEndLoaded(oImage);
};
oImage.Image.onerror = function(){
oImage.Image = null;
oImage.Status = ImageLoadStatus.Complete;
oThis.Api.asyncImageEndLoaded(oImage);
};
//oImage.Image.crossOrigin = 'anonymous';
oImage.Image.src = oImage.src;
return null; return null;
}; };
this.LoadImageAsync = function(i)
{
var _id = oThis.images_loading[i];
var oImage = new CImage(_id);
oImage.Status = ImageLoadStatus.Loading;
oImage.Image = new Image();
oThis.map_image_index[oImage.src] = oImage;
oImage.Image.onload = function(){
oImage.Status = ImageLoadStatus.Complete;
oThis.Api.asyncImageEndLoadedBackground(oImage);
};
oImage.Image.onerror = function(){
oImage.Status = ImageLoadStatus.Complete;
oImage.Image = null;
oThis.Api.asyncImageEndLoadedBackground(oImage);
};
//oImage.Image.crossOrigin = 'anonymous';
oImage.Image.src = oImage.src;
}
} }
var g_flow_anchor = new Image(); var g_flow_anchor = new Image();
...@@ -714,4 +682,4 @@ ...@@ -714,4 +682,4 @@
window['AscCommon'].g_image_loader = new CGlobalImageLoader(); window['AscCommon'].g_image_loader = new CGlobalImageLoader();
window['AscCommon'].g_flow_anchor = g_flow_anchor; window['AscCommon'].g_flow_anchor = g_flow_anchor;
window['AscCommon'].g_flow_anchor2 = g_flow_anchor2; window['AscCommon'].g_flow_anchor2 = g_flow_anchor2;
})(window, window.document); })(window, window.document);
\ No newline at end of file
...@@ -214,7 +214,7 @@ ...@@ -214,7 +214,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>953.26982.52565.21981</string> </value> <value> <string>954.49381.42329.36369</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -232,7 +232,7 @@ ...@@ -232,7 +232,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1471895811.54</float> <float>1477136468.98</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -96,63 +96,69 @@ ...@@ -96,63 +96,69 @@
///////////////////////////////////////////////////////// /////////////////////////////////////////////////////////
////////////// IMAGES //////////////////////// ////////////// IMAGES ////////////////////////
///////////////////////////////////////////////////////// /////////////////////////////////////////////////////////
//var prot = AscCommon.DocumentUrls.prototype; var prot = AscCommon.DocumentUrls.prototype;
//prot.mediaPrefix = 'media/'; prot.mediaPrefix = 'media/';
//prot.init = function(urls) { prot.init = function(urls) {
//}; };
//prot.getUrls = function() { prot.getUrls = function() {
// return this.urls; return this.urls;
//}; };
//prot.addUrls = function(urls){ prot.addUrls = function(urls){
//}; };
//prot.addImageUrl = function(strPath, url){ prot.addImageUrl = function(strPath, url){
//}; };
//prot.getImageUrl = function(strPath){ prot.getImageUrl = function(url){
// if (0 === strPath.indexOf('theme')) var _first = "jio:";
// return null; if (0 === url.indexOf(_first))
// return url;
// if (window.editor && window.editor.ThemeLoader && window.editor.ThemeLoader.ThemesUrl != "" && strPath.indexOf(window.editor.ThemeLoader.ThemesUrl) == 0)
// return null; if (0 === url.indexOf('theme'))
// return null;
// return this.documentUrl + "/media/" + strPath;
//}; if (window.editor && window.editor.ThemeLoader && window.editor.ThemeLoader.ThemesUrl !== "" && url.indexOf(window.editor.ThemeLoader.ThemesUrl) === 0)
//prot.getImageLocal = function(url){ return null;
// var _first = this.documentUrl + "/media/";
// if (0 == url.indexOf(_first)) return _first + url;
// return url.substring(_first.length); //return this.documentUrl + "/media/" + strPath;
// };
// if (window.editor && window.editor.ThemeLoader && 0 == url.indexOf(editor.ThemeLoader.ThemesUrlAbs)) { prot.getImageLocal = function(url){
// return url.substring(editor.ThemeLoader.ThemesUrlAbs.length); //var _first = this.documentUrl + "/media/";
// } var _first = "jio:";
// if (0 === url.indexOf(_first))
// return null; return url.substring(_first.length);
//};
//prot.imagePath2Local = function(imageLocal){ if (window.editor && window.editor.ThemeLoader && 0 == url.indexOf(editor.ThemeLoader.ThemesUrlAbs)) {
// return this.getImageLocal(imageLocal); return url.substring(editor.ThemeLoader.ThemesUrlAbs.length);
//}; }
//prot.getUrl = function(strPath){
// if (0 === strPath.indexOf('theme')) return null;
// return null; };
// prot.imagePath2Local = function(imageLocal){
// if (window.editor && window.editor.ThemeLoader && window.editor.ThemeLoader.ThemesUrl != "" && strPath.indexOf(window.editor.ThemeLoader.ThemesUrl) == 0) return this.getImageLocal(imageLocal);
// return null; };
// prot.getUrl = function(strPath){
// return this.documentUrl + "/media/" + strPath; if (0 === strPath.indexOf('theme'))
//}; return null;
//prot.getLocal = function(url){
// return this.getImageLocal(url); if (window.editor && window.editor.ThemeLoader && window.editor.ThemeLoader.ThemesUrl != "" && strPath.indexOf(window.editor.ThemeLoader.ThemesUrl) == 0)
//}; return null;
//
//AscCommon.sendImgUrls = function(api, images, callback) return this.documentUrl + "/media/" + strPath;
//{ };
// var _data = []; prot.getLocal = function(url){
// for (var i = 0; i < images.length; i++) return this.getImageLocal(url);
// { };
// var _url = window["AscDesktopEditor"]["LocalFileGetImageUrl"](images[i]);
// _data[i] = { url: images[i], path : AscCommon.g_oDocumentUrls.getImageUrl(_url) }; AscCommon.sendImgUrls = function(api, images, callback)
// } {
// callback(_data); var _data = [];
//}; for (var i = 0; i < images.length; i++)
{
var _url = window["AscDesktopEditor"]["LocalFileGetImageUrl"](images[i]);
_data[i] = { url: images[i], path : AscCommon.g_oDocumentUrls.getImageUrl(_url) };
}
callback(_data);
};
///////////////////////////////////////////////////////// /////////////////////////////////////////////////////////
//////////////// SAVE ////////////////////// //////////////// SAVE //////////////////////
......
...@@ -214,7 +214,7 @@ ...@@ -214,7 +214,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>953.22698.40133.18688</string> </value> <value> <string>954.51979.55804.41523</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -232,7 +232,7 @@ ...@@ -232,7 +232,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1471735058.6</float> <float>1477241042.88</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -179,19 +179,6 @@ Asc['asc_docs_api'].prototype.asc_DownloadAs = function(typeFile, bIsDownloadEve ...@@ -179,19 +179,6 @@ Asc['asc_docs_api'].prototype.asc_DownloadAs = function(typeFile, bIsDownloadEve
this.asc_Save(false, true); this.asc_Save(false, true);
}; };
Asc['asc_docs_api'].prototype.AddImageUrl = function(url, imgProp)
{
var _url = window["AscDesktopEditor"]["LocalFileGetImageUrl"](url);
this.AddImageUrlAction(AscCommon.g_oDocumentUrls.getImageUrl(_url), imgProp);
};
Asc['asc_docs_api'].prototype.AddImage = function()
{
window["AscDesktopEditor"]["LocalFileGetImageUrlFromOpenFileDialog"]();
};
Asc['asc_docs_api'].prototype.asc_addImage = function()
{
window["AscDesktopEditor"]["LocalFileGetImageUrlFromOpenFileDialog"]();
};
Asc['asc_docs_api'].prototype.asc_isOffline = function() Asc['asc_docs_api'].prototype.asc_isOffline = function()
{ {
return true; return true;
...@@ -232,4 +219,4 @@ window["on_editor_native_message"] = function(sCommand, sParam) ...@@ -232,4 +219,4 @@ window["on_editor_native_message"] = function(sCommand, sParam)
editor.asc_Print(); editor.asc_Print();
else if (sCommand == "editor:stopDemonstration") else if (sCommand == "editor:stopDemonstration")
editor.EndDemonstration(true); editor.EndDemonstration(true);
}; };
\ No newline at end of file
...@@ -214,7 +214,7 @@ ...@@ -214,7 +214,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>953.23955.24221.49971</string> </value> <value> <string>954.44984.4954.55005</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -232,7 +232,7 @@ ...@@ -232,7 +232,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1471735110.45</float> <float>1476825925.82</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -214,7 +214,7 @@ ...@@ -214,7 +214,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>953.23955.24221.49971</string> </value> <value> <string>954.52297.36807.13824</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -232,7 +232,7 @@ ...@@ -232,7 +232,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1471735115.14</float> <float>1477300784.16</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -186,19 +186,6 @@ Asc['asc_docs_api'].prototype.asc_DownloadAs = function(typeFile, bIsDownloadEve ...@@ -186,19 +186,6 @@ Asc['asc_docs_api'].prototype.asc_DownloadAs = function(typeFile, bIsDownloadEve
this.asc_Save(false, true); this.asc_Save(false, true);
}; };
Asc['asc_docs_api'].prototype.AddImageUrl = function(url, imgProp)
{
var _url = window["AscDesktopEditor"]["LocalFileGetImageUrl"](url);
this.AddImageUrlAction(AscCommon.g_oDocumentUrls.getImageUrl(_url), imgProp);
};
Asc['asc_docs_api'].prototype.AddImage = function()
{
window["AscDesktopEditor"]["LocalFileGetImageUrlFromOpenFileDialog"]();
};
Asc['asc_docs_api'].prototype.asc_addImage = function()
{
window["AscDesktopEditor"]["LocalFileGetImageUrlFromOpenFileDialog"]();
};
Asc['asc_docs_api'].prototype.asc_isOffline = function() Asc['asc_docs_api'].prototype.asc_isOffline = function()
{ {
return true; return true;
......
...@@ -214,7 +214,7 @@ ...@@ -214,7 +214,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>953.22698.40133.18688</string> </value> <value> <string>953.25056.16442.43622</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -232,7 +232,7 @@ ...@@ -232,7 +232,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1471735226.72</float> <float>1476833225.03</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -214,7 +214,7 @@ ...@@ -214,7 +214,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>953.22698.40133.18688</string> </value> <value> <string>954.51722.41712.40192</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -232,7 +232,7 @@ ...@@ -232,7 +232,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1471735257.22</float> <float>1477302176.9</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
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