Rating content in a Plone site

I’ve been meaning to try out Alec Mitchell’s contentratings product and tonight I finally sat down and tried installing it in a fresh Plone 2.5 test instance. The README is very comprehensive, but apparently I didn’t read it carefully enough because after putting contentratings into the Zope products directly, Zope wouldn’t restart.

Alec was on the #plone IRC channel and was kind enough to walk me through the process of configuring it. The product uses the “new school” approach which is to put it in $INSTANCE/lib/python. Once I moved it there, then Zope started up with no problem.

The next instructions in the README were to add the interface declarations in configure.zcml. Since I was just testing the product, I decided to configure as rateable the ‘Page’ content type that comes with ATContentTypes. This required adding these lines to ATContentTypes/configure.zcml:



 
   
   
                                                                                                                                                                      


After reporting that this still wasn’t working, Alec realized that he had omitted one critical line in configure.zcml:


 

Then I added the following code snippet to the bottom of CMFPlone/skins/plone_content/document_byline.pt:


 
   
   
 
 
 

Lastly, it was necessary to add these lines to the configure.zcml file to get the star images to appear:


 

 

The last line is not necessary if you are using Plone 2.5, since everything is already traversable.

What next

I proposed making a simple product which configures the relevant content types to be ratable, adds the indexes to the catalog and provides some nice looking views and portlets to display the highest rated content on the site.

I asked about making a configlet which would let the site admin choose which content types were ratable and Alec’s reply was “you just make a view that calls classImplements on the classes or directlyProvides on the instances.”

The goal is to make contentratings accessible and usable out-of-the-box. This could be a nice little weekend project.


5 Responses to “Rating content in a Plone site”


  1. 1 Jon Stahl

    Nice to see you back in the blogosphere!

    Your code snippets aren’t showing. :-(

    But more seriously, so now there are three ratings products out there for Plone: contentratings, ATRatings and now Rating Engine, which looks like a direct descedant of ATRatings that adds voting.

    Perhaps the portlets and views can be stolen from ATRatings & Rating Engine?

  2. 2 nate

    Hi Jon,

    Yeah, WP was mangling the code until I installed “Code Auto Escape” which preserves the code as long as its encapsulated in “pre” and “code” tags.

    It’s too bad theploneblog.org doesn’t have trackbacks enabled so I could have this post comment on your post. http://theploneblog.org/blog/archive/2006/05/19/im-enjoying-atratings

    Good idea about repurposing the views and portlets from those other ratings products. I’ll see if they can be used with contentratings.

    Nate

  3. 3 Nate Aune

    At the Big Apple Sprint, Christof Haemmerle (reco) wrapped up the code from this blog post into a product called PloneContentRating which has been posted to the collective. I don’t like that it gets installed as a new skin which is not really necessary. But after installation, it does enable ratings on all ATCT content types.

  4. 4 Christof Haemmerle

    hi nate, thanx for the credit. without the help of darian schram (dvschramm) it would not have been possible. :)

  5. 5 Sean

    I would love to see the missing code snippets. I am having trouble getting contentratings working with my custome 2.5x type (don’t get the .zcml stuff)

Leave a Reply