[Product-Developers] guestbook behaviour of plone.app.discussion comments

Guido Stevens guido.stevens at cosent.net
Thu Dec 5 09:59:57 UTC 2013


Hi Torsten,

If I were you I'd just implement a custom viewlet that:
- on a specific discussion-enabled context ("Document")
- extracts all the Discussion Items for that context from the 
plone.app.discussion annotation
- convert comments to a flat list, ignore all threading
- re-sort with most recent on top
- display the comments

Then via zcml disable plone.app.discussion comment rendering and show 
your own viewlet. Keep the plone.app.discussion "add comment" form - no 
need to change that.

There's no need to change plone.app.discussion itself. You only want a 
different display of it's existing data structures; that's what a 
customized viewlet can do for you.

Please note that the discussions for a page are stored *on that page* 
and you can see how to extract them in the p.a.d. code.

:*CU#

On 02/12/13 23:42, Torsten Kühnel wrote:
> Hello,
>
> i am using Plone for a few small but content based websites and i am
> really happy with what is provided out of the box.
>
> Plone setup and Content management/editing is real straightforward, not
> to say easy, and the users provide good feedback about the intuitive
> interface when they use it to edit their sites and provide content.
>
> For me as the maintainer of the Plone system in use it is my job to
> provide the features the users need, and one of it is a guestbook.
>
> While migrating from Plone 3.3 to 4.3.2 the quintagroup.plonecomments
> comments were successfully converted to plone.app.discussion ones.
>
> While digging into the code to see where the requirements i have could be
> implemented i ended up with the conclusion that the plone.app.discussion
> package itself is the best place to make the changes or extend.
>
> One of the key requirements, so the users tell me, of guestbook-style
> comments compared to the plone.app.discussion provided comments is the
> order they apear. A new guestbook entry should appear on top of the
> others, but with related replies below. This is what the users of my
> sites tell me.
>
> The thing to modify is the way the generator object returns the comments
> from the IConversation object in the CommentsViewlet. When i subclass
> this viewlet in my lets say collective.guestbookcomments product, i end
> up with the following problems:
>
> 1: How to implement a way a site manager can decide which content object
> should have comments, and which guestbook-style comments? When i subclass
> and overwrite the plone.app.discussion machinery, normal comments would
> no longer be possible. So i thought of a switch in the properties tab of
> a content object. But i have no clue how to achieve that, it looks to me
> digging too deep into Plones internal machinery. Is there a safe and
> upgrade compatible way to stick a checkbox from an addon product onto
> content objects? Maybe via an Interface?
>
> 2: When i provide new translations via .po files for the guestbook style
> comments, i just overwrite the plone provided comment ones, too. This is
> not the way to go, but duplicating the whole discussion machinery to have
> one for comments and one for guestbookentries just to get proper strings
> on the labels looks much too heavy for me.
>
> So i ended up in that the plone.app.discussion package needs to be
> extended to cover described use case. But tampering with core plone
> packages is two levels above my knowledge, sorry.
>
>
> Thanks for any hints and helps and clues !


-- 
     Guido Stevens  |  +31.43.3618933  |  http://cosent.nl

     s o c i a l   k n o w l e d g e   t e c h n o l o g y



More information about the Product-Developers mailing list