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
1
Merge Requests
1
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
Boxiang Sun
erp5
Commits
a4d9fcc3
Commit
a4d9fcc3
authored
Sep 27, 2019
by
Roque
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_officejs_ooffice: text editor uses custom view
parent
cbb3b35b
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
232 additions
and
6 deletions
+232
-6
bt5/erp5_officejs_ooffice/PathTemplateItem/web_page_module/gadget_ooffice_text_appcache.xml
...lateItem/web_page_module/gadget_ooffice_text_appcache.xml
+5
-2
bt5/erp5_officejs_ooffice/PathTemplateItem/web_page_module/gadget_ooffice_text_router.html.html
...Item/web_page_module/gadget_ooffice_text_router.html.html
+2
-2
bt5/erp5_officejs_ooffice/PathTemplateItem/web_page_module/gadget_ooffice_text_router.html.xml
...eItem/web_page_module/gadget_ooffice_text_router.html.xml
+2
-2
bt5/erp5_officejs_ooffice/SkinTemplateItem/portal_skins/erp5_ooffice_text_editor/only_office_document_view.html.html
...5_ooffice_text_editor/only_office_document_view.html.html
+20
-0
bt5/erp5_officejs_ooffice/SkinTemplateItem/portal_skins/erp5_ooffice_text_editor/only_office_document_view.html.xml
...p5_ooffice_text_editor/only_office_document_view.html.xml
+28
-0
bt5/erp5_officejs_ooffice/SkinTemplateItem/portal_skins/erp5_ooffice_text_editor/only_office_document_view.js.js
.../erp5_ooffice_text_editor/only_office_document_view.js.js
+147
-0
bt5/erp5_officejs_ooffice/SkinTemplateItem/portal_skins/erp5_ooffice_text_editor/only_office_document_view.js.xml
...erp5_ooffice_text_editor/only_office_document_view.js.xml
+28
-0
No files found.
bt5/erp5_officejs_ooffice/PathTemplateItem/web_page_module/gadget_ooffice_text_appcache.xml
View file @
a4d9fcc3
...
...
@@ -1246,6 +1246,9 @@ onlyoffice/fonts/ttf/ktwsh55ufijgk35iptozrmuwqtuy.ttf\n
onlyoffice/fonts/ttf/ktwsh55ufirzeamcpft1h7dwca.ttf\n
onlyoffice/fonts/ttf/p7agk5uum7xi6muwqtuy.ttf\n
\n
only_office_document_view.html\n
only_office_document_view.js\n
\n
#new approach (storage hateoas requests)\n
gadget_erp5_pt_form_view_editable.html\n
gadget_erp5_pt_form_view_editable.js\n
...
...
@@ -1450,7 +1453,7 @@ NETWORK:\n
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
978.
32613.12762.62071
</string>
</value>
<value>
<string>
978.
46959.46449.51712
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -1468,7 +1471,7 @@ NETWORK:\n
</tuple>
<state>
<tuple>
<float>
156
8728047.24
</float>
<float>
156
9592159.32
</float>
<string>
UTC
</string>
</tuple>
</state>
...
...
bt5/erp5_officejs_ooffice/PathTemplateItem/web_page_module/gadget_ooffice_text_router.html.html
View file @
a4d9fcc3
...
...
@@ -25,8 +25,8 @@
<script
data-renderjs-configuration=
"app_actions"
type=
"text/x-renderjs-configuration"
>
(
'
Text | ooffice_text_view
'
,
'
Document Module | ooffice_text_view
'
,
'
Document Module | ooffice_upload_document
'
,
'
Text | ooffice_download_document
'
)
</script>
<script
data-renderjs-configuration=
"app_allowed_sub_types"
type=
"text/x-renderjs-configuration"
>
(
'
Document Module | Text
'
,)
</script>
<script
data-renderjs-configuration=
"app_view_reference"
type=
"text/x-renderjs-configuration"
>
ooffice_text_view
</script>
<script
data-renderjs-configuration=
"document_module_dict"
type=
"text/x-renderjs-configuration"
>
{
"
front_page
"
:
1
,
"
editable
"
:
0
,
"
hide_add_button
"
:
0
,
"
jump_button
"
:
0
,
"
fast_input_button
"
:
0
,
"
export_button
"
:
0
,
"
filter_action
"
:
1
,
"
panel_action
"
:
1
,
"
previous_next_button
"
:
0
,
"
history_previous_link
"
:
0
,
"
title
"
:
"
Text Documents
"
,
"
hide_listbox_buttons
"
:
1
,
"
blob_type
"
:
""
,
"
blob_create_object_url
"
:
0
,
"
only_office
"
:
1
,
"
file_extension
"
:
"
docy
"
}
</script>
<script
data-renderjs-configuration=
"text_dict"
type=
"text/x-renderjs-configuration"
>
{
"
front_page
"
:
0
,
"
editable
"
:
1
,
"
hide_add_button
"
:
0
,
"
jump_button
"
:
0
,
"
fast_input_button
"
:
0
,
"
export_button
"
:
0
,
"
filter_action
"
:
0
,
"
panel_action
"
:
1
,
"
previous_next_button
"
:
1
,
"
history_previous_link
"
:
1
,
"
title
"
:
"
Text
"
,
"
hide_listbox_buttons
"
:
1
,
"
blob_type
"
:
"
application/x-asc-text
"
,
"
blob_create_object_url
"
:
0
,
"
only_office
"
:
1
,
"
file_extension
"
:
"
docy
"
}
</script>
<script
data-renderjs-configuration=
"document_module_dict"
type=
"text/x-renderjs-configuration"
>
{
"
front_page
"
:
1
,
"
editable
"
:
0
,
"
hide_add_button
"
:
0
,
"
jump_button
"
:
0
,
"
fast_input_button
"
:
0
,
"
export_button
"
:
0
,
"
filter_action
"
:
1
,
"
panel_action
"
:
1
,
"
previous_next_button
"
:
0
,
"
history_previous_link
"
:
0
,
"
title
"
:
"
Text Documents
"
,
"
hide_listbox_buttons
"
:
1
,
"
blob_type
"
:
""
,
"
blob_create_object_url
"
:
0
,
"
file_extension
"
:
"
docy
"
}
</script>
<script
data-renderjs-configuration=
"text_dict"
type=
"text/x-renderjs-configuration"
>
{
"
front_page
"
:
0
,
"
editable
"
:
1
,
"
hide_add_button
"
:
0
,
"
jump_button
"
:
0
,
"
fast_input_button
"
:
0
,
"
export_button
"
:
0
,
"
filter_action
"
:
0
,
"
panel_action
"
:
1
,
"
previous_next_button
"
:
1
,
"
history_previous_link
"
:
1
,
"
title
"
:
"
Text
"
,
"
hide_listbox_buttons
"
:
1
,
"
blob_type
"
:
"
application/x-asc-text
"
,
"
blob_create_object_url
"
:
0
,
"
file_extension
"
:
"
docy
"
,
"
custom_view_gadget
"
:
"
only_office_document_view.html
"
}
</script>
<script
data-renderjs-configuration=
"file_extension"
type=
"text/x-renderjs-configuration"
>
docy
</script>
<script
data-renderjs-configuration=
"upload_dict"
type=
"text/x-renderjs-configuration"
>
{
"
docx
"
:
"
docy
"
,
"
docy
"
:
"
docy
"
}
</script>
<script
data-renderjs-configuration=
"conversion_dict"
type=
"text/x-renderjs-configuration"
>
{
"
docy
"
:
[
"
docx
"
],
"
docx
"
:
[
"
docy
"
,
"
pdf
"
]}
</script>
...
...
bt5/erp5_officejs_ooffice/PathTemplateItem/web_page_module/gadget_ooffice_text_router.html.xml
View file @
a4d9fcc3
...
...
@@ -241,7 +241,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
978.
36904.61549.50073
</string>
</value>
<value>
<string>
978.
46962.63675.39185
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -259,7 +259,7 @@
</tuple>
<state>
<tuple>
<float>
156
8980484.29
</float>
<float>
156
9592995.31
</float>
<string>
UTC
</string>
</tuple>
</state>
...
...
bt5/erp5_officejs_ooffice/SkinTemplateItem/portal_skins/erp5_ooffice_text_editor/only_office_document_view.html.html
0 → 100644
View file @
a4d9fcc3
<!doctype html>
<html>
<head>
<meta
charset=
"utf-8"
>
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1"
>
<title>
OfficeJS Document View
</title>
<script
src=
"rsvp.js"
></script>
<script
src=
"renderjs.js"
></script>
<script
src=
"only_office_document_view.js"
></script>
</head>
<body>
<form
class=
"save_form ui-body-c"
novalidate
>
</form>
</body>
</html>
\ No newline at end of file
bt5/erp5_officejs_ooffice/SkinTemplateItem/portal_skins/erp5_ooffice_text_editor/only_office_document_view.html.xml
0 → 100644
View file @
a4d9fcc3
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"File"
module=
"OFS.Image"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
__name__
</string>
</key>
<value>
<string>
only_office_document_view.html
</string>
</value>
</item>
<item>
<key>
<string>
content_type
</string>
</key>
<value>
<string>
text/html
</string>
</value>
</item>
<item>
<key>
<string>
precondition
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string></string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
bt5/erp5_officejs_ooffice/SkinTemplateItem/portal_skins/erp5_ooffice_text_editor/only_office_document_view.js.js
0 → 100644
View file @
a4d9fcc3
/*global document, window, rJS, RSVP, jIO, Blob */
/*jslint nomen: true, indent: 2, maxerr: 3 */
(
function
(
document
,
window
,
rJS
,
RSVP
,
jIO
,
Blob
)
{
"
use strict
"
;
rJS
(
window
)
/////////////////////////////////////////////////////////////////
// Acquired methods
/////////////////////////////////////////////////////////////////
.
declareAcquiredMethod
(
"
getSetting
"
,
"
getSetting
"
)
.
declareAcquiredMethod
(
"
notifySubmitted
"
,
"
notifySubmitted
"
)
.
declareAcquiredMethod
(
"
notifySubmitting
"
,
"
notifySubmitting
"
)
.
declareAcquiredMethod
(
"
jio_getAttachment
"
,
"
jio_getAttachment
"
)
.
declareAcquiredMethod
(
"
jio_putAttachment
"
,
"
jio_putAttachment
"
)
/////////////////////////////////////////////////////////////////
// declared methods
/////////////////////////////////////////////////////////////////
.
declareMethod
(
'
render
'
,
function
(
options
)
{
var
gadget
=
this
,
state_dict
=
{
doc
:
options
.
doc
,
form_definition
:
options
.
form_definition
,
child_gadget_url
:
options
.
child_gadget_url
,
options
:
options
},
portal_type_dict
=
options
.
form_definition
.
portal_type_dict
,
form_view_div
=
document
.
createElement
(
'
div
'
),
extension
,
blob
;
return
gadget
.
getSetting
(
"
file_extension
"
)
.
push
(
function
(
file_extension
)
{
if
(
file_extension
.
substring
(
file_extension
.
length
-
1
)
==
"
y
"
)
{
file_extension
=
file_extension
.
replace
(
/.$/
,
"
x
"
);
}
extension
=
file_extension
;
gadget
.
element
.
appendChild
(
form_view_div
);
return
gadget
.
declareGadget
(
"
gadget_officejs_form_view.html
"
,
{
element
:
form_view_div
,
scope
:
'
form_view
'
});
})
.
push
(
function
(
form_view_gadget
)
{
if
(
!
state_dict
.
doc
.
filename
)
{
state_dict
.
doc
.
filename
=
"
default.
"
+
extension
;
}
state_dict
.
mime_type
=
portal_type_dict
.
file_extension
;
if
(
options
.
doc
.
action
)
{
return
form_view_gadget
.
changeState
(
state_dict
);
}
state_dict
.
content_editable
=
options
.
doc
.
content_type
===
undefined
||
options
.
doc
.
content_type
.
indexOf
(
"
application/x-asc
"
)
===
0
;
return
new
RSVP
.
Queue
()
.
push
(
function
()
{
if
(
!
state_dict
.
content_editable
)
{
return
gadget
.
jio_getAttachment
(
options
.
jio_key
,
"
data
"
);
}
return
gadget
.
declareGadget
(
"
gadget_ojs_cloudooo.html
"
)
.
push
(
function
(
ojs_cloudooo
)
{
return
ojs_cloudooo
.
getConvertedBlob
({
jio_key
:
options
.
jio_key
,
format
:
state_dict
.
mime_type
,
filename
:
options
.
doc
.
filename
});
});
})
.
push
(
undefined
,
function
(
error
)
{
if
(
error
instanceof
jIO
.
util
.
jIOError
&&
error
.
status_code
===
404
)
{
return
new
Blob
();
}
throw
error
;
})
.
push
(
function
(
blob
)
{
if
(
state_dict
.
content_editable
)
{
return
jIO
.
util
.
readBlobAsDataURL
(
blob
);
}
return
jIO
.
util
.
readBlobAsText
(
blob
);
})
.
push
(
function
(
result
)
{
state_dict
.
data
=
result
.
target
.
result
;
state_dict
.
blob_type
=
portal_type_dict
.
blob_type
;
return
form_view_gadget
.
changeState
(
state_dict
);
});
});
})
.
declareMethod
(
"
triggerSubmit
"
,
function
()
{
var
argument_list
=
arguments
,
gadget
=
this
,
child_gadget
,
view_gadget
,
content_dict
,
data
,
name_list
;
return
gadget
.
notifySubmitting
()
.
push
(
function
(
view_gadget
)
{
return
gadget
.
getDeclaredGadget
(
'
form_view
'
);
})
.
push
(
function
(
result
)
{
view_gadget
=
result
;
return
view_gadget
.
getDeclaredGadget
(
'
erp5_pt_gadget
'
);
})
.
push
(
function
(
result
)
{
child_gadget
=
result
;
if
(
!
child_gadget
.
state
.
editable
)
{
return
child_gadget
.
triggerSubmit
(
argument_list
);
}
return
child_gadget
.
getContent
();
})
.
push
(
function
(
result
)
{
content_dict
=
result
;
if
(
!
content_dict
)
{
return
;
}
data
=
content_dict
.
text_content
;
delete
content_dict
.
text_content
;
name_list
=
view_gadget
.
state
.
doc
.
filename
.
split
(
'
.
'
);
if
(
name_list
.
pop
()
!==
view_gadget
.
state
.
mime_type
)
{
name_list
.
push
(
view_gadget
.
state
.
mime_type
);
content_dict
.
filename
=
name_list
.
join
(
'
.
'
);
}
return
gadget
.
getSetting
(
"
content_type
"
);
})
.
push
(
function
(
content_type
)
{
content_dict
.
content_type
=
content_type
;
return
child_gadget
.
submitContent
(
child_gadget
.
state
.
jio_key
,
undefined
,
content_dict
);
})
.
push
(
function
()
{
return
gadget
.
jio_putAttachment
(
child_gadget
.
state
.
jio_key
,
'
data
'
,
jIO
.
util
.
dataURItoBlob
(
data
))
.
push
(
function
()
{
return
gadget
.
declareGadget
(
"
gadget_ojs_cloudooo.html
"
);
})
.
push
(
function
(
cloudooo
)
{
return
cloudooo
.
putAllCloudoooConvertionOperation
({
format
:
view_gadget
.
state
.
mime_type
,
jio_key
:
child_gadget
.
state
.
jio_key
});
});
},
function
(
error
)
{
console
.
log
(
error
);
return
gadget
.
notifySubmitted
({
message
:
"
Submit failed
"
,
status
:
"
error
"
});
});
});
}(
document
,
window
,
rJS
,
RSVP
,
jIO
,
Blob
));
\ No newline at end of file
bt5/erp5_officejs_ooffice/SkinTemplateItem/portal_skins/erp5_ooffice_text_editor/only_office_document_view.js.xml
0 → 100644
View file @
a4d9fcc3
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"File"
module=
"OFS.Image"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
__name__
</string>
</key>
<value>
<string>
only_office_document_view.js
</string>
</value>
</item>
<item>
<key>
<string>
content_type
</string>
</key>
<value>
<string>
application/javascript
</string>
</value>
</item>
<item>
<key>
<string>
precondition
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string></string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
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