Index: openacs-4/etc/install/README =================================================================== RCS file: /usr/local/cvsroot/openacs-4/etc/install/README,v diff -u -N -r1.3 -r1.4 --- openacs-4/etc/install/README 12 Oct 2003 08:31:41 -0000 1.3 +++ openacs-4/etc/install/README 23 Oct 2003 13:49:29 -0000 1.4 @@ -30,7 +30,7 @@ data setup, or to only perform a cvs checkout, or only recreate the database. Invoke install.sh --help to see command line switches. -*** Prerequisites +*** Prerequisites in full 1) If you already have a server running that is to be recreated - move away and save any local changes (patches) that you have made to the @@ -70,3 +70,8 @@ http://tclwebtest.sourceforge.net) and specify the directory the tclwebtest executable resides in in your config file (the default config file is config.tcl). + +*** FAQ + +Q: How do I copy files into the source tree after checkout, but before install? +A: You can specify \ No newline at end of file Index: openacs-4/etc/install/dotlrn-basic-setup.test =================================================================== RCS file: /usr/local/cvsroot/openacs-4/etc/install/dotlrn-basic-setup.test,v diff -u -N -r1.7 -r1.8 --- openacs-4/etc/install/dotlrn-basic-setup.test 23 Oct 2003 12:35:21 -0000 1.7 +++ openacs-4/etc/install/dotlrn-basic-setup.test 23 Oct 2003 13:49:29 -0000 1.8 @@ -49,11 +49,18 @@ ::twt::log_section "Add news items - one per class" ::twt::news::add_item_to_classes $server_url - ::twt::log_section "Customize layout of the MySpace page as a student" - ::twt::user::login [::twt::user::get_random_users student 1] + set student_email [::twt::user::get_random_users student 1] + ::twt::log_section "Login as student $student_email" + ::twt::user::login $student_email + + ::twt::log_section "Test customize layout page" ::twt::new_portal::test::customize_layout - ::twt::user::login_site_wide_admin + #::twt::log_section "Test the manage memberships page" + #::twt::dotlrn::test::manage_my_memberships + + #::twt::user::login_site_wide_admin + # Test Execution END } result] } { Index: openacs-4/etc/install/tcl/dotlrn-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/etc/install/tcl/dotlrn-procs.tcl,v diff -u -N -r1.7 -r1.8 --- openacs-4/etc/install/tcl/dotlrn-procs.tcl 23 Oct 2003 12:35:01 -0000 1.7 +++ openacs-4/etc/install/tcl/dotlrn-procs.tcl 23 Oct 2003 13:49:22 -0000 1.8 @@ -225,13 +225,51 @@ ad_proc ::twt::dotlrn::test::manage_my_memberships {} { Test that user can manage (join/drop) his own class and community memberships. } { + # First request some ids from the OpenACS server + set user_id [::twt::oacs::eval "ad_conn user_id"] + set class_community_id [::twt::oacs::get_class_to_join $user_id] + set club_join_community_id [::twt::oacs::get_club_to_join $user_id "open"] + set club_request_community_id [::twt::oacs::get_club_to_join $user_id "needs approval"] + + # Visit the manage memberships page ::twt::do_request "/dotlrn/manage-memberships" # Join a class - link follow ~u "^register?community_id=$community_id" + set link_pattern "register.*community_id=$class_community_id" + link follow ~u $link_pattern - # Request membership for a class + # Assert class join link is gone + if { [::twt::count_links $link_pattern] > 0 } { + ::twt::log_alert "Class with community_id $community_id was joined but the join link still appears to be present" + } + + # Join a club + set link_pattern "register.*community_id=$club_join_community_id" + link follow ~u $link_pattern - # Drop a class + # Assert join club link is gone + if { [::twt::count_links $link_pattern] > 0 } { + ::twt::log_alert "Club with community_id $community_id was joined but the join link still appears to be present" + } + # Request membership for a club + set link_pattern "register.*community_id=$club_request_community_id" + link follow ~u $link_pattern + + # Assert request membership link is gone + if { [::twt::count_links $link_pattern] > 0 } { + ::twt::log_alert "Requested membership for club with community_id $community_id but the request link still appears to be present" + } + + # Drop a class + set link_pattern deregister + set deregister_count_before [::twt::count_links $link_pattern] + link follow ~u $link_pattern + set deregister_count_after [::twt::count_links $link_pattern] + + # Assert there is now one less class to deregister from + ::twt::assert_equals \ + "Should be one less class to dergister from after deregistering" \ + $deregister_count_after \ + [expr $deregister_count_before - 1] } Index: openacs-4/etc/install/tcl/eval-command.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/etc/install/tcl/eval-command.tcl,v diff -u -N -r1.1 -r1.2 --- openacs-4/etc/install/tcl/eval-command.tcl 21 Oct 2003 15:06:15 -0000 1.1 +++ openacs-4/etc/install/tcl/eval-command.tcl 23 Oct 2003 13:49:22 -0000 1.2 @@ -9,9 +9,11 @@ tcl_command } -if { ![acs_user::site_wide_admin_p -user_id [ad_conn user_id]] } { - ad_return_forbidden "Permission Denied" "You don't have permission to access this page" -} +# Commenting out as this forces scripts to keep an admin login but we want to test with +# student accounts as well +#if { ![acs_user::site_wide_admin_p -user_id [ad_conn user_id]] } { +# ad_return_forbidden "Permission Denied" "You don't have permission to access this page" +#} set result [eval $tcl_command] Index: openacs-4/etc/install/tcl/oacs-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/etc/install/tcl/oacs-procs.tcl,v diff -u -N -r1.1 -r1.2 --- openacs-4/etc/install/tcl/oacs-procs.tcl 23 Oct 2003 12:35:01 -0000 1.1 +++ openacs-4/etc/install/tcl/oacs-procs.tcl 23 Oct 2003 13:49:22 -0000 1.2 @@ -25,40 +25,38 @@ "] } -ad_proc ::twt::oacs::get_classes_to_join { email } { - Return a list of ids for classes that the user with - given email can join. +ad_proc ::twt::oacs::get_class_to_join { user_id } { + Return community_id of a random class that the user can join. } { - set user_id [user_id_from_email $email] - - return [::twt::oacs::eval " + set community_ids [::twt::oacs::eval " db_list can_join_community_ids { select community_id from dotlrn_class_instances_full - where dotlrn_class_instances_full.join_policy <> 'closed' + where dotlrn_class_instances_full.join_policy = 'open' and not exists (select 1 from dotlrn_member_rels_full where dotlrn_member_rels_full.user_id = '$user_id' and dotlrn_member_rels_full.community_id = dotlrn_class_instances_full.class_instance_id) } "] + + return [::twt::get_random_items_from_list $community_ids 1] } -ad_proc ::twt::oacs::get_clubs_to_join { email } { - Return a list of ids for clubs that the user with - given email can join. +ad_proc ::twt::oacs::get_club_to_join { user_id join_policy } { + Return community_id of a random club that the user can join. } { - set user_id [user_id_from_email $email] - return [::twt::oacs::eval " db_list can_join_club_ids { select f.community_id from dotlrn_clubs_full f - where f.join_policy <> 'closed' + where f.join_policy = '$join_policy' and f.club_id not in (select dotlrn_member_rels_full.community_id as club_id from dotlrn_member_rels_full where dotlrn_member_rels_full.user_id = '$user_id') } "] + + return [::twt::get_random_items_from_list $community_ids 1] } Index: openacs-4/etc/install/tcl/twt-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/etc/install/tcl/twt-procs.tcl,v diff -u -N -r1.7 -r1.8 --- openacs-4/etc/install/tcl/twt-procs.tcl 23 Oct 2003 12:35:01 -0000 1.7 +++ openacs-4/etc/install/tcl/twt-procs.tcl 23 Oct 2003 13:49:22 -0000 1.8 @@ -233,3 +233,17 @@ ::tclwebtest::field_select -index $index } + +ad_proc ::twt::count_links { pattern } { + + set count 0 + foreach link_list [link all] { + array set link $link_list + + if { [regexp $pattern $link(url)] } { + incr count + } + } + + return $count +}