"
+ return $output
+}
+
+ad_proc -public ratings::get_list {
+ {-context_object_id ""}
+ -object_id:required
+} {
+ Returns a list of elements of the form { rating_id value } for one object_id. If context_object_id
+ was provided then retursn the pairs in that context_id, else, it returns all pairs for
+ that object_id.
+
+ @param context_object_id The object_id that groups diferent ratings.
+ @param object_id The object_id that was rated.
+ @return the list { rating_id value } for the object_id.
+
+ @author Miguel Marin (miguelmarin@viaro.net)
+ @creation-date 2005-07-29
+} {
+ set extra_query ""
+ if { ![empty_string_p $context_object_id] } {
+ set extra_query "and context_object_id = $context_object_id"
+ }
+ return [db_list_of_lists get_rating_id " "]
+}
+
+ad_proc -public ratings::get_average {
+ -context_object_id:required
+ -object_id:required
+ {-dimension_key ""}
+} {
+ Returns the average rating for one on the same context_object_id and object_id. If dimension_key is specified
+ then returns only the average for that dimension.
+
+ @param context_object_id The object_id that groups diferent ratings.
+ @param object_id The object_id that was rated.
+ @param dimension_key The dimension to get the average.
+ @returns a average rating value.
+
+ @author Miguel Marin (miguelmarin@viaro.net)
+ @creation-date 2005-07-29
+} {
+ set extra_query ""
+ if { ![empty_string_p $dimension_key] } {
+ set extra_query "and dimension_id = ( select dimension_id from rating_dimensions where dimension_key = '$dimension_key' )"
+ }
+ return [db_string get_average_rating " "]
+}
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `openacs-4/packages/ratings/tcl/rating-procs.xql'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `openacs-4/packages/ratings/www/add-dimension-postgresql.xql'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `openacs-4/packages/ratings/www/add-dimension.adp'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `openacs-4/packages/ratings/www/add-dimension.tcl'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `openacs-4/packages/ratings/www/add-dimension.xql'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `openacs-4/packages/ratings/www/all-ratings.adp'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `openacs-4/packages/ratings/www/all-ratings.tcl'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `openacs-4/packages/ratings/www/delete-dimension-postgresql.xql'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `openacs-4/packages/ratings/www/delete-dimension.tcl'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `openacs-4/packages/ratings/www/index.adp'.
Fisheye: No comparison available. Pass `N' to diff?
Index: openacs-4/packages/ratings/www/rate.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/ratings/www/rate.tcl,v
diff -u -r1.3 -r1.3.2.1
--- openacs-4/packages/ratings/www/rate.tcl 21 May 2004 07:48:05 -0000 1.3
+++ openacs-4/packages/ratings/www/rate.tcl 29 Jul 2005 23:08:24 -0000 1.3.2.1
@@ -11,17 +11,27 @@
dimension_key:notnull
rating:integer,notnull
{return_url:trim {}}
+ {nomem_p "f"}
+ {context_object_id ""}
}
+
set user_id [auth::require_login]
+
+
set rating_id [ratings::rate -dimension_key $dimension_key \
-object_id $object_id \
-user_id $user_id \
- -rating $rating]
+ -rating $rating \
+ -nomem_p $nomem_p]
+if { ![empty_string_p $context_object_id] } {
+ db_dml update_context_id { update ratings set context_object_id = :context_object_id where rating_id = :rating_id }
+}
+
if {[empty_string_p $return_url]} {
set return_url [get_referrer]
}
-ad_returnredirect -message "Your rating is now $rating for this item." $return_url
+ad_returnredirect -message "Your rating is now $rating for this item $dimension_key." $return_url