Index: openacs-4/packages/imsld/www/imsld-tree.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/www/imsld-tree.tcl,v diff -u -N -r1.11 -r1.12 --- openacs-4/packages/imsld/www/imsld-tree.tcl 27 Sep 2006 14:41:35 -0000 1.11 +++ openacs-4/packages/imsld/www/imsld-tree.tcl 29 Sep 2006 10:28:03 -0000 1.12 @@ -24,7 +24,14 @@ # current role information. # the user must have an active role in the run +set possible_user_roles [imsld::roles::get_user_roles -user_id $user_id -run_id $run_id] +set possible_user_role_names [imsld::roles::get_roles_names -roles_list $possible_user_roles] +# remove   added in the previous proc +regsub -all " " $possible_user_role_names "" $possible_user_role_names +# if there is only one role, set it +set current_role_id [expr { [llength $possible_user_roles] == 1 ? [lindex $possible_user_roles 0] : "" }] + if { ![empty_string_p $current_role_id] } { # a role has been selected, update in db db_dml update_current_role { @@ -38,11 +45,6 @@ } } -set possible_user_roles [imsld::roles::get_user_roles -user_id $user_id -run_id $run_id] -set possible_user_role_names [imsld::roles::get_roles_names -roles_list $possible_user_roles] -# remove   added in the previous proc -regsub -all " " $possible_user_role_names "" $possible_user_role_names - if { ![db_0or1row get_current_role { select map.active_role_id as user_role_id from imsld_run_users_group_rels map, @@ -52,10 +54,11 @@ and ar.object_id_one = iruge.group_id and ar.object_id_two = :user_id and iruge.run_id = :run_id + and map.active_role_id is not null }] } { # generate the first option set possible_user_roles [linsert $possible_user_roles 0 0] - set possible_user_role_names [linsert $possible_user_role_names 0 "<#_ Select role... #>"] + set possible_user_role_names [linsert $possible_user_role_names 0 "[_ imsld.Select_role]"] set user_role_id -1 }