Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5-Boxiang
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Hamza
erp5-Boxiang
Commits
7c6edb42
Commit
7c6edb42
authored
Jan 29, 2018
by
Boris Kocherov
Committed by
Romain Courteaud
Feb 26, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[erp5_only_office] use Editor.bin as file content document and simplify save/open
parent
05b7b301
Changes
10
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
115 additions
and
96 deletions
+115
-96
bt5/erp5_only_office/SkinTemplateItem/portal_skins/erp5_only_office/onlyoffice.gadget.js.js
...tem/portal_skins/erp5_only_office/onlyoffice.gadget.js.js
+79
-25
bt5/erp5_only_office/SkinTemplateItem/portal_skins/erp5_only_office/onlyoffice/sdkjs/cell/api.js.js
...al_skins/erp5_only_office/onlyoffice/sdkjs/cell/api.js.js
+0
-3
bt5/erp5_only_office/SkinTemplateItem/portal_skins/erp5_only_office/onlyoffice/sdkjs/common/Local/common.js.js
...p5_only_office/onlyoffice/sdkjs/common/Local/common.js.js
+19
-41
bt5/erp5_only_office/SkinTemplateItem/portal_skins/erp5_only_office/onlyoffice/sdkjs/slide/Local/api.js.js
...s/erp5_only_office/onlyoffice/sdkjs/slide/Local/api.js.js
+3
-3
bt5/erp5_only_office/SkinTemplateItem/portal_skins/erp5_only_office/onlyoffice/sdkjs/slide/api.js.js
...l_skins/erp5_only_office/onlyoffice/sdkjs/slide/api.js.js
+0
-3
bt5/erp5_only_office/SkinTemplateItem/portal_skins/erp5_only_office/onlyoffice/sdkjs/word/Local/api.js.js
...ns/erp5_only_office/onlyoffice/sdkjs/word/Local/api.js.js
+11
-6
bt5/erp5_only_office/SkinTemplateItem/portal_skins/erp5_only_office/onlyoffice/sdkjs/word/api.js.js
...al_skins/erp5_only_office/onlyoffice/sdkjs/word/api.js.js
+0
-3
bt5/erp5_only_office/SkinTemplateItem/portal_skins/erp5_only_office/onlyoffice/web-apps/apps/documenteditor/main/app/controller/Main.js.js
...b-apps/apps/documenteditor/main/app/controller/Main.js.js
+1
-4
bt5/erp5_only_office/SkinTemplateItem/portal_skins/erp5_only_office/onlyoffice/web-apps/apps/presentationeditor/main/app/controller/Main.js.js
...ps/apps/presentationeditor/main/app/controller/Main.js.js
+1
-4
bt5/erp5_only_office/SkinTemplateItem/portal_skins/erp5_only_office/onlyoffice/web-apps/apps/spreadsheeteditor/main/app/controller/Main.js.js
...pps/apps/spreadsheeteditor/main/app/controller/Main.js.js
+1
-4
No files found.
bt5/erp5_only_office/SkinTemplateItem/portal_skins/erp5_only_office/onlyoffice.gadget.js.js
View file @
7c6edb42
/*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
=
'
as
Text
'
;
if
(
attId
===
'
body.txt
'
||
attId
===
'
Editor.bin
'
)
{
opt
=
'
as
BinArray
'
;
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
)
{
return
g
.
jio_getAttachment
(
'
/
'
,
'
Editor.bin
'
)
.
push
(
undefined
,
function
(
error
)
{
if
(
error
.
status_code
===
404
)
{
throw
'
not supported format of document: body.txt absent "
'
+
throw
'
not supported format of document:
'
+
'
body.txt/Editor.bin absent "
'
+
value
.
slice
(
0
,
100
)
+
'
"
'
;
}
throw
error
;
})
.
push
(
jIO
.
util
.
readBlobAsText
)
.
push
(
function
(
evt
)
{
return
evt
.
target
.
result
;
});
}
throw
error
;
});
}
}
})
.
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,23 +442,55 @@ 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
;
})
.
push
(
function
(
data
)
{
if
(
data
)
{
var
body
=
data
[
g
.
props
.
key
];
return
zip
.
putAttachment
(
'
/
'
,
'
body.txt
'
,
body
);
if
(
g
.
props
.
save_defer
)
{
return
g
.
props
.
save_defer
.
promise
;
}
})
.
push
(
function
()
{
// 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
zip
.
getAttachment
(
'
/
'
,
'
body.txt
'
)
.
push
(
undefined
,
function
(
error
)
{
if
(
error
.
status_code
===
404
)
{
...
...
@@ -451,6 +498,9 @@ DocsAPI.DocEditor.version = function () {
}
throw
error
;
});
}
throw
error
;
});
})
.
push
(
function
(
Editor_bin
)
{
if
(
Editor_bin
)
{
...
...
@@ -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
;
});
});
...
...
bt5/erp5_only_office/SkinTemplateItem/portal_skins/erp5_only_office/onlyoffice/sdkjs/cell/api.js.js
View file @
7c6edb42
...
...
@@ -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
;
};
...
...
bt5/erp5_only_office/SkinTemplateItem/portal_skins/erp5_only_office/onlyoffice/sdkjs/common/Local/common.js.js
View file @
7c6edb42
...
...
@@ -276,15 +276,8 @@ 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
)
{
g
=
Common
.
Gateway
,
doc
=
g
.
props
.
value
;
if
(
!
doc
)
{
switch
(
g
.
props
.
documentType
)
{
case
"
presentation
"
:
...
...
@@ -299,27 +292,12 @@ AscCommon.baseEditorsApi.prototype.jio_open = function () {
}
}
t
.
_OfflineAppDocumentEndLoad
(
''
,
doc
);
})
.
push
(
undefined
,
function
(
error
)
{
console
.
log
(
error
);
});
};
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
bt5/erp5_only_office/SkinTemplateItem/portal_skins/erp5_only_office/onlyoffice/sdkjs/slide/Local/api.js.js
View file @
7c6edb42
...
...
@@ -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
);
...
...
bt5/erp5_only_office/SkinTemplateItem/portal_skins/erp5_only_office/onlyoffice/sdkjs/slide/api.js.js
View file @
7c6edb42
...
...
@@ -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
;
};
...
...
bt5/erp5_only_office/SkinTemplateItem/portal_skins/erp5_only_office/onlyoffice/sdkjs/word/Local/api.js.js
View file @
7c6edb42
...
...
@@ -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
{
this
.
OpenDocument2
(
_url
,
_
data
);
this
.
OpenDocument2
(
_url
,
_
binary
);
this
.
WordControl
.
m_oLogicDocument
.
Set_FastCollaborativeEditing
(
false
);
}
DesktopOfflineUpdateLocalName
(
this
);
...
...
bt5/erp5_only_office/SkinTemplateItem/portal_skins/erp5_only_office/onlyoffice/sdkjs/word/api.js.js
View file @
7c6edb42
...
...
@@ -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
;
};
...
...
bt5/erp5_only_office/SkinTemplateItem/portal_skins/erp5_only_office/onlyoffice/web-apps/apps/documenteditor/main/app/controller/Main.js.js
View file @
7c6edb42
...
...
@@ -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
));
...
...
bt5/erp5_only_office/SkinTemplateItem/portal_skins/erp5_only_office/onlyoffice/web-apps/apps/presentationeditor/main/app/controller/Main.js.js
View file @
7c6edb42
...
...
@@ -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
));
...
...
bt5/erp5_only_office/SkinTemplateItem/portal_skins/erp5_only_office/onlyoffice/web-apps/apps/spreadsheeteditor/main/app/controller/Main.js.js
View file @
7c6edb42
...
...
@@ -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
));
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment