--- loncom/auth/lonroles.pm 2010/06/02 16:27:43 1.231.4.14 +++ loncom/auth/lonroles.pm 2010/08/20 03:40:01 1.231.4.15 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # User Roles Screen # -# $Id: lonroles.pm,v 1.231.4.14 2010/06/02 16:27:43 raeburn Exp $ +# $Id: lonroles.pm,v 1.231.4.15 2010/08/20 03:40:01 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -225,7 +225,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); } } @@ -924,7 +933,7 @@ sub gather_roles { if ($role =~ /^cr\//) { my ($rdummy,$rdomain,$rauthor,$rrole)=split(/\//,$role); if ($tremark) { $tremark.='
'; } - $tremark.=&mt('Defined by [_1] at [_2].',$rauthor,$rdomain); + $tremark.=&mt('Customrole defined by [_1].',$rauthor.':'.$rdomain); } $trole=Apache::lonnet::plaintext($role); my $ttype;