Index: openacs-4/contrib/packages/cop-ui/lib/communities.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/cop-ui/lib/communities.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/packages/cop-ui/lib/communities.adp 7 May 2004 17:25:39 -0000 1.1 @@ -0,0 +1 @@ + \ No newline at end of file Index: openacs-4/contrib/packages/cop-ui/lib/communities.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/cop-ui/lib/communities.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/packages/cop-ui/lib/communities.tcl 7 May 2004 17:25:39 -0000 1.1 @@ -0,0 +1,102 @@ +set pretty_name [_ acs-subsite.subsite] +set pretty_plural [_ acs-subsite.subsites] + +set admin_p [permission::permission_p -object_id [ad_conn package_id] -privilege admin -party_id [ad_conn untrusted_user_id]] + +template::list::create \ + -name subsites \ + -multirow subsites \ + -no_data {

No communities exist yet. Request one!

} \ + -main_class communities \ + -selected_format list \ + -formats { + table { + label Table + layout table + } + list { + label List + layout list + template { +

+

+

34 items this week, last update 20/4/2004

+

+ } + } + } -elements { + instance_name { + label "[_ acs-subsite.Name]" + link_url_eval "$url/" + } + num_members { + label "[_ acs-subsite.Members]" + html { align right } + } + member_state { + label "Member state" + display_template { + + Member + Membership requested + Membership denied + + @subsites.member_state@ + Join + Request membership + + + } + } + blurb { + hide_p 1 + display_template {@subsites.blurb;noquote@} + } + } + + +set subsite_node_id [subsite::get_element -element node_id] +set subsite_url [subsite::get_element -element url] + +set untrusted_user_id [ad_conn untrusted_user_id] + +db_multirow -extend { join_url blurb } subsites select_subsites { + select p.package_id, + p.instance_name, + n.node_id, + n.name, + :subsite_url || n.name as url, + (select count(*) + from group_approved_member_map m + where m.rel_type = 'membership_rel' + and m.group_id = ag.group_id) as num_members, + (select min(r2.member_state) + from group_member_map m2, + membership_rels r2 + where m2.group_id = ag.group_id + and m2.member_id = :untrusted_user_id + and r2.rel_id = m2.rel_id) as member_state, + g.group_id, + g.join_policy + from site_nodes n, + apm_packages p, + application_groups ag, + groups g + where n.parent_id = :subsite_node_id + and p.package_id = n.object_id + and p.package_key = 'acs-subsite' + and ag.package_id = p.package_id + and g.group_id = ag.group_id + and (exists (select 1 + from all_object_party_privilege_map perm + where perm.object_id = p.package_id + and perm.privilege = 'read' + and perm.party_id = :untrusted_user_id) or g.join_policy != 'closed') + order by lower(instance_name) +} { + set join_url [export_vars -base "${subsite_url}register/user-join" { group_id { return_url [ad_return_url] } }] + # need to get the blurb text for each community + set cop_id [site_node::get_children -node_id $node_id -package_key cop-ui -element package_id] + set blurb [parameter::get -parameter Description -package_id $cop_id] + set blurb_format [parameter::get -parameter DescriptionFormat -package_id $cop_id] +} 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.2 -r1.3 --- openacs-4/contrib/packages/cop-ui/lib/contributions.tcl 29 Apr 2004 15:56:04 -0000 1.2 +++ openacs-4/contrib/packages/cop-ui/lib/contributions.tcl 7 May 2004 17:25:39 -0000 1.3 @@ -1,22 +1,36 @@ # /packages/cop-ui/lib/contributions -# Display the site contributions for user user_id -if {![info exists user_id]} { +# Display the site contributions +# If user_id set it will be limited by that user otherwise all users. +# if limit set then only limit items will be displayed. +# if root_node_id exists then only return things under root node. + +if {![info exists user_id]} { set user_id {} } +if {![info exists category]} { + set category {} +} +if {[info exists root_node_id]} { + set packages [cop::util::packages -node_id $root_node_id] +} else { + set packages {} +} + + lappend elements rating_img { label "Rating" display_template "@content.rating_img;noquote@" } lappend elements ratings { label \# display_template "@content.ratings;noquote@" - html {align right} + html {align right} } -lappend elements views { +lappend elements views { label "Views" - html {align right} + html {align right} } lappend elements object_title { @@ -31,10 +45,10 @@ lappend elements last_modified { label {Last update} display_template "@content.last_modified;noquote@" - html {align right} + html {align right} } -if {[empty_string_p $user_id]} { +if {[empty_string_p $user_id]} { lappend elements name { label {Created by} display_template {@content.name@} @@ -46,28 +60,28 @@ -multirow content \ -key object_id \ -elements $elements \ - -filters { + -filters { user_id {} } \ - -orderby { - rating_img { + -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 { + object_title { orderby lower(o.title) } - views { + views { orderby_desc {views asc} orderby_asc {views desc} } - ratings { + ratings { orderby ratings } - object_type { + object_type { orderby lower(t.pretty_name) } - last_modified { + last_modified { orderby_asc {o.last_modified desc} orderby_desc {o.last_modified asc} } @@ -80,37 +94,46 @@ 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 {} +set restrict {} + +if {![empty_string_p $user_id]} { + append restrict "\nand o.creation_user = :user_id" } +if {![empty_string_p $category]} { + append restrict "\nand exists (select 1 from category_object_map c where c.object_id = o.object_id and c.category_id = :category)" +} + +if {![empty_string_p $packages]} { + append restrict "\nand o.package_id in ([join $packages ,])" +} + # 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 + 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 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', - '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','pa_album','pa_photo')) - and u.user_id = o.creation_user + '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','pa_album','pa_photo','static_page')) $restrict - [template::list::orderby_clause -orderby -name "content"]" { + [template::list::orderby_clause -orderby -name "content"] limit 20" { 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 { + } else { set rating_img {} } + 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] {\ }] 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]} { + 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/cop-master.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/cop-ui/lib/cop-master.adp,v diff -u -r1.3 -r1.4 --- openacs-4/contrib/packages/cop-ui/lib/cop-master.adp 29 Apr 2004 15:56:04 -0000 1.3 +++ openacs-4/contrib/packages/cop-ui/lib/cop-master.adp 7 May 2004 17:25:39 -0000 1.4 @@ -1,5 +1,6 @@ +
@title;noquote@ @@ -79,4 +80,3 @@ - Index: openacs-4/contrib/packages/cop-ui/www/categories/index.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/cop-ui/www/categories/index.adp,v diff -u -r1.1 -r1.2 --- openacs-4/contrib/packages/cop-ui/www/categories/index.adp 31 Mar 2004 21:12:17 -0000 1.1 +++ openacs-4/contrib/packages/cop-ui/www/categories/index.adp 7 May 2004 17:25:39 -0000 1.2 @@ -1 +1,25 @@ -Category browsing. + + Categories + categories + +
+
+ +

@categories.tree_name@

+
    + +
  • @categories.pad;noquote@@categories.category_name@ (@categories.count@)
  • + + +
  • @categories.pad;noquote@@categories.category_name@ (@categories.count@)@categories.category_name@ +
  • +
    +
    +
    +
+
+
+
+ +
+
\ No newline at end of file Index: openacs-4/contrib/packages/cop-ui/www/categories/index.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/cop-ui/www/categories/index.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/packages/cop-ui/www/categories/index.tcl 7 May 2004 17:25:39 -0000 1.1 @@ -0,0 +1,24 @@ +ad_page_contract { + Main category display page + @author Jeff Davis (davis@xarg.net) + @cvs-id $Id: index.tcl,v 1.1 2004/05/07 17:25:39 jeffd Exp $ +} { + {cat:trim,integer {}} + {orderby "rating_img,desc"} +} + +# Get category data. +set counts {} +set node_id [ad_conn node_id] +set packages [cop::util::packages -node_id $node_id] +db_foreach category_count " + SELECT c.category_id as catid, count(*) as count + FROM category_object_map c, acs_objects o + where c.object_id = o.object_id + and o.package_id in ([join $packages ,]) + group by c.category_id +" { + lappend counts $catid $count +} + +category_tree::get_multirow -datasource categories -container_id [ad_conn subsite_id] -category_counts $counts 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.1 -r1.2 --- openacs-4/contrib/packages/cop-ui/www/ratings/index.tcl 28 Mar 2004 21:17:11 -0000 1.1 +++ openacs-4/contrib/packages/cop-ui/www/ratings/index.tcl 7 May 2004 17:25:40 -0000 1.2 @@ -32,7 +32,7 @@ } object_title { label {Item} - display_template {@ratings.object_title@} + display_template {@ratings.object_title@} } } @@ -61,12 +61,15 @@ owner_id {} } +set node_id [ad_conn node_id] +set packages [cop::util::packages -node_id $node_id] set icons [cop::rating::icon_base] db_multirow -extend {rating_img object_ratings_url rating} ratings ratings " - SELECT 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 + 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 + 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 "\"$rating\"" Index: openacs-4/contrib/packages/cop-ui/www/related/index.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/cop-ui/www/related/index.tcl,v diff -u -r1.2 -r1.3 --- openacs-4/contrib/packages/cop-ui/www/related/index.tcl 2 Apr 2004 01:50:49 -0000 1.2 +++ openacs-4/contrib/packages/cop-ui/www/related/index.tcl 7 May 2004 17:25:40 -0000 1.3 @@ -12,7 +12,6 @@ set user_id [auth::refresh_login] - set title "Related items" set context [list {related items}] @@ -35,6 +34,8 @@ } } +set packages [cop::util::packages -node_id [ad_conn node_id]] + template::list::create \ -name related \ -multirow related \ @@ -53,6 +54,8 @@ and o2.object_id = ar.object_id_two and ar.rel_id = r.rel_id and ro.object_id = r.rel_id + and ( o1.package_id in ([join $packages ,]) + or o2.package_id in ([join $packages ,])) [template::list::orderby_clause -orderby -name "related"]" { set user_url [acs_community_member_url -user_id $user_id] set extra foo Index: openacs-4/contrib/packages/cop-ui/www/related/relate.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/cop-ui/www/related/relate.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/contrib/packages/cop-ui/www/related/relate.tcl 28 Mar 2004 21:17:11 -0000 1.1 +++ openacs-4/contrib/packages/cop-ui/www/related/relate.tcl 7 May 2004 17:25:40 -0000 1.2 @@ -29,8 +29,9 @@ set context [list [list ./ relate] {relate object}] set elements { - object_type { + type { label {Type} + display_template "@relate.pretty_name@" } object_title { label {Item} @@ -40,12 +41,14 @@ } clipped { label {Clipped on} + display_template "@relate.clipped;noquote@" + html {align right} } } -lappend elements extra { - label {Debug} -} +#lappend elements extra { +# label {Debug} +#} set bulk [list "Relate" relation-add] @@ -56,7 +59,9 @@ -key object_id \ -elements $elements \ -orderby { - object_type {} + type { + orderby lower(t.pretty_name),x.clipped + } object_title { orderby lower(x.object_title),x.clipped } @@ -70,29 +75,34 @@ object_one {} } -bulk_actions $bulk -bulk_action_export_vars object_one +set now [clock_to_ansi [clock seconds]] + db_multirow -extend extra relate relate " SELECT * FROM ( - SELECT o.object_type,o.object_id, co.title as clipboard, coalesce(o.title,'? '|| o.object_type || o.object_id) as object_title, to_char(cm.clipped_on,'YYYY-MM-DD HH24:MI') as clipped - FROM acs_objects o, cop_clipboards c, acs_objects co, cop_clipboard_object_map cm + SELECT t.pretty_name,o.object_id, co.title as clipboard, coalesce(o.title,'? '|| o.object_type || o.object_id) as object_title, to_char(cm.clipped_on,'YYYY-MM-DD HH24:MI:SS') as clipped + FROM acs_objects o, cop_clipboards c, acs_objects co, cop_clipboard_object_map cm, acs_object_types t WHERE c.owner_id = :user_id and cm.clipboard_id = c.clipboard_id and o.object_id = cm.object_id and co.object_id = c.clipboard_id and cm.object_id != :object_one - UNION - SELECT o.object_type, v.object_id, 'viewed', coalesce(o.title,'? ' || o.object_type || o.object_id) as object_title, to_char(v.last_viewed,'YYYY-MM-DD HH24:MI') - FROM cop_object_views v, acs_objects o + and t.object_type = o.object_type + UNION ALL + SELECT t.pretty_name, v.object_id, 'viewed', coalesce(o.title,'? ' || o.object_type || o.object_id) as object_title, to_char(v.last_viewed,'YYYY-MM-DD HH24:MI:SS') + FROM cop_object_views v, acs_objects o, acs_object_types t WHERE o.object_id = v.object_id and v.viewer_id = :user_id - and v.object_id != :object_one) x + and v.object_id != :object_one + and t.object_type = o.object_type + ) x WHERE not exists ( SELECT 1 FROM acs_rels WHERE rel_type = 'cop_rel' and ( (object_id_one = :object_one and object_id_two = x.object_id) or (object_id_one = x.object_id and object_id_two = :object_one))) [template::list::orderby_clause -orderby -name "relate"]" { - set extra {} + set clipped [regsub -all { } [util::age_pretty -hours_limit 0 -mode_2_fmt "%X %a" -mode_3_fmt "%x" -timestamp_ansi $clipped -sysdate_ansi $now] {\ }] }