version 1.82, 2004/05/07 22:04:16
|
version 1.83, 2004/07/02 10:03:44
|
Line 986 END
|
Line 986 END
|
} |
} |
} |
} |
} elsif ($_=~/^form\.act/) { |
} elsif ($_=~/^form\.act/) { |
if |
if ($_=~/^form\.act\_([^\_]+)\_([^\_]+)\_cr_cr_([^\_]+)_(\w+)_([^\_]+)$/) { |
($_=~/^form\.act\_([^\_]+)\_([^\_]+)\_cr_cr_([^\_]+)_(\w+)_([^\_]+)$/) { |
|
# Activate a custom role |
# Activate a custom role |
my $url='/'.$1.'/'.$2; |
my ($one,$two,$three,$four,$five)=($1,$2,$3,$4,$5); |
my $full=$1.'_'.$2.'_cr_cr_'.$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}) { |
if ($ENV{'form.sec_'.$full}) { |
$url.='/'.$ENV{'form.sec_'.$full}; |
$url.='/'.$ENV{'form.sec_'.$full}; |
} |
} |
Line 1002 END
|
Line 1003 END
|
$ENV{'form.end_'.$full} : |
$ENV{'form.end_'.$full} : |
0 ); |
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):''). |
($start?', '.&mt('starting').' '.localtime($start):''). |
($end?', ending '.localtime($end):'').': <b>'. |
($end?', ending '.localtime($end):'').': <b>'. |
&Apache::lonnet::assigncustomrole( |
&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). |
'</b><br>'); |
'</b><br>'); |
} elsif ($_=~/^form\.act\_([^\_]+)\_([^\_]+)\_([^\_]+)$/) { |
} elsif ($_=~/^form\.act\_([^\_]+)\_([^\_]+)\_([^\_]+)$/) { |
# Activate roles for sections with 3 id numbers |
# Activate roles for sections with 3 id numbers |
# set start, end times, and the url for the class |
# set start, end times, and the url for the class |
|
my ($one,$two,$three)=($1,$2,$3); |
my $start = ( $ENV{'form.start_'.$1.'_'.$2.'_'.$3} ? |
my $start = ( $ENV{'form.start_'.$one.'_'.$two.'_'.$three} ? |
$ENV{'form.start_'.$1.'_'.$2.'_'.$3} : |
$ENV{'form.start_'.$one.'_'.$two.'_'.$three} : |
$now ); |
$now ); |
my $end = ( $ENV{'form.end_'.$1.'_'.$2.'_'.$3} ? |
my $end = ( $ENV{'form.end_'.$one.'_'.$two.'_'.$three} ? |
$ENV{'form.end_'.$1.'_'.$2.'_'.$3} : |
$ENV{'form.end_'.$one.'_'.$two.'_'.$three} : |
0 ); |
0 ); |
my $url='/'.$1.'/'.$2; |
my $url='/'.$one.'/'.$two; |
if ($ENV{'form.sec_'.$1.'_'.$2.'_'.$3}) { |
$ENV{'form.sec_'.$one.'_'.$two.'_'.$three}=~s/\W//g; |
$url.='/'.$ENV{'form.sec_'.$1.'_'.$2.'_'.$3}; |
if ($ENV{'form.sec_'.$one.'_'.$two.'_'.$three}) { |
|
$url.='/'.$ENV{'form.sec_'.$one.'_'.$two.'_'.$three}; |
} |
} |
# Assign the role and report it |
# 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):''). |
($start?', '.&mt('starting').' '.localtime($start):''). |
($end?', '.&mt('ending').' '.localtime($end):'').': <b>'. |
($end?', '.&mt('ending').' '.localtime($end):'').': <b>'. |
&Apache::lonnet::assignrole( |
&Apache::lonnet::assignrole( |
$ENV{'form.ccdomain'},$ENV{'form.ccuname'}, |
$ENV{'form.ccdomain'},$ENV{'form.ccuname'}, |
$url,$3,$end,$start). |
$url,$three,$end,$start). |
'</b><br>'); |
'</b><br>'); |
# Handle students differently |
# Handle students differently |
if ($3 eq 'st') { |
if ($three eq 'st') { |
$url=~/^\/(\w+)\/(\w+)/; |
$url=~/^\/(\w+)\/(\w+)/; |
my $cid=$1.'_'.$2; |
my $cid=$one.'_'.$two; |
$r->print(&mt('Add to classlist').': <b>'. |
$r->print(&mt('Add to classlist').': <b>'. |
&Apache::lonnet::critical( |
&Apache::lonnet::critical( |
'put:'.$ENV{'course.'.$cid.'.domain'}.':'. |
'put:'.$ENV{'course.'.$cid.'.domain'}.':'. |