Index: openacs-4/contrib/packages/cop-base/lib/cop-sidebar.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/cop-base/lib/cop-sidebar.tcl,v diff -u -r1.2 -r1.3 --- openacs-4/contrib/packages/cop-base/lib/cop-sidebar.tcl 14 May 2004 12:36:33 -0000 1.2 +++ openacs-4/contrib/packages/cop-base/lib/cop-sidebar.tcl 23 Jun 2004 14:22:50 -0000 1.3 @@ -3,7 +3,6 @@ set subsite [ad_conn subsite_id] set user_id [ad_conn user_id] set cur_pkg [ad_conn package_id] -set ratingicons [cop::rating::icon_base] db_1row obj_title {select o.object_type, pretty_name as tname, pretty_plural as tname_s, title as obj_title, package_id as obj_pkg, acs_object__name(object_id) as acs_name from acs_objects o, acs_object_types t where object_id = :displayed_object_id and t.object_type = o.object_type} if {[empty_string_p $obj_title]} { @@ -15,40 +14,45 @@ } # get the clipboard info -cop::clipboard::clipboards -create_new -force_default [ad_conn user_id] clipboards -cop::clipboard::clipped $displayed_object_id [ad_conn user_id] clipped +clipboard::clipboards -create_new -force_default [ad_conn user_id] clipboards +clipboard::clipped $displayed_object_id [ad_conn user_id] clipped # record object view and get current count. -db_string record_view "select cop_object_record_view(:displayed_object_id, :user_id)" -default 0 -if {![db_0or1row views "select views, unique_views from cop_object_view_agg where object_id = :displayed_object_id"]} { +db_string record_view "select views__record_view(:displayed_object_id, :user_id)" -default 0 +if {![db_0or1row views "select views, unique_views from view_aggregates where object_id = :displayed_object_id"]} { set views missing set unique_views missing } # Stuff for ratings. -set rate_form [cop::rating::widget -object_one $displayed_object_id] -set current_rating [cop::rating::get -object_one $displayed_object_id -user_id $user_id] -array set ratings [cop::rating::aggregate::get -object_one $displayed_object_id] -if {[info exists ratings(ratings)]} { - set ratings(stars) [format %.1f [expr round($ratings(rating_sum)*2.0/$ratings(ratings))/2.0]] +set rate_form [ratings::form -object_id $displayed_object_id] +set current_rating [ratings::get -object_id $displayed_object_id -user_id $user_id] +array set ratings [ratings::aggregates::get -object_id $displayed_object_id] +if {[info exists ratings(all_rating_ave)]} { + set ratings(stars) [ratings::icon::html_fragment -rating $ratings(all_rating_ave)] } else { - set ratings(ratings) 0 + set ratings(all_ratings) 0 + set ratings(stars) {} } if {![empty_string_p $current_rating]} { - set stars [format %.1f $current_rating ] + set stars [ratings::icon::html_fragment -rating $current_rating] } +set return_url [ad_return_url] - # stuff for comments # todo: suppress for things that should not be commentable. set comment_link {} append comment_link [general_comments_get_comments -print_content_p 1 $displayed_object_id [ad_return_url]] -append comment_link [general_comments_create_link -object_name "Name for $displayed_object_id" -link_attributes {class="button"} $displayed_object_id [ad_return_url] ] +append comment_link [general_comments_create_link -object_name "Name for $displayed_object_id" -link_attributes {class="button"} $displayed_object_id $return_url ] # Stuff for related items -cop::relation::get_related -object_id $displayed_object_id -datasource related +relation::get_related -object_id $displayed_object_id -datasource related +template::multirow extend related delete_url +template::multirow foreach related { + set delete_url [export_vars -base related/relation-delete {rel_id return_url}] +} # mapped categories: set catass_list [category::list::get_pretty_list \