--- loncom/interface/loncreateuser.pm 2004/12/28 05:01:44 1.92 +++ loncom/interface/loncreateuser.pm 2005/01/11 22:12:22 1.98 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Create a user # -# $Id: loncreateuser.pm,v 1.92 2004/12/28 05:01:44 raeburn Exp $ +# $Id: loncreateuser.pm,v 1.98 2005/01/11 22:12:22 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -73,10 +73,9 @@ my $authformint; my $authformfsys; my $authformloc; -BEGIN { - $ENV{'SERVER_NAME'}=~/(\w+\.\w+)$/; - my $krbdefdom=$1; - $krbdefdom=~tr/a-z/A-Z/; +sub initialize_authen_forms { + my ($krbdefdom)=( $ENV{'SERVER_NAME'}=~/(\w+\.\w+)$/); + $krbdefdom= uc($krbdefdom); my %param = ( formname => 'document.cu', kerb_def_dom => $krbdefdom ); @@ -174,8 +173,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//g; + $ccdomain=~s/\W//g; unless (($ccuname) && ($ccdomain)) { &print_username_entry_form($r); @@ -397,6 +396,7 @@ ENDFORMINFO 'lg' => "Login Data" ); my $genhelp=&Apache::loncommon::help_open_topic('Generation'); + &initialize_authen_forms(); $r->print(<$lt{'cnu'} @@ -674,6 +674,7 @@ END $currentauth=~/^localauth:/ ) { # bad authentication scheme if (&Apache::lonnet::allowed('mau',$ENV{'request.role.domain'})) { + &initialize_authen_forms(); my %lt=&Apache::lonlocal::texthash( 'err' => "ERROR", 'uuas' => "This user has an unrecognized authentication scheme", @@ -715,6 +716,7 @@ ENDBADAUTH } else { # Authentication type is valid my $authformcurrent=''; my $authform_other=''; + &initialize_authen_forms(); if ($currentauth=~/^krb(4|5):/) { $authformcurrent=$authformkrb; $authform_other="

$authformint

\n". @@ -1174,7 +1176,7 @@ END $r->print(&commit_customrole($securl,$three,$four,$five,$start,$end)); } } - } elsif ($_=~/^form\.act\_([^\_]+)\_([^\_]+)\_([^\_]+)$/) { + } elsif ($_=~/^form\.act\_([^\_]+)\_(\w+)\_([^\_]+)$/) { # Activate roles for sections with 3 id numbers # set start, end times, and the url for the class my ($one,$two,$three)=($1,$2,$3); @@ -1235,14 +1237,6 @@ END $r->print(&commit_standardrole($url,$2,$start,$end,$1,undef,'')); } } - # Assign the role and report it. - $r->print(&mt('Assigning').' '.$2.' in '.$url.': '. - ($start?', '.&mt('starting').' '.localtime($start):''). - ($end?', '.&mt('ending').' '.localtime($end):'').': '. - &Apache::lonnet::assignrole( - $ENV{'form.ccdomain'},$ENV{'form.ccuname'}, - $url,$2,$end,$start) - .'
'); } else { $r->print('

'.&mt('ERROR').': '.&mt('Unknown command').' '.$_.'


'); } @@ -1254,7 +1248,7 @@ END } sub commit_customrole { - my ($url,$three,$four,$five,$end,$start) = @_; + my ($url,$three,$four,$five,$start,$end) = @_; my $output = &mt('Assigning custom role').' "'.$five.'" by '.$four.'@'.$three.' in '.$url. ($start?', '.&mt('starting').' '.localtime($start):''). ($end?', ending '.localtime($end):'').': '. @@ -1714,12 +1708,13 @@ sub course_sections { if ($num_sections == 1) { $output = ''."\n"; + $output .= '"multiple" size="'.$multiple.'">'."\n"; foreach (@sections) { $output .= '\n"; }