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 -r1.5 -r1.6 --- openacs-4/etc/install/dotlrn-basic-setup.test 15 Oct 2003 10:08:43 -0000 1.5 +++ openacs-4/etc/install/dotlrn-basic-setup.test 21 Oct 2003 15:06:36 -0000 1.6 @@ -8,6 +8,10 @@ ::twt::log_section "Add the site wide admin to dotLRN" ::twt::dotlrn::add_site_wide_admin $server_url + + ::twt::log_section "Load I18N Messages and enter German locale" + ::twt::acs_lang::load_i18n_messages + ::twt::acs_lang::set_locale de_DE ::twt::log_section "Upload users" ::twt::user::upload_users $server_url Index: openacs-4/etc/install/install.sh =================================================================== RCS file: /usr/local/cvsroot/openacs-4/etc/install/install.sh,v diff -u -r1.19 -r1.20 --- openacs-4/etc/install/install.sh 21 Oct 2003 11:09:17 -0000 1.19 +++ openacs-4/etc/install/install.sh 21 Oct 2003 15:06:36 -0000 1.20 @@ -322,7 +322,9 @@ if parameter_true "$dotlrn_demo_data"; then # Do .LRN demo data setup echo "$0: Starting basic setup of .LRN at $(date)" + cp ${script_path}/tcl/eval-command.tcl $serverroot/www/eval-command.tcl ${tclwebtest_dir}/tclwebtest -config_file $config_file dotlrn-basic-setup.test + rm $serverroot/www/eval-command.tcl fi if parameter_true $crawl_links; then Index: openacs-4/etc/install/tcl/acs-lang-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/etc/install/tcl/acs-lang-procs.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/etc/install/tcl/acs-lang-procs.tcl 21 Oct 2003 15:06:15 -0000 1.1 @@ -0,0 +1,35 @@ +# Procs to support testing OpenACS with Tclwebtest. +# +# Procs for testing the acs-lang (I18N) package +# +# @author Peter Marklund + +namespace eval ::twt::acs_lang {} + +ad_proc ::twt::acs_lang::load_i18n_messages {} { + Enables all locales and loads all message catalogs. +} { + # First enable all locales + ::twt::oacs_eval { + set all_locales [db_list all_locales {select locale from ad_locales}] + + foreach locale $all_locales { + lang::system::locale_set_enabled -locale $locale -enabled_p t + } + } + + # Load all catalog files (also imports en_US, but never mind) + ::twt::oacs_eval lang::catalog::import +} + +ad_proc ::twt::acs_lang::set_locale { locale } { + Change locale of logged in user to locale. +} { + ::twt::log "Changing to locale $locale" + + ::twt::do_request /acs-lang + form find locale + field find ~n site_wide_locale + ::twt::multiple_select_value $locale + form submit +} Index: openacs-4/etc/install/tcl/config-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/etc/install/tcl/config-procs.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/etc/install/tcl/config-procs.tcl 12 Oct 2003 01:10:13 -0000 1.1 +++ openacs-4/etc/install/tcl/config-procs.tcl 21 Oct 2003 15:06:15 -0000 1.2 @@ -15,6 +15,9 @@ # TODO: put variables in twt namespace +global __serverroot +set __serverroot $serverroot + global __server_url set __server_url $server_url @@ -61,3 +64,9 @@ return $__admin_password } + +ad_proc ::twt::config::serverroot { } { + global __serverroot + + return $__serverroot +} 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 --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/etc/install/tcl/eval-command.tcl 21 Oct 2003 15:06:15 -0000 1.1 @@ -0,0 +1,18 @@ +ad_page_contract { + This is a page script to be put on a test server that enables us to execute + arbitrary Tcl commands and retrieve the results. This is a temporary solution + to allow us to access the OpenACS Tcl API for as long as Tclwebtest is not running + inside OpenACS. + + @author Peter Marklund +} { + 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" +} + +set result [eval $tcl_command] + +ns_return 200 text/plain $result Index: openacs-4/etc/install/tcl/test-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/etc/install/tcl/test-procs.tcl,v diff -u -r1.3 -r1.4 --- openacs-4/etc/install/tcl/test-procs.tcl 12 Oct 2003 01:10:13 -0000 1.3 +++ openacs-4/etc/install/tcl/test-procs.tcl 21 Oct 2003 15:06:15 -0000 1.4 @@ -13,6 +13,7 @@ source $script_dir/twt-procs.tcl source $script_dir/user-procs.tcl source $script_dir/admin-procs.tcl +source $script_dir/acs-lang-procs.tcl source $script_dir/dotlrn-procs.tcl source $script_dir/class-procs.tcl source $script_dir/forums-procs.tcl 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 -r1.3 -r1.4 --- openacs-4/etc/install/tcl/twt-procs.tcl 15 Oct 2003 10:08:21 -0000 1.3 +++ openacs-4/etc/install/tcl/twt-procs.tcl 21 Oct 2003 15:06:15 -0000 1.4 @@ -27,6 +27,11 @@ the request a number of times if it fails because of a socket connect problem. } { + # Qualify page_url if necessary + if { [regexp {^/} $page_url] } { + set page_url "[::twt::config::server_url]${page_url}" + } + set retry_count 0 set retry_max 10 set error_p 0 @@ -80,6 +85,17 @@ return $urls_list } +ad_proc ::twt::oacs_eval { tcl_command } { + Execute an OpenACS Tcl API command and return the result. + + @param tcl_command A list where the first item is the the + proc name and the remaining ones are proc arguments +} { + ::twt::do_request "/eval-command?[::http::formatQuery tcl_command $tcl_command]" + + return [response body] +} + ad_proc ::twt::get_random_items_from_list { list number } { Given a list and the lenght of the list to return, return a list with a random subset of items from the input list. @@ -192,3 +208,22 @@ } } } + +ad_proc ::twt::multiple_select_value { value } { + Selects the option with the given value in the current + form widget (workaround since I can only get tclwebtest + to select based on label). +} { + # Get the label from the value + array set current_field [field current] + set field_choices $current_field(choices) + set index 0 + foreach field_choice $field_choices { + if { [string equal $value [lindex $field_choice 0]] } { + break + } + incr index + } + + ::tclwebtest::field_select -index $index +}