Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
Romain Courteaud
erp5
Commits
2bffb96b
Commit
2bffb96b
authored
Dec 07, 2018
by
Boris Kocherov
Committed by
Romain Courteaud
Feb 13, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[erp5_only_office] use jio.getAttachment optional parameter format
parent
65a8b9d0
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
30 deletions
+20
-30
bt5/erp5_only_office/SkinTemplateItem/portal_skins/erp5_only_office/onlyoffice.gadget.js.js
...tem/portal_skins/erp5_only_office/onlyoffice.gadget.js.js
+19
-29
bt5/erp5_only_office/SkinTemplateItem/portal_skins/erp5_only_office/onlyoffice/sdkjs/common/GlobalLoaders.js.js
...5_only_office/onlyoffice/sdkjs/common/GlobalLoaders.js.js
+1
-1
No files found.
bt5/erp5_only_office/SkinTemplateItem/portal_skins/erp5_only_office/onlyoffice.gadget.js.js
View file @
2bffb96b
/*global window, rJS, RSVP, DocsAPI, console, document,
/*global window, rJS, RSVP, DocsAPI, console, document,
Common, require, jIO, URL, FileReader, atob, ArrayBuffer,
Common, require, jIO, URL, FileReader, atob, ArrayBuffer,
Uint8Array, XMLHttpRequest, Blob, Rusha, define,
Uint8Array, XMLHttpRequest, Blob, Rusha, define,
Uint8ClampedArray,
TextDecoder, DesktopOfflineAppDocumentEndSave*/
TextDecoder, DesktopOfflineAppDocumentEndSave*/
/*jslint nomen: true, maxlen:80, indent:2*/
/*jslint nomen: true, maxlen:80, indent:2*/
"
use strict
"
;
"
use strict
"
;
...
@@ -72,9 +73,10 @@ DocsAPI.DocEditor.version = function () {
...
@@ -72,9 +73,10 @@ DocsAPI.DocEditor.version = function () {
.
declareAcquiredMethod
(
'
notifyChange
'
,
'
notifyChange
'
)
.
declareAcquiredMethod
(
'
notifyChange
'
,
'
notifyChange
'
)
.
declareMethod
(
"
jio_getAttachment
"
,
function
(
docId
,
attId
,
opt
)
{
.
declareMethod
(
"
jio_getAttachment
"
,
function
(
docId
,
attId
,
opt
)
{
var
g
=
this
,
var
g
=
this
,
queue
;
convert
;
opt
=
opt
||
{};
if
(
attId
===
'
body.txt
'
||
attId
===
'
Editor.bin
'
)
{
if
(
attId
===
'
body.txt
'
||
attId
===
'
Editor.bin
'
)
{
opt
=
'
asBinArray
'
;
opt
=
{
'
format
'
:
'
bin_array
'
}
;
if
(
!
docId
)
{
if
(
!
docId
)
{
docId
=
'
/
'
;
docId
=
'
/
'
;
}
}
...
@@ -83,36 +85,24 @@ DocsAPI.DocEditor.version = function () {
...
@@ -83,36 +85,24 @@ DocsAPI.DocEditor.version = function () {
docId
=
'
/media/
'
;
docId
=
'
/media/
'
;
}
}
}
}
queue
=
g
.
props
.
value_zip_storage
.
getAttachment
(
docId
,
attId
)
if
(
opt
.
format
===
"
blob_url
"
)
{
convert
=
opt
.
format
;
delete
opt
.
format
;
}
if
(
opt
.
format
===
"
bin_array
"
)
{
convert
=
opt
.
format
;
opt
.
format
=
'
array_buffer
'
;
}
return
g
.
props
.
value_zip_storage
.
getAttachment
(
docId
,
attId
,
opt
)
.
push
(
function
(
blob
)
{
.
push
(
function
(
blob
)
{
var
data
;
if
(
convert
===
"
bin_array
"
)
{
if
(
opt
===
"
asText
"
)
{
return
new
Uint8ClampedArray
(
blob
);
data
=
jIO
.
util
.
readBlobAsText
(
blob
)
.
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
"
)
{
data
=
new
RSVP
.
Promise
(
function
(
resolve
,
reject
)
{
var
reader
=
new
FileReader
();
reader
.
addEventListener
(
'
load
'
,
function
()
{
resolve
(
reader
.
result
);
});
reader
.
addEventListener
(
'
error
'
,
reject
);
reader
.
readAsDataURL
(
blob
);
});
}
else
{
data
=
blob
;
}
}
return
data
;
if
(
convert
===
"
blob_url
"
)
{
return
URL
.
createObjectURL
(
blob
);
}
return
blob
;
});
});
return
queue
;
})
})
.
declareMethod
(
"
jio_putAttachment
"
,
function
(
docId
,
atId
,
data
)
{
.
declareMethod
(
"
jio_putAttachment
"
,
function
(
docId
,
atId
,
data
)
{
var
g
=
this
,
var
g
=
this
,
...
...
bt5/erp5_only_office/SkinTemplateItem/portal_skins/erp5_only_office/onlyoffice/sdkjs/common/GlobalLoaders.js.js
View file @
2bffb96b
...
@@ -509,7 +509,7 @@
...
@@ -509,7 +509,7 @@
queue
,
queue
,
oThis
=
this
;
oThis
=
this
;
if
(
0
===
start
.
indexOf
(
'
jio:
'
))
{
if
(
0
===
start
.
indexOf
(
'
jio:
'
))
{
queue
=
Common
.
Gateway
.
jio_getAttachment
(
this
.
Api
.
documentId
,
image_id
.
slice
(
4
),
'
asBlobURL
'
)
queue
=
Common
.
Gateway
.
jio_getAttachment
(
this
.
Api
.
documentId
,
image_id
.
slice
(
4
),
{
format
:
'
blob_url
'
}
)
.
push
(
undefined
,
function
(
error
)
{
.
push
(
undefined
,
function
(
error
)
{
console
.
error
(
error
);
console
.
error
(
error
);
return
""
;
return
""
;
...
...
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