--- loncom/interface/loncreateuser.pm 2003/05/10 23:06:52 1.53 +++ loncom/interface/loncreateuser.pm 2003/07/17 18:10:53 1.57 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Create a user # -# $Id: loncreateuser.pm,v 1.53 2003/05/10 23:06:52 www Exp $ +# $Id: loncreateuser.pm,v 1.57 2003/07/17 18:10:53 matthew Exp $ # # Copyright Michigan State University Board of Trustees # @@ -46,7 +46,7 @@ # 05/10,10/16 Gerd Kortemeyer # 02/11/02 Matthew Hall # -# $Id: loncreateuser.pm,v 1.53 2003/05/10 23:06:52 www Exp $ +# $Id: loncreateuser.pm,v 1.57 2003/07/17 18:10:53 matthew Exp $ ### package Apache::loncreateuser; @@ -54,6 +54,7 @@ package Apache::loncreateuser; use strict; use Apache::Constants qw(:common :http); use Apache::lonnet; +use Apache::loncommon; my $loginscript; # piece of javascript used in two separate instances my $generalrule; @@ -285,12 +286,15 @@ END my $allowed=0; my $delallowed=0; if ($area =~ /^\/(\w+)\/(\d\w+)/ ) { + my ($coursedom,$coursedir) = ($1,$2); + # $1.'_'.$2 is the course id (eg. 103_12345abcef103l3). my %coursedata= &Apache::lonnet::coursedescription($1.'_'.$2); my $carea; if (defined($coursedata{'description'})) { $carea='Course: '.$coursedata{'description'}. - '
Domain: '.$1; + '
Domain: '.$coursedom.(' 'x8). + &Apache::loncommon::syllabuswrapper('Syllabus',$coursedir,$coursedom); } else { $carea='Unavailable course: '.$area; } @@ -344,7 +348,11 @@ END if (($active) && ($allowed)) { $row.= ''; } else { - $row.=' '; + if ($active) { + $row.=' '; + } else { + $row.='expired or revoked'; + } } $row.=''; if ($delallowed) { @@ -723,20 +731,20 @@ END # Revoke roles if ($_=~/^form\.rev/) { if ($_=~/^form\.rev\:([^\_]+)\_([^\_]+)$/) { - $r->print('Revoking '.$2.' in '.$1.': '. + $r->print('Revoking '.$2.' in '.$1.': '. &Apache::lonnet::assignrole($ENV{'form.ccdomain'}, - $ENV{'form.ccuname'},$1,$2,$now).'
'); + $ENV{'form.ccuname'},$1,$2,$now).'

'); if ($2 eq 'st') { $1=~/^\/(\w+)\/(\w+)/; my $cid=$1.'_'.$2; - $r->print('Drop from classlist: '. + $r->print('Drop from classlist: '. &Apache::lonnet::critical('put:'. $ENV{'course.'.$cid.'.domain'}.':'. $ENV{'course.'.$cid.'.num'}.':classlist:'. &Apache::lonnet::escape($ENV{'form.ccuname'}.':'. $ENV{'form.ccdomain'}).'='. &Apache::lonnet::escape($now.':'), - $ENV{'course.'.$cid.'.home'}).'
'); + $ENV{'course.'.$cid.'.home'}).'

'); } } } elsif ($_=~/^form\.del/) { @@ -747,41 +755,44 @@ END if ($2 eq 'st') { $1=~/^\/(\w+)\/(\w+)/; my $cid=$1.'_'.$2; - $r->print('Drop from classlist: '. + $r->print('Drop from classlist: '. &Apache::lonnet::critical('put:'. $ENV{'course.'.$cid.'.domain'}.':'. $ENV{'course.'.$cid.'.num'}.':classlist:'. &Apache::lonnet::escape($ENV{'form.ccuname'}.':'. $ENV{'form.ccdomain'}).'='. &Apache::lonnet::escape($now.':'), - $ENV{'course.'.$cid.'.home'}).'
'); + $ENV{'course.'.$cid.'.home'}).'

'); } } } elsif ($_=~/^form\.act/) { if ($_=~/^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} ? - $ENV{'form.start_'.$1.'_'.$2} : + + my $start = ( $ENV{'form.start_'.$1.'_'.$2.'_'.$3} ? + $ENV{'form.start_'.$1.'_'.$2.'_'.$3} : $now ); - my $end = ( $ENV{'form.end_'.$1.'_'.$2} ? - $ENV{'form.end_'.$1.'_'.$2} : + my $end = ( $ENV{'form.end_'.$1.'_'.$2.'_'.$3} ? + $ENV{'form.end_'.$1.'_'.$2.'_'.$3} : 0 ); my $url='/'.$1.'/'.$2; if ($ENV{'form.sec_'.$1.'_'.$2.'_'.$3}) { $url.='/'.$ENV{'form.sec_'.$1.'_'.$2.'_'.$3}; } # Assign the role and report it - $r->print('Assigning: '.$3.' in '.$url.': '. + $r->print('Assigning: '.$3.' in '.$url. + ($start?', starting '.localtime($start):''). + ($end?', ending '.localtime($end):'').': '. &Apache::lonnet::assignrole( $ENV{'form.ccdomain'},$ENV{'form.ccuname'}, $url,$3,$end,$start). - '
'); + '

'); # Handle students differently if ($3 eq 'st') { $url=~/^\/(\w+)\/(\w+)/; my $cid=$1.'_'.$2; - $r->print('Add to classlist: '. + $r->print('Add to classlist: '. &Apache::lonnet::critical( 'put:'.$ENV{'course.'.$cid.'.domain'}.':'. $ENV{'course.'.$cid.'.num'}.':classlist:'. @@ -790,7 +801,7 @@ END $ENV{'form.ccdomain'} ).'='. &Apache::lonnet::escape($end.':'.$start), $ENV{'course.'.$cid.'.home'}) - .'
'); + .'

'); } } elsif ($_=~/^form\.act\_([^\_]+)\_([^\_]+)$/) { # Activate roles for sections with two id numbers @@ -804,10 +815,12 @@ END my $url='/'.$1.'/'; # Assign the role and report it. $r->print('Assigning: '.$2.' in '.$url.': '. + ($start?', starting '.localtime($start):''). + ($end?', ending '.localtime($end):'').': '. &Apache::lonnet::assignrole( $ENV{'form.ccdomain'},$ENV{'form.ccuname'}, $url,$2,$end,$start) - .'
'); + .'

'); } } } # End of foreach (keys(%ENV))