Index: openacs-4/contrib/packages/cop-base/cop-base.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/cop-base/cop-base.info,v diff -u -r1.6 -r1.7 --- openacs-4/contrib/packages/cop-base/cop-base.info 28 Jun 2004 10:52:04 -0000 1.6 +++ openacs-4/contrib/packages/cop-base/cop-base.info 25 Jan 2005 23:33:43 -0000 1.7 @@ -8,7 +8,7 @@ t cop - + Jeff Davis Community of Practice base package Xarg @@ -28,6 +28,7 @@ + Index: openacs-4/contrib/packages/cop-base/catalog/cop-base.en_US.ISO-8859-1.xml =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/cop-base/catalog/cop-base.en_US.ISO-8859-1.xml,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/packages/cop-base/catalog/cop-base.en_US.ISO-8859-1.xml 25 Jan 2005 23:33:43 -0000 1.1 @@ -0,0 +1,13 @@ + + + Views Help + Views show how popular a given item of content is, showing total number of views and how many different users within the community have seen the item. + Ratings Help + Ratings are for community members to rate the quality, informativeness or relevance of a particular content item. + Related Items Help + Related Items are other content items which provide additional information relevant to the item being viewed. + Categories Help + Categories provide a way to find other related information and can be used to navigate the content contained in the community. + Clipboards Help + Clipboards are a personal clipping or bookmark facility much like you find in a web browser which allow you to mark items you would like to relate to other items, or keep track of for future reference. + Index: openacs-4/contrib/packages/cop-base/lib/install.xml =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/cop-base/lib/install.xml,v diff -u -r1.6 -r1.7 --- openacs-4/contrib/packages/cop-base/lib/install.xml 27 Apr 2004 10:41:28 -0000 1.6 +++ openacs-4/contrib/packages/cop-base/lib/install.xml 25 Jan 2005 23:33:43 -0000 1.7 @@ -8,40 +8,64 @@ - - - - - - - - - + + + + + + + + + - - - + + + - - + + + + - - + + - - - + + - - + + + - + + + + SIG Discussion + - + + - + + + + - - + + + + + + + + + + + + + + + + Fisheye: Tag 1.3 refers to a dead (removed) revision in file `openacs-4/contrib/packages/cop-base/sql/postgresql/cop-base-create.sql'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.2 refers to a dead (removed) revision in file `openacs-4/contrib/packages/cop-base/sql/postgresql/cop-base-drop.sql'. Fisheye: No comparison available. Pass `N' to diff? Index: openacs-4/contrib/packages/cop-base/sql/postgresql/datamodel.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/cop-base/sql/postgresql/datamodel.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/packages/cop-base/sql/postgresql/datamodel.sql 25 Jan 2005 23:33:43 -0000 1.1 @@ -0,0 +1,35 @@ +-- CoP Base tables +-- +-- Copyright (C) 2004 Jeff Davis +-- @author Jeff Davis +-- @creation-date 7/20/2004 +-- +-- @cvs-id $Id: datamodel.sql,v 1.1 2005/01/25 23:33:43 jeffd Exp $ +-- +-- This is free software distributed under the terms of the GNU Public +-- License. Full text of the license is available from the GNU Project: +-- http://www.fsf.org/copyleft/gpl.html + +create table cop_requests ( + request_id integer + constraint cop_requests_pk primary key, + user_id integer + constraint cop_requests_user_id_fk + references users(user_id) + not null, + requested timestamptz + default now(), + from_ip varchar(16), + req_state varchar(20) + constraint cop_requests_req_state_ck + check (req_state in ('approved','denied','pending')), + req_user_id integer + constraint cop_requests_req_user_id_fk + references users(user_id), + req_ip varchar(16), + req_action timestamptz, + title varchar(200) not null, + description text not null, + desc_format varchar(100) not null, + url_stub varchar(200) +); Index: openacs-4/contrib/packages/cop-base/www/index.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/cop-base/www/index.adp,v diff -u -r1.2 -r1.3 --- openacs-4/contrib/packages/cop-base/www/index.adp 2 Apr 2004 01:50:49 -0000 1.2 +++ openacs-4/contrib/packages/cop-base/www/index.adp 25 Jan 2005 23:33:44 -0000 1.3 @@ -1,8 +1,9 @@ CoP Central - Create a new community -
-
-
- Load the APLAWS categories + +

Administer [@pending@ pending requests]

+
+ +

The CoP Website documentation is available

+ Index: openacs-4/contrib/packages/cop-base/www/index.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/cop-base/www/index.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/packages/cop-base/www/index.tcl 25 Jan 2005 23:33:44 -0000 1.1 @@ -0,0 +1,14 @@ +ad_page_contract { + top level list of cop + + @author davis@xarg.net + @creation-date 2004-07-20 + @cvs-id $Id: index.tcl,v 1.1 2005/01/25 23:33:44 jeffd Exp $ + +} + +set package_id [ad_conn package_id] +set user_id [ad_verify_and_get_user_id] +set admin_p [permission::permission_p -party_id $user_id -object_id $package_id -privilege admin] +db_1row pending {select count(*) as pending from cop_requests where req_state = 'pending'} + Index: openacs-4/contrib/packages/cop-base/www/admin/community-new.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/cop-base/www/admin/community-new.tcl,v diff -u -r1.3 -r1.4 --- openacs-4/contrib/packages/cop-base/www/admin/community-new.tcl 27 Apr 2004 10:41:28 -0000 1.3 +++ openacs-4/contrib/packages/cop-base/www/admin/community-new.tcl 25 Jan 2005 23:33:44 -0000 1.4 @@ -4,8 +4,13 @@ @author Jeff Davis (davis@xarg.net) @creation-date 2004-03-04 @cvs-id $Id$ +} { + {request_id:integer {}} } +set user_id [ad_conn user_id] +set peeraddr [ad_conn peeraddr] + ad_form -name copnew -form { {name:text {label {Community name}} @@ -17,6 +22,7 @@ {help_text "This is the last part of the url. It should not have any spaces or characters other
   than -, _, a-z, A-Z, and 0-9. Your community will be created at [ad_url]/url_stub/"} } + {request_id:text(hidden),optional} {description:richtext(richtext),optional {html {cols 60 rows 10}} {label "Description"} @@ -26,45 +32,74 @@ set category_ids {} -category::ad_form::add_widgets -help_text { - Choose a root category for the community. If you do not choose one an empty
   - category tree will be created which you can add to later -} \ +category::ad_form::add_widgets \ + -form_name copnew \ + -help_text { + Choose a root category for the community. If you do not choose one an empty
   + category tree will be created which you can add to later + } \ -container_object_id [subsite::main_site_id] \ - -form_name copnew + -excluded_trees [list [parameter::get -parameter KMCategoryTreeID]] \ -ad_form -extend -name copnew -validate { - { name {![string is space $name]} {You must enter a name.} } - { stub {![string is space $stub]} {You must enter a URL stub.} } - { stub {[regexp {^[-A-Za-z0-9_]*$} [string trim $stub]]} {Your URL stub contains invalid characters} } - { stub {![db_string stub_exists "select count(*) from site_nodes where parent_id = (select node_id from site_nodes where object_id = [subsite::main_site_id]) and lower(name) = lower(:stub)"]} {A community with this url already exists} } -} -on_submit { - set Description [template::util::richtext::get_property contents $description] - set DescriptionFormat [template::util::richtext::get_property format $description] +ns_log Debug "JCD: [list [parameter::get -parameter KMCategoryTreeID]] " - set out [cop::install /packages/cop-base/lib/install.xml \ - [list \ - base_url /$stub \ - name $name \ - Description $Description \ - DescriptionFormat $DescriptionFormat \ - ] ] +ad_form -extend -name copnew \ + -validate { + { name {![string is space $name]} {You must enter a name.} } + { stub {![string is space $stub]} {You must enter a URL stub.} } + { stub {[regexp {^[-A-Za-z0-9_]*$} [string trim $stub]]} {Your URL stub contains invalid characters} } + { stub {![db_string stub_exists "select count(*) from site_nodes where parent_id = (select node_id from site_nodes where object_id = [subsite::main_site_id]) and lower(name) = lower(:stub)"]} {A community with this url already exists} } + } -on_request { + if {![string is space $request_id]} { + db_1row request_data { + select title as name, description as desc_text, desc_format from cop_requests where request_id = :request_id + } + set description [template::util::richtext::create $desc_text $desc_format] + } - set category_ids [category::ad_form::get_categories -container_object_id [subsite::main_site_id]] - set cop_subsite_id [site_node::get_element -url /$stub -element package_id] - if {![empty_string_p $category_ids]} { - # map a subtree to the CoP... - category_tree::map -tree_id [category::get_tree [lindex $category_ids 0]] \ - -object_id $cop_subsite_id \ - -subtree_category_id [lindex $category_ids 0] - } else { - # create a new tree... - set tree_id [category_tree::add -name Categories \ - -description "$name Categories" \ - -context_id $cop_subsite_id] - category::add -name "$name" -description "$name root" -tree_id $tree_id -parent_id {} - category_tree::map -tree_id $tree_id -object_id $cop_subsite_id + } -on_submit { + set Description [template::util::richtext::get_property contents $description] + set DescriptionFormat [template::util::richtext::get_property format $description] + + set out [apm::process_install_xml /packages/cop-base/lib/install.xml \ + [list \ + base_url /$stub \ + name $name \ + Description $Description \ + DescriptionFormat $DescriptionFormat \ + ] ] + + set category_ids [category::ad_form::get_categories -container_object_id [subsite::main_site_id]] + set cop_subsite_id [site_node::get_element -url /$stub -element package_id] + if {![empty_string_p $category_ids]} { + # map a subtree to the CoP... + category_tree::map -tree_id [category::get_tree [lindex $category_ids 0]] \ + -object_id $cop_subsite_id \ + -subtree_category_id [lindex $category_ids 0] + } else { + # create a new tree for the community. + set tree_id [category_tree::add -name Categories \ + -description "$name Categories" \ + -context_id $cop_subsite_id] + category::add -name "$name" -description "$name root" -tree_id $tree_id -parent_id {} + category_tree::map -tree_id $tree_id -object_id $cop_subsite_id + } + + if {![string is space $request_id] + && [db_0or1row request {select user_id as req_user_id from cop_requests where request_id = :request_id}]} { + db_dml update_req_state { + update cop_requests set req_user_id = :user_id, req_ip = :peeraddr, req_action = now(), url_stub = :stub, req_state='approved' + where request_id = :request_id + } + acs_user::get -user_id $user_id -array user + acs_user::get -user_id $req_user_id -array req_user + + ns_sendmail \ + $req_user(email) \ + $user(email) \ + "Created $name" \ + "Your community \"$name\" has been created\nGo to [ad_url]/$stub to see it." + } + } -after_submit { + ad_returnredirect -message "Created community \"$name\"" "/$stub" } -} -after_submit { - ad_returnredirect -message "Created community \"$name\"" "/$stub" -} Index: openacs-4/contrib/packages/cop-base/www/admin/deny.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/cop-base/www/admin/deny.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/packages/cop-base/www/admin/deny.tcl 25 Jan 2005 23:33:44 -0000 1.1 @@ -0,0 +1,27 @@ +ad_page_contract { + Community of Practice request denied. + + @author Jeff Davis (davis@xarg.net) + @creation-date 2004-03-04 + @cvs-id $Id: deny.tcl,v 1.1 2005/01/25 23:33:44 jeffd Exp $ +} { + {request_id:integer {}} +} + +set user_id [ad_conn user_id] +set peeraddr [ad_conn peeraddr] + +db_1row request { + select title, user_id as req_user_id + from cop_requests + where request_id = :request_id +} + +acs_user::get -user_id $req_user_id -array req_user +db_dml update { + update cop_requests set req_user_id = :user_id, req_ip = :peeraddr, req_action = now(), req_state='denied' + where request_id = :request_id +} + +ad_returnredirect -message "Community request for \"$title\" denied. You might want to inform $req_user(name) $req_user(email)" "requests" + Index: openacs-4/contrib/packages/cop-base/www/admin/index.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/cop-base/www/admin/index.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/packages/cop-base/www/admin/index.adp 25 Jan 2005 23:33:44 -0000 1.1 @@ -0,0 +1,8 @@ + + CoP Central + + Index: openacs-4/contrib/packages/cop-base/www/admin/index.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/cop-base/www/admin/index.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/packages/cop-base/www/admin/index.tcl 25 Jan 2005 23:33:44 -0000 1.1 @@ -0,0 +1,14 @@ +ad_page_contract { + top level list of cop + + @author davis@xarg.net + @creation-date 2004-07-20 + @cvs-id $Id: index.tcl,v 1.1 2005/01/25 23:33:44 jeffd Exp $ + +} + +set package_id [ad_conn package_id] +set user_id [ad_verify_and_get_user_id] +set admin_p [permission::permission_p -party_id $user_id -object_id $package_id -privilege admin] +db_1row pending {select count(*) as pending from cop_requests where req_state = 'pending'} + Index: openacs-4/contrib/packages/cop-base/www/admin/requests.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/cop-base/www/admin/requests.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/packages/cop-base/www/admin/requests.adp 25 Jan 2005 23:33:44 -0000 1.1 @@ -0,0 +1,4 @@ + +Community requests + + \ No newline at end of file Index: openacs-4/contrib/packages/cop-base/www/admin/requests.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/cop-base/www/admin/requests.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/packages/cop-base/www/admin/requests.tcl 25 Jan 2005 23:33:44 -0000 1.1 @@ -0,0 +1,54 @@ +ad_page_contract { + Community of Practice pending requests + + @author Jeff Davis (davis@xarg.net) + @creation-date 2004-03-04 + @cvs-id $Id: requests.tcl,v 1.1 2005/01/25 23:33:44 jeffd Exp $ +} + +template::list::create \ + -name requests \ + -multirow requests \ + -no_data {No pending requests} \ + -selected_format list \ + -formats { + table { + label Table + layout table + } + list { + label List + layout list + template { +

+

+

+ } + } + } -elements { + title { + label Title + } + description { + label Description + } + actions { + label Actions + display_template { + Approve | deny + } + } + } + +db_multirow requests requests { + select request_id, user_id, requested, from_ip, req_state, title, description, desc_format, url_stub + from cop_requests + where req_state = 'pending' +} { + set description [ad_html_text_convert -from $desc_format -to text/plain $description] +} + + + + + Index: openacs-4/contrib/packages/cop-ui/lib/category-display.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/cop-ui/lib/category-display.adp,v diff -u -r1.1 -r1.2 --- openacs-4/contrib/packages/cop-ui/lib/category-display.adp 14 May 2004 11:30:15 -0000 1.1 +++ openacs-4/contrib/packages/cop-ui/lib/category-display.adp 25 Jan 2005 23:33:43 -0000 1.2 @@ -1,8 +1,10 @@

@heading@

+
\ No newline at end of file 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.4 -r1.5 --- openacs-4/contrib/packages/cop-ui/lib/index.tcl 14 May 2004 11:30:15 -0000 1.4 +++ openacs-4/contrib/packages/cop-ui/lib/index.tcl 25 Jan 2005 23:33:43 -0000 1.5 @@ -15,4 +15,5 @@ -to text/html \ [parameter::get -package_id $package_id -parameter Description -default {def}] ] +set news [lars_blog_get_as_string -url [ad_conn url]helping/news -display_template /packages/lars-blogger/lib/titles]