Index: openacs-4/contrib/packages/cop-ui/lib/contributions.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/cop-ui/lib/contributions.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/packages/cop-ui/lib/contributions.adp 27 Apr 2004 10:56:35 -0000 1.1 @@ -0,0 +1 @@ + \ No newline at end of file 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 --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/packages/cop-ui/lib/contributions.tcl 27 Apr 2004 10:56:35 -0000 1.1 @@ -0,0 +1,117 @@ +# /packages/cop-ui/lib/contributions +# Display the site contributions for user user_id +if {![info exists user_id]} { + set user_id {} +} + +lappend elements rating_img { + label "Rating" + display_template "@content.rating_img;noquote@" +} +lappend elements ratings { + label \# + display_template "@content.ratings;noquote@" + html {align right} +} + +lappend elements views { + label "Views" + html {align right} +} + +lappend elements object_title { + label {Title} + display_template {@content.title@} +} + +lappend elements object_type { + label {Type} +} + +lappend elements last_modified { + label {Last update} + display_template "@content.last_modified;noquote@" + html {align right} +} + +if {[empty_string_p $user_id]} { + lappend elements name { + label {Created by} + display_template {@content.name@} + } +} + +template::list::create \ + -name content \ + -multirow content \ + -key object_id \ + -elements $elements \ + -filters { + user_id {} + } \ + -orderby { + rating_img { + orderby_desc {coalesce(rating_ave,99) asc, o.last_modified desc} + orderby_asc {coalesce(rating_ave,0) desc, o.last_modified desc} + } + object_title { + orderby lower(o.title) + } + views { + orderby_desc {views asc} + orderby_asc {views desc} + } + ratings { + orderby ratings + } + object_type { + orderby lower(t.pretty_name) + } + last_modified { + orderby o.last_modified + } + name { + orderby_asc "lower(u.last_name),lower(u.first_names)" + orderby_desc "lower(u.last_name) desc,lower(u.first_names) desc" + } + } + +set icons [cop::rating::icon_base] +set now [clock_to_ansi [clock seconds]] + +if {![empty_string_p $user_id]} { + set restrict "and o.creation_user = :user_id" +} else { + set restrict {} +} + +# TODO: need to get the dimension to display, need to find the right CoP +db_multirow -extend {rating_img url_one ratings_url user_url} 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 + FROM acs_object_types t, acs_users_all u, 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) + 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', + 'content_item','cal_item','bt_bug','bt_patch', 'faq', 'faq_q_and_a', 'bookshelf_book') + and (o.object_type != 'content_item' or i.content_type in ('content_extlink','file_storage_object')) + and u.user_id = o.creation_user + $restrict + [template::list::orderby_clause -orderby -name "content"]" { + if {![empty_string_p $rating_ave]} { + set ratings_url "/cop1/cop/ratings/ratings?object_id=$object_id" + set rating [format %.1f [expr {(round(2.0*$rating_ave))/2.0}]] + set rating_img "\"$rating\"" + set ratings "$ratings" + } else { + set rating_img {} + } + set last_modified [regsub -all { } [util::age_pretty -timestamp_ansi $last_modified -sysdate_ansi $now] {\ }] + set user_url [acs_community_member_url -user_id $user_id] + if {[catch {set url_one [acs_sc_call -error FtsContentProvider url [list $object_id] $object_type]} errMsg]} { + global errorCode + set url_one $errorCode + } + } + Index: openacs-4/contrib/packages/cop-ui/lib/index.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/cop-ui/lib/index.adp,v diff -u -r1.2 -r1.3 --- openacs-4/contrib/packages/cop-ui/lib/index.adp 1 Apr 2004 12:09:45 -0000 1.2 +++ openacs-4/contrib/packages/cop-ui/lib/index.adp 27 Apr 2004 10:56:35 -0000 1.3 @@ -9,3 +9,11 @@
  • related
  • categories
  • + + +
    Notify me + of new content and updates + XML +
    Index: openacs-4/contrib/packages/cop-ui/lib/index.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/cop-ui/lib/index.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/contrib/packages/cop-ui/lib/index.tcl 31 Mar 2004 21:12:16 -0000 1.1 +++ openacs-4/contrib/packages/cop-ui/lib/index.tcl 27 Apr 2004 10:56:35 -0000 1.2 @@ -1,7 +1,10 @@ ad_page_contract { -} {} +} { + {user_id:integer ""} + {orderby "rating_img,desc"} +} set subsite_name [ad_conn instance_name] set url [cop::util::url] @@ -12,3 +15,4 @@ -to text/html \ [parameter::get -package_id $package_id -parameter Description -default {def}] ] + 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.2 -r1.3 --- openacs-4/contrib/packages/cop-ui/www/ratings/ratings.tcl 2 Apr 2004 01:50:49 -0000 1.2 +++ openacs-4/contrib/packages/cop-ui/www/ratings/ratings.tcl 27 Apr 2004 10:56:36 -0000 1.3 @@ -25,7 +25,7 @@ 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 $user_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" }