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
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boris Kocherov
erp5
Commits
49a01c56
Commit
49a01c56
authored
Dec 06, 2016
by
Boris Kocherov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_officejs_ooffice: catch and display of document value errors
parent
f9435ae1
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
9 deletions
+28
-9
bt5/erp5_officejs_ooffice/PathTemplateItem/web_page_module/ooffice_gadget_ooffice_js.js
...TemplateItem/web_page_module/ooffice_gadget_ooffice_js.js
+25
-6
bt5/erp5_officejs_ooffice/PathTemplateItem/web_page_module/ooffice_gadget_ooffice_js.xml
...emplateItem/web_page_module/ooffice_gadget_ooffice_js.xml
+3
-3
No files found.
bt5/erp5_officejs_ooffice/PathTemplateItem/web_page_module/ooffice_gadget_ooffice_js.js
View file @
49a01c56
...
@@ -20,13 +20,22 @@ if (Common === undefined) {
...
@@ -20,13 +20,22 @@ if (Common === undefined) {
});
});
}
}
function
display_error
(
gadget
,
error
)
{
var
display_error_element
;
display_error_element
=
gadget
.
props
.
element
;
display_error_element
.
innerHTML
=
'
<br/><p style="color: red"></p><br/><br/>
'
;
display_error_element
.
querySelector
(
'
p
'
).
textContent
=
error
;
throw
error
;
}
function
dataURLtoBlob
(
url
)
{
function
dataURLtoBlob
(
url
)
{
var
byteString
=
atob
(
url
.
split
(
'
,
'
)[
1
]),
var
byteString
=
atob
(
url
.
split
(
'
,
'
)[
1
]),
mimeString
=
url
.
split
(
'
,
'
)[
0
].
split
(
'
:
'
)[
1
].
split
(
'
;
'
)[
0
],
mimeString
=
url
.
split
(
'
,
'
)[
0
].
split
(
'
:
'
)[
1
].
split
(
'
;
'
)[
0
],
ab
=
new
ArrayBuffer
(
byteString
.
length
),
ab
=
new
ArrayBuffer
(
byteString
.
length
),
ia
=
new
Uint8Array
(
ab
),
ia
=
new
Uint8Array
(
ab
),
i
;
i
;
for
(
i
=
0
;
i
<
byteString
.
length
;
i
++
)
{
for
(
i
=
0
;
i
<
byteString
.
length
;
i
+=
1
)
{
ia
[
i
]
=
byteString
.
charCodeAt
(
i
);
ia
[
i
]
=
byteString
.
charCodeAt
(
i
);
}
}
return
new
Blob
([
ab
],
{
type
:
mimeString
});
return
new
Blob
([
ab
],
{
type
:
mimeString
});
...
@@ -228,19 +237,29 @@ if (Common === undefined) {
...
@@ -228,19 +237,29 @@ if (Common === undefined) {
g
.
props
.
key
=
options
.
key
||
"
text_content
"
;
g
.
props
.
key
=
options
.
key
||
"
text_content
"
;
g
.
props
.
value
=
options
.
value
;
g
.
props
.
value
=
options
.
value
;
if
(
g
.
props
.
value
)
{
if
(
g
.
props
.
value
)
{
magic
=
g
.
props
.
value
.
slice
(
0
,
5
);
if
(
g
.
props
.
value
.
slice
===
undefined
)
{
if
(
magic
===
"
[obje
"
)
{
display_error
(
g
,
"
not suported type of document value:
"
+
g
.
props
.
value
=
""
;
typeof
g
.
props
.
value
)
;
}
}
magic
=
g
.
props
.
value
.
slice
(
0
,
5
);
if
(
magic
===
"
data:
"
)
{
if
(
magic
===
"
data:
"
)
{
g
.
props
.
value
=
atob
(
g
.
props
.
value
.
split
(
'
,
'
)[
1
]);
g
.
props
.
value
=
atob
(
g
.
props
.
value
.
split
(
'
,
'
)[
1
]);
}
}
magic
=
g
.
props
.
value
.
slice
(
0
,
4
);
magic
=
g
.
props
.
value
.
slice
(
0
,
4
);
if
(
magic
===
"
PK
\
x03
\
x04
"
||
magic
===
"
PK
\
x05
\
x06
"
)
{
switch
(
magic
)
{
case
'
XLSY
'
:
case
'
PPTY
'
:
case
'
DOCY
'
:
break
;
case
"
PK
\
x03
\
x04
"
:
case
"
PK
\
x05
\
x06
"
:
g
.
props
.
value_zip_storage
=
jIO
.
createJIO
({
g
.
props
.
value_zip_storage
=
jIO
.
createJIO
({
type
:
"
zipfile
"
,
type
:
"
zipfile
"
,
file
:
g
.
props
.
value
file
:
g
.
props
.
value
});
});
break
;
default
:
display_error
(
g
,
'
not supported format: "
'
+
g
.
props
.
value
+
'
"
'
);
}
}
}
}
if
(
!
g
.
props
.
value_zip_storage
)
{
if
(
!
g
.
props
.
value_zip_storage
)
{
...
@@ -512,7 +531,7 @@ if (Common === undefined) {
...
@@ -512,7 +531,7 @@ if (Common === undefined) {
return
{};
return
{};
})
})
.
push
(
undefined
,
function
(
error
)
{
.
push
(
undefined
,
function
(
error
)
{
console
.
log
(
'
gadget_ooffice.js redner error:
'
+
error
);
display_error
(
g
,
error
);
});
});
})
})
...
...
bt5/erp5_officejs_ooffice/PathTemplateItem/web_page_module/ooffice_gadget_ooffice_js.xml
View file @
49a01c56
...
@@ -182,7 +182,7 @@
...
@@ -182,7 +182,7 @@
</tuple>
</tuple>
<state>
<state>
<tuple>
<tuple>
<float>
147
7517617.81
</float>
<float>
147
9313191.95
</float>
<string>
UTC
</string>
<string>
UTC
</string>
</tuple>
</tuple>
</state>
</state>
...
@@ -227,7 +227,7 @@
...
@@ -227,7 +227,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
serial
</string>
</key>
<key>
<string>
serial
</string>
</key>
<value>
<string>
955.
11818.53126.43110
</string>
</value>
<value>
<string>
955.
51056.50.46796
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
state
</string>
</key>
<key>
<string>
state
</string>
</key>
...
@@ -245,7 +245,7 @@
...
@@ -245,7 +245,7 @@
</tuple>
</tuple>
<state>
<state>
<tuple>
<tuple>
<float>
14
78799571.16
</float>
<float>
14
81036322.7
</float>
<string>
UTC
</string>
<string>
UTC
</string>
</tuple>
</tuple>
</state>
</state>
...
...
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