Index: openacs-4/packages/dotlrn/sql/oracle/dotlrn-classes-create.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/sql/oracle/Attic/dotlrn-classes-create.sql,v
diff -u -r1.5 -r1.6
--- openacs-4/packages/dotlrn/sql/oracle/dotlrn-classes-create.sql	7 Nov 2001 20:20:55 -0000	1.5
+++ openacs-4/packages/dotlrn/sql/oracle/dotlrn-classes-create.sql	9 Nov 2001 15:24:57 -0000	1.6
@@ -127,6 +127,7 @@
     pretty_name			in dotlrn_communities.pretty_name%TYPE,
     description			in dotlrn_communities.description%TYPE,
     package_id			in dotlrn_communities.package_id%TYPE default null,
+    page_id			in dotlrn_communities.page_id%TYPE default null,
     creation_date		in acs_objects.creation_date%TYPE
 				default sysdate,
     creation_user		in acs_objects.creation_user%TYPE
@@ -154,6 +155,7 @@
     pretty_name			in dotlrn_communities.pretty_name%TYPE,
     description			in dotlrn_communities.description%TYPE,
     package_id			in dotlrn_communities.package_id%TYPE default null,
+    page_id			in dotlrn_communities.page_id%TYPE default null,
     creation_date		in acs_objects.creation_date%TYPE
 				default sysdate,
     creation_user		in acs_objects.creation_user%TYPE
@@ -171,6 +173,7 @@
  	pretty_name => pretty_name,
  	description => description,
  	package_id => package_id,
+	page_id => page_id,
  	creation_date => creation_date,
  	creation_user => creation_user,
  	creation_ip => creation_ip,
Index: openacs-4/packages/dotlrn/sql/oracle/dotlrn-communities-create.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/sql/oracle/Attic/dotlrn-communities-create.sql,v
diff -u -r1.5 -r1.6
--- openacs-4/packages/dotlrn/sql/oracle/dotlrn-communities-create.sql	6 Nov 2001 21:46:48 -0000	1.5
+++ openacs-4/packages/dotlrn/sql/oracle/dotlrn-communities-create.sql	9 Nov 2001 15:24:57 -0000	1.6
@@ -36,6 +36,7 @@
 				constraint dlrn_comm_key_un unique,
        pretty_name		varchar(100) not null,
        description		varchar(4000),
+       page_id			references portals(portal_id),
        package_id		constraint dlrn_comm_pack_id_fk
 				references apm_packages(package_id)
 );
@@ -166,6 +167,7 @@
    community_key	in dotlrn_communities.community_key%TYPE,
    pretty_name		in dotlrn_communities.pretty_name%TYPE,
    description		in dotlrn_communities.description%TYPE,
+   page_id		in dotlrn_communities.page_id%TYPE default null,
    package_id		in dotlrn_communities.package_id%TYPE default null,
    creation_date        in acs_objects.creation_date%TYPE
                            default sysdate,
@@ -201,6 +203,7 @@
    community_key	in dotlrn_communities.community_key%TYPE,
    pretty_name		in dotlrn_communities.pretty_name%TYPE,
    description		in dotlrn_communities.description%TYPE,
+   page_id		in dotlrn_communities.page_id%TYPE default null,
    package_id		in dotlrn_communities.package_id%TYPE default null,
    creation_date        in acs_objects.creation_date%TYPE
                            default sysdate,
@@ -222,9 +225,9 @@
    );
 
    insert into dotlrn_communities
-   (community_id, community_type, community_key, pretty_name, description, package_id)
+   (community_id, community_type, community_key, pretty_name, description, package_id, page_id)
    values
-   (c_id, community_type, community_key, pretty_name, description, package_id);
+   (c_id, community_type, community_key, pretty_name, description, package_id, page_id);
 
    return c_id;
  end;
Index: openacs-4/packages/dotlrn/tcl/class-procs-oracle.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/tcl/Attic/class-procs-oracle.xql,v
diff -u -r1.2 -r1.3
--- openacs-4/packages/dotlrn/tcl/class-procs-oracle.xql	7 Nov 2001 22:22:09 -0000	1.2
+++ openacs-4/packages/dotlrn/tcl/class-procs-oracle.xql	9 Nov 2001 15:24:57 -0000	1.3
@@ -31,7 +31,8 @@
 	term => :term,
 	community_key => :short_name,
 	pretty_name => :class_name,
-	description => :description
+	description => :description,
+	page_id => :page_id
 );
 
 end;
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.8 -r1.9
--- openacs-4/packages/dotlrn/tcl/class-procs.tcl	7 Nov 2001 22:22:09 -0000	1.8
+++ openacs-4/packages/dotlrn/tcl/class-procs.tcl	9 Nov 2001 15:24:57 -0000	1.9
@@ -79,6 +79,9 @@
 	set short_name "$class_type-$term-$year"
 
 	db_transaction {
+	    # Create the portal page
+	    set page_id [portal::create [ad_conn user_id]]
+
 	    # Insert the class instance
 	    set community_id [db_exec_plsql create_class_instance {}]
 	    
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.19 -r1.20
--- openacs-4/packages/dotlrn/tcl/community-procs.tcl	9 Nov 2001 03:56:43 -0000	1.19
+++ openacs-4/packages/dotlrn/tcl/community-procs.tcl	9 Nov 2001 15:24:57 -0000	1.20
@@ -223,6 +223,14 @@
 	return [db_string select_user_page_id {}]
     }
 
+    ad_proc -public get_community_non_members_page_id {
+	community_id
+    } {
+	Get the community page ID for non-members
+    } {
+	return [db_string select_community_page_id {}]
+    }
+
     ad_proc -public get_all_communities_by_user {
 	user_id
     } {
Index: openacs-4/packages/dotlrn/tcl/community-procs.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/tcl/community-procs.xql,v
diff -u -r1.7 -r1.8
--- openacs-4/packages/dotlrn/tcl/community-procs.xql	7 Nov 2001 22:22:09 -0000	1.7
+++ openacs-4/packages/dotlrn/tcl/community-procs.xql	9 Nov 2001 15:24:57 -0000	1.8
@@ -63,6 +63,12 @@
 </querytext>
 </fullquery>
 
+<fullquery name="dotlrn_community::get_community_non_members_page_id.select_community_page_id">
+<querytext>
+select page_id from dotlrn_communities where community_id= :community_id
+</querytext>
+</fullquery>
+
 <fullquery name="dotlrn_community::get_all_communities_by_user.select_communities_by_user">
 <querytext>
 select dotlrn_communities.community_id, community_type, community_key, pretty_name from dotlrn_communities, dotlrn_member_rels_full where dotlrn_communities.community_id = dotlrn_member_rels_full.community_id and dotlrn_member_rels_full.user_id = :user_id
Index: openacs-4/packages/dotlrn/www/one-community-not-member.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/www/Attic/one-community-not-member.adp,v
diff -u -r1.2 -r1.3
--- openacs-4/packages/dotlrn/www/one-community-not-member.adp	9 Oct 2001 14:35:58 -0000	1.2
+++ openacs-4/packages/dotlrn/www/one-community-not-member.adp	9 Nov 2001 15:24:57 -0000	1.3
@@ -4,3 +4,6 @@
 
 You are not a member of this community. Would you like to <a href=community-register>register</a>?
 
+<p>
+
+@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 -r1.4 -r1.5
--- openacs-4/packages/dotlrn/www/one-community.tcl	12 Oct 2001 14:48:54 -0000	1.4
+++ openacs-4/packages/dotlrn/www/one-community.tcl	9 Nov 2001 15:24:57 -0000	1.5
@@ -25,6 +25,15 @@
 if {![dotlrn_community::member_p $community_id $user_id]} {
     set context_bar [list "Not a member"]
 
+    set page_id [dotlrn_community::get_community_non_members_page_id $community_id]
+
+    # Possible that there is no portal page for non-members
+    if {! [empty_string_p $page_id]} {
+	set rendered_page [portal::render $page_id]
+    } else {
+	set rendered_page ""
+    }
+
     ad_return_template one-community-not-member
     return
 } else {
Index: openacs-4/packages/dotlrn-dotlrn/tcl/dotlrn-dotlrn-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-dotlrn/tcl/dotlrn-dotlrn-procs.tcl,v
diff -u -r1.3 -r1.4
--- openacs-4/packages/dotlrn-dotlrn/tcl/dotlrn-dotlrn-procs.tcl	1 Nov 2001 23:13:03 -0000	1.3
+++ openacs-4/packages/dotlrn-dotlrn/tcl/dotlrn-dotlrn-procs.tcl	9 Nov 2001 15:23:18 -0000	1.4
@@ -45,19 +45,14 @@
     } {
 	Add the dotlrn applet
     } {
-	# Callback to get node_id from community
-	# REVISIT this (ben)
-#	set node_id [site_node_id [ad_conn url]]
+	# No mounting of anything
 
-	# create the dotlrn package instance (all in one, I've mounted it)
-#	set package_key [package_key]
-	#set package_id [site_node_mount_application -return package_id $node_id $package_key $package_key $package_key]
+	# Get the non-member page_id
+	set non_member_page_id [dotlrn_community::get_community_non_members_page_id $community_id]
 
-	# set up a forum inside that instance
-	#dotlrn_forum_new -context_id $package_id -short_name "Discussions"
+	# Add the element there, too
+	dotlrn_portlet::make_self_available $page_id $community_id
 
-	# aks - I think we just return the community_id here?
-	# return the package_id
 	return $community_id
     }
 
@@ -91,9 +86,6 @@
 	# nothing for now
 
 	# Make dotlrn DS available to this page
-	dotlrn_portlet::make_self_available $page_id
-
-	# Call the portal element to be added correctly
 	dotlrn_portlet::add_self_to_page $page_id $community_id
     }