Index: openacs-4/packages/dotlrn/dotlrn.info
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/dotlrn.info,v
diff -u -r1.10 -r1.11
--- openacs-4/packages/dotlrn/dotlrn.info	9 Nov 2001 01:11:31 -0000	1.10
+++ openacs-4/packages/dotlrn/dotlrn.info	9 Nov 2001 03:56:43 -0000	1.11
@@ -69,6 +69,10 @@
             <file type="content_page" path="www/admin/classes.adp"/>
             <file type="content_page" path="www/admin/classes.tcl"/>
             <file type="query_file" path="www/admin/classes.xql"/>
+            <file type="content_page" path="www/admin/community-user-add-2.adp"/>
+            <file type="content_page" path="www/admin/community-user-add-2.tcl"/>
+            <file type="content_page" path="www/admin/community-user-add-3.tcl"/>
+            <file type="content_page" path="www/admin/community-user-add.adp"/>
             <file type="content_page" path="www/admin/community-user-add.tcl"/>
             <file type="query_file" path="www/admin/community-user-add.xql"/>
             <file type="content_page" path="www/admin/index.adp"/>
@@ -94,6 +98,8 @@
             <file type="query_file" path="www/classes.xql"/>
             <file type="content_page" path="www/community-deregister.tcl"/>
             <file type="content_page" path="www/community-register.tcl"/>
+            <file type="content_page" path="www/configure.adp"/>
+            <file type="content_page" path="www/configure.tcl"/>
             <file type="query_file" db_type="oracle" path="www/index-oracle.xql"/>
             <file type="query_file" db_type="postgresql" path="www/index-postgresql.xql"/>
             <file path="www/index.adp"/>
Index: openacs-4/packages/dotlrn/sql/oracle/dotlrn-community-memberships-packages-create.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/sql/oracle/Attic/dotlrn-community-memberships-packages-create.sql,v
diff -u -r1.2 -r1.3
--- openacs-4/packages/dotlrn/sql/oracle/dotlrn-community-memberships-packages-create.sql	8 Nov 2001 23:57:40 -0000	1.2
+++ openacs-4/packages/dotlrn/sql/oracle/dotlrn-community-memberships-packages-create.sql	9 Nov 2001 03:56:43 -0000	1.3
@@ -89,6 +89,7 @@
     rel_type		in acs_rels.rel_type%TYPE default 'dotlrn_admin_rel',
     community_id	in dotlrn_communities.community_id%TYPE,
     user_id		in dotlrn_users.user_id%TYPE,
+    page_id		in dotlrn_member_rels.page_id%TYPE default null,
     creation_user	in acs_objects.creation_user%TYPE default null,
     creation_ip		in acs_objects.creation_ip%TYPE default null
   ) return dotlrn_admin_rels.rel_id%TYPE;
@@ -109,6 +110,7 @@
     rel_type		in acs_rels.rel_type%TYPE default 'dotlrn_admin_rel',
     community_id	in dotlrn_communities.community_id%TYPE,
     user_id		in dotlrn_users.user_id%TYPE,
+    page_id		in dotlrn_member_rels.page_id%TYPE default null,
     creation_user	in acs_objects.creation_user%TYPE default null,
     creation_ip		in acs_objects.creation_ip%TYPE default null
   ) return dotlrn_admin_rels.rel_id%TYPE
@@ -119,6 +121,7 @@
 			rel_type => rel_type,
 			community_id => community_id,
 			user_id => user_id,
+			page_id => page_id,
 			creation_user => creation_user,
 			creation_ip => creation_ip);
 
@@ -224,6 +227,7 @@
     rel_type		in acs_rels.rel_type%TYPE default 'dotlrn_ta_rel',
     class_instance_id	in dotlrn_class_instances.class_instance_id%TYPE,
     user_id		in dotlrn_users.user_id%TYPE,
+    page_id		in dotlrn_member_rels.page_id%TYPE,
     creation_user	in acs_objects.creation_user%TYPE default null,
     creation_ip		in acs_objects.creation_ip%TYPE default null
   ) return dotlrn_ta_rels.rel_id%TYPE;
@@ -244,6 +248,7 @@
     rel_type		in acs_rels.rel_type%TYPE default 'dotlrn_ta_rel',
     class_instance_id	in dotlrn_class_instances.class_instance_id%TYPE,
     user_id		in dotlrn_users.user_id%TYPE,
+    page_id		in dotlrn_member_rels.page_id%TYPE,
     creation_user	in acs_objects.creation_user%TYPE default null,
     creation_ip		in acs_objects.creation_ip%TYPE default null
   ) return dotlrn_ta_rels.rel_id%TYPE
@@ -254,6 +259,7 @@
 			rel_type => rel_type,
 			community_id => class_instance_id,
 			user_id => user_id,
+			page_id => page_id,
 			creation_user => creation_user,
 			creation_ip => creation_ip);
 
@@ -290,6 +296,7 @@
     rel_type		in acs_rels.rel_type%TYPE default 'dotlrn_instructor_rel',
     class_instance_id	in dotlrn_class_instances.class_instance_id%TYPE,
     user_id		in dotlrn_users.user_id%TYPE,
+    page_id		in dotlrn_member_rels.page_id%TYPE,
     creation_user	in acs_objects.creation_user%TYPE default null,
     creation_ip		in acs_objects.creation_ip%TYPE default null
   ) return dotlrn_instructor_rels.rel_id%TYPE;
@@ -310,6 +317,7 @@
     rel_type		in acs_rels.rel_type%TYPE default 'dotlrn_instructor_rel',
     class_instance_id	in dotlrn_class_instances.class_instance_id%TYPE,
     user_id		in dotlrn_users.user_id%TYPE,
+    page_id		in dotlrn_member_rels.page_id%TYPE,
     creation_user	in acs_objects.creation_user%TYPE default null,
     creation_ip		in acs_objects.creation_ip%TYPE default null
   ) return dotlrn_instructor_rels.rel_id%TYPE
@@ -320,6 +328,7 @@
 			rel_type => rel_type,
 			community_id => class_instance_id,
 			user_id => user_id,
+			page_id => page_id,
 			creation_user => creation_user,
 			creation_ip => creation_ip);
 
Index: openacs-4/packages/dotlrn/tcl/community-procs-oracle.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/tcl/community-procs-oracle.xql,v
diff -u -r1.1 -r1.2
--- openacs-4/packages/dotlrn/tcl/community-procs-oracle.xql	8 Oct 2001 21:39:05 -0000	1.1
+++ openacs-4/packages/dotlrn/tcl/community-procs-oracle.xql	9 Nov 2001 03:56:43 -0000	1.2
@@ -44,4 +44,10 @@
 </querytext>
 </fullquery>
 
+<fullquery name="dotlrn_community::get_community_type_from_community_id.select_community_type">
+<querytext>
+select object_type from acs_object_types where supertype='dotlrn_community' start with object_type = (select community_type from dotlrn_communities where community_id=:community_id) connect by object_type= prior supertype 
+</querytext>
+</fullquery>
+
 </queryset>
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.18 -r1.19
--- openacs-4/packages/dotlrn/tcl/community-procs.tcl	9 Nov 2001 03:05:31 -0000	1.18
+++ openacs-4/packages/dotlrn/tcl/community-procs.tcl	9 Nov 2001 03:56:43 -0000	1.19
@@ -96,6 +96,34 @@
 	# Not sure what to do here yet
     }
 
+    ad_proc -public get_allowed_rel_types {
+	{ -community_type "" }
+	{ -community_id "" }
+    } {
+	if {[empty_string_p $community_type]} {
+	    set community_type [get_community_type_from_community_id $community_id]
+	}
+	
+	if {$community_type == "dotlrn_class"} {
+	    return {
+		{dotlrn_student_rel Student}
+		{dotlrn_ta_rel TA}
+		{dotlrn_instructor_rel Instructor}
+		{dotlrn_admin_rel Admin}
+	    }
+	}
+
+	if {$community_type == "dotlrn_club"} {
+	    return {
+		{dotlrn_member_rel Member}
+		{dotlrn_admin_rel Admin}
+	    }
+	}
+
+	return {}
+    }
+
+
     ad_proc -public get_pretty_rel_type {
 	rel_type
     } {
@@ -245,6 +273,14 @@
 	return [db_list_of_lists select_all_communities {}]
     }
 
+    ad_proc -public get_community_type_from_community_id {
+	community_id
+    } {
+	returns the community type from community_id
+    } {
+	return [db_string select_community_type {}]
+    }
+
     ad_proc -public get_community_type {
     } {
 	Returns the community type key depending on the node we're at
Index: openacs-4/packages/dotlrn/www/configure.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/www/configure.adp,v
diff -u
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/dotlrn/www/configure.adp	9 Nov 2001 03:56:43 -0000	1.1
@@ -0,0 +1,6 @@
+<master src="master">
+<property name="context_bar">@context_bar@</property>
+<property name="title">Configure Main Portlet: @name@</property>
+<p>
+
+@rendered_page@
Index: openacs-4/packages/dotlrn/www/configure.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/www/configure.tcl,v
diff -u
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/dotlrn/www/configure.tcl	9 Nov 2001 03:56:43 -0000	1.1
@@ -0,0 +1,24 @@
+
+ad_page_contract {
+    Displays a configuration page for the main portal
+    
+    @author Ben Adida (ben@openforce.net)
+    @author Arjun Sanyal (arjun@openforce.net)
+    @creation-date 2001-11-08
+} {
+}
+
+set user_id [ad_conn user_id]
+
+# Pull out the NPP page ID and render it!
+set page_id [dotlrn_community::get_workspace_page_id $user_id]
+
+# Get the portal's name for the title
+set name [portal::get_name $page_id]
+
+set rendered_page [portal::configure $page_id]
+
+set context_bar {Configure}
+
+ad_return_template
+
Index: openacs-4/packages/dotlrn/www/student-list.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/www/Attic/student-list.adp,v
diff -u -r1.1 -r1.2
--- openacs-4/packages/dotlrn/www/student-list.adp	9 Oct 2001 15:02:49 -0000	1.1
+++ openacs-4/packages/dotlrn/www/student-list.adp	9 Nov 2001 03:56:43 -0000	1.2
@@ -3,6 +3,6 @@
 
 <ul>
 <multiple name=students>
-<li> @last_name@, @first_names@ (<a href=mailto:@email@>@email@</a>)
+<li> @students.last_name@, @students.first_names@ (<a href=mailto:@students.email@>@students.email@</a>), <i>@students.role@</i>
 </multiple>
 </ul>
Index: openacs-4/packages/dotlrn/www/student-list.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/www/Attic/student-list.tcl,v
diff -u -r1.2 -r1.3
--- openacs-4/packages/dotlrn/www/student-list.tcl	7 Nov 2001 18:49:41 -0000	1.2
+++ openacs-4/packages/dotlrn/www/student-list.tcl	9 Nov 2001 03:56:43 -0000	1.3
@@ -23,10 +23,10 @@
 
 set list_of_students [dotlrn_community::list_users $community_id]
 
-template::multirow create students user_id first_names last_name email
+template::multirow create students user_id first_names last_name email role
 
 foreach student $list_of_students {
-    template::multirow append students [lindex $student 1] [lindex $student 2] [lindex $student 3] [lindex $student 4]
+    template::multirow append students [lindex $student 2] [lindex $student 3] [lindex $student 4] [lindex $student 5] [dotlrn_community::get_pretty_rel_type [lindex $student 1]]
 }
 
 ad_return_template
Index: openacs-4/packages/dotlrn/www/admin/community-user-add-2.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/www/admin/Attic/community-user-add-2.adp,v
diff -u
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/dotlrn/www/admin/community-user-add-2.adp	9 Nov 2001 03:56:43 -0000	1.1
@@ -0,0 +1,17 @@
+<master src="../master">
+<property name="title">dotLRN Admin: Add a User to a Community</property>
+
+You're adding <strong>@first_names@ @last_name@ (@email@)</strong>:<p>
+
+<FORM method=get action=community-user-add-3>
+<INPUT TYPE=hidden name=user_id value=@user_id@>
+<INPUT TYPE=hidden name=community_id value=@community_id@>
+Role: 
+<SELECT name=rel_type>
+<multiple name="roles">
+<OPTION value="@roles.rel_type@"> @roles.pretty_name@
+</multiple>
+</SELECT>
+
+<INPUT TYPE=submit value=add>
+</FORM>
Index: openacs-4/packages/dotlrn/www/admin/community-user-add-2.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/www/admin/Attic/community-user-add-2.tcl,v
diff -u
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/dotlrn/www/admin/community-user-add-2.tcl	9 Nov 2001 03:56:43 -0000	1.1
@@ -0,0 +1,24 @@
+
+ad_page_contract {
+    Search for a new user for dotLRN
+    
+    @author Ben Adida (ben@openforce.net)
+    @creation-date 2001-11-04
+} {
+    user_id
+    community_id
+}
+
+# Get user information
+db_1row select_user_info "select first_names, last_name, email from dotlrn_users_full where user_id=:user_id"
+
+# Depending on the community_type, we have allowable rel_types
+set rel_types [dotlrn_community::get_allowed_rel_types -community_id $community_id]
+
+template::multirow create roles rel_type pretty_name
+
+foreach rel_type $rel_types {
+    template::multirow append roles [lindex $rel_type 0] [lindex $rel_type 1]
+}
+
+ad_return_template
Index: openacs-4/packages/dotlrn/www/admin/community-user-add-3.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/www/admin/Attic/community-user-add-3.tcl,v
diff -u
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/dotlrn/www/admin/community-user-add-3.tcl	9 Nov 2001 03:56:43 -0000	1.1
@@ -0,0 +1,16 @@
+
+ad_page_contract {
+    Add the new user
+    
+    @author Ben Adida (ben@openforce.net)
+    @creation-date 2001-11-04
+} {
+    community_id
+    user_id
+    rel_type
+}
+
+# Add the relation
+dotlrn_community::add_user -rel_type $rel_type $community_id $user_id
+
+ad_returnredirect "one-class-instance?class_instance_id=$community_id"
Index: openacs-4/packages/dotlrn/www/admin/community-user-add.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/www/admin/Attic/community-user-add.adp,v
diff -u -r1.1 -r1.2
--- openacs-4/packages/dotlrn/www/admin/community-user-add.adp	9 Nov 2001 01:11:31 -0000	1.1
+++ openacs-4/packages/dotlrn/www/admin/community-user-add.adp	9 Nov 2001 03:56:43 -0000	1.2
@@ -4,7 +4,7 @@
 The results of your search are:
 <ul>
 <multiple name="users">
-<li> <a href=community-add-user-2?community_type=@community_type@&community_id=@community_id@&user_id=@users.user_id@>@users.last_name@, @users.first_names@ (@users.email@)
+<li> <a href=community-user-add-2?community_id=@community_id@&user_id=@users.user_id@>@users.last_name@, @users.first_names@ (@users.email@)
 </multiple>
 </ul>
 
Index: openacs-4/packages/dotlrn/www/admin/community-user-add.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/www/admin/Attic/community-user-add.tcl,v
diff -u -r1.1 -r1.2
--- openacs-4/packages/dotlrn/www/admin/community-user-add.tcl	9 Nov 2001 01:11:31 -0000	1.1
+++ openacs-4/packages/dotlrn/www/admin/community-user-add.tcl	9 Nov 2001 03:56:43 -0000	1.2
@@ -7,7 +7,6 @@
 } {
     search_text
     community_id
-    community_type
 }
 
 # Just search
Index: openacs-4/packages/dotlrn/www/admin/one-class-instance.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/www/admin/Attic/one-class-instance.adp,v
diff -u -r1.2 -r1.3
--- openacs-4/packages/dotlrn/www/admin/one-class-instance.adp	9 Nov 2001 01:11:31 -0000	1.2
+++ openacs-4/packages/dotlrn/www/admin/one-class-instance.adp	9 Nov 2001 03:56:43 -0000	1.3
@@ -9,5 +9,5 @@
 
 <p>
 
-<form method=get action=community-user-add><li> Add a user: <input type=hidden name=community_id value=@class_instance_id@><input type=hidden name=community_type value=dotlrn_class><input type=text name=search_text> <input type=submit value=search></form>
+<form method=get action=community-user-add><li> Add a user: <input type=hidden name=community_id value=@class_instance_id@><input type=text name=search_text> <input type=submit value=search></form>
 </ul>