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
1
Issues
1
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
Roque
erp5
Commits
d4bccb9e
Commit
d4bccb9e
authored
Oct 08, 2019
by
Roque
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_officejs: enable readonly view for non-only-office documents
parent
d9220ced
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 @
d4bccb9e
/*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 */
/*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
"
;
"
use strict
"
;
function
renderField
(
field_id
,
field_definition
,
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
=
{};
var
key
,
raw_value
,
override
,
final_value
,
item_list
,
result
=
{};
for
(
key
in
field_definition
.
values
)
{
for
(
key
in
field_definition
.
values
)
{
if
(
field_definition
.
values
.
hasOwnProperty
(
key
))
{
if
(
field_definition
.
values
.
hasOwnProperty
(
key
))
{
...
@@ -45,11 +45,16 @@
...
@@ -45,11 +45,16 @@
}
}
if
(
result
.
renderjs_extra
&&
blob_type
)
{
if
(
result
.
renderjs_extra
&&
blob_type
)
{
result
[
"
default
"
]
=
data
;
result
[
"
default
"
]
=
data
;
result
.
editable
=
content_editable
;
if
(
!
content_editable
)
{
result
.
type
=
"
EditorField
"
;
}
}
}
return
result
;
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
,
var
i
,
j
,
field_list
,
field_info
,
my_element
,
element_id
,
rendered_field
,
raw_properties
=
form_definition
.
fields_raw_properties
,
raw_properties
=
form_definition
.
fields_raw_properties
,
form_json
=
{
form_json
=
{
...
@@ -73,7 +78,8 @@
...
@@ -73,7 +78,8 @@
if
(
element_id
&&
raw_properties
.
hasOwnProperty
(
my_element
))
{
if
(
element_id
&&
raw_properties
.
hasOwnProperty
(
my_element
))
{
field_info
=
raw_properties
[
my_element
];
field_info
=
raw_properties
[
my_element
];
rendered_field
=
renderField
(
element_id
,
field_info
,
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
]
=
form_json
.
erp5_document
.
_embedded
.
_view
[
my_element
]
=
rendered_field
;
rendered_field
;
}
}
...
@@ -86,7 +92,7 @@
...
@@ -86,7 +92,7 @@
}
}
function
handleSubmit
(
gadget
,
child_gadget
,
content_dict
)
{
function
handleSubmit
(
gadget
,
child_gadget
,
content_dict
)
{
var
data
,
name_list
;
var
data
;
return
gadget
.
notifySubmitting
()
return
gadget
.
notifySubmitting
()
.
push
(
function
()
{
.
push
(
function
()
{
if
(
gadget
.
state
.
blob_type
)
{
if
(
gadget
.
state
.
blob_type
)
{
...
@@ -95,7 +101,9 @@
...
@@ -95,7 +101,9 @@
delete
content_dict
.
text_content
;
delete
content_dict
.
text_content
;
}
}
return
child_gadget
.
submitContent
(
return
child_gadget
.
submitContent
(
child_gadget
.
state
.
jio_key
,
undefined
,
content_dict
child_gadget
.
state
.
jio_key
,
undefined
,
content_dict
);
);
})
})
.
push
(
function
()
{
.
push
(
function
()
{
...
@@ -227,8 +235,15 @@
...
@@ -227,8 +235,15 @@
.
onStateChange
(
function
onStateChange
()
{
.
onStateChange
(
function
onStateChange
()
{
var
fragment
=
document
.
createElement
(
'
div
'
),
var
fragment
=
document
.
createElement
(
'
div
'
),
gadget
=
this
,
gadget
=
this
,
form_json
=
renderForm
(
gadget
.
state
.
form_definition
,
gadget
.
state
.
doc
,
content_editable
=
gadget
.
state
.
content_editable
,
gadget
.
state
.
data
,
gadget
.
state
.
blob_type
);
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
)
{
while
(
gadget
.
element
.
firstChild
)
{
gadget
.
element
.
removeChild
(
gadget
.
element
.
firstChild
);
gadget
.
element
.
removeChild
(
gadget
.
element
.
firstChild
);
}
}
...
@@ -338,4 +353,4 @@
...
@@ -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 @
d4bccb9e
...
@@ -269,7 +269,7 @@
...
@@ -269,7 +269,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
serial
</string>
</key>
<key>
<string>
serial
</string>
</key>
<value>
<string>
978.
46851.17123.15906
</string>
</value>
<value>
<string>
978.
63202.6561.35293
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
state
</string>
</key>
<key>
<string>
state
</string>
</key>
...
@@ -287,7 +287,7 @@
...
@@ -287,7 +287,7 @@
</tuple>
</tuple>
<state>
<state>
<tuple>
<tuple>
<float>
15
69577593.67
</float>
<float>
15
70539644.03
</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