--- loncom/interface/loncreateuser.pm 2004/05/07 22:04:16 1.82 +++ loncom/interface/loncreateuser.pm 2004/07/02 10:03:44 1.83 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Create a user # -# $Id: loncreateuser.pm,v 1.82 2004/05/07 22:04:16 albertel Exp $ +# $Id: loncreateuser.pm,v 1.83 2004/07/02 10:03:44 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -986,11 +986,12 @@ END } } } elsif ($_=~/^form\.act/) { - if -($_=~/^form\.act\_([^\_]+)\_([^\_]+)\_cr_cr_([^\_]+)_(\w+)_([^\_]+)$/) { + if ($_=~/^form\.act\_([^\_]+)\_([^\_]+)\_cr_cr_([^\_]+)_(\w+)_([^\_]+)$/) { # Activate a custom role - my $url='/'.$1.'/'.$2; - my $full=$1.'_'.$2.'_cr_cr_'.$3.'_'.$4.'_'.$5; + my ($one,$two,$three,$four,$five)=($1,$2,$3,$4,$5); + my $url='/'.$one.'/'.$two; + my $full=$one.'_'.$two.'_cr_cr_'.$three.'_'.$four.'_'.$five; + $ENV{'form.sec_'.$full}=~s/\W//g; if ($ENV{'form.sec_'.$full}) { $url.='/'.$ENV{'form.sec_'.$full}; } @@ -1002,38 +1003,39 @@ END $ENV{'form.end_'.$full} : 0 ); - $r->print(&mt('Assigning custom role').' "'.$5.'" by '.$4.'@'.$3.' in '.$url. + $r->print(&mt('Assigning custom role').' "'.$five.'" by '.$four.'@'.$three.' in '.$url. ($start?', '.&mt('starting').' '.localtime($start):''). ($end?', ending '.localtime($end):'').': '. &Apache::lonnet::assigncustomrole( - $ENV{'form.ccdomain'},$ENV{'form.ccuname'},$url,$3,$4,$5,$end,$start). + $ENV{'form.ccdomain'},$ENV{'form.ccuname'},$url,$three,$four,$five,$end,$start). '
'); } elsif ($_=~/^form\.act\_([^\_]+)\_([^\_]+)\_([^\_]+)$/) { # Activate roles for sections with 3 id numbers # set start, end times, and the url for the class - - my $start = ( $ENV{'form.start_'.$1.'_'.$2.'_'.$3} ? - $ENV{'form.start_'.$1.'_'.$2.'_'.$3} : + my ($one,$two,$three)=($1,$2,$3); + my $start = ( $ENV{'form.start_'.$one.'_'.$two.'_'.$three} ? + $ENV{'form.start_'.$one.'_'.$two.'_'.$three} : $now ); - my $end = ( $ENV{'form.end_'.$1.'_'.$2.'_'.$3} ? - $ENV{'form.end_'.$1.'_'.$2.'_'.$3} : + my $end = ( $ENV{'form.end_'.$one.'_'.$two.'_'.$three} ? + $ENV{'form.end_'.$one.'_'.$two.'_'.$three} : 0 ); - my $url='/'.$1.'/'.$2; - if ($ENV{'form.sec_'.$1.'_'.$2.'_'.$3}) { - $url.='/'.$ENV{'form.sec_'.$1.'_'.$2.'_'.$3}; + my $url='/'.$one.'/'.$two; + $ENV{'form.sec_'.$one.'_'.$two.'_'.$three}=~s/\W//g; + if ($ENV{'form.sec_'.$one.'_'.$two.'_'.$three}) { + $url.='/'.$ENV{'form.sec_'.$one.'_'.$two.'_'.$three}; } # Assign the role and report it - $r->print(&mt('Assigning').' '.$3.' in '.$url. + $r->print(&mt('Assigning').' '.$three.' in '.$url. ($start?', '.&mt('starting').' '.localtime($start):''). ($end?', '.&mt('ending').' '.localtime($end):'').': '. &Apache::lonnet::assignrole( $ENV{'form.ccdomain'},$ENV{'form.ccuname'}, - $url,$3,$end,$start). + $url,$three,$end,$start). '
'); # Handle students differently - if ($3 eq 'st') { + if ($three eq 'st') { $url=~/^\/(\w+)\/(\w+)/; - my $cid=$1.'_'.$2; + my $cid=$one.'_'.$two; $r->print(&mt('Add to classlist').': '. &Apache::lonnet::critical( 'put:'.$ENV{'course.'.$cid.'.domain'}.':'.