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 @@
+<master src="master">
+<property name="title">dotLRN New Community</property>
+
+<form action="community-new-2" method=POST>
+<table border=0>
+<tr>
+<td>Community Type</td>
+<td><strong>@community_type@</strong></td>
+</tr>
+<tr>
+<td>Name</td>
+<td><INPUT TYPE=text name=pretty_name size=50></td>
+</tr>
+<tr>
+<td>Year</td>
+<td><INPUT TYPE=text name=year size=50></td>
+</tr>
+<tr>
+<td>Term</td>
+<td><INPUT TYPE=text name=term size=50></td>
+</tr>
+<tr>
+<td valign=top>Description:</td>
+<td><textarea name=description cols=50 rows=5 wrap=soft></textarea></td>
+</tr>
+</table>
+<INPUT type=submit value="Create Class">
+</form>
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 @@
 
 <fullquery name="select_classes">
 <querytext>
-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
 </querytext>
 </fullquery>
 
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 @@
 <else>
 <ul>
 <multiple name=classes>
-<li><a href=@classes.url@>@classes.class_key@</a>
+<li><a href=<%= [dotlrn_community::get_url -package_id @classes.package_id@] %>>@classes.class_key@</a>
 </multiple>
 </ul>
 </else>
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 @@
+<master src="master">
+<property name="title">dotLRN: @pretty_name@</property>
+<p>
+<blockquote>
+@description@
+</blockquote>
+
+<ul>
+<multiple name=communities>
+<li><a href=@communities.url@>@communities.pretty_name@</a>
+</multiple>
+</ul>
+
+<p>
+<a href=community-new>New Community of this Type</a>
+<p>
+</ul>
+
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 @@
+<?xml version="1.0"?>
+
+<queryset>
+
+<fullquery name="select_community_type_info">
+<querytext>
+select pretty_name, description, supertype from dotlrn_community_types where community_type= :community_type
+</querytext>
+</fullquery>
+
+</queryset>
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 @@
+<master src="master">
+<property name="title">dotLRN Community</property>
+
+@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"
+