--- loncom/interface/lonuserutils.pm 2015/08/05 18:47:21 1.171 +++ loncom/interface/lonuserutils.pm 2015/08/09 21:43:18 1.172 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Utility functions for managing LON-CAPA user accounts # -# $Id: lonuserutils.pm,v 1.171 2015/08/05 18:47:21 raeburn Exp $ +# $Id: lonuserutils.pm,v 1.172 2015/08/09 21:43:18 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -4297,7 +4297,7 @@ sub upfile_drop_add { my $newuserdom = $env{'request.role.domain'}; map { $cancreate{$_} = &can_create_user($newuserdom,$context,$_); } keys(%longtypes); # Get new users list - my (%existinguser,%userinfo,%disallow,%rulematch,%inst_results,%idinst_results,%alerts,%checkuname); + my (%existinguser,%userinfo,%disallow,%rulematch,%inst_results,%alerts,%checkuname); my $counter = -1; foreach my $line (@userdata) { $counter ++; @@ -4507,7 +4507,7 @@ sub upfile_drop_add { } $checkid = 1; $newuser = 1; - $checkuname{$username.':'.$newuserdom} = { 'newuser' => 1, 'id' => 1 }; + $checkuname{$username.':'.$newuserdom} = { 'newuser' => $newuser, 'id' => $id }; } else { if ($context eq 'course' || $context eq 'author') { if ($userdomain eq $domain ) { @@ -4566,34 +4566,41 @@ sub upfile_drop_add { } # end of foreach (@userdata) if ($counter > -1) { my $total = $counter + 1; - my %prog_state = &Apache::lonhtmlcommon::Create_PrgWin($r,$total); my %checkids; - if (keys(%existinguser)) { - foreach my $dom (keys(%existinguser)) { - if (ref($existinguser{$dom}) eq 'HASH') { - my %idhash = &Apache::lonnet::idrget($dom,keys(%{$existinguser{$dom}})); - foreach my $username (keys(%{$existinguser{$dom}})) { - if ($idhash{$username} ne $existinguser{$dom}{$username}) { - $checkids{$username.':'.$dom} = { 'id' => $existinguser{$dom}{$username} }; + if ((keys(%existinguser)) || (keys(%checkuname))) { + $r->print(&mt('Please be patient -- checking for institutional data ...')); + $r->rflush(); + if (keys(%existinguser)) { + foreach my $dom (keys(%existinguser)) { + if (ref($existinguser{$dom}) eq 'HASH') { + my %idhash = &Apache::lonnet::idrget($dom,keys(%{$existinguser{$dom}})); + foreach my $username (keys(%{$existinguser{$dom}})) { + if ($idhash{$username} ne $existinguser{$dom}{$username}) { + $checkids{$username.':'.$dom} = { + 'id' => $existinguser{$dom}{$username}, + }; + } + } + if (keys(%checkids)) { + &Apache::loncommon::user_rule_check(\%checkids,{ 'id' => 1 }, + \%alerts,\%rulematch, + \%inst_results,\%curr_rules, + \%got_rules); } - } - if (keys(%checkids)) { - &Apache::loncommon::user_rule_check(\%checkids,{ 'id' => 1 }, - \%alerts,\%rulematch, - \%idinst_results,\%curr_rules, - \%got_rules); } } } + if (keys(%checkuname)) { + &Apache::loncommon::user_rule_check(\%checkuname,{ 'username' => 1, 'id' => 1, }, + \%alerts,\%rulematch,\%inst_results, + \%curr_rules,\%got_rules); + } + $r->print(' '.&mt('done').'

'); + $r->rflush(); } - if (keys(%checkuname)) { - &Apache::loncommon::user_rule_check(\%checkuname,{ 'username' => 1 }, - \%alerts,\%rulematch,\%inst_results, - \%curr_rules,\%got_rules); - } + my %prog_state = &Apache::lonhtmlcommon::Create_PrgWin($r,$total); $r->print(''); + &Apache::lonhtmlcommon::Increment_PrgWin($r,\%prog_state,'last user'); } # end of loop + $r->print(''); &Apache::lonhtmlcommon::Close_PrgWin($r,\%prog_state); } # Flush the course logs so reverse user roles immediately updated