Forum OpenACS Q&A: AJAX Ratings

Collapse
13: AJAX Ratings (response to 1)
Posted by Eduardo Santos on
Hi everyone,

As I told you before, I've been working in ratings package also, and right i got a fresh AJAX interface. The idea was to create a procedure that generates the HTML code that can be inserted on any page for any object you wnat to rate. It's based now on the package icons in a way that, when you click on the icon representing the rating, an AJAX Request automatically puts the results in the database.

If you want to take look, give me your opinion and some guidelines for future development, just take a look at the code:

http://svn.softwarepublico.gov.br/trac/openacs/browser/branches/mpv2/packages/ratings

One can also make an SVN checkout using the command:

svn co http://svn.softwarepublico.gov.br/svn/openacs/branches/mpv2/packages/ratings

There are basically three important procedures:

  • ratings::icon::get_info - Take the info about the images path and some other things (based on ratings::icon::get)
  • ratings::icon::html_fragment_new - Generate the html image output for the icons
  • ratings::ajax - Generate the AJAX complete form and HTML output

One can put the AJAX rating widget using the command ratings::ajax supplying the object_id to be rated. The version number was bumped to 0.2d because some dependencies changed (you must have ajaxhelper now).