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
alecs_myu
erp5
Commits
003b0bc5
Commit
003b0bc5
authored
Jan 14, 2019
by
Roque
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_messenger: getting posts with jio allDocs
- get rid of scripts to add and get posts
parent
fca49e31
Changes
13
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
34 additions
and
329 deletions
+34
-329
bt5/erp5_messenger/SkinTemplateItem/portal_skins/erp5_messenger/MessengerThreadModule_viewMessengerThreadList.xml
...ssenger/MessengerThreadModule_viewMessengerThreadList.xml
+1
-3
bt5/erp5_messenger/SkinTemplateItem/portal_skins/erp5_messenger/MessengerThreadModule_viewMessengerThreadList/listbox.xml
...MessengerThreadModule_viewMessengerThreadList/listbox.xml
+8
-25
bt5/erp5_messenger/SkinTemplateItem/portal_skins/erp5_messenger/MessengerThread_createNewMessengerPost.py
.../erp5_messenger/MessengerThread_createNewMessengerPost.py
+0
-58
bt5/erp5_messenger/SkinTemplateItem/portal_skins/erp5_messenger/MessengerThread_createNewMessengerPost.xml
...erp5_messenger/MessengerThread_createNewMessengerPost.xml
+0
-72
bt5/erp5_messenger/SkinTemplateItem/portal_skins/erp5_messenger/MessengerThread_getCommentPostList.py
...kins/erp5_messenger/MessengerThread_getCommentPostList.py
+0
-24
bt5/erp5_messenger/SkinTemplateItem/portal_skins/erp5_messenger/MessengerThread_getCommentPostList.xml
...ins/erp5_messenger/MessengerThread_getCommentPostList.xml
+0
-62
bt5/erp5_messenger/SkinTemplateItem/portal_skins/erp5_messenger/MessengerThread_getCommentPostListAsJson.py
...rp5_messenger/MessengerThread_getCommentPostListAsJson.py
+0
-2
bt5/erp5_messenger/SkinTemplateItem/portal_skins/erp5_messenger/MessengerThread_getCommentPostListAsJson.xml
...p5_messenger/MessengerThread_getCommentPostListAsJson.xml
+0
-62
bt5/erp5_messenger/SkinTemplateItem/portal_skins/erp5_messenger/MessengerThread_view.xml
...Item/portal_skins/erp5_messenger/MessengerThread_view.xml
+1
-1
bt5/erp5_messenger/SkinTemplateItem/portal_skins/erp5_messenger/MessengerThread_view/listbox.xml
...tal_skins/erp5_messenger/MessengerThread_view/listbox.xml
+1
-1
bt5/erp5_messenger/SkinTemplateItem/portal_skins/erp5_messenger/MessengerThread_view/my_listbox.xml
..._skins/erp5_messenger/MessengerThread_view/my_listbox.xml
+1
-1
bt5/erp5_messenger/SkinTemplateItem/portal_skins/erp5_messenger/gadget_postlist.html.html
...tem/portal_skins/erp5_messenger/gadget_postlist.html.html
+2
-2
bt5/erp5_messenger/SkinTemplateItem/portal_skins/erp5_messenger/gadget_postlist.js.js
...ateItem/portal_skins/erp5_messenger/gadget_postlist.js.js
+20
-16
No files found.
bt5/erp5_messenger/SkinTemplateItem/portal_skins/erp5_messenger/MessengerThreadModule_viewMessengerThreadList.xml
View file @
003b0bc5
...
...
@@ -43,9 +43,7 @@
</item>
<item>
<key>
<string>
edit_order
</string>
</key>
<value>
<list/>
</value>
<value>
<string>
[]
</string>
</value>
</item>
<item>
<key>
<string>
encoding
</string>
</key>
...
...
bt5/erp5_messenger/SkinTemplateItem/portal_skins/erp5_messenger/MessengerThreadModule_viewMessengerThreadList/listbox.xml
View file @
003b0bc5
...
...
@@ -6,19 +6,6 @@
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
delegated_list
</string>
</key>
<value>
<list>
<string>
all_columns
</string>
<string>
columns
</string>
<string>
domain_root_list
</string>
<string>
domain_tree
</string>
<string>
selection_name
</string>
<string>
title
</string>
</list>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
listbox
</string>
</value>
...
...
@@ -31,6 +18,10 @@
<key>
<string>
external_validator_failed
</string>
</key>
<value>
<string>
The input failed the external validator.
</string>
</value>
</item>
<item>
<key>
<unicode>
required_not_found
</unicode>
</key>
<value>
<string>
Input is required but no input given.
</string>
</value>
</item>
</dictionary>
</value>
</item>
...
...
@@ -46,10 +37,6 @@
<key>
<string>
form_id
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
target
</string>
</key>
<value>
<string></string>
</value>
</item>
</dictionary>
</value>
</item>
...
...
@@ -65,10 +52,6 @@
<key>
<string>
form_id
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
target
</string>
</key>
<value>
<string></string>
</value>
</item>
</dictionary>
</value>
</item>
...
...
@@ -142,15 +125,15 @@
<value>
<list>
<tuple>
<string>
Discussion
Thread
</string>
<string>
Discussion
Thread
</string>
<string>
Messenger
Thread
</string>
<string>
Messenger
Thread
</string>
</tuple>
</list>
</value>
</item>
<item>
<key>
<string>
selection_name
</string>
</key>
<value>
<string>
discussion
_module_selection
</string>
</value>
<value>
<string>
messenger_thread
_module_selection
</string>
</value>
</item>
<item>
<key>
<string>
target
</string>
</key>
...
...
@@ -158,7 +141,7 @@
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string>
Discussion
Threads
</string>
</value>
<value>
<string>
Messenger
Threads
</string>
</value>
</item>
</dictionary>
</value>
...
...
bt5/erp5_messenger/SkinTemplateItem/portal_skins/erp5_messenger/MessengerThread_createNewMessengerPost.py
deleted
100644 → 0
View file @
fca49e31
"""
This script allows to create a new Messenger Post in context.
"""
from
DateTime
import
DateTime
from
Products.ERP5Type.Log
import
log
portal
=
context
.
getPortalObject
()
person
=
portal
.
portal_membership
.
getAuthenticatedMember
().
getUserValue
()
messenger_thread
=
context
is_temp_object
=
messenger_thread
.
isTempObject
()
if
is_temp_object
:
# this is a temporary object accessed by its reference
# we need to get real ZODB one
messenger_thread
=
messenger_thread
.
getOriginalDocument
()
# inspired on PostModule_createHTMLPostForSupportRequest
# temporarily using post_module until data structure (and portal_type/module) for Post are defined
post
=
context
.
PostModule_createHTMLPostFromText
(
follow_up
=
follow_up
,
data
=
text_content
,
source_reference
=
source_reference
,
)
# XXX the UI of support request app should be responsible for generating a unique
# "message id" for each posted message.
if
not
post
.
getSourceReference
():
post
.
setSourceReference
(
post
.
getId
())
ingest_document_tag
=
'ingest-%s'
%
post
.
getSourceReference
()
after_ingest_document_tag
=
'after-ingest-%s'
%
post
.
getSourceReference
()
document
=
None
#TODO
#if file not in ("undefined", None): # XXX "undefined" ? should also be fixed in javascript side
#get attachment code from PostModule_createHTMLPostForSupportRequest
#else:
# when we don't upload a document, we can publish the post now.
post
.
publish
()
follow_up_value
=
portal
.
restrictedTraverse
(
follow_up
)
assert
follow_up_value
.
getPortalType
()
==
"Messenger Thread"
# TODO: CHECK IF THIS IS NEEDED
# to be able to display the just posted data in MessengerThread_getCommentPostListAsJson,
# we store it in a session variable.
successor_name
=
successor_link
=
None
if
document
is
not
None
:
successor_link
,
successor_name
=
document
.
getRelativeUrl
(),
document
.
getFilename
()
portal
.
portal_sessions
[
'%s.latest_comment'
%
follow_up_value
.
getRelativeUrl
()][
'comment_post_list'
]
=
dict
(
user
=
post
.
Base_getOwnerTitle
(),
date
=
post
.
getStartDate
().
ISO8601
(),
text
=
post
.
asStrippedHTML
(),
attachment_link
=
successor_link
,
attachment_name
=
successor_name
,
message_id
=
post
.
getSourceReference
(),)
return
bt5/erp5_messenger/SkinTemplateItem/portal_skins/erp5_messenger/MessengerThread_createNewMessengerPost.xml
deleted
100644 → 0
View file @
fca49e31
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"PythonScript"
module=
"Products.PythonScripts.PythonScript"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
Script_magic
</string>
</key>
<value>
<int>
3
</int>
</value>
</item>
<item>
<key>
<string>
_bind_names
</string>
</key>
<value>
<object>
<klass>
<global
name=
"NameAssignments"
module=
"Shared.DC.Scripts.Bindings"
/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key>
<string>
_asgns
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
name_container
</string>
</key>
<value>
<string>
container
</string>
</value>
</item>
<item>
<key>
<string>
name_context
</string>
</key>
<value>
<string>
context
</string>
</value>
</item>
<item>
<key>
<string>
name_m_self
</string>
</key>
<value>
<string>
script
</string>
</value>
</item>
<item>
<key>
<string>
name_subpath
</string>
</key>
<value>
<string>
traverse_subpath
</string>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
title, follow_up, text_content, form_id=\'view\', predecessor=None, source_reference=None, file=None, **kw
</string>
</value>
</item>
<item>
<key>
<string>
_proxy_roles
</string>
</key>
<value>
<tuple>
<string>
Assignor
</string>
<string>
Manager
</string>
<string>
Owner
</string>
</tuple>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
MessengerThread_createNewMessengerPost
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
bt5/erp5_messenger/SkinTemplateItem/portal_skins/erp5_messenger/MessengerThread_getCommentPostList.py
deleted
100644 → 0
View file @
fca49e31
from
Products.ERP5Type.Log
import
log
from
DateTime
import
DateTime
portal
=
context
.
getPortalObject
()
document_type_list
=
portal
.
getPortalDocumentTypeList
()
comment_list
=
[]
followup_thread
=
'follow_up/'
+
context
.
getRelativeUrl
()
catalog_kw
=
{
'portal_type'
:
'%Post'
,
'query'
:
portal
.
portal_catalog
.
getCategoryParameterDict
(
category_list
=
[
followup_thread
]),
'validation_state'
:
"published"
}
for
post
in
portal
.
portal_catalog
(
**
catalog_kw
):
# hardcoded content until data structure (and portal_type/module) for Post are defined
comment_list
.
append
((
dict
(
user
=
"hardcoded user"
,
#event.getSourceTitle(),
date
=
DateTime
().
ISO8601
(),
#"TODO: get date",#event.getStartDate().ISO8601(),
text
=
post
.
getData
(),
#event.asStrippedHTML(),
attachment_link
=
None
,
#attachment_link,
attachment_name
=
None
,
#attachment_name,
message_id
=
"hardcoded message_id"
,
#event.getSourceReference(),
)))
return
comment_list
bt5/erp5_messenger/SkinTemplateItem/portal_skins/erp5_messenger/MessengerThread_getCommentPostList.xml
deleted
100644 → 0
View file @
fca49e31
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"PythonScript"
module=
"Products.PythonScripts.PythonScript"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
Script_magic
</string>
</key>
<value>
<int>
3
</int>
</value>
</item>
<item>
<key>
<string>
_bind_names
</string>
</key>
<value>
<object>
<klass>
<global
name=
"NameAssignments"
module=
"Shared.DC.Scripts.Bindings"
/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key>
<string>
_asgns
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
name_container
</string>
</key>
<value>
<string>
container
</string>
</value>
</item>
<item>
<key>
<string>
name_context
</string>
</key>
<value>
<string>
context
</string>
</value>
</item>
<item>
<key>
<string>
name_m_self
</string>
</key>
<value>
<string>
script
</string>
</value>
</item>
<item>
<key>
<string>
name_subpath
</string>
</key>
<value>
<string>
traverse_subpath
</string>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
MessengerThread_getCommentPostList
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
bt5/erp5_messenger/SkinTemplateItem/portal_skins/erp5_messenger/MessengerThread_getCommentPostListAsJson.py
deleted
100644 → 0
View file @
fca49e31
from
json
import
dumps
return
dumps
(
context
.
MessengerThread_getCommentPostList
())
bt5/erp5_messenger/SkinTemplateItem/portal_skins/erp5_messenger/MessengerThread_getCommentPostListAsJson.xml
deleted
100644 → 0
View file @
fca49e31
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"PythonScript"
module=
"Products.PythonScripts.PythonScript"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
Script_magic
</string>
</key>
<value>
<int>
3
</int>
</value>
</item>
<item>
<key>
<string>
_bind_names
</string>
</key>
<value>
<object>
<klass>
<global
name=
"NameAssignments"
module=
"Shared.DC.Scripts.Bindings"
/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key>
<string>
_asgns
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
name_container
</string>
</key>
<value>
<string>
container
</string>
</value>
</item>
<item>
<key>
<string>
name_context
</string>
</key>
<value>
<string>
context
</string>
</value>
</item>
<item>
<key>
<string>
name_m_self
</string>
</key>
<value>
<string>
script
</string>
</value>
</item>
<item>
<key>
<string>
name_subpath
</string>
</key>
<value>
<string>
traverse_subpath
</string>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
MessengerThread_getCommentPostListAsJson
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
bt5/erp5_messenger/SkinTemplateItem/portal_skins/erp5_messenger/MessengerThread_view.xml
View file @
003b0bc5
...
...
@@ -78,6 +78,7 @@
<value>
<list>
<string>
listbox
</string>
<string>
my_listbox
</string>
</list>
</value>
</item>
...
...
@@ -108,7 +109,6 @@
<string>
my_title
</string>
<string>
my_short_title
</string>
<string>
my_reference
</string>
<string>
my_listbox
</string>
</list>
</value>
</item>
...
...
bt5/erp5_messenger/SkinTemplateItem/portal_skins/erp5_messenger/MessengerThread_view/listbox.xml
View file @
003b0bc5
...
...
@@ -128,7 +128,7 @@
</item>
<item>
<key>
<string>
selection_name
</string>
</key>
<value>
<string>
discussion
_post_selection
</string>
</value>
<value>
<string>
messenger
_post_selection
</string>
</value>
</item>
<item>
<key>
<string>
sort
</string>
</key>
...
...
bt5/erp5_messenger/SkinTemplateItem/portal_skins/erp5_messenger/MessengerThread_view/my_listbox.xml
View file @
003b0bc5
...
...
@@ -159,7 +159,7 @@
<dictionary>
<item>
<key>
<string>
_text
</string>
</key>
<value>
<string>
python: [(\'view\', "view"), (\'jio_key\', context.getRelativeUrl()), (\'portal_type\', context.getPortalType()), (\'maximize\', \'listbox\' not in field.id)]
</string>
</value>
<value>
<string>
python: [
( \'query\', context.getPortalObject().portal_catalog.getSQLCatalog().buildQuery({"portal_type":[\'Messenger Post\'], "parent_uid":context.getUid()}).asSearchTextExpression(context.getPortalObject().portal_catalog.getSQLCatalog()) ),
(\'view\', "view"), (\'jio_key\', context.getRelativeUrl()), (\'portal_type\', context.getPortalType()), (\'maximize\', \'listbox\' not in field.id)]
</string>
</value>
</item>
</dictionary>
</pickle>
...
...
bt5/erp5_messenger/SkinTemplateItem/portal_skins/erp5_messenger/gadget_postlist.html.html
View file @
003b0bc5
...
...
@@ -20,7 +20,7 @@
<
li
>
By
<
strong
>
{{
user
}}
<
/strong>
-
<
time
datetime
=
"
{{ date }}
"
title
=
"
{{ date_formatted }}
"
>
{{
date_relative
}}
<
/time
>
<
br
/>
{{{
tex
t
}}}
{{{
value
.
text_conten
t
}}}
{{
#
if
attachment_link
}}
<
br
/>
<
strong
>
Attachment
:
<
/strong
>
...
...
@@ -30,7 +30,7 @@
<
/li
>
{{
/
each
}}
{{
else
}}
<
p
><
em
>
No
comment
yet
.
<
/em></
p
><
hr
id
=
"
post_item
"
>
<
p
><
em
>
No
posts
yet
.
<
/em></
p
><
hr
id
=
"
post_item
"
>
{{
/
if
}}
</script>
...
...
bt5/erp5_messenger/SkinTemplateItem/portal_skins/erp5_messenger/gadget_postlist.js.js
View file @
003b0bc5
/*jslint nomen: true, indent: 2 */
/*global window, rJS, RSVP, document,
moment, jIO, Handlebars
*/
(
function
(
window
,
rJS
,
RSVP
,
document
,
moment
,
jIO
,
Handlebars
)
{
/*global window, rJS, RSVP, document,
moment, jIO, Handlebars, console
*/
(
function
(
window
,
rJS
,
RSVP
,
document
,
moment
,
jIO
,
Handlebars
,
console
)
{
"
use strict
"
;
var
gadget_klass
=
rJS
(
window
),
comment_list_template
=
Handlebars
.
compile
(
...
...
@@ -10,8 +10,7 @@
rJS
(
window
)
.
declareAcquiredMethod
(
"
getSetting
"
,
"
getSetting
"
)
.
declareAcquiredMethod
(
"
jio_getAttachment
"
,
"
jio_getAttachment
"
)
.
declareAcquiredMethod
(
"
jio_putAttachment
"
,
"
jio_putAttachment
"
)
.
declareAcquiredMethod
(
"
jio_allDocs
"
,
"
jio_allDocs
"
)
.
declareMethod
(
'
render
'
,
function
(
options
)
{
var
gadget
=
this
;
...
...
@@ -25,6 +24,7 @@
id
:
options
.
jio_key
,
view
:
options
.
view
,
editable
:
options
.
editable
,
query
:
options
.
query
,
erp5_form
:
options
.
erp5_form
||
{}
};
return
gadget
.
changeState
(
state_dict
);
...
...
@@ -33,13 +33,17 @@
.
onStateChange
(
function
()
{
var
gadget
=
this
;
return
gadget
.
jio_getAttachment
(
'
post_module
'
,
gadget
.
hateoas_url
+
gadget
.
options
.
jio_key
+
"
/MessengerThread_getCommentPostListAsJson
"
)
.
push
(
function
(
post_list
)
{
console
.
log
(
"
gadget.state.query:
"
);
console
.
log
(
gadget
.
state
.
query
);
return
gadget
.
jio_allDocs
({
"
query
"
:
gadget
.
state
.
query
,
"
select_list
"
:
[
"
text_content
"
,
"
modification_date
"
,
"
local_role
"
],
"
sort_on
"
:
[[
"
modification_date
"
,
"
ascending
"
]]
})
.
push
(
function
(
results
)
{
var
post_list
=
results
.
data
.
rows
;
function
getPostWithLinkAndLocalDate
(
post
)
{
post
.
date
=
post
.
value
.
modification_date
;
post
.
date_formatted
=
moment
(
post
.
date
).
format
(
'
LLLL
'
);
post
.
date_relative
=
moment
(
post
.
date
).
fromNow
();
if
(
post
.
attachment_link
===
null
)
{
...
...
@@ -60,9 +64,12 @@
}
);
}
// build links with attachments and localized dates
var
queue_list
=
[],
i
=
0
;
for
(
i
=
0
;
i
<
post_list
.
length
;
i
+=
1
)
{
post_list
[
i
].
user
=
"
zope
"
;
// problems getting Owner property
// TODO: attachments
post_list
[
i
].
attachment_link
=
null
;
post_list
[
i
].
attachment_name
=
null
;
queue_list
.
push
(
getPostWithLinkAndLocalDate
(
post_list
[
i
]));
}
return
RSVP
.
all
(
queue_list
);
...
...
@@ -70,10 +77,7 @@
.
push
(
function
(
comment_list
)
{
var
comments
=
gadget
.
element
.
querySelector
(
"
#post_list
"
);
comments
.
innerHTML
=
comment_list_template
({
comments
:
comment_list
});
})
;
});
})
.
onLoop
(
function
()
{
...
...
@@ -88,4 +92,4 @@
return this.submitPostComment();
})*/
;
}(
window
,
rJS
,
RSVP
,
document
,
moment
,
jIO
,
Handlebars
));
\ No newline at end of file
}(
window
,
rJS
,
RSVP
,
document
,
moment
,
jIO
,
Handlebars
,
console
));
\ No newline at end of file
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