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
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
Paul Graydon
erp5
Commits
20f0dae9
Commit
20f0dae9
authored
Oct 08, 2019
by
Roque
Committed by
Roque
Oct 09, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_officejs: enable readonly view for non-only-office documents
parent
fd45d525
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
12 deletions
+27
-12
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_form_view_js.js
...plateItem/web_page_module/gadget_officejs_form_view_js.js
+25
-10
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_form_view_js.xml
...lateItem/web_page_module/gadget_officejs_form_view_js.xml
+2
-2
No files found.
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_form_view_js.js
View file @
20f0dae9
/*global document, window, rJS, RSVP, Blob, URL, jIO, ensureArray */
/*global document, window, rJS, RSVP, Blob, URL, jIO, ensureArray
, console
*/
/*jslint nomen: true, indent: 2, maxerr: 10, maxlen: 80 */
(
function
(
document
,
window
,
rJS
,
RSVP
,
Blob
,
URL
,
jIO
,
ensureArray
)
{
(
function
(
document
,
window
,
rJS
,
RSVP
,
Blob
,
URL
,
jIO
,
ensureArray
,
console
)
{
"
use strict
"
;
function
renderField
(
field_id
,
field_definition
,
context_document
,
data
,
blob_type
)
{
context_document
,
data
,
blob_type
,
content_editable
)
{
var
key
,
raw_value
,
override
,
final_value
,
item_list
,
result
=
{};
for
(
key
in
field_definition
.
values
)
{
if
(
field_definition
.
values
.
hasOwnProperty
(
key
))
{
...
...
@@ -45,11 +45,16 @@
}
if
(
result
.
renderjs_extra
&&
blob_type
)
{
result
[
"
default
"
]
=
data
;
result
.
editable
=
content_editable
;
if
(
!
content_editable
)
{
result
.
type
=
"
EditorField
"
;
}
}
return
result
;
}
function
renderForm
(
form_definition
,
context_document
,
data
,
blob_type
)
{
function
renderForm
(
form_definition
,
context_document
,
data
,
blob_type
,
content_editable
)
{
var
i
,
j
,
field_list
,
field_info
,
my_element
,
element_id
,
rendered_field
,
raw_properties
=
form_definition
.
fields_raw_properties
,
form_json
=
{
...
...
@@ -73,7 +78,8 @@
if
(
element_id
&&
raw_properties
.
hasOwnProperty
(
my_element
))
{
field_info
=
raw_properties
[
my_element
];
rendered_field
=
renderField
(
element_id
,
field_info
,
context_document
,
data
,
blob_type
);
context_document
,
data
,
blob_type
,
content_editable
);
form_json
.
erp5_document
.
_embedded
.
_view
[
my_element
]
=
rendered_field
;
}
...
...
@@ -86,7 +92,7 @@
}
function
handleSubmit
(
gadget
,
child_gadget
,
content_dict
)
{
var
data
,
name_list
;
var
data
;
return
gadget
.
notifySubmitting
()
.
push
(
function
()
{
if
(
gadget
.
state
.
blob_type
)
{
...
...
@@ -95,7 +101,9 @@
delete
content_dict
.
text_content
;
}
return
child_gadget
.
submitContent
(
child_gadget
.
state
.
jio_key
,
undefined
,
content_dict
child_gadget
.
state
.
jio_key
,
undefined
,
content_dict
);
})
.
push
(
function
()
{
...
...
@@ -227,8 +235,15 @@
.
onStateChange
(
function
onStateChange
()
{
var
fragment
=
document
.
createElement
(
'
div
'
),
gadget
=
this
,
form_json
=
renderForm
(
gadget
.
state
.
form_definition
,
gadget
.
state
.
doc
,
gadget
.
state
.
data
,
gadget
.
state
.
blob_type
);
content_editable
=
gadget
.
state
.
content_editable
,
form_json
;
if
(
content_editable
===
undefined
)
{
content_editable
=
gadget
.
state
.
form_definition
.
portal_type_dict
.
editable
;
}
form_json
=
renderForm
(
gadget
.
state
.
form_definition
,
gadget
.
state
.
doc
,
gadget
.
state
.
data
,
gadget
.
state
.
blob_type
,
content_editable
);
while
(
gadget
.
element
.
firstChild
)
{
gadget
.
element
.
removeChild
(
gadget
.
element
.
firstChild
);
}
...
...
@@ -338,4 +353,4 @@
});
});
}(
document
,
window
,
rJS
,
RSVP
,
Blob
,
URL
,
jIO
,
ensureArray
));
}(
document
,
window
,
rJS
,
RSVP
,
Blob
,
URL
,
jIO
,
ensureArray
,
console
));
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_form_view_js.xml
View file @
20f0dae9
...
...
@@ -269,7 +269,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
978.
46851.17123.15906
</string>
</value>
<value>
<string>
978.
63202.6561.35293
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -287,7 +287,7 @@
</tuple>
<state>
<tuple>
<float>
15
69577593.67
</float>
<float>
15
70539644.03
</float>
<string>
UTC
</string>
</tuple>
</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