Index: openacs-4/packages/dotlrn/tcl/class-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/tcl/class-procs.tcl,v diff -u -r1.5 -r1.6 --- openacs-4/packages/dotlrn/tcl/class-procs.tcl 5 Oct 2001 15:14:25 -0000 1.5 +++ openacs-4/packages/dotlrn/tcl/class-procs.tcl 6 Oct 2001 18:24:42 -0000 1.6 @@ -55,7 +55,7 @@ # dotlrn_community::new_type $class_group_type_key dotlrn_class $pretty_name # Set the site node - dotlrn_community::set_type_site_node $class_group_type_key $node_id + dotlrn_community::set_type_package_id $class_group_type_key $package_id # insert the class into the DB # ALREADY DONE by PL/SQL API @@ -67,6 +67,7 @@ ad_proc -public new_instance { + {-description ""} class_type class_name term @@ -78,10 +79,10 @@ set short_name "$class_type-$term-$year" # Create the community - set community_id [dotlrn_community::new dotlrn_class $short_name $pretty_name] + # set community_id [dotlrn_community::new dotlrn_class $short_name $pretty_name] # Insert the class instance - db_dml insert_class_instance {} + set community_id [db_exec_plsql create_class_instance {}] # Set up the node set parent_node_id [db_string select_parent_node_id {}] Index: openacs-4/packages/dotlrn/tcl/community-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/tcl/community-procs.tcl,v diff -u -r1.4 -r1.5 --- openacs-4/packages/dotlrn/tcl/community-procs.tcl 5 Oct 2001 15:14:25 -0000 1.4 +++ openacs-4/packages/dotlrn/tcl/community-procs.tcl 6 Oct 2001 18:24:42 -0000 1.5 @@ -64,6 +64,18 @@ db_dml update_package_id {} } + ad_proc -public get_url { + {-current_node_id ""} + {-package_id ""} + } { + This gets the relative URL for a package_id under a particular node_id + } { + if {[empty_string_p $current_node_id]} { + set current_node_id [site_node_id [ad_conn url]] + } + + return [db_string select_node_url {}] + } ad_proc set_attribute { community_id @@ -146,7 +158,11 @@ } { Return a datasource of the communities that a user belongs to in a particular type } { - return [db_multirow select_communities {}] + set list_of_communities [list] + + db_foreach select_communities {} { + lappend list_of_communities [list $community_id $community_key $pretty_name $description [get_url -package_id $package_id]] + } } ad_proc -public get_community_type { Index: openacs-4/packages/dotlrn/www/community-new-2.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/www/Attic/community-new-2.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotlrn/www/community-new-2.tcl 6 Oct 2001 18:24:42 -0000 1.1 @@ -0,0 +1,19 @@ + + +ad_page_contract { + Create a New Community - process form + + @author Ben Adida (ben@openforce.net) + @creation-date 2001-10-05 +} { + pretty_name:trim + description + {year ""} + {term ""} +} + +# Get the community type +set community_type [dotlrn_community::get_community_type] + +# assume it's a class for now +set community_id [dotlrn_class::new_instance -description "" $community_type $pretty_name $term $year] Index: openacs-4/packages/dotlrn/www/community-new.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/www/Attic/community-new.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotlrn/www/community-new.adp 6 Oct 2001 18:24:42 -0000 1.1 @@ -0,0 +1,28 @@ + +dotLRN New Community + +
+ + + + + + + + + + + + + + + + + + + + + +
Community Type@community_type@
Name
Year
Term
Description:
+ +
Index: openacs-4/packages/dotlrn/www/community-new.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/www/Attic/community-new.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotlrn/www/community-new.tcl 6 Oct 2001 18:24:42 -0000 1.1 @@ -0,0 +1,14 @@ + + +ad_page_contract { + Create a New Community - input form + + @author Ben Adida (ben@openforce.net) + @creation-date 2001-10-05 +} { +} + +set community_type [dotlrn_community::get_community_type] + +ad_return_template + Index: openacs-4/packages/dotlrn/www/index-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/www/Attic/index-oracle.xql,v diff -u -r1.2 -r1.3 --- openacs-4/packages/dotlrn/www/index-oracle.xql 5 Oct 2001 15:14:29 -0000 1.2 +++ openacs-4/packages/dotlrn/www/index-oracle.xql 6 Oct 2001 18:24:42 -0000 1.3 @@ -5,7 +5,7 @@ -select class_key, node_id, site_node.url(node_id) as url from dotlrn_classes, dotlrn_community_types where dotlrn_community_types.community_type=dotlrn_classes.class_key order by class_key +select class_key, package_id from dotlrn_classes, dotlrn_community_types where dotlrn_community_types.community_type=dotlrn_classes.class_key order by class_key Index: openacs-4/packages/dotlrn/www/index.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/www/index.adp,v diff -u -r1.1 -r1.2 --- openacs-4/packages/dotlrn/www/index.adp 20 Sep 2001 18:29:35 -0000 1.1 +++ openacs-4/packages/dotlrn/www/index.adp 6 Oct 2001 18:24:42 -0000 1.2 @@ -8,7 +8,7 @@ Index: openacs-4/packages/dotlrn/www/one-community-admin.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/www/one-community-admin.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotlrn/www/one-community-admin.tcl 6 Oct 2001 18:24:42 -0000 1.1 @@ -0,0 +1,31 @@ + + +ad_page_contract { + Admin a community + + @author Ben Adida (ben@openforce.net) + @creation-date 2001-10-05 +} { +} + +# Check that this is a community type +if {[ad_parameter community_level_p] != 1} { + ns_returnredirect "./" + return +} + +set user_id [ad_conn user_id] + +# What community type are we at? +set community_id [dotlrn_community::get_community_id] + +# Load some community type info +db_1row select_community_type_info {} + +# Check what communities of this type the user is a member of +# cause we want to display that! +set communities [dotlrn_community::get_communities_by_user $community_type $user_id] + +# communities should be a data source + +ad_return_template Index: openacs-4/packages/dotlrn/www/one-community-type.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/www/one-community-type.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotlrn/www/one-community-type.adp 6 Oct 2001 18:24:42 -0000 1.1 @@ -0,0 +1,18 @@ + +dotLRN: @pretty_name@ +

+

+@description@ +
+ + + +

+New Community of this Type +

+ + Index: openacs-4/packages/dotlrn/www/one-community-type.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/www/one-community-type.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotlrn/www/one-community-type.tcl 6 Oct 2001 18:24:42 -0000 1.1 @@ -0,0 +1,35 @@ + +ad_page_contract { + Displays a community type + + @author Ben Adida (ben@openforce.net) + @creation-date 2001-10-04 +} { +} + +# Check that this is a community type +if {[ad_parameter community_type_level_p] != 1} { + ns_returnredirect "./" + return +} + +set user_id [ad_conn user_id] + +# What community type are we at? +set community_type [dotlrn_community::get_community_type] + +# Load some community type info +db_1row select_community_type_info {} + +# Check what communities of this type the user is a member of +# cause we want to display that! +set list_of_communities [dotlrn_community::get_communities_by_user $community_type $user_id] + +# communities should be a data source +template::multirow create communities community_id community_type pretty_name description url + +foreach comm $list_of_communities { + template::multirow append communities [lindex $comm 0] [lindex $comm 1] [lindex $comm 2] [lindex $comm 3] [lindex $comm 4] +} + +ad_return_template Index: openacs-4/packages/dotlrn/www/one-community-type.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/www/one-community-type.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotlrn/www/one-community-type.xql 6 Oct 2001 18:24:42 -0000 1.1 @@ -0,0 +1,11 @@ + + + + + + +select pretty_name, description, supertype from dotlrn_community_types where community_type= :community_type + + + + Index: openacs-4/packages/dotlrn/www/one-community.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/www/one-community.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotlrn/www/one-community.adp 6 Oct 2001 18:24:42 -0000 1.1 @@ -0,0 +1,4 @@ + +dotLRN Community + +@rendered_page@ Index: openacs-4/packages/dotlrn/www/one-community.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/www/one-community.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotlrn/www/one-community.tcl 6 Oct 2001 18:24:42 -0000 1.1 @@ -0,0 +1,31 @@ + +ad_page_contract { + Displays a community + + @author Ben Adida (ben@openforce.net) + @creation-date 2001-10-04 +} { +} + +# Check that this is a community type +if {[ad_parameter community_level_p] != 1} { + ns_returnredirect "./" + return +} + +set user_id [ad_conn user_id] + +# What community type are we at? +set community_id [dotlrn_community::get_community_id] + +# Check that this user is a member +if {[dotlrn_community::member_p $community_id $user_id]} { + ad_return_template one-community-not-member +} else { + # Pull out the NPP page ID and render it! + set page_id [dotlrn_community::get_page_id $community_id $user_id] + + set rendered_page [portal::render_portal $page_id] + + ad_return_template +} Index: openacs-4/packages/dotlrn/www/test.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/www/test.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotlrn/www/test.tcl 6 Oct 2001 18:24:42 -0000 1.1 @@ -0,0 +1,7 @@ + + +# A testing script + +# Create a class +doc_body_append "nothing" +