--- loncom/interface/loncreateuser.pm 2004/01/17 18:12:05 1.77 +++ loncom/interface/loncreateuser.pm 2004/08/24 23:50:15 1.86 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Create a user # -# $Id: loncreateuser.pm,v 1.77 2004/01/17 18:12:05 www Exp $ +# $Id: loncreateuser.pm,v 1.86 2004/08/24 23:50:15 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -123,10 +123,7 @@ sub print_username_entry_form { my $defdom=$ENV{'request.role.domain'}; my @domains = &Apache::loncommon::get_domains(); my $domform = &Apache::loncommon::select_dom_form($defdom,'ccdomain'); - my $bodytag =&Apache::loncommon::bodytag( - 'Create Users, Change User Privileges'). - &Apache::loncommon::help_open_faq(282). - &Apache::loncommon::help_open_bug('Instructor Interface'); + my $bodytag =&Apache::loncommon::bodytag('Create Users, Change User Privileges').&Apache::loncommon::help_open_menu('',undef,undef,'',282,'Instructor Interface'); my $selscript=&Apache::loncommon::studentbrowser_javascript(); my $sellink=&Apache::loncommon::selectstudent_link ('crtuser','ccuname','ccdomain'); @@ -177,8 +174,8 @@ sub print_user_modification_page { my $ccuname=$ENV{'form.ccuname'}; my $ccdomain=$ENV{'form.ccdomain'}; - $ccuname=~s/\W//gs; - $ccdomain=~s/\W//gs; + $ccuname=~s/[\W|_]//gs; + $ccdomain=~s/[\W|_]//gs; unless (($ccuname) && ($ccdomain)) { &print_username_entry_form($r); @@ -250,7 +247,7 @@ ENDFORMINFO ''."\n". &Apache::loncommon::home_server_option_list($ccdomain); - my %lt=&Apache::lonlocal::texthash( + my %lt=&Apache::lonlocal::texthash( 'cnu' => "Create New User", 'nu' => "New User", 'id' => "in domain", @@ -263,6 +260,7 @@ ENDFORMINFO 'hs' => "Home Server", 'lg' => "Login Data" ); + my $genhelp=&Apache::loncommon::help_open_topic('Generation'); $r->print(<$lt{'cnu'} @@ -281,7 +279,7 @@ $loginscript $lt{'ln'} -$lt{'gen'} +$lt{'gen'}$genhelp $lt{'idsn'}

@@ -295,7 +293,7 @@ $lt{'hs'}: '; + } else { + $row.=' '; + } + $row.=''; if ($delallowed) { $row.= ''; } else { @@ -467,8 +489,24 @@ END ''.($role_end_time ?localtime($role_end_time) : ' ' ) ."\n"; - $r->print($row); + $sortrole{$sortkey}=$envkey; + $roletext{$envkey}=$row; + $roleclass{$envkey}=$class; + #$r->print($row); } # end of foreach (table building loop) + foreach my $type ('Construction Space','Course','Domain','System','Unknown') { + my $output; + foreach my $which (sort {uc($a) cmp uc($b)} (keys(%sortrole))) { + if ($roleclass{$sortrole{$which}} =~ /^\Q$type\E/) { + $output.=$roletext{$sortrole{$which}}; + } + } + if (defined($output)) { + $r->print("". + "".&mt($type).""); + } + $r->print($output); + } $r->print(''); } # End of unless my $currentauth=&Apache::lonnet::queryauthenticate($ccuname,$ccdomain); @@ -585,7 +623,7 @@ ENDOTHERAUTHS 'rol' => "Role", 'ext' => "Extent", 'sta' => "Start", - 'end' => "End". + 'end' => "End", 'cau' => "Co-Author", 'ssd' => "Set Start Date", 'sed' => "Set End Date" @@ -595,13 +633,13 @@ ENDOTHERAUTHS - + - - @@ -923,12 +961,34 @@ END $ENV{'course.'.$cid.'.home'}).'
'); } } + } elsif ($_=~/^form\.ren/) { + if ($_=~/^form\.ren\:([^\_]+)\_([^\_]+)$/) { + my $result=&Apache::lonnet::assignrole($ENV{'form.ccdomain'}, + $ENV{'form.ccuname'},$1,$2,0,$now); + $r->print(&mt('Re-Enabling [_1] in [_2]: [_3]', + $2,$1,$result).'
'); + if ($2 eq 'st') { + $1=~/^\/(\w+)\/(\w+)/; + my $cid=$1.'_'.$2; + $r->print(&mt('Add to 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'}) + .'
'); + } + } } 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}; } @@ -940,38 +1000,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'}.':'. @@ -1235,6 +1296,7 @@ sub course_level_table { my $bgcol=$thiscourse; $bgcol=~s/[^7-9a-e]//g; $bgcol=substr($bgcol.$bgcol.$bgcol.'ffffff',2,6); + my ($domain)=split(/\//,$thiscourse); foreach ('st','ta','ep','ad','in','cc') { if (&Apache::lonnet::allowed('c'.$_,$thiscourse)) { my $plrole=&Apache::lonnet::plaintext($_); @@ -1242,7 +1304,7 @@ sub course_level_table { - + ENDEXTENT if ($_ ne 'cc') { $table .= <
$lt{'act'}$lt{'rol'}$lt{'ext'} $lt{'sta'}$lt{'end'}
$lt{'cau'} $cudom\_$cuname + $lt{'ssd'} + $lt{'sed'}
$plrole$area$area
Domain: $domain