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

Torsten Kühnel tdk at fuer-adrian.de
Fri Dec 6 10:39:02 UTC 2013


Am Thu, 05 Dec 2013 10:59:57 +0100 schrieb Guido Stevens:

> 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
> ...

Hi Guido,

thank you for your answer ! 
I spent some more time on the problem and came to the following:

Guest book style enabled comments should be able to co exists with 
classic discussion style ones. I bet the users want discussions here and 
there on their content some times, who knows. So the display style should 
be choosable by the user.

At the moment i have the following code working: I created a product on 
the file system with no theme. I choosed the name 
collective.guestbookcomments, not sure if this is appropriate. Anyway..

I found out how to use browser layers to make the extension available 
only for the sites wanted. So it wont interfere with plone sites in the 
same zodb.

Then i found out how to use archetypes.schema.extender to put a boolean 
widget below the allow discussion setting of a document to enable/disable 
guestbook style comments. I "hope" there is similar functionality for 
dexterity content types available, to extend the product this way later.

Then i registered a class and a viewlet based on the discussion ones for 
the new package, which has the logic to reorder the comments. This was not 
so trivial as it looked, because site managers want to leave comments on 
the guestbook entries "below" the entry, while the list of guestbook 
entries bottom top. But i solved this.

Then i hided the discussion.comments viewlet from the belowportalcontent 
manager and put my in. This may cause some confusion and may interfer 
with theme products hiding/moving the discussion viewlet, so i will note 
that in the readme of the product.

So i end up with a viewlet which has control over how to render the 
actually discussion list, either discussion style or guestbook style by a 
setting in the document.

The actual decision on what to render is in the new comments.pt which has 
two parts, one a copy from the dicussion comments.pt, and one adapted to 
guestbook style comments with title, img tag and such. This way the 
guestbook can by styled independently from discussions. This looks 
somewhat ugly to me to have that in one pagetemplate, but i don't know 
how to make plone use the orginal template from app.discussion or my one.

At the moment i am in the i18n stuff, because i want to have a way to 
label all strings and buttons differently, too, but the original strings 
stick in several plone packages.

Then i have a problem with subclassing and decorated functions, as it 
looks the decorator calls the base class and not my derived one, thats 
bad and i am new to decorators, too. 

Any suggestions welcome. Please let me know if such an addon product is 
worth to be published to the collective or not.

thanks for Plone !
 





More information about the Product-Developers mailing list