--- loncom/interface/lonuserutils.pm 2012/02/09 22:06:16 1.136.6.3 +++ loncom/interface/lonuserutils.pm 2012/04/25 21:05:30 1.137 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Utility functions for managing LON-CAPA user accounts # -# $Id: lonuserutils.pm,v 1.136.6.3 2012/02/09 22:06:16 raeburn Exp $ +# $Id: lonuserutils.pm,v 1.137 2012/04/25 21:05:30 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -342,8 +342,7 @@ sub print_upload_manager_header { ."

\n"); $r->print('

'. &mt('Identify fields in uploaded list')."

\n"); - $r->print(&mt('Enter as many fields as you can.').'
'. - &mt('The system will inform you and bring you back to this page, [_1]if the data selected are insufficient to add users.','
')."
\n"); + $r->print(&mt('Enter as many fields as you can.
The system will inform you and bring you back to this page,
if the data selected are insufficient to add users.')."
\n"); $r->print(&hidden_input('action','upload'). &hidden_input('state','got_file'). &hidden_input('associate',''). @@ -1423,7 +1422,8 @@ sub curr_role_permissions { sub my_custom_roles { my ($crstype) = @_; my %returnhash=(); - my %rolehash=&Apache::lonnet::dump('roles'); + my $extra = &Apache::lonnet::freeze_escape({'skipcheck' => 1}); + my %rolehash=&Apache::lonnet::dump('roles',undef,undef,'.',undef,$extra); foreach my $key (keys(%rolehash)) { if ($key=~/^rolesdef\_(\w+)$/) { if ($crstype eq 'Community') { @@ -2322,7 +2322,6 @@ END 'type' => "enroll type/action", 'email' => "e-mail address", 'photo' => "photo", - 'lastlogin' => "last login", 'extent' => "extent", 'pr' => "Proceed", 'ca' => "check all", @@ -2371,9 +2370,6 @@ END push(@cols,'groups'); } push(@cols,'email'); - if ($context eq 'course') { - push(@cols,'lastlogin'); - } } my $rolefilter = $env{'form.showrole'}; @@ -2598,11 +2594,6 @@ END Future => 'Future', Expired => 'Expired', ); - # If this is for a single course get last course "log-in". - my %crslogins; - if ($context eq 'course') { - %crslogins=&Apache::lonnet::dump('nohist_crslastlogin',$cdom,$cnum); - } # Get groups, role, permanent e-mail so we can sort on them if # necessary. foreach my $user (keys(%{$userlist})) { @@ -2751,12 +2742,6 @@ END $in{'end'} = &Apache::lonlocal::locallocaltime($in{'end'}); } } - if ($context eq 'course') { - my $lastlogin = $crslogins{$in{'username'}.':'.$in{'domain'}.':'.$in{'section'}.':'.$role}; - if ($lastlogin ne '') { - $in{'lastlogin'} = &Apache::lonlocal::locallocaltime($lastlogin); - } - } if ($mode eq 'view' || $mode eq 'html' || $mode eq 'autoenroll' || $mode eq 'pickauthor') { $r->print(&Apache::loncommon::start_data_table_row()); my $checkval; @@ -4181,32 +4166,10 @@ sub upfile_drop_add { } $checkid = 1; $newuser = 1; - if ($username =~/^[^\@]+\@[^\@]+$/) { - if ($email eq '') { - $email = $username; - } - my $lc_email; - if ($username eq $email) { - $lc_email = lc($email); - } - my $lc_username = lc($username); - if ($lc_username ne $username) { - if ($username eq $email) { - $email = $lc_username; - } - $username = $lc_username; - $uhome=&Apache::lonnet::homeserver($username,$userdomain); - if ($uhome ne 'no_host') { - $newuser = 0; - } - } - } - } - my $user = $username.':'.$newuserdom; - if ($newuser) { + my $user = $username.':'.$newuserdom; my $checkhash; my $checks = { 'username' => 1 }; - $checkhash->{$user} = { 'newuser' => 1, }; + $checkhash->{$username.':'.$newuserdom} = { 'newuser' => 1, }; &Apache::loncommon::user_rule_check($checkhash,$checks, \%alerts,\%rulematch,\%inst_results,\%curr_rules, \%got_rules); @@ -4228,13 +4191,8 @@ sub upfile_drop_add { } unless ($cancreate{$usertype}) { my $showtype = $longtypes{$usertype}; - if ($usertype eq 'unofficial') { - $r->print('
'. - &mt("[_1]: The user does not exist, and the new user's username must be an e-mail address.",''.$username.'')); - } else { - $r->print('
'. - &mt("[_1]: The user does not exist, and you are not permitted to create users of type: [_2].",''.$username.'',$showtype)); - } + $r->print('
'. + &mt('[_1]: The user does not exist, and you are not permitted to create users of type: [_2].',''.$username.'',$showtype)); next; } } else {