Index: openacs-4/contrib/packages/cop-ui/lib/contributions.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/cop-ui/lib/contributions.tcl,v
diff -u -r1.4 -r1.5
--- openacs-4/contrib/packages/cop-ui/lib/contributions.tcl 14 May 2004 11:30:15 -0000 1.4
+++ openacs-4/contrib/packages/cop-ui/lib/contributions.tcl 15 Jun 2004 11:48:48 -0000 1.5
@@ -137,7 +137,6 @@
}
}
-set icons [cop::rating::icon_base]
set now [clock_to_ansi [clock seconds]]
set restrict {}
@@ -154,13 +153,13 @@
append restrict "\nand o.package_id in ([join $packages ,])"
}
-# TODO: need to get the dimension to display, need to find the right CoP
+# JCDXXX: TODO: need to get the dimension to display, need to find the right CoP, permissions
db_multirow -extend {stars url_one ratings_url user_url new} content content "
- SELECT o.title, o.object_id, o.title, t.pretty_name as object_type, r.rating_ave, r.ratings, v.views, to_char(o.last_modified,'YYYY-MM-DD HH24:MI:SS') as last_modified, u.user_id, u.first_names || ' ' || u.last_name as name
+ SELECT o.title, o.object_id, o.title, t.pretty_name as object_type, r.all_rating_ave as rating_ave, r.all_ratings as ratings, v.views, to_char(o.last_modified,'YYYY-MM-DD HH24:MI:SS') as last_modified, u.user_id, u.first_names || ' ' || u.last_name as name
FROM acs_object_types t, acs_objects o
left outer join cr_items i on (o.object_id = i.item_id)
- left outer join cop_rating_aggregates r on (o.object_id = r.object_one)
- left outer join cop_object_view_agg v on (v.object_id = o.object_id)
+ left outer join rating_aggregates r on (o.object_id = r.object_id)
+ left outer join view_aggregates v on (v.object_id = o.object_id)
left outer join acs_users_all u on (u.user_id = o.creation_user)
WHERE t.object_type = case when o.object_type = 'content_item' then i.content_type else o.object_type end
and o.object_type in ('content_item','pinds_blog_entry','forums_forum','forums_message',
@@ -169,22 +168,22 @@
$restrict
[template::list::orderby_clause -orderby -name "content"]$limit" {
if {![empty_string_p $rating_ave]} {
- set ratings_url "/cop1/cop/ratings/ratings?object_id=$object_id"
+ set ratings_url [export_vars -base ratings object_id]
set rating [format %.1f [expr {(round(2.0*$rating_ave))/2.0}]]
- set stars ""
+ set stars [ratings::icon::html_fragment -rating $rating_ave]
set ratings "$ratings"
} else {
set stars {none}
- set ratings "0"
+ set ratings 0
}
- # XXXJCD - make this work in general.
+ # JCDXXX - make this work in general.
if {($object_id % 3) == 0} {
set new {NEW}
} else {
set new {}
}
- # XXXJCD - make this work in general.
+ # JCDXXX - make this work in general.
regsub {/www/cop1/static} $title {} title
set last_modified [regsub -all { } [util::age_pretty -hours_limit 0 -mode_2_fmt "%X %a" -mode_3_fmt "%x" -timestamp_ansi $last_modified -sysdate_ansi $now] {\ }]
Fisheye: Tag 1.2 refers to a dead (removed) revision in file `openacs-4/contrib/packages/cop-ui/www/ratings/delete.tcl'.
Fisheye: No comparison available. Pass `N' to diff?
Index: openacs-4/contrib/packages/cop-ui/www/ratings/index.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/cop-ui/www/ratings/index.tcl,v
diff -u -r1.2 -r1.3
--- openacs-4/contrib/packages/cop-ui/www/ratings/index.tcl 7 May 2004 17:25:40 -0000 1.2
+++ openacs-4/contrib/packages/cop-ui/www/ratings/index.tcl 15 Jun 2004 11:48:50 -0000 1.3
@@ -1,9 +1,9 @@
-# /packages/cop-ui/www/clipboard/view.tcl
+# /packages/cop-ui/www/ratings/index.tcl
ad_page_contract {
Display the agg ratings.
@author Jeff Davis (davis@xarg.net)
- @creation-date 11/12/2003
+ @creation-date 2003-11-23
@cvs-id $Id$
} {
@@ -21,7 +21,7 @@
set elements {
ratings {
label Ratings
- display_template {@ratings.ratings@ (show)}
+ display_template {@ratings.all_ratings@ (show)}
}
rating_img {
label "Average"
@@ -42,12 +42,12 @@
-elements $elements \
-orderby {
ratings {
- orderby_asc {ratings desc}
- orderby_desc {ratings asc}
+ orderby_asc {all_ratings desc}
+ orderby_desc {all_ratings asc}
}
rating_img {
- orderby_asc {rating_ave desc}
- orderby_desc {rating_ave asc}
+ orderby_asc {all_rating_ave desc}
+ orderby_desc {all_rating_ave asc}
}
rated_on {
orderby_asc {o.last_modified desc}
@@ -64,14 +64,13 @@
set node_id [ad_conn node_id]
set packages [cop::util::packages -node_id $node_id]
-set icons [cop::rating::icon_base]
+# JCDXXX: TODO: permissions, recent only, paginate.
db_multirow -extend {rating_img object_ratings_url rating} ratings ratings "
- SELECT o.object_id,r.rating_ave, to_char(r.rated_on,'YYYY-MM-DD HH24:MI') as rated_on, o.title as object_title, r.object_one, r.ratings, r.rating_sum, r.rating_ave
- FROM cop_rating_aggregates r, acs_objects o
- WHERE o.object_id = r.object_one
+ SELECT o.object_id, to_char(r.rated_on,'YYYY-MM-DD HH24:MI') as rated_on, o.title as object_title, r.all_ratings, r.all_rating_sum,r.all_rating_ave
+ FROM rating_aggregates r, acs_objects o
+ WHERE o.object_id = r.object_id
and o.package_id in ([join $packages ,])
[template::list::orderby_clause -orderby -name "ratings"]" {
- set rating [format %.1f [expr {(round(2.0*$rating_ave))/2.0}]]
- set rating_img ""
- set object_ratings_url "./ratings?object_id=$object_one"
+ set rating_img [ratings::icon::html_fragment -rating $all_rating_ave]
+ set object_ratings_url [export_vars -base ratings {object_id}]
}
Fisheye: Tag 1.2 refers to a dead (removed) revision in file `openacs-4/contrib/packages/cop-ui/www/ratings/rate.tcl'.
Fisheye: No comparison available. Pass `N' to diff?
Index: openacs-4/contrib/packages/cop-ui/www/ratings/ratings.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/cop-ui/www/ratings/ratings.adp,v
diff -u -r1.2 -r1.3
--- openacs-4/contrib/packages/cop-ui/www/ratings/ratings.adp 2 Apr 2004 01:50:49 -0000 1.2
+++ openacs-4/contrib/packages/cop-ui/www/ratings/ratings.adp 15 Jun 2004 11:48:50 -0000 1.3
@@ -2,6 +2,7 @@
@title@
@context@
-View item
-@owner_name@'s member page
-
\ No newline at end of file
+ View item
+ @owner_name@'s member page
+
+
\ No newline at end of file
Index: openacs-4/contrib/packages/cop-ui/www/ratings/ratings.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/cop-ui/www/ratings/ratings.tcl,v
diff -u -r1.3 -r1.4
--- openacs-4/contrib/packages/cop-ui/www/ratings/ratings.tcl 27 Apr 2004 10:56:36 -0000 1.3
+++ openacs-4/contrib/packages/cop-ui/www/ratings/ratings.tcl 15 Jun 2004 11:48:50 -0000 1.4
@@ -1,4 +1,4 @@
-# /packages/cop-ui/www/clipboard/view.tcl
+# /packages/cop-ui/www/ratings/ratings.tcl
ad_page_contract {
Display the ratings for object obj_id.
@@ -14,112 +14,23 @@
set user_id [auth::refresh_login]
set admin_p [permission::permission_p -object_id [ad_conn package_id] -privilege admin]
+set context [list [list ./ ratings] one]
set clause {}
set title "Rating"
+
if {![empty_string_p $object_id]} {
set object_name [db_string object_name {select acs_object__name(:object_id);}]
append title " for $object_name"
- append clause "and r.object_one = :object_id\n"
}
if {![empty_string_p $owner_id]} {
set owner_name [db_string owner_name {select person__name(:owner_id);}]
set owner_url [acs_community_member_url -user_id $owner_id]
append title " by $owner_name"
- append clause "and r.owner_id = :owner_id\n"
}
if {[empty_string_p "$owner_id$object_id"]} {
ad_return_complaint 1 [list "No object or person given"]
}
-set context [list [list ./ ratings] one]
-
-set elements {
- rating_img {
- label "Rating"
- display_template "@ratings.rating_img;noquote@"
- }
-}
-
-if {[empty_string_p $owner_id]} {
- lappend elements name {
- label {[_ acs-subsite.Name]}
- display_template {@ratings.name@ (ratings)}
- }
-}
-
-lappend elements rated {
- label "Rated"
- display_template {@ratings.rated;noquote@}
-}
-
-if {[empty_string_p $object_id]} {
- lappend elements object_title {
- label {Item}
- display_template {@ratings.object_title@ (ratings)}
- }
-}
-
-if { 0 } {
- lappend elements extra {
- label {Debug}
- display_template {o.title:@ratings.obj_title@ url:@ratings.url_one@ type:@ratings.object_type@}
- }
-}
-if {$admin_p} {
- set bulk [list "Delete ratings" delete]
-} else {
- set bulk {}
-}
-
-template::list::create \
- -name ratings \
- -multirow ratings \
- -key rating_id \
- -elements $elements \
- -orderby {
- name {
- orderby_asc "lower(u.last_name),lower(u.first_names)"
- orderby_desc "lower(u.last_name) desc,lower(u.first_names) desc"
- }
- rating_img {
- orderby_desc {rating asc, o.last_modified desc}
- orderby_asc {rating desc, o.last_modified desc}
- }
- rated {
- orderby_desc {o.last_modified asc}
- orderby_asc {o.last_modified desc}
- }
- object_title {
- orderby lower(o.title)
- }
- } -filters {
- object_id {}
- owner_id {}
- } -bulk_actions $bulk
-
-set icons [cop::rating::icon_base]
-set now [clock_to_ansi [clock seconds]]
-db_multirow -extend {rated rating_img user_url user_ratings_url object_ratings_url url_one} ratings ratings "
- SELECT r.rating_id, u.first_names || ' ' || u.last_name as name, u.user_id, u.email, r.owner_id, r.rating, to_char(o.last_modified,'YYYY-MM-DD HH24:MI:SS') as rated_on, acs_object__name(o2.object_id) as object_title, r.object_one, o2.title as obj_title, o2.object_type
- FROM acs_users_all u, cop_ratings r, acs_objects o, acs_objects o2
- WHERE r.owner_id = u.user_id
- $clause
- and o.object_id = r.rating_id
- and o2.object_id = r.object_one
- [template::list::orderby_clause -orderby -name "ratings"]" {
- set rating [format %.1f $rating]
- set rating_img ""
- set user_url [acs_community_member_url -user_id $user_id]
- set user_ratings_url "ratings?owner_id=$user_id"
- set object_ratings_url "ratings?object_id=$object_one"
- set rated [regsub -all { } [util::age_pretty -timestamp_ansi $rated_on -sysdate_ansi $now] {\ }]
-
- if {[catch {set url_one [acs_sc_call -error FtsContentProvider url [list $object_one] $object_type]} errMsg]} {
- global errorCode
- set url_one $errorCode
- }
- }
-