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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Sebastian
erp5
Commits
d1eb52cd
Commit
d1eb52cd
authored
Oct 13, 2017
by
Tristan Cavelier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_post: change create HTML post API
keep backward compatibility with erp5_officejs_support_request_ui
parent
abc20a0e
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
32 additions
and
32 deletions
+32
-32
bt5/erp5_officejs_support_request_ui/SkinTemplateItem/portal_skins/erp5_officejs_support_request/PostModule_createHTMLPostForSupportRequest.py
...ort_request/PostModule_createHTMLPostForSupportRequest.py
+16
-6
bt5/erp5_post/SkinTemplateItem/portal_skins/erp5_post/PostModule_createHTMLPost.py
...eItem/portal_skins/erp5_post/PostModule_createHTMLPost.py
+11
-20
bt5/erp5_post/SkinTemplateItem/portal_skins/erp5_post/PostModule_createHTMLPost.xml
...Item/portal_skins/erp5_post/PostModule_createHTMLPost.xml
+1
-1
bt5/erp5_post/SkinTemplateItem/portal_skins/erp5_post/PostModule_createHTMLPostFromText.py
...rtal_skins/erp5_post/PostModule_createHTMLPostFromText.py
+3
-4
bt5/erp5_post/SkinTemplateItem/portal_skins/erp5_post/PostModule_createHTMLPostFromText.xml
...tal_skins/erp5_post/PostModule_createHTMLPostFromText.xml
+1
-1
No files found.
bt5/erp5_officejs_support_request_ui/SkinTemplateItem/portal_skins/erp5_officejs_support_request/PostModule_createHTMLPostForSupportRequest.py
View file @
d1eb52cd
follow_up_object
,
=
context
.
getPortalObject
().
portal_catalog
(
relative_url
=
follow_up
,
limit
=
1
)
follow_up_object
.
edit
()
# update modification date
result
=
context
.
PostModule_createHTMLPostFromText
(
follow_up
,
predecessor
,
data
,
file
,
post
=
context
.
PostModule_createHTMLPostFromText
(
follow_up
=
follow_up
,
data
=
data
,
)
return
result
if
file
!=
"undefined"
:
# XXX "undefined" ? should also be fixed in javascript side
document_kw
=
{
'batch_mode'
:
True
,
'redirect_to_document'
:
False
,
'file'
:
file
}
document
=
context
.
Base_contribute
(
**
document_kw
)
# set relation between post and document
# XXX successor is used as a way to put a relation between the attachment and the post,
# the actual way should be to use a proper container like an Event that will have
# one or several posts and one or several attachments.
post
.
setSuccessorValueList
([
document
])
# XXX depending on security model this should be changed accordingly
document
.
publish
()
bt5/erp5_post/SkinTemplateItem/portal_skins/erp5_post/PostModule_createHTMLPost.py
View file @
d1eb52cd
portal
=
context
.
getPortalObject
()
now
=
DateTime
()
# create an HTML Post
post_module
=
portal
.
post_module
...
...
@@ -14,27 +12,20 @@ if object_list:
else
:
raise
LookupError
(
"Target follow up object not found"
)
post
.
edit
(
start_date
=
now
,
follow_up_value
=
follow_up_object
,
predecessor_value
=
predecessor
if
predecessor
else
None
,
text_content
=
data
,
)
# handle attachments
if
file
!=
"undefined"
:
document_kw
=
{
'batch_mode'
:
True
,
'redirect_to_document'
:
False
,
'file'
:
file
}
document
=
context
.
Base_contribute
(
**
document_kw
)
# set relation between post and document
post
.
setSuccessorValueList
([
document
])
# depending on security model this should be changed accordingly
document
.
publish
()
now
=
DateTime
()
post_edit_kw
=
{
"start_date"
:
now
,
"follow_up_value"
:
follow_up_object
,
"text_content"
:
data
,
}
if
predecessor
is
not
None
:
predecessor_value
,
=
portal
.
portal_catalog
(
relative_url
=
predecessor
)
post_edit_kw
[
"predecessor_value"
]
=
predecessor_value
.
getObject
()
post
.
edit
(
**
post_edit_kw
)
post
.
publish
()
# We need to reindex the object on server. So the page will get the post which
# just submmitted.
post
.
immediateReindexObject
()
return
return
post
bt5/erp5_post/SkinTemplateItem/portal_skins/erp5_post/PostModule_createHTMLPost.xml
View file @
d1eb52cd
...
...
@@ -50,7 +50,7 @@
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
follow_up,
predecessor, data, fil
e
</string>
</value>
<value>
<string>
follow_up,
data, predecessor=Non
e
</string>
</value>
</item>
<item>
<key>
<string>
_proxy_roles
</string>
</key>
...
...
bt5/erp5_post/SkinTemplateItem/portal_skins/erp5_post/PostModule_createHTMLPostFromText.py
View file @
d1eb52cd
return
context
.
PostModule_createHTMLPost
(
follow_up
,
predecessor
,
"<p>"
+
data
.
replace
(
"&"
,
"&"
).
replace
(
"<"
,
"<"
).
replace
(
">"
,
">"
).
replace
(
" "
,
" "
).
replace
(
"
\
n
"
,
"<br/>"
)
+
"</p>"
,
file
,
follow_up
=
follow_up
,
predecessor
=
predecessor
,
data
=
"<p>"
+
data
.
replace
(
"&"
,
"&"
).
replace
(
"<"
,
"<"
).
replace
(
">"
,
">"
).
replace
(
" "
,
" "
).
replace
(
"
\
n
"
,
"<br/>"
)
+
"</p>"
,
)
bt5/erp5_post/SkinTemplateItem/portal_skins/erp5_post/PostModule_createHTMLPostFromText.xml
View file @
d1eb52cd
...
...
@@ -50,7 +50,7 @@
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
follow_up,
predecessor, data, fil
e
</string>
</value>
<value>
<string>
follow_up,
data, predecessor=Non
e
</string>
</value>
</item>
<item>
<key>
<string>
_proxy_roles
</string>
</key>
...
...
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