--- loncom/auth/lonroles.pm 2010/06/02 15:41:50 1.250 +++ loncom/auth/lonroles.pm 2010/06/03 14:41:07 1.252 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # User Roles Screen # -# $Id: lonroles.pm,v 1.250 2010/06/02 15:41:50 raeburn Exp $ +# $Id: lonroles.pm,v 1.252 2010/06/03 14:41:07 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -223,7 +223,16 @@ sub handler { if ($env{'request.course.id'}) { # Check if user is CC trying to select a course role if ($env{'form.switchrole'}) { - if (!defined($env{'user.role.'.$env{'form.switchrole'}})) { + my $switch_is_active; + if (defined($env{'user.role.'.$env{'form.switchrole'}})) { + my ($start,$end) = split(/\./,$env{'user.role.'.$env{'form.switchrole'}}); + if (!$end || $end > $now) { + if (!$start || $start < $refresh) { + $switch_is_active = 1; + } + } + } + unless ($switch_is_active) { &adhoc_course_role($refresh,$then); } } @@ -1120,10 +1129,12 @@ sub print_rolerows { if (ref($roletext->{$sortrole->{$which}}) eq 'ARRAY') { $output.= &Apache::loncommon::start_data_table_row(). $roletext->{$sortrole->{$which}}->[0]. - &Apache::loncommon::end_data_table_row(). - &Apache::loncommon::continue_data_table_row(). - $roletext->{$sortrole->{$which}}->[1]. &Apache::loncommon::end_data_table_row(); + if ($roletext->{$sortrole->{$which}}->[1] ne '') { + $output .= &Apache::loncommon::continue_data_table_row(). + $roletext->{$sortrole->{$which}}->[1]. + &Apache::loncommon::end_data_table_row(); + } } if ($sortrole->{$which} =~ m-dc\./($match_domain)/-) { if (ref($dcroles) eq 'HASH') {