[LON-CAPA-cvs] cvs: loncom /interface loncreateuser.pm
albertel
lon-capa-cvs@mail.lon-capa.org
Fri, 02 Jul 2004 10:03:44 -0000
albertel Fri Jul 2 06:03:44 2004 EDT
Modified files:
/loncom/interface loncreateuser.pm
Log:
- strip no word characters from sections (BUG#3077)
Index: loncom/interface/loncreateuser.pm
diff -u loncom/interface/loncreateuser.pm:1.82 loncom/interface/loncreateuser.pm:1.83
--- loncom/interface/loncreateuser.pm:1.82 Fri May 7 18:04:16 2004
+++ loncom/interface/loncreateuser.pm Fri Jul 2 06:03:44 2004
@@ -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 @@
}
}
} 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 @@
$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):'').': <b>'.
&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>');
} 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):'').': <b>'.
&Apache::lonnet::assignrole(
$ENV{'form.ccdomain'},$ENV{'form.ccuname'},
- $url,$3,$end,$start).
+ $url,$three,$end,$start).
'</b><br>');
# 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').': <b>'.
&Apache::lonnet::critical(
'put:'.$ENV{'course.'.$cid.'.domain'}.':'.