Commit 7c6edb42 authored by Boris Kocherov's avatar Boris Kocherov Committed by Romain Courteaud

[erp5_only_office] use Editor.bin as file content document and simplify save/open

parent 05b7b301
/*global window, rJS, RSVP, DocsAPI, console, document,
Common, require, jIO, URL, FileReader, atob, ArrayBuffer,
Uint8Array, XMLHttpRequest, Blob, Rusha, define*/
Uint8Array, XMLHttpRequest, Blob, Rusha, define,
TextDecoder, DesktopOfflineAppDocumentEndSave*/
/*jslint nomen: true, maxlen:80, indent:2*/
"use strict";
if (Common === undefined) {
......@@ -71,8 +72,8 @@ DocsAPI.DocEditor.version = function () {
.declareMethod("jio_getAttachment", function (docId, attId, opt) {
var g = this,
queue;
if (attId === 'body.txt') {
opt = 'asText';
if (attId === 'body.txt' || attId === 'Editor.bin') {
opt = 'asBinArray';
if (!docId) {
docId = '/';
}
......@@ -89,6 +90,11 @@ DocsAPI.DocEditor.version = function () {
.then(function (evt) {
return evt.target.result;
});
} else if (opt === "asBinArray") {
data = jIO.util.readBlobAsArrayBuffer(blob)
.then(function (evt) {
return new Uint8ClampedArray(evt.target.result);
});
} else if (opt === "asBlobURL") {
data = URL.createObjectURL(blob);
} else if (opt === "asDataURL") {
......@@ -246,7 +252,7 @@ DocsAPI.DocEditor.version = function () {
return "";
})
.push(function (portal_type) {
var value, documentType, magic;
var value;
portal_type = portal_type || options.portal_type;
g.props.binary_loader = false;
g.props.jio_key = options.jio_key;
......@@ -276,27 +282,36 @@ DocsAPI.DocEditor.version = function () {
type: "zipfile",
file: value
});
return g.props.value_zip_storage.getAttachment('/', 'body.txt')
return g.jio_getAttachment('/', 'body.txt')
.push(undefined, function (error) {
if (error.status_code === 404) {
throw 'not supported format of document: body.txt absent "' +
value.slice(0, 100) + '"';
return g.jio_getAttachment('/', 'Editor.bin')
.push(undefined, function (error) {
if (error.status_code === 404) {
throw 'not supported format of document:' +
' body.txt/Editor.bin absent "' +
value.slice(0, 100) + '"';
}
throw error;
});
}
throw error;
})
.push(jIO.util.readBlobAsText)
.push(function (evt) {
return evt.target.result;
});
}
}
})
.push(function (value) {
var documentType, magic;
g.props.value = value;
if (!g.props.documentType && value === "") {
throw "can not create empty document " +
"because portal_type is unknown";
}
if (value) {
magic = g.props.value.slice(0, 4);
magic = value.slice(0, 4);
if (typeof magic !== 'string') {
magic = String.fromCharCode.apply(null, magic);
}
switch (magic) {
case 'XLSY':
documentType = "spreadsheet";
......@@ -427,27 +442,62 @@ DocsAPI.DocEditor.version = function () {
});
})
.declareMethod("jio_save", function (data) {
var g = this,
zip = g.props.value_zip_storage;
return new RSVP.Queue()
.push(function () {
if (data) {
return g.jio_putAttachment('/', 'body.txt', data)
.push(function () {
// cleanup if Editor.bin exist
return zip.removeAttachment('/', 'Editor.bin')
.push(undefined, function (error) {
if (error.status_code !== 404) {
throw error;
}
});
})
.push(undefined, function (error) {
display_error(g, error);
});
}
})
.push(function () {
if (g.props.save_defer) {
// if we are run from getContent
g.props.save_defer.resolve();
g.props.save_defer = null;
} else {
g.triggerSubmit();
}
});
})
.declareMethod('getContent', function () {
var g = this,
zip = g.props.value_zip_storage,
queue = new RSVP.Queue(),
save_defer = RSVP.defer();
g.props.save_defer = save_defer;
g.props.handlers.save();
queue = new RSVP.Queue();
if (g.props.handlers.save()) {
g.props.save_defer = RSVP.defer();
}
return queue.push(function () {
return save_defer.promise;
if (g.props.save_defer) {
return g.props.save_defer.promise;
}
})
.push(function (data) {
if (data) {
var body = data[g.props.key];
return zip.putAttachment('/', 'body.txt', body);
}
})
.push(function () {
return zip.getAttachment('/', 'body.txt')
// prevent save empty zip archive
// check document exist in archive
return zip.getAttachment('/', 'Editor.bin')
.push(undefined, function (error) {
if (error.status_code === 404) {
return "";
return zip.getAttachment('/', 'body.txt')
.push(undefined, function (error) {
if (error.status_code === 404) {
return "";
}
throw error;
});
}
throw error;
});
......@@ -465,6 +515,10 @@ DocsAPI.DocEditor.version = function () {
.push(function (evt) {
var data = {};
data[g.props.key] = evt.target.result;
// TODO it should be run on state change
// if fail send int:1
// it clear modification state onlyoffice
DesktopOfflineAppDocumentEndSave(0);
return data;
});
});
......
......@@ -3302,9 +3302,6 @@ var editor;
var oBinaryFileWriter = new AscCommonExcel.BinaryFileWriter(this.wbModel);
oBinaryFileWriter.Write(undefined, true);
var _header = oBinaryFileWriter.WriteFileHeader(oBinaryFileWriter.Memory.GetCurPosition(), Asc.c_nVersionNoBase64);
window["native"]["Save_End"](_header, oBinaryFileWriter.Memory.GetCurPosition());
return oBinaryFileWriter.Memory.ImData.data;
};
......
......@@ -276,50 +276,28 @@ AscCommon.downloadUrlAsBlob = function (url) {
AscCommon.baseEditorsApi.prototype.jio_open = function () {
var t = this,
g = Common.Gateway;
return g.jio_getAttachment('/', 'body.txt')
.push(undefined, function (error) {
if (error["status_code"] === 404) {
return g.props.value;
}
throw error;
})
.push(function (doc) {
if (!doc) {
switch (g.props.documentType) {
case "presentation":
doc = t.getEmpty();
break;
case "spreadsheet":
doc = "XLSY;v2;2286;BAKAAgAAA+cHAAAEAwgAAADqCAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA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UAbgB0AAUEAAAAEwAAABgAAAAAAwAAAAEBAAELAAAAAgYAAAAABAAAAADjAAAAAN4AAAABGwAAAAAGDAAAAFMAaABlAGUAdAAxAAEEAQAAAAIBAgIkAAAAAx8AAAABAQACBAEEAAADBAEAAAAEBAAAAAAFBXnalahdiStABAQAAABBADEAFhEAAAAXDAAAAAQBAAAAAQYBAAAAAQsKAAAAAQWamZmZmZkpQA48AAAAAAVxPQrXowA0QAEFKFyPwvUIOkACBXE9CtejADRAAwUoXI/C9Qg6QAQFcT0K16MANEAFBXE9CtejADRADwYAAAAAAQEBAQkQBgAAAAABAQEBAAkAAAAAGAYAAAACAQAAAAAAAAAA";
break;
case "text":
doc = window.g_sEmpty_bin;
break;
}
}
t._OfflineAppDocumentEndLoad('', doc);
})
.push(undefined, function (error) {
console.log(error);
});
g = Common.Gateway,
doc = g.props.value;
if (!doc) {
switch (g.props.documentType) {
case "presentation":
doc = t.getEmpty();
break;
case "spreadsheet":
doc = "XLSY;v2;2286;BAKAAgAAA+cHAAAEAwgAAADqCAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA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AAAAQEAAAAABA4AAABQAGUAcgBjAGUAbgB0AAUEAAAAEwAAABgAAAAAAwAAAAEBAAELAAAAAgYAAAAABAAAAADjAAAAAN4AAAABGwAAAAAGDAAAAFMAaABlAGUAdAAxAAEEAQAAAAIBAgIkAAAAAx8AAAABAQACBAEEAAADBAEAAAAEBAAAAAAFBXnalahdiStABAQAAABBADEAFhEAAAAXDAAAAAQBAAAAAQYBAAAAAQsKAAAAAQWamZmZmZkpQA48AAAAAAVxPQrXowA0QAEFKFyPwvUIOkACBXE9CtejADRAAwUoXI/C9Qg6QAQFcT0K16MANEAFBXE9CtejADRADwYAAAAAAQEBAQkQBgAAAAABAQEBAAkAAAAAGAYAAAACAQAAAAAAAAAA";
break;
case "text":
doc = window.g_sEmpty_bin;
break;
}
}
t._OfflineAppDocumentEndLoad('', doc);
};
AscCommon.baseEditorsApi.prototype.jio_save = function () {
var t = this,
g = Common.Gateway,
result = {},
data = t.asc_nativeGetFile();
if (g.props.save_defer) {
// if we are run from getContent
result[g.props.key] = data;
g.props.save_defer.resolve(result);
g.props.save_defer = null;
} else {
// TODO: rewrite to put_attachment
return g.jio_putAttachment('/', 'body.txt', data)
.push(undefined, function (error) {
console.log(error);
});
}
// data = t.asc_nativeGetFile(); // base64 file
data = new Blob([t.asc_nativeGetFileData()]); // binary file
return g.jio_save(data);
};
\ No newline at end of file
......@@ -49,16 +49,16 @@ Asc['asc_docs_api'].prototype._OfflineAppDocumentStartLoad = function()
AscCommon.History.UserSaveMode = true;
return this.jio_open();
};
Asc['asc_docs_api'].prototype._OfflineAppDocumentEndLoad = function(_url, _data)
Asc['asc_docs_api'].prototype._OfflineAppDocumentEndLoad = function(_url, _binary)
{
//AscCommon.g_oIdCounter.m_sUserId = window["AscDesktopEditor"]["CheckUserId"]();
if (_data == "")
if (_binary == "")
{
this.sendEvent("asc_onError", c_oAscError.ID.ConvertationOpenError, c_oAscError.Level.Critical);
return;
}
this.OpenDocument2(_url, _data);
this.OpenDocument2(_url, _binary);
this.WordControl.m_oLogicDocument.Set_FastCollaborativeEditing(false);
this.DocumentOrientation = (null == this.WordControl.m_oLogicDocument) ? true : !this.WordControl.m_oLogicDocument.Orientation;
DesktopOfflineUpdateLocalName(this);
......
......@@ -6704,9 +6704,6 @@ background-repeat: no-repeat;\
this.WordControl.m_oLogicDocument.CalculateComments();
writer.WriteDocument3(this.WordControl.m_oLogicDocument);
var _header = "PPTY;v10;" + writer.pos + ";";
window["native"]["Save_End"](_header, writer.pos);
return writer.ImData.data;
};
......
......@@ -49,21 +49,26 @@ Asc['asc_docs_api'].prototype._OfflineAppDocumentStartLoad = function()
AscCommon.History.UserSaveMode = true;
return this.jio_open();
};
Asc['asc_docs_api'].prototype._OfflineAppDocumentEndLoad = function(_url, _data)
Asc['asc_docs_api'].prototype._OfflineAppDocumentEndLoad = function(_url, _binary)
{
//AscCommon.g_oIdCounter.m_sUserId = window["AscDesktopEditor"]["CheckUserId"]();
if (_data == "")
if (_binary == "")
{
this.sendEvent("asc_onError", c_oAscError.ID.ConvertationOpenError, c_oAscError.Level.Critical);
return;
}
if (AscCommon.c_oSerFormat.Signature !== _data.substring(0, AscCommon.c_oSerFormat.Signature.length))
var _sign_len = AscCommon.c_oSerFormat.Signature.length;
var _signature = _binary.slice(0, _sign_len);
if (typeof _signature !== 'string') {
_signature = String.fromCharCode.apply(null, _signature);
}
if (AscCommon.c_oSerFormat.Signature !== _signature)
{
this.OpenDocument(_url, _data);
this.OpenDocument(_url, _binary);
}
else
else
{
this.OpenDocument2(_url, _data);
this.OpenDocument2(_url, _binary);
this.WordControl.m_oLogicDocument.Set_FastCollaborativeEditing(false);
}
DesktopOfflineUpdateLocalName(this);
......
......@@ -7985,9 +7985,6 @@ background-repeat: no-repeat;\
oBinaryFileWriter.Write(true);
var _header = AscCommon.c_oSerFormat.Signature + ";v" + Asc.c_nVersionNoBase64 + ";" + _memory.GetCurPosition() + ";";
window["native"]["Save_End"](_header, _memory.GetCurPosition());
return _memory.ImData.data;
};
......
......@@ -933,12 +933,9 @@ define([
Common.Gateway.on('processmouse', _.bind(me.onProcessMouse, me));
Common.Gateway.on('refreshhistory', _.bind(me.onRefreshHistory, me));
Common.Gateway.on('save', function () {
var g = Common.Gateway;
if (me.api.isDocumentModified()) {
me.api.asc_Save();
}
if (g.props.save_defer) {
g.props.save_defer.resolve(undefined);
return true;
}
});
Common.Gateway.on('downloadas', _.bind(me.onDownloadAs, me));
......
......@@ -713,12 +713,9 @@ define([
Common.Gateway.on('processrightschange', _.bind(me.onProcessRightsChange, me));
Common.Gateway.on('processmouse', _.bind(me.onProcessMouse, me));
Common.Gateway.on('save', function () {
var g = Common.Gateway;
if (me.api.isDocumentModified()) {
me.api.asc_Save();
}
if (g.props.save_defer) {
g.props.save_defer.resolve(undefined);
return true;
}
});
Common.Gateway.on('downloadas', _.bind(me.onDownloadAs, me));
......
......@@ -716,12 +716,9 @@ define([
Common.Gateway.on('processrightschange', _.bind(me.onProcessRightsChange, me));
Common.Gateway.on('processmouse', _.bind(me.onProcessMouse, me));
Common.Gateway.on('save', function () {
var g = Common.Gateway;
if (me.api.asc_isDocumentModified()) {
me.api.asc_Save();
}
if (g.props.save_defer) {
g.props.save_defer.resolve(undefined);
return true;
}
});
Common.Gateway.on('downloadas', _.bind(me.onDownloadAs, me));
......
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