Index: openacs-4/packages/dotlrn/sql/oracle/dotlrn-applet-sc-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/sql/oracle/Attic/dotlrn-applet-sc-create.sql,v diff -u -r1.3 -r1.4 --- openacs-4/packages/dotlrn/sql/oracle/dotlrn-applet-sc-create.sql 5 Oct 2001 15:14:21 -0000 1.3 +++ openacs-4/packages/dotlrn/sql/oracle/dotlrn-applet-sc-create.sql 8 Oct 2001 21:38:37 -0000 1.4 @@ -22,6 +22,27 @@ contract_desc => 'dotLRN Applet implement a specific interface' ); + -- Get a pretty name + foo := acs_sc_msg_type.new ( + msg_type_name => 'dotlrn_applet.GetPrettyName.InputType', + msg_type_spec => '' + ); + + foo := acs_sc_msg_type.new ( + msg_type_name => 'dotlrn_applet.GetPrettyName.OutputType', + msg_type_spec => 'pretty_name:string' + ); + + foo := acs_sc_operation.new ( + 'dotlrn_applet', + 'GetPrettyName', + 'Get the pretyt name', + 't', -- not cacheable + 0, -- n_args + 'dotlrn_applet.GetPrettyName.InputType', + 'dotlrn_applet.GetPrettyName.OutputType' + ); + -- Add the applet to a community foo := acs_sc_msg_type.new( msg_type_name => 'dotlrn_applet.AddApplet.InputType', 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.2 -r1.3 --- openacs-4/packages/dotlrn/sql/oracle/dotlrn-classes-create.sql 5 Oct 2001 15:14:21 -0000 1.2 +++ openacs-4/packages/dotlrn/sql/oracle/dotlrn-classes-create.sql 8 Oct 2001 21:38:37 -0000 1.3 @@ -115,19 +115,19 @@ create or replace package dotlrn_class_instance is function new ( - class_instance_id in dotlrn_class_instances.class_instance_id%TYPE, + class_instance_id in dotlrn_class_instances.class_instance_id%TYPE default null, class_key in dotlrn_class_instances.class_key%TYPE, year in dotlrn_class_instances.year%TYPE, term in dotlrn_class_instances.term%TYPE, community_key in dotlrn_communities.community_key%TYPE, - pretty_name in dotlrn_communities.pretty_name%TYPE, - description in dotlrn_communities.description%TYPE, + pretty_name in dotlrn_communities.pretty_name%TYPE, + description in dotlrn_communities.description%TYPE, package_id in dotlrn_communities.package_id%TYPE default null, creation_date in acs_objects.creation_date%TYPE - default sysdate, + default sysdate, creation_user in acs_objects.creation_user%TYPE - default null, - creation_ip in acs_objects.creation_ip%TYPE default null, + default null, + creation_ip in acs_objects.creation_ip%TYPE default null, context_id in acs_objects.context_id%TYPE default null ) return dotlrn_class_instances.class_instance_id%TYPE; @@ -147,31 +147,31 @@ year in dotlrn_class_instances.year%TYPE, term in dotlrn_class_instances.term%TYPE, community_key in dotlrn_communities.community_key%TYPE, - pretty_name in dotlrn_communities.pretty_name%TYPE, - description in dotlrn_communities.description%TYPE, + pretty_name in dotlrn_communities.pretty_name%TYPE, + description in dotlrn_communities.description%TYPE, package_id in dotlrn_communities.package_id%TYPE default null, creation_date in acs_objects.creation_date%TYPE - default sysdate, + default sysdate, creation_user in acs_objects.creation_user%TYPE - default null, - creation_ip in acs_objects.creation_ip%TYPE default null, + default null, + creation_ip in acs_objects.creation_ip%TYPE default null, context_id in acs_objects.context_id%TYPE default null ) return dotlrn_class_instances.class_instance_id%TYPE is v_class_instance_id dotlrn_class_instances.class_instance_id%TYPE; begin - v_class_instance_id := dotlrn_community.new ( - community_id => class_instance_id, - community_type => class_key, - community_key => community_key, - pretty_name => pretty_name, - description => description, - package_id => package_id, - creation_date => creation_date, - creation_user => creation_user, - creation_ip => creation_ip, - context_id => context_id - ); + v_class_instance_id := dotlrn_community.new ( + community_id => class_instance_id, + community_type => class_key, + community_key => community_key, + pretty_name => pretty_name, + description => description, + package_id => package_id, + creation_date => creation_date, + creation_user => creation_user, + creation_ip => creation_ip, + context_id => context_id + ); insert into dotlrn_class_instances (class_instance_id, class_key, year, term) Index: openacs-4/packages/dotlrn/sql/oracle/dotlrn-init.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/sql/oracle/dotlrn-init.sql,v diff -u -r1.3 -r1.4 --- openacs-4/packages/dotlrn/sql/oracle/dotlrn-init.sql 5 Oct 2001 15:14:21 -0000 1.3 +++ openacs-4/packages/dotlrn/sql/oracle/dotlrn-init.sql 8 Oct 2001 21:38:37 -0000 1.4 @@ -71,94 +71,96 @@ acs_rel_type.create_role ('teaching_assistant', 'Teaching Assistant', 'Teaching Assistants'); acs_rel_type.create_role ('instructor', 'Instructor', 'Instructors'); acs_rel_type.create_role ('admin', 'Administrator', 'Administrators'); + + -- a lot of the following stuff is commented out because it has to be done in TCL -- create relationships - acs_rel_type.create_type ( - rel_type => 'admin_rel', - supertype => 'membership_rel', - pretty_name => 'Administration Relation', - pretty_plural => 'Administration Relationships', - package_name => 'dotlrn_admin_rel', - table_name => 'dotlrn_admin_rel', - id_column => 'XXX', - object_type_one => 'dotlrn_community', role_one => NULL, - min_n_rels_one => 0, max_n_rels_one => null, - object_type_two => 'party', role_two => 'admin', - min_n_rels_two => 0, max_n_rels_two => null - ); +-- acs_rel_type.create_type ( +-- rel_type => 'admin_rel', +-- supertype => 'membership_rel', +-- pretty_name => 'Administration Relation', +-- pretty_plural => 'Administration Relationships', +-- package_name => 'dotlrn_admin_rel', +-- table_name => 'dotlrn_admin_rel', +-- id_column => 'XXX', +-- object_type_one => 'dotlrn_community', role_one => NULL, +-- min_n_rels_one => 0, max_n_rels_one => null, +-- object_type_two => 'party', role_two => 'admin', +-- min_n_rels_two => 0, max_n_rels_two => null +-- ); - acs_rel_type.create_type ( - rel_type => 'instructor_rel', - supertype => 'admin_rel', - pretty_name => 'Instructor Relation', - pretty_plural => 'Instructor Relationships', - package_name => 'dotlrn_instructor_rel', - table_name => 'dotlrn_instructor_rel', - id_column => 'XXX', - object_type_one => 'dotlrn_class', role_one => NULL, - min_n_rels_one => 0, max_n_rels_one => null, - object_type_two => 'party', role_two => 'instructor', - min_n_rels_two => 0, max_n_rels_two => null - ); +-- acs_rel_type.create_type ( +-- rel_type => 'instructor_rel', +-- supertype => 'admin_rel', +-- pretty_name => 'Instructor Relation', +-- pretty_plural => 'Instructor Relationships', +-- package_name => 'dotlrn_instructor_rel', +-- table_name => 'dotlrn_instructor_rel', +-- id_column => 'XXX', +-- object_type_one => 'dotlrn_class', role_one => NULL, +-- min_n_rels_one => 0, max_n_rels_one => null, +-- object_type_two => 'party', role_two => 'instructor', +-- min_n_rels_two => 0, max_n_rels_two => null +-- ); - acs_rel_type.create_type ( - rel_type => 'ta_rel', - supertype => 'admin_rel', - pretty_name => 'TA Relation', - pretty_plural => 'TA Relationships', - package_name => 'dotlrn_ta_rel', - table_name => 'dotlrn_ta_rel', - id_column => 'XXX', - object_type_one => 'dotlrn_class', role_one => NULL, - min_n_rels_one => 0, max_n_rels_one => null, - object_type_two => 'party', role_two => 'teaching_assistant', - min_n_rels_two => 0, max_n_rels_two => null - ); +-- acs_rel_type.create_type ( +-- rel_type => 'ta_rel', +-- supertype => 'admin_rel', +-- pretty_name => 'TA Relation', +-- pretty_plural => 'TA Relationships', +-- package_name => 'dotlrn_ta_rel', +-- table_name => 'dotlrn_ta_rel', +-- id_column => 'XXX', +-- object_type_one => 'dotlrn_class', role_one => NULL, +-- min_n_rels_one => 0, max_n_rels_one => null, +-- object_type_two => 'party', role_two => 'teaching_assistant', +-- min_n_rels_two => 0, max_n_rels_two => null +-- ); - acs_rel_type.create_type ( - rel_type => 'student_rel', - supertype => 'membership_rel', - pretty_name => 'Student Relation', - pretty_plural => 'Student Relationships', - package_name => 'dotlrn_student_rel', - table_name => 'dotlrn_student_rel', - id_column => 'XXX', - object_type_one => 'dotlrn_class', role_one => NULL, - min_n_rels_one => 0, max_n_rels_one => null, - object_type_two => 'party', role_two => 'student', - min_n_rels_two => 0, max_n_rels_two => null - ); +-- acs_rel_type.create_type ( +-- rel_type => 'student_rel', +-- supertype => 'membership_rel', +-- pretty_name => 'Student Relation', +-- pretty_plural => 'Student Relationships', +-- package_name => 'dotlrn_student_rel', +-- table_name => 'dotlrn_student_rel', +-- id_column => 'XXX', +-- object_type_one => 'dotlrn_class', role_one => NULL, +-- min_n_rels_one => 0, max_n_rels_one => null, +-- object_type_two => 'party', role_two => 'student', +-- min_n_rels_two => 0, max_n_rels_two => null +-- ); -- add permissible stuff - insert into group_type_rels - (group_rel_type_id, group_type, rel_type) - values - (acs_object_id_seq.nextval, 'dotlrn_class', 'admin_rel'); +-- insert into group_type_rels +-- (group_rel_type_id, group_type, rel_type) +-- values +-- (acs_object_id_seq.nextval, 'dotlrn_class', 'admin_rel'); - insert into group_type_rels - (group_rel_type_id, group_type, rel_type) - values - (acs_object_id_seq.nextval, 'dotlrn_club', 'admin_rel'); +-- insert into group_type_rels +-- (group_rel_type_id, group_type, rel_type) +-- values +-- (acs_object_id_seq.nextval, 'dotlrn_club', 'admin_rel'); - insert into group_type_rels - (group_rel_type_id, group_type, rel_type) - values - (acs_object_id_seq.nextval, 'dotlrn_club', 'membership_rel'); +-- insert into group_type_rels +-- (group_rel_type_id, group_type, rel_type) +-- values +-- (acs_object_id_seq.nextval, 'dotlrn_club', 'membership_rel'); - insert into group_type_rels - (group_rel_type_id, group_type, rel_type) - values - (acs_object_id_seq.nextval, 'dotlrn_class', 'student_rel'); +-- insert into group_type_rels +-- (group_rel_type_id, group_type, rel_type) +-- values +-- (acs_object_id_seq.nextval, 'dotlrn_class', 'student_rel'); - insert into group_type_rels - (group_rel_type_id, group_type, rel_type) - values - (acs_object_id_seq.nextval, 'dotlrn_class', 'instructor_rel'); +-- insert into group_type_rels +-- (group_rel_type_id, group_type, rel_type) +-- values +-- (acs_object_id_seq.nextval, 'dotlrn_class', 'instructor_rel'); - insert into group_type_rels - (group_rel_type_id, group_type, rel_type) - values - (acs_object_id_seq.nextval, 'dotlrn_class', 'ta_rel'); +-- insert into group_type_rels +-- (group_rel_type_id, group_type, rel_type) +-- values +-- (acs_object_id_seq.nextval, 'dotlrn_class', 'ta_rel'); 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 --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotlrn/tcl/class-procs-oracle.xql 8 Oct 2001 21:39:05 -0000 1.1 @@ -0,0 +1,41 @@ + + + +oracle8.1.6 + + + +declare +begin + +:1 := dotlrn_class.new ( + class_key => :name, + pretty_name => :pretty_name, + pretty_plural => :pretty_name, + description => :description +); + +end; + + + + + + +declare +begin + +:1 := dotlrn_class_instance.new ( + class_key => :class_type, + year => :year, + term => :term, + community_key => :short_name, + pretty_name => :class_name, + description => :description +); + +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.6 -r1.7 --- openacs-4/packages/dotlrn/tcl/class-procs.tcl 6 Oct 2001 18:24:42 -0000 1.6 +++ openacs-4/packages/dotlrn/tcl/class-procs.tcl 8 Oct 2001 21:38:37 -0000 1.7 @@ -78,31 +78,28 @@ } { set short_name "$class_type-$term-$year" - # Create the community - # set community_id [dotlrn_community::new dotlrn_class $short_name $pretty_name] + db_transaction { + # Insert the 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 {}] + set parent_node_id [ad_conn -get node_id] + + # Instantiate the right package at that site node, probably portals + set package_id [site_node_mount_application -return "package_id" $parent_node_id $short_name [one_class_package_key] $short_name] - # Insert the 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 {}] - - # Instantiate the right package at that site node, probably portals - set result [site_node_mount_application -return "package_id,node_id" $parent_node_id $short_name [one_class_package_key] $short_name] - set package_id [lindex $result 0] - set node_id [lindex $result 1] - - # Set the right parameters - ad_parameter -package_id $package_id -set 0 dotlrn_level_p - ad_parameter -package_id $package_id -set 0 class_level_p - ad_parameter -package_id $package_id -set 1 class_instance_level_p - - # Set up the node - dotlrn_community::set_site_node $community_id $node_id - - # Assign proper permissions to the site node - # NOT CERTAIN what to do here yet - + # Set the right parameters + ad_parameter -package_id $package_id -set 0 dotlrn_level_p + ad_parameter -package_id $package_id -set 0 community_type_level_p + ad_parameter -package_id $package_id -set 1 community_level_p + + # Set up the node + dotlrn_community::set_package_id $community_id $package_id + + # Assign proper permissions to the site node + # NOT CERTAIN what to do here yet + } } ad_proc -public available_roles { 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 --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotlrn/tcl/community-procs-oracle.xql 8 Oct 2001 21:39:05 -0000 1.1 @@ -0,0 +1,47 @@ + + + +oracle8.1.6 + + + +declare +begin + +:1 := dotlrn_community_type.new ( + community_type => :community_type, + parent_type => :supertype, + pretty_name => :pretty_name, + pretty_plural => :pretty_name, + description => :description +); + +end; + + + + + + +declare +begin + +:1 := dotlrn_community.new ( + community_type => :community_type, + community_key => :name + pretty_name => :pretty_name, + pretty_plural => :pretty_name, + description => :description +); + +end; + + + + + +select site_node.url(node_id) from site_nodes where parent_id= :current_node_id and object_id= :package_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.5 -r1.6 --- openacs-4/packages/dotlrn/tcl/community-procs.tcl 6 Oct 2001 18:24:42 -0000 1.5 +++ openacs-4/packages/dotlrn/tcl/community-procs.tcl 8 Oct 2001 21:38:37 -0000 1.6 @@ -40,7 +40,7 @@ db_dml update_package_id {} } - ad_proc new { + ad_proc -public new { {-description ""} community_type name @@ -64,6 +64,15 @@ db_dml update_package_id {} } + ad_proc admin_access_p { + community_id + } { + Checks admin access to a community + } { + # HACK FOR NOW!! (ben) FIXIT + return 1 + } + ad_proc -public get_url { {-current_node_id ""} {-package_id ""} @@ -74,7 +83,7 @@ set current_node_id [site_node_id [ad_conn url]] } - return [db_string select_node_url {}] + return [db_string select_node_url {} -default ""] } ad_proc set_attribute { @@ -111,17 +120,19 @@ } { Assigns a user to a particular role for that class. Roles in DOTLRN can be student, prof, ta, admin } { - # Set up the relationship - set rel_id [relation_add $rel_type $community_id $user_id] - - # Set up a portal page for that user - set page_id [portal::create_portal $user_id] - - # Insert the membership - db_dml insert_membership {} - - # do the callbacks - applets_dispatch AddUser [list $community_id $user_id] + db_transaction { + # Set up the relationship + set rel_id [relation_add -member_state approved $rel_type $community_id $user_id] + + # Set up a portal page for that user + set page_id [portal::create_portal $user_id] + + # Insert the membership + db_dml insert_membership {} + + # do the callbacks + applets_dispatch $community_id AddUser [list $community_id $user_id] + } } ad_proc -public remove_user { @@ -130,17 +141,19 @@ } { Removes a user from a class } { - # Callbacks - applets_dispatch RemoveUser [list $community_id $user_id] - - # Get the relationship ID - set rel_id [db_string select_rel_id {}] - - # Remove the membership - db_dml delete_membership {} - - # Remove it - relation_remove $rel_id + db_transaction { + # Callbacks + applets_dispatch $community_id RemoveUser [list $community_id $user_id] + + # Get the relationship ID + set rel_id [db_string select_rel_id {}] + + # Remove the membership + db_dml delete_membership {} + + # Remove it + relation_remove $rel_id + } } ad_proc -public get_page_id { @@ -161,10 +174,27 @@ 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]] + lappend list_of_communities [list $community_id $community_type $pretty_name $description [get_url -package_id $package_id]] } + + return $list_of_communities } + ad_proc -public get_active_communities { + community_type + } { + Returns a list of active communities for a given type. + FIXME: right now all communities are active. + } { + set list_of_communities [list] + + db_foreach select_active_communities {} { + lappend list_of_communities [list $community_id $community_type $pretty_name $description [get_url -package_id $package_id]] + } + + return $list_of_communities + } + ad_proc -public get_community_type { } { Returns the community type key depending on the node we're at @@ -197,8 +227,13 @@ } { Adds an applet to the community } { - # Insert in the DB - db_dml insert_applet {} + db_transaction { + # Insert in the DB + db_dml insert_applet {} + + # Callback + applet_call $applet_key AddApplet [list $community_id] + } } ad_proc -public remove_applet { @@ -207,29 +242,53 @@ } { Removes an applet from a community } { - # Delete from the DB - db_dml delete_applet {} + # Get the package_id + set package_id [get_package_id $community_id] + + db_transaction { + # Callback + applet_call $applet_key RemoveApplet [list $community_id $package_id] + + # Delete from the DB + db_dml delete_applet {} + } } ad_proc -public list_applets { - community_id + {community_id ""} } { Lists the applets associated with a community } { - # List from the DB - return [db_list select_community_applets {}] + if {[empty_string_p $community_id]} { + # List all applets + return [db_list select_all_applets {}] + } else { + # List from the DB + return [db_list select_community_applets {}] + } } ad_proc -public applets_dispatch { + community_id op list_args } { Dispatch an operation to every applet } { - foreach applet [list_applets] { + foreach applet [list_applets $community_id] { # Callback on applet - acs_sc_call dotLRN_Applet $op $list_args $applet + applet_call $applet $op $list_args } } + ad_proc -public applet_call { + applet_key + op + {list_args {}} + } { + Call a particular applet op + } { + acs_sc_call dotlrn_applet $op $list_args $applet_key + } + } 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 --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotlrn/tcl/community-procs.xql 8 Oct 2001 21:39:05 -0000 1.1 @@ -0,0 +1,144 @@ + + + + + + +declare +begin +end; + + + + + + +update dotlrn_community_types set package_id= :package_id where community_type= :community_type + + + + + + +insert into dotlrn_communities +(community_id, community_type, community_key, pretty_name, description) +values +(:community_id, :community_type, :name, :pretty_name, :description) + + + + + +update dotlrn_communities set package_id= :package_id where community_id= :community_id + + + + + +select rel_id, users.user_id, first_names, last_name, email from users, dotlrn_community_memberships +where community_id= :community_id and users.user_id = dotlrn_community_memberships.user_id + + + + + +select count(*) from dotlrn_community_memberships where community_id= :community_id and user_id= :user_id + + + + + +insert into dotlrn_community_memberships +(rel_id, community_id, user_id, page_id) +values +(:rel_id, :community_id, :user_id, :page_id) + + + + + +select rel_id from dotlrn_community_memberships where community_id= :community_id and user_id= :user_id + + + + + +delete from dotlrn_community_memberships where rel_id=:rel_id + + + + + +select page_id from dotlrn_community_memberships where community_id= :community_id and user_id= :user_id + + + + + +select dotlrn_communities.community_id as community_id, community_type, pretty_name, description, package_id +from dotlrn_communities, dotlrn_community_memberships +where community_type= :community_type +and user_id= :user_id +and dotlrn_communities.community_id = dotlrn_community_memberships.community_id + + +\ + + +select community_id, community_type, pretty_name, description, package_id +from dotlrn_communities +where community_type= :community_type + + + + + +select community_type from dotlrn_community_types where package_id= :package_id + + + + + +select community_id from dotlrn_communities where package_id= :package_id + + + + + +select package_id from dotlrn_communities where community_id= :community_id + + + + + +insert into dotlrn_community_applets +(community_id, applet_key) +values +(:community_id, :applet_key) + + + + + +delete from dotlrn_community_applets where +community_id= :community_id and applet_key= :applet_key + + + + + +select impl_name from acs_sc_impls, acs_sc_bindings, acs_sc_contracts +where +acs_sc_impls.impl_id = acs_sc_bindings.impl_id and +acs_sc_contracts.contract_id= acs_sc_bindings.contract_id and +acs_sc_contracts.contract_name='dotlrn_applet' + + + + + +select applet_key from dotlrn_community_applets where community_id= :community_id + + + + Index: openacs-4/packages/dotlrn/tcl/dotlrn-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/tcl/dotlrn-procs.tcl,v diff -u -r1.4 -r1.5 --- openacs-4/packages/dotlrn/tcl/dotlrn-procs.tcl 3 Oct 2001 21:11:00 -0000 1.4 +++ openacs-4/packages/dotlrn/tcl/dotlrn-procs.tcl 8 Oct 2001 21:38:37 -0000 1.5 @@ -18,6 +18,29 @@ namespace eval dotlrn { + ad_proc install { + } { + Does some installation that cannot be done in SQL + } { + db_transaction { + # Create the rel types + rel_types::new -supertype membership_rel -role_two admin admin_rel "Administration Relation" "Administration Relations" dotlrn_community 0 "" party 0 "" + rel_types::new -supertype membership_rel -role_two student student_rel "Student Relation" "Student Relations" dotlrn_community 0 "" party 0 "" + rel_types::new -supertype admin_rel -role_two admin instructor_rel "Instructor Relation" "Instructor Relations" dotlrn_community 0 "" party 0 "" + rel_types::new -supertype admin_rel -role_two admin ta_rel "TA Relation" "TA Relations" dotlrn_community 0 "" party 0 "" + + # Add what's permissible (we would do this in SQL if the above could be done in SQL...) + rel_types::add_permissible dotlrn_class admin_rel + rel_types::add_permissible dotlrn_class student_rel + rel_types::add_permissible dotlrn_class ta_rel + rel_types::add_permissible dotlrn_class instructor_rel + + rel_types::add_permissible dotlrn_club admin_rel + # rel_types::add_permissible dotlrn_club membership_rel + } + } + + ad_proc -public class_group_type_key { } { Returns the group type key used for class groups @@ -32,12 +55,4 @@ return [ad_parameter group_type_key] } - ad_proc -public node_id { - {-package_id ""} - } { - Returns the node ID of the current dotLRN package - } { - ## TOTAL HACK (BEN!!) - return 0 - } } Index: openacs-4/packages/dotlrn/www/applet-add.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/www/applet-add.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotlrn/www/applet-add.tcl 8 Oct 2001 21:39:05 -0000 1.1 @@ -0,0 +1,24 @@ + +ad_page_contract { + Add an applet to a community + + @author Ben Adida (ben@openforce.net) + @creation-date 2001-10-08 +} { + applet_key +} + +# Get the community ID +set community_id [dotlrn_community::get_community_id] + +# Check access +if {![dotlrn_community::admin_access_p $community_id]} { + ns_returnredirect / + return +} + +# Add the applet +dotlrn_community::add_applet $community_id $applet_key + +# Get back to where you once belonged +ns_returnredirect one-community-admin Index: openacs-4/packages/dotlrn/www/applet-remove.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/www/applet-remove.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotlrn/www/applet-remove.tcl 8 Oct 2001 21:39:05 -0000 1.1 @@ -0,0 +1,24 @@ + +ad_page_contract { + Remove an applet from a community + + @author Ben Adida (ben@openforce.net) + @creation-date 2001-10-08 +} { + applet_key +} + +# Get the community ID +set community_id [dotlrn_community::get_community_id] + +# Check access +if {![dotlrn_community::admin_access_p $community_id]} { + ns_returnredirect / + return +} + +# Add the applet +dotlrn_community::remove_applet $community_id $applet_key + +# Get back to where you once belonged +ns_returnredirect one-community-admin Index: openacs-4/packages/dotlrn/www/install.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/www/Attic/install.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotlrn/www/install.tcl 8 Oct 2001 21:39:05 -0000 1.1 @@ -0,0 +1,4 @@ + +dotlrn::install + +ns_returnredirect "./" Index: openacs-4/packages/dotlrn/www/one-community-admin.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/www/one-community-admin.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotlrn/www/one-community-admin.adp 8 Oct 2001 21:39:05 -0000 1.1 @@ -0,0 +1,22 @@ + +@context_bar@ +dotLRN Community Admin: @pretty_name@ + +Here you can do all sorts of administrative stuff. + +

+ +

Active Applets

+ + +

+

Applets to Add

+ 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 -r1.1 -r1.2 --- openacs-4/packages/dotlrn/www/one-community-admin.tcl 6 Oct 2001 18:24:42 -0000 1.1 +++ openacs-4/packages/dotlrn/www/one-community-admin.tcl 8 Oct 2001 21:38:37 -0000 1.2 @@ -20,12 +20,30 @@ set community_id [dotlrn_community::get_community_id] # Load some community type info -db_1row select_community_type_info {} +db_1row select_community_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] +# Get active applets +set list_of_active_applets [dotlrn_community::list_applets $community_id] -# communities should be a data source +template::multirow create active_applets applet_key applet_pretty_name +foreach applet_key $list_of_active_applets { + template::multirow append active_applets $applet_key [dotlrn_community::applet_call $applet_key GetPrettyName] +} + + +# List all applets +set list_of_applets [dotlrn_community::list_applets] + +template::multirow create all_applets applet_key applet_pretty_name + +foreach applet_key $list_of_applets { + if {[lsearch $list_of_active_applets $applet_key] == -1} { + template::multirow append all_applets $applet_key [dotlrn_community::applet_call $applet_key GetPrettyName] + } +} + + +set context_bar {Admin} + ad_return_template Index: openacs-4/packages/dotlrn/www/one-community-admin.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/www/one-community-admin.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotlrn/www/one-community-admin.xql 8 Oct 2001 21:39:05 -0000 1.1 @@ -0,0 +1,11 @@ + + + + + + +select pretty_name from dotlrn_communities where community_id = :community_id + + + + 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 -r1.2 -r1.3 --- openacs-4/packages/dotlrn/www/one-community-type.adp 7 Oct 2001 19:21:08 -0000 1.2 +++ openacs-4/packages/dotlrn/www/one-community-type.adp 8 Oct 2001 21:38:37 -0000 1.3 @@ -20,7 +20,7 @@

Active Communities of this 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 -r1.1 -r1.2 --- openacs-4/packages/dotlrn/www/one-community.adp 6 Oct 2001 18:24:42 -0000 1.1 +++ openacs-4/packages/dotlrn/www/one-community.adp 8 Oct 2001 21:38:37 -0000 1.2 @@ -1,4 +1,7 @@ dotLRN Community +

dotLRN Community: @pretty_name@

+ + @rendered_page@ Index: openacs-4/packages/dotlrn/www/test.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/www/test.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/packages/dotlrn/www/test.tcl 6 Oct 2001 18:24:42 -0000 1.1 +++ openacs-4/packages/dotlrn/www/test.tcl 8 Oct 2001 21:38:37 -0000 1.2 @@ -1,7 +1,8 @@ # A testing script +dotlrn_community::remove_user 2377 2195 -# Create a class -doc_body_append "nothing" +ns_returnredirect ./ +