File:  [LON-CAPA] / loncom / enrollment / Enrollment.pm
Revision 1.37: download - view: text, annotated - select for diffs
Sun Dec 23 02:48:50 2007 UTC (16 years, 4 months ago) by raeburn
Branches: MAIN
CVS tags: version_2_6_X, version_2_6_3, version_2_6_2, version_2_6_1, version_2_6_0, version_2_5_99_1, HEAD
Removing $uname which should have been deleted when &mt() was added.

    1: # Automated Enrollment manager
    2: # $Id: Enrollment.pm,v 1.37 2007/12/23 02:48:50 raeburn Exp $
    3: #
    4: # Copyright Michigan State University Board of Trustees
    5: #
    6: # This file is part of the LearningOnline Network with CAPA (LON-CAPA).
    7: #
    8: # LON-CAPA is free software; you can redistribute it and/or modify
    9: # it under the terms of the GNU General Public License as published by
   10: # the Free Software Foundation; either version 2 of the License, or
   11: # (at your option) any later version.
   12: #
   13: # LON-CAPA is distributed in the hope that it will be useful,
   14: # but WITHOUT ANY WARRANTY; without even the implied warranty of
   15: # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   16: # GNU General Public License for more details.
   17: #
   18: # You should have received a copy of the GNU General Public License
   19: # along with LON-CAPA; if not, write to the Free Software
   20: # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
   21: #
   22: # /home/httpd/html/adm/gpl.txt
   23: #
   24: # http://www.lon-capa.org/
   25: #
   26: package LONCAPA::Enrollment;
   27: 
   28: use Apache::loncoursedata;
   29: use Apache::lonnet;
   30: use Apache::loncommon();
   31: use Apache::lonmsg;
   32: use Apache::lonlocal;
   33: use HTML::Entities;
   34: use LONCAPA::Configuration;
   35: use Time::Local;
   36: use lib '/home/httpd/lib/perl';
   37: 
   38: use strict;
   39: 
   40: sub update_LC {
   41:     my ($dom,$crs,$adds,$drops,$startdate,$enddate,$authtype,$autharg,$classesref,$groupref,$logmsg,$newusermsg,$context,$phototypes) = @_; 
   42: # Get institutional code and title of this class
   43:     my %courseinfo = ();
   44:     &get_courseinfo($dom,$crs,\%courseinfo);
   45: # Get current LON-CAPA student enrollment for this class
   46:     my $configvars = &LONCAPA::Configuration::read_conf('loncapa.conf');
   47:     my $cid = $dom."_".$crs;
   48:     my $roster = &Apache::loncoursedata::get_classlist($dom,$crs);
   49:     my $cend = &Apache::loncoursedata::CL_END;
   50:     my $cstart = &Apache::loncoursedata::CL_START; 
   51:     my $stuid=&Apache::loncoursedata::CL_ID;
   52:     my $sec=&Apache::loncoursedata::CL_SECTION;
   53:     my $status=&Apache::loncoursedata::CL_STATUS;
   54:     my $type=&Apache::loncoursedata::CL_TYPE;
   55:     my $lockedtype=&Apache::loncoursedata::CL_LOCKEDTYPE;
   56:     my @localstudents = ();
   57:     my @futurestudents = ();
   58:     my @activestudents = ();
   59:     my @excludedstudents = ();
   60:     my $currlist;
   61:     foreach my $uname (keys %{$roster} ) {
   62:         if ($uname =~ m/^(.+):$dom$/) {
   63:             if ($$roster{$uname}[$status] eq "Active") {
   64:                 push @activestudents, $1;
   65:                 @{$$currlist{$1}} = @{$$roster{$uname}};
   66:                 push @localstudents, $1;
   67:             } elsif ( ($$roster{$uname}[$cstart] > time)  && ($$roster{$uname}[$cend] > time || $$roster{$uname}[$cend] == 0 || $$roster{$uname}[$cend] eq '') ) {
   68:                 push @futurestudents, $1;
   69:                 @{$$currlist{$1}} = @{$$roster{$uname}};
   70:                 push @localstudents, $1;
   71:             } elsif ($$roster{$uname}[$lockedtype] == 1) {
   72:                 push @excludedstudents, $1;
   73:             }
   74:         }
   75:     }
   76:     my $linefeed = '';
   77:     my $addresult = '';
   78:     my $dropresult = '';
   79:     my $switchresult = '';
   80:     my $photoresult = '';
   81:     if ($context eq "updatenow") {
   82:         $linefeed = "</li>\n<li>"; 
   83:     } elsif ($context eq "automated") {
   84:         $linefeed = "\n";
   85:     }
   86:     my $enrollcount = 0;
   87:     my $dropcount = 0;
   88:     my $switchcount = 0;
   89: 
   90: # Get role names
   91:     my %longroles = ();
   92:     open(FILE,"<$$configvars{'lonTabDir'}.'/rolesplain.tab");
   93:     my @rolesplain = <FILE>;
   94:     close(FILE);
   95:     foreach (@rolesplain) {
   96:         if ($_ =~ /^(st|ta|ex|ad|in|cc):([\w\s]+)$/) {
   97:             $longroles{$1} = $2;
   98:         }
   99:     }
  100: 
  101:     srand( time() ^ ($$ + ($$ << 15))  ); # Seed rand in case initial passwords have to be generated for new users.
  102: 
  103: # Get mapping of IDs to usernames for current LON-CAPA student enrollment for this class 
  104:     my @LCids = ();
  105:     my %unameFromLCid = ();
  106:     foreach my $uname (sort keys %{$currlist}) {
  107:         my $stuID = $$currlist{$uname}[$stuid];
  108:         if (!grep/^$stuID$/,@LCids) {
  109:             push @LCids, $stuID;
  110:             @{$unameFromLCid{$stuID}} = ();
  111:         }
  112:         push @{$unameFromLCid{$stuID}},$uname;
  113:     }
  114:  
  115: # Get latest institutional enrollment for this class.
  116:     my %allenrolled = ();
  117:     my @reg_students = ();
  118:     my %place = ();
  119:     $place{'autharg'} = &CL_autharg();
  120:     $place{'authtype'} = &CL_authtype();
  121:     $place{'email'} = &CL_email();
  122:     $place{'enddate'} = &CL_enddate();
  123:     $place{'firstname'} = &CL_firstname();
  124:     $place{'generation'} = &CL_generation();
  125:     $place{'groupID'} = &CL_groupID();
  126:     $place{'lastname'} = &CL_lastname();
  127:     $place{'middlename'} = &CL_middlename();
  128:     $place{'startdate'} = &CL_startdate();
  129:     $place{'studentID'} = &CL_studentID();
  130:     my %ucount = ();
  131:     my %enrollinfo = ();
  132:     foreach my $class (@{$classesref}) {
  133:         my %enrolled = ();
  134:         &parse_classlist($$configvars{'lonDaemons'},$dom,$crs,$class,\%place,$$groupref{$class},\%enrolled);
  135:         foreach my $uname (sort keys %enrolled ) {
  136:             if (!grep/^$uname$/,@reg_students) {
  137:                 push @reg_students,$uname;
  138:                 $ucount{$uname} = 0;
  139:                 @{$allenrolled{$uname}} = ();
  140:             }
  141:             @{$allenrolled{$uname}[$ucount{$uname}]} = @{$enrolled{$uname}};
  142:             $ucount{$uname} ++;
  143:         }
  144:     }
  145: 
  146: # Check for multiple sections for a single student 
  147:     my @okusers = ();
  148:     foreach my $uname (@reg_students)  {
  149:         if (grep/^$uname$/,@excludedstudents) {
  150:             $$logmsg .= &mt('No re-enrollment for [_1] - user was previously manually unenrolled and locked.',$uname).$linefeed;
  151:         } elsif (@{$allenrolled{$uname}} > 1) {
  152:             my @sections = ();
  153:             my $saved;
  154:             for (my $i=0; $i<@{$allenrolled{$uname}}; $i++) {
  155:                 my @stuinfo = @{$allenrolled{$uname}[$i]};
  156:                 my $secnum = $stuinfo[ $place{'groupID'} ];
  157:                 unless ($secnum eq '') {
  158:                     unless (grep/^$secnum$/,@sections) {
  159:                         $saved = $i; 
  160:                         push @sections,$secnum;
  161:                     }
  162:                 }
  163:             }
  164:             if (@sections == 0) {
  165:                 @{$enrollinfo{$uname}} = @{$allenrolled{$uname}[0]};
  166:                 push @okusers, $uname;
  167:             }
  168:             elsif (@sections == 1) {
  169:                 @{$enrollinfo{$uname}} = @{$allenrolled{$uname}[$saved]};
  170:                 push @okusers, $uname;
  171:             }
  172:             elsif (@sections > 1) {
  173:                 $$logmsg .=  &mt('[_1] appears in classlists for more than one section of this course, i.e. in sections: ',$uname);
  174:                 foreach (@sections) {
  175:                     $$logmsg .= " $_,";
  176:                 }
  177:                 chop($$logmsg);
  178:                 $$logmsg .= '. '.&mt('Because of this ambiguity, no enrollment action was taken for this student.').$linefeed;
  179:             }
  180:         } else {
  181:             @{$enrollinfo{$uname}} = @{$allenrolled{$uname}[0]};
  182:             push @okusers, $uname;
  183:         }
  184:     }
  185: # Get mapping of student IDs to usernames for users in institutional data for this class  
  186:     my @allINids = ();
  187:     my %unameFromINid = ();
  188:     foreach my $uname (@okusers) {
  189:         $enrollinfo{$uname}[ $place{'studentID'} ] =~ tr/A-Z/a-z/;
  190:         my $stuID = $enrollinfo{$uname}[ $place{'studentID'} ];
  191:         if (grep/^$stuID$/,@allINids)  {
  192:             push @{$unameFromINid{$stuID}},$uname;
  193:         } else {
  194:             push @allINids, $stuID;
  195:             @{$unameFromINid{$stuID}} = $uname; 
  196:         }
  197:     }
  198: 
  199: # Explicitly allow access to creation/modification of students if called as an automated process.
  200:     if ($context eq 'automated') {
  201:         $env{'allowed.cst'}='F';
  202:     }
  203: 
  204: # Compare IDs with existing LON-CAPA enrollment for this class
  205:     foreach my $uname (@okusers) {
  206:         unless ($uname eq '') {
  207:             my %uidhash=&Apache::lonnet::idrget($dom,$uname);
  208:             my @stuinfo = @{$enrollinfo{$uname}};
  209:             my $access = '';
  210:             if (grep/^$uname$/,@localstudents) {
  211: # Check for studentID changes
  212:                 if ( ($uidhash{$uname}) && ($uidhash{$uname} !~ /error\:/) )  {
  213:                     unless ( ($uidhash{$uname}) eq ($stuinfo[ $place{studentID} ]) ) {
  214:                         $$logmsg .= &mt('Change in ID for [_1]. StudentID in LON-CAPA system is [_2]; StudentID in institutional data is [_3].',$uname,$uidhash{$uname},$stuinfo[ $place{studentID} ]).$linefeed; 
  215:                     }
  216:                 }
  217: # Check for switch from manual to auto
  218:                 unless (($$currlist{$uname}[$type] eq "auto") || ($$currlist{$uname}[$lockedtype] eq "1") || (!$adds) ) {
  219: # drop manually added student
  220:                     my $drop_reply = &Apache::lonnet::modifystudent($dom,$uname,'','','',undef,undef,undef,undef,$$currlist{$uname}[$sec],time,undef,undef,undef,undef,'auto','',$cid);
  221: # re-enroll as auto student
  222:                     if ($drop_reply !~ /^ok/) {
  223:                             $$logmsg .= &mt('An error occured during the attempt to convert [_1] from a manual type to an auto type student - [_2].',$uname,$drop_reply).$linefeed;
  224:                     } else {
  225: # re-enroll as auto student
  226:                         my ($auth,$authparam,$first,$middle,$last,$gene,$usec,$end,$start,$emailaddr,$pid,$emailenc);
  227:                         &prepare_add($authtype,$autharg,$enddate,$startdate,\@stuinfo,\%place,\$dom,\$uname,\$auth,\$authparam,\$first,\$middle,\$last,\$gene,\$usec,\$end,\$start,\$emailaddr,\$pid,\$emailenc);
  228:                         if ($$currlist{$uname}[$sec] ne $usec) {
  229:                             my $showoldsec = $$currlist{$uname}[$sec];
  230:                             if ($$currlist{$uname}[$sec] eq '') {
  231:                                 $showoldsec = &mt('none');
  232:                             }
  233:                             my $showsec = $usec;
  234:                             if ($usec eq '') {
  235:                                 $showsec = &mt('none');
  236:                             }
  237:                             $switchresult .= &mt("Section for [_1] switched from '[_2]' to '[_3]'.",$uname,$showoldsec,$showsec).$linefeed;
  238:                             if ($context eq 'automated') {
  239:                                 $$logmsg .= &mt("Section switch for [_1] from '[_2]' to '[_3]'.",$uname,$showoldsec,$usec).$linefeed;
  240:                             }
  241:                             $switchcount ++;
  242:                         }
  243:                         &execute_add($context,'switchtype',$uname,$dom,$auth,$authparam,$first,$middle,$last,$gene,$pid,$usec,$end,$start,$emailenc,$cid,\$addresult,\$enrollcount,$linefeed,$logmsg);
  244:                     }
  245:                 } 
  246: # Check for section changes
  247:                 if ($$currlist{$uname}[$sec] eq $stuinfo[ $place{groupID} ]) {
  248: # Check for access date changes for students with access starting in the future.
  249:                     if ( (grep/^$uname$/,@futurestudents) && ($$currlist{$uname}[$type] eq "auto") && ($adds == 1) ) {
  250:                         my $datechange = &datechange_check($$currlist{$uname}[$cstart],$$currlist{$uname}[$cend],$startdate,$enddate);
  251:                         if ($datechange) {
  252:                             my $modify_access_result = &Apache::lonnet::modify_student_enrollment($dom,$uname,undef,undef,undef,undef,undef,$stuinfo[ $place{groupID} ],$enddate,$startdate,'auto','',$cid);
  253:                             $access = &showaccess($enddate,$startdate);
  254:                             if ($modify_access_result =~ /^ok/) {
  255:                                 $$logmsg .= &mt('Change in access dates for [_1].',$uname).$access.$linefeed;
  256:                             } else {
  257:                                 $$logmsg .= &mt('Error when attempting to change start and/or end access dates for [_1] in section: [_2] -error [_3].',$uname,$stuinfo[$place{groupID}],$modify_access_result).$linefeed;
  258:                             }
  259:                         }
  260:                     }
  261:                 } else {
  262:                     if ( ($$currlist{$uname}[$type] eq "auto") && ($adds == 1) ) {
  263: # Delete from roles.db for current section
  264:                         my $expiretime = time;
  265:                         my $uurl='/'.$cid;
  266:                         $uurl=~s/\_/\//g;
  267:                         if ($$currlist{$uname}[$sec]) {
  268:                             $uurl.='/'.$$currlist{$uname}[$sec];
  269:                         }
  270:                         my $expire_role_result = &Apache::lonnet::assignrole($dom,$uname,$uurl,'st',$expiretime);
  271:                         if ($expire_role_result eq 'ok') {
  272:                             my $modify_section_result;
  273:                             if (grep/^$uname$/,@activestudents) {
  274:                                 $modify_section_result = &Apache::lonnet::modify_student_enrollment($dom,$uname,undef,undef,undef,undef,undef,$stuinfo[ $place{groupID} ],$$currlist{$uname}[$cend],$$currlist{$uname}[$cstart],'auto','',$cid);
  275:                             } else {
  276:                                 $modify_section_result =  &Apache::lonnet::modify_student_enrollment($dom,$uname,undef,undef,undef,undef,undef,$stuinfo[ $place{groupID} ],$enddate,$startdate,'auto','',$cid);
  277:                                 $access =  &showaccess($enddate,$startdate);
  278:                             }
  279:                             if ($modify_section_result =~ /^ok/) {
  280:                                 $switchresult .= &mt("Section for [_1] switched from old section: '[_2]' to new section: '[_3]'.",$uname,$$currlist{$uname}[$sec],$stuinfo[ $place{groupID} ]).$access.$linefeed;
  281:                                 if ($context eq 'automated') {
  282:                                     $$logmsg .= &mt('Section switch for [_1] from [_2] to [_3]',$uname,$$currlist{$uname}[$sec],$stuinfo[ $place{groupID} ]).$linefeed;
  283:                                 }
  284:                                 $switchcount ++;
  285:                             } else {
  286:                                 $$logmsg .= &mt("Error when attempting section change for [_1], from old section: '[_2]' to new section: '[_3]' -error: [_4]",$uname,$$currlist{$uname}[$sec],$stuinfo[ $place{groupID} ],$modify_section_result).$linefeed;
  287:                             }
  288:                         } else {
  289:                             $$logmsg .= &mt("Error when attempting to expire role for [_1] in old section: '[_2]' -error: '[_3]'.",$uname,$$currlist{$uname}[$sec],$expire_role_result).$linefeed;
  290:                         }
  291:                     }
  292:                 }
  293:             } else {
  294: # Check for changed usernames by checking studentIDs
  295:                 if ( ($stuinfo[ $place{studentID} ] ne '') && (grep/^$stuinfo[ $place{studentID} ]$/,@LCids) ) {
  296:                     foreach my $match ( @{ $unameFromLCid{ $stuinfo[ $place{studentID} ] } }  ) {
  297:                         $$logmsg .= &mt('A possible change in username has been detected for a student enrolled in this course.').' '.&mt('The existing LON-CAPA classlist contains user: [_1] and student ID: [_2].',$match,$stuinfo[ $place{studentID} ]);
  298:                         if (grep/^$match$/,@okusers) {
  299:                             $$logmsg .= &mt('The username [_1] remains in the institutional classlist, but the same student ID is used for new user: [_2] now found in the institutional classlist.',$match,$uname).' '.&mt('You may need to contact your Domain Coordinator to determine how to resolve this issue and whether to move student data files for user: [_1] to [_2].',$match,$uname).' ';
  300:                         } else {
  301:                             unless ($drops == 1) {
  302:                                 $$logmsg .= &mt('This username - [_1] - has been dropped from the institutional classlist, but the student ID of this user is also used by [_2] who now appears in the institutional classlist.',$match,$uname).' '.&mt('You may need to contact your Domain Coordinator to request a move of the student data files for user: [_1] to [_2].',$match,$uname).' ';
  303:                             }
  304:                         }
  305:                         $$logmsg .= &mt('Because of this student ID conflict, the new username - [_1] - has not been added to the LON-CAPA classlist',$uname).$linefeed;
  306:                     }
  307:                 } elsif ($adds == 1) {
  308:                     my ($auth,$authparam,$first,$middle,$last,$gene,$usec,$end,$start,$emailaddr,$pid,$emailenc);
  309:                     &prepare_add($authtype,$autharg,$enddate,$startdate,\@stuinfo,\%place,\$dom,\$uname,\$auth,\$authparam,\$first,\$middle,\$last,\$gene,\$usec,\$end,\$start,\$emailaddr,\$pid,\$emailenc);
  310: # Check for existing account in this LON-CAPA domain for this username
  311:                     my $uhome=&Apache::lonnet::homeserver($uname,$dom);
  312:                     if ($uhome eq 'no_host') { # User does not exist
  313:                         my $args = {'auth' => $auth,
  314:                                     'authparam' => $authparam,
  315:                                     'emailenc' => $emailenc,
  316:                                     'udom' => $dom,
  317:                                     'uname' => $uname,
  318:                                     'pid' => $pid,
  319:                                     'first' => $first,
  320:                                     'middle' => $middle,
  321:                                     'last' => $last,
  322:                                     'gene' => $gene,
  323:                                     'usec' => $usec,
  324:                                     'end' => $end,
  325:                                     'start' => $start,
  326:                                     'emailaddr' => $emailaddr,
  327:                                     'cid' => $cid,
  328:                                     'crs' => $crs,
  329:                                     'cdom' => $dom,
  330:                                     'context' => $context,
  331:                                     'linefeed' => $linefeed,
  332:                                     'role' => 'st'
  333:                                    };
  334:                         my $outcome = &create_newuser($args,$logmsg,$newusermsg,\$enrollcount,\$addresult,\%longroles,\%courseinfo);
  335:                     } else {
  336:                         &execute_add($context,'newstudent',$uname,$dom,$auth,$authparam,$first,$middle,$last,$gene,$pid,$usec,$end,$start,$emailenc,$cid,\$addresult,\$enrollcount,$linefeed,$logmsg);
  337:                     }
  338:                     if ($courseinfo{'showphoto'}) {
  339:                         my ($result,$resulttype) = 
  340:                            &Apache::lonnet::auto_checkphotos($uname,$dom,$pid);
  341:                         if ($resulttype) {
  342:                             push(@{$$phototypes{$resulttype}},$uname);
  343:                         }
  344:                     }
  345:                 }
  346:             }
  347:         }
  348:     }
  349:     if ($courseinfo{'showphoto'}) {
  350:         if (keys(%{$phototypes})>0) {
  351:             my %lt = &photo_response_types();
  352:             foreach my $type (sort(keys(%{$phototypes}))) {
  353:                 my $numphoto = @{$$phototypes{$type}};
  354:                 if ($numphoto > 0) {
  355:                     if ($context eq 'updatenow') {
  356:                         $photoresult .=  '<br /><b>'.
  357: 			    &mt('For [_1] students, photos ',$numphoto).
  358: 			    $lt{$type}.'</b><ul><li>';
  359:                     } else {
  360:                         $photoresult .=  "\n".&mt("For [quant,_1,student], photos ",$numphoto).
  361: 			    $lt{$type}."\n";
  362:                     }
  363:                     foreach my $user (@{$$phototypes{$type}}) { 
  364:                         $photoresult .= $user.$linefeed;
  365:                     }
  366:                     if ($context eq 'updatenow') {
  367:                         $photoresult = substr($photoresult,0,
  368: 					      rindex($photoresult,"<li>"));
  369:                         $photoresult .= '</ul><br />';
  370:                     } else {
  371:                         $photoresult .= "\n";
  372:                     }
  373:                 }
  374:             }
  375:         }
  376:     }
  377: 
  378: # Do drops
  379:     if ( ($drops == 1) && (@reg_students > 0) ) {
  380:         foreach my $uname (@localstudents) {
  381:             if ($$currlist{$uname}[$type] eq "auto") {
  382:                 my @saved = ();
  383:                 if (!grep/^$uname$/,@reg_students) {
  384: # Check for changed usernames by checking studentIDs
  385:                     if (grep/^$$currlist{$uname}[ $stuid ]$/,@allINids) {
  386:                         foreach my $match (@{$unameFromINid{$$currlist{$uname}[ $stuid ]}} ) {
  387:                             $$logmsg .= &mt('A possible change in username has been detected for a student enrolled in this course.').' '.&mt('The existing LON-CAPA classlist contains user: [_1] and student ID: [_2].',$uname,$$currlist{$uname}[ $place{studentID} ]).' '.&mt('This username has been dropped from the institutional classlist, but the same student ID is used for user: [_1] who still appears in the institutional classlist.',$match).' '.&mt('You may need to move the student data files for user: [_1] to [_2]',$uname,$match).' '.&mt('Because of this, user [_1] has not been dropped from the course.',$uname).$linefeed;
  388:                             push @saved,$uname;
  389:                         }
  390:                     } elsif (@saved == 0) {
  391:                         my $drop_reply = &Apache::lonnet::modifystudent($dom,$uname,'','','',undef,undef,undef,undef,$$currlist{$uname}[$sec],time,undef,undef,undef,undef,'auto','',$cid);
  392:                         if ($drop_reply !~ /^ok/) {
  393:                             $$logmsg .= &mt('An error occured during the attempt to expire the [_1] from the old section [_2] - [_3].',$uname,$$currlist{$uname}[$sec],$drop_reply).$linefeed;
  394:                         } else {
  395:                             $dropcount ++;
  396:                             my %userenv = &Apache::lonnet::get('environment',['firstname','lastname','id'],$dom,$uname);
  397:                             $dropresult .= $userenv{'firstname'}." ".$userenv{'lastname'}." (".$userenv{'id'}.") - ".$uname.' '.&mt("dropped from section/group: '[_1]'.",$$currlist{$uname}[$sec]).$linefeed; 
  398:                             if ($context eq 'automated') {
  399:                                 $$logmsg .= &mt('User [_1] student role expired from course.',$uname).$linefeed;
  400:                             }
  401:                         }
  402:                     }
  403:                 }
  404:             }
  405:         }
  406:     }
  407: 
  408: # Terminated explictly allowed access to student creation/modification
  409:     if ($context eq 'automated') {
  410:         delete($env{'allowed.cst'});
  411:     }
  412:     if ($enrollcount > 0) {
  413:         if ($context eq "updatenow") {
  414:             $addresult = substr($addresult,0,rindex($addresult,"<li>"));
  415:             $addresult = &mt("The following [quant,_1,student was,students were] added to this LON-CAPA course:",$enrollcount).'<br/><ul><li>'.$addresult.'</ul><br/><br/>';
  416:         } else {
  417:             $addresult = &mt("The following [quant,_1,student was,students were] added to this LON-CAPA course:",$enrollcount)."\n\n".$addresult."\n\n";
  418:         }
  419:     }
  420:     if ($dropcount > 0) {
  421:         if ($context eq "updatenow") {
  422:             $dropresult = substr($dropresult,0,rindex($dropresult,"<li>"));
  423:             $dropresult = &mt("The following [quant,_1,student was,students were] expired from this LON-CAPA course:",$dropcount).'<br/><ul><li>'.$dropresult.'</ul><br/><br/>';
  424:         } else {
  425:             $dropresult = &mt("The following [quant,_1,student was,students were] expired from this LON-CAPA course:",$dropcount)."\n\n".$dropresult."\n\n";
  426:         }
  427:     }
  428:     if ($switchcount > 0) {
  429:         if ($context eq "updatenow") {
  430:             $switchresult = substr($switchresult,0,rindex($switchresult,"<li>"));
  431:             $switchresult = &mt("The following [quant,_1,student] switched sections in this LON-CAPA course:",$switchcount).'<br/><ul><li>'.$switchresult.'</ul><br/><br/>';
  432:         } else {
  433:             $switchresult = &mt("The following [quant,_1,student] switched sections in this LON-CAPA course:",$switchcount)."\n\n".$switchresult."\n\n";
  434:         }
  435:     }
  436:     if ( ($adds) && ($enrollcount == 0) ) {
  437:         $addresult = &mt('There were no new students to add to the course.');
  438:         if ($context eq "updatenow") {
  439:             $addresult .="<br/><br/>";
  440:         } else {
  441:             $addresult .="\n";
  442:         }
  443:     }
  444:     if ( ($drops) && ($dropcount == 0) ) {
  445:         $dropresult = &mt('There were no students with roles to expire because all active students previously added to the course from institutional classlist(s) are still officially registered.');
  446:         if ($context eq "updatenow") {
  447:             $dropresult .="<br/>";
  448:         } else {
  449:             $dropresult .="\n";
  450:         }
  451:     }
  452:     my $changecount = $enrollcount + $dropcount + $switchcount;
  453:     return ($changecount,$addresult.$photoresult.$dropresult.$switchresult);
  454: }
  455: 
  456: sub create_newuser {
  457:     my ($args,$logmsg,$newusermsg,$enrollcount,$addresult,$longroles,
  458: 	$courseinfo,$called_context) = @_;
  459:     my $auth = $args->{'auth'};
  460:     my $authparam = $args->{'authparam'};
  461:     my $emailenc = $args->{'emailenc'};
  462:     my $udom = $args->{'udom'};
  463:     my $uname = $args->{'uname'};
  464:     my $pid = $args->{'pid'};
  465:     my $first = $args->{'first'};
  466:     my $middle = $args->{'middle'};
  467:     my $last = $args->{'last'} ;
  468:     my $gene = $args->{'gene'};
  469:     my $usec = $args->{'usec'};
  470:     my $end = $args->{'end'};
  471:     my $start = $args->{'start'};
  472:     my $emailaddr = $args->{'emailaddr'};
  473:     my $cid = $args->{'cid'};
  474:     my $crs = $args->{'crs'};
  475:     my $cdom = $args->{'cdom'};
  476:     my $context = $args->{'context'};
  477:     my $linefeed = $args->{'linefeed'};
  478:     my $role = $args->{'role'};
  479:     my $create_passwd = 0;
  480:     my $authchk = '';
  481:     my $outcome;
  482:     unless ($authparam eq '') { $authchk = 'ok'; };
  483: # If no account exists and passwords should be generated
  484:     if ($auth eq "internal") {
  485:         if ($authparam eq '') {
  486:             $authparam = &create_password();
  487:             if ($authparam eq '') {
  488:                 $authchk = '';
  489:             } else {
  490:                 $create_passwd = 1;
  491:                 $authchk = 'ok';
  492:             }
  493:         }
  494:     } elsif ($auth eq "localauth") {
  495:         ($authparam,$create_passwd,$authchk) = &Apache::lonnet::auto_create_password($crs,$cdom,$authparam,$udom);
  496:     } elsif ($auth =~ m/^krb/) {
  497:         if ($authparam eq '') {
  498:             $$logmsg .= &mt('No Kerberos domain was provided for the new user - [_1], so the new user was not enrolled in the course',$uname).$linefeed;
  499:             $authchk = 'invalid';
  500:         }
  501:     } else {
  502:         $authchk = 'invalid';
  503:         $$logmsg .= &mt('An invalid authentication type was provided for the new user - [_1], so the user was not enrolled in the course.',$uname).$linefeed;
  504:     }
  505:     if ($authchk eq 'ok') {
  506: # Now create user.
  507:         my $type = 'auto';
  508:         my $userurl = '/'.$cdom.'/'.$crs;
  509:         if ($usec ne '') {
  510:             $userurl .= '/'.$usec;
  511:         }
  512:         if ($context eq 'createowner' || $context eq 'createcourse') {
  513:             my $result = &Apache::lonnet::modifyuser($udom,$uname,$pid,$auth,$authparam,$first,$middle,$last,$gene,'1',undef,$emailaddr);
  514:             if ($result eq 'ok' && $context eq 'createcourse') {
  515:                 $outcome = &Apache::loncommon::commit_standardrole($udom,$uname,$userurl,$role,$start,$end,$cdom,$crs,$usec,$called_context);
  516:                 unless ($outcome =~ /^Error:/) {
  517:                     $outcome = 'ok';
  518:                 }
  519:             } else {
  520:                 $outcome = $result;
  521:             }
  522:         } else {
  523:             $outcome=&Apache::lonnet::modifystudent($udom,$uname,$pid,$auth,$authparam,$first,$middle,$last,$gene,$usec,$end,$start,'',undef,$emailaddr,'auto','',$cid);
  524:         }
  525:         if ($outcome eq 'ok') {
  526:             my $access = &showaccess($end,$start);
  527:             my $showsec = $usec;
  528:             if ($usec eq '') {
  529:                 $showsec = &mt('none');
  530:             }
  531:             $$addresult .= "$first $last ($pid) - $uname ".&mt("enrolled in section/group: '[_1]'.",$showsec).$access.$linefeed;
  532:             unless ($context eq 'createowner' || $context eq 'createcourse') {
  533:                 $$enrollcount ++;
  534:             }
  535:             if ($called_context eq 'automated') {
  536:                 $$logmsg .= &mt('New [_1] user [_2] added successfully.',$udom,$uname);
  537:             }
  538:             unless ($emailenc eq '' || $context eq 'createowner' || $context eq 'createcourse') {
  539:                 my %emailHash;
  540:                 $emailHash{'critnotification'}  = $emailenc;
  541:                 $emailHash{'notification'} = $emailenc;
  542:                 $emailHash{'permanentemail'} = $emailenc;
  543:                 my $putresult = &Apache::lonnet::put('environment',\%emailHash,$udom,$uname);
  544:             }
  545:             if ($create_passwd) {
  546: # Send e-mail with initial password to new user at $emailaddr.
  547: # If e-mail address is invalid, send password via message to courseowner i
  548: # (if automated call) or to user if roster update.
  549:                 if ($emailaddr eq '') {
  550:                     $$newusermsg .= &mt(' username: [_1], password: [_2]',$uname,$authparam).$linefeed."\n";
  551:                 } else {
  552:                     my $subject = &mt('New LON-CAPA account');
  553:                     my $body;
  554:                     if ($context eq 'createowner') {
  555:                         $body = &mt('A user account has been created for you while creating your new course in the LON-CAPA course management and online homework system.')."\n\n".&mt('You should log-in to the system using the following credentials:')."\n".&mt('username: ').$uname."\n".&mt('password: ').$authparam."\n\n".&mt('The URL you should use to access the LON-CAPA system at your school is: ').'http://'.$ENV{'SERVER_NAME'}."\n\n";
  556:                     } elsif ($context eq 'createcourse') {
  557:                         $body = &mt('You have been assigned the role of [_1] in a new course: [_2] - [_3] in the LON-CAPA course management and online homework system.',$$longroles{$role},$$courseinfo{'description'},$$courseinfo{'inst_code'}).' '.&mt('As you did not have an existing user account in the system, one has been created for you.')."\n\n".&mt("You should log-in to the system using the following credentials:\nusername: [_1]\npassword: [_2]",$uname,$authparam)."\n\n".&mt('The URL you should use to access the LON-CAPA system at your school is: '),'http://'.$ENV{'SERVER_NAME'}."\n\n"; 
  558:                     } else {
  559:                         my $access_start = 'immediately';
  560:                         if ($start > 0) {
  561:                             $access_start = localtime($start)
  562:                         }
  563:                         $body = &mt('You have been enrolled in the LON-CAPA system at your school, because you are a registered student in a class that is using the LON-CAPA couse management and online homework system.')."\n\n".&mt("You should log-in to the system using the following credentials:\nusername: [_1]\npassword: [_2]",$uname,$authparam)."\n\n".&mt('The URL you should use to access the LON-CAPA system at your school is: ').'http://'.$ENV{'SERVER_NAME'}."\n\n".&mt('When you log-in you will be able to access the LON-CAPA course for [_1] - [_2] starting [_3].',$$courseinfo{'description'},$$courseinfo{'inst_code'},$access_start)."\n";
  564:                     }
  565:                     &Apache::lonmsg::sendemail($emailaddr,$subject,$body);
  566:                 }
  567:                 if ($called_context eq 'automated') {
  568:                     $$logmsg .= &mt(' Initial password - sent to ').$emailaddr.$linefeed;
  569:                 }
  570:             } else {
  571:                 if ($called_context eq 'automated') {
  572:                     $$logmsg .= $linefeed;
  573:                 }
  574:             }
  575:         } else {
  576:             $$logmsg .= &mt('An error occurred adding new user [_1] - [_2].',$uname,$outcome).$linefeed;
  577:         }
  578:     } else {
  579:         $$logmsg .= &mt('An error occurred adding the new user [_1] because the authcheck failed for authtype [_2] and parameter [_3].',$uname,$auth,$authparam).' '.&mt('The authcheck response was [_1].',$authchk).$linefeed;
  580:     }
  581:     return $outcome;
  582: }
  583: 
  584: sub prepare_add {
  585:     my ($authtype,$autharg,$enddate,$startdate,$stuinfo,$place,$dom,$uname,$auth,$authparam,$first,$middle,$last,$gene,$usec,$end,$start,$emailaddr,$pid,$emailenc) = @_;
  586:     $$auth = $$stuinfo[ $$place{'authtype'} ];
  587:     $$authparam = $$stuinfo[ $$place{'autharg'} ];
  588:     $$first = $$stuinfo[ $$place{'firstname'} ];
  589:     $$middle = $$stuinfo[ $$place{'middlename'} ];
  590:     $$last = $$stuinfo[ $$place{'lastname'} ];
  591:     $$gene = $$stuinfo[ $$place{'generation'} ];
  592:     $$usec = $$stuinfo[ $$place{'groupID'} ];
  593:     $$end = $$stuinfo[ $$place{'enddate'} ];
  594:     $$start = $$stuinfo[ $$place{'startdate'} ];
  595:     $$emailaddr = $$stuinfo[ $$place{'email'} ];
  596:     $$pid = $$stuinfo[ $$place{'studentID'} ];
  597:                                                                                   
  598: # remove non alphanumeric values from section
  599:     $$usec =~ s/\W//g;
  600:                                                                                   
  601:     unless ($$emailaddr =~/^[^\@]+\@[^\@]+$/) { $$emailaddr =''; }
  602:     $$emailenc = &HTML::Entities::encode($$emailaddr,'<>&"');
  603:                                                                                   
  604: # Use course defaults where entry is absent
  605:     if ( ($$auth eq '') || (!defined($$auth)) ) {
  606:         $$auth =  $authtype;
  607:     }
  608:     if ( ($$authparam eq '')  || (!defined($$authparam)) )  {
  609:         $$authparam = $autharg;
  610:     }
  611:     if ( ($$end eq '') || (!defined($$end)) )  {
  612:         $$end = $enddate;
  613:     }
  614:     if ( ($$start eq '')  || (!defined($$start)) )  {
  615:         $$start = $startdate;
  616:     }
  617: # Clean up whitespace
  618:     foreach ($dom,$uname,$pid,$first,$middle,$last,$gene,$usec) {
  619:         $$_ =~ s/(\s+$|^\s+)//g;
  620:     }
  621:     return;
  622: }
  623: 
  624: sub execute_add {
  625:     my ($context,$caller,$uname,$dom,$auth,$authparam,$first,$middle,$last,$gene,$pid,$usec,$end,$start,$emailenc,$cid,$addresult,$enrollcount,$linefeed,$logmsg) = @_;
  626: # Get the user's information and authentication
  627:     my %userenv = &Apache::lonnet::get('environment',['firstname','middlename','lastname','generation','id','critnotification','notification','permanentemail'],$dom,$uname);
  628:     my ($tmp) = keys(%userenv);
  629:     if ($tmp =~ /^(con_lost|error)/i) {
  630:         %userenv = ();
  631:     }
  632: # Get the user's e-mail address
  633:     if ($userenv{critnotification} =~ m/%40/) {
  634:         unless ($emailenc eq $userenv{critnotification}) {
  635:             $$logmsg .= &mt('Current critical notification e-mail
  636: - [_1] for [_2] is different to e-mail address in institutional classlist - [_3].',$userenv{critnotification},$uname,$emailenc).$linefeed;
  637:         }
  638:     }
  639:     if ($userenv{notification} =~ m/%40/) {
  640:         unless ($emailenc eq $userenv{notification}) {
  641:             $$logmsg .= &mt('Current standard notification e-mail
  642: - [_1] for [_2] is different to e-mail address in institutional classlist - [_3]',$userenv{notification},$uname,$emailenc).$linefeed;
  643:         }
  644:     }
  645:     if ($userenv{permanentemail} =~ m/%40/) {
  646:         unless ($emailenc eq $userenv{permanentemail}) {
  647:             $$logmsg .= &mt('Current permanent e-mail
  648: - [_1] for [_2] is different to e-mail address in institutional classlist - [_3]',$userenv{permanentemail},$uname,$emailenc).$linefeed;
  649:         }
  650:     }
  651:     my $krbdefdom = '';
  652:     my $currentauth=&Apache::lonnet::queryauthenticate($uname,$dom);
  653:     if ($currentauth=~/^(krb[45]):(.*)/) {
  654:         $currentauth = $1;
  655:         $krbdefdom = $2;
  656:     } elsif ($currentauth=~ /^(unix|internal|localauth):/) {
  657:         $currentauth = $1;
  658:     } else {
  659:         $$logmsg .= &mt('Invalid authentication method [_1] for [_2].',$currentauth,$uname).$linefeed;
  660:     }
  661: # Report if authentication methods are different.
  662:     if ($currentauth ne $auth) {
  663:         $$logmsg .= &mt("Authentication type mismatch for [_1] - '[_2]' in system, '[_3]' based on information in classlist or default for this course.",$uname,$currentauth,$auth).$linefeed;
  664:     } elsif ($auth =~ m/^krb/) {
  665:         if ($krbdefdom ne $authparam) {
  666:             $$logmsg .= &mt("Kerberos domain mismatch for [_1] - '[_2]' in system, '[_3]' based on information in classlist or default for this course.",$uname,$krbdefdom,$authparam).$linefeed;
  667:         }
  668:     }
  669:                                                                                   
  670: # Check user data
  671:     if ($first  ne $userenv{'firstname'}  ||
  672:         $middle ne $userenv{'middlename'} ||
  673:         $last   ne $userenv{'lastname'}   ||
  674:         $gene   ne $userenv{'generation'} ||
  675:         $pid    ne $userenv{'id'} ||
  676:         $emailenc ne $userenv{'permanentemail'} ) {
  677: # Make the change(s)
  678:         my %changeHash;
  679:         $changeHash{'firstname'}  = $first;
  680:         $changeHash{'middlename'} = $middle;
  681:         $changeHash{'lastname'}   = $last;
  682:         $changeHash{'generation'} = $gene;
  683:         $changeHash{'id'} = $pid;
  684:         $changeHash{'permanentemail'} = $emailenc;
  685:         my $putresult = &Apache::lonnet::put('environment',\%changeHash,$dom,$uname);
  686:         if ($putresult eq 'ok') {
  687:             $$logmsg .= &mt('User information updated for user: [_1] prior to enrollment.',$uname).$linefeed;
  688:         } else {
  689:             $$logmsg .= &mt('There was a problem modifying user data for existing user - [_1] -error: [_2], enrollment will still be attempted.',$uname,$putresult).$linefeed;
  690:         }
  691:     }
  692:                                                                                   
  693: # Assign the role of student in the course.
  694:     my $classlist_reply = &Apache::lonnet::modify_student_enrollment($dom,$uname,$pid,$first,$middle,$last,$gene,$usec,$end,$start,'auto','',$cid);
  695:     if ($classlist_reply eq 'ok') {
  696:         my $access = &showaccess($end,$start);
  697:         my $showsec = $usec;
  698:         if ($usec eq '') {
  699:             $showsec = &mt('none');
  700:         }
  701:         if ($caller eq 'switchtype') {
  702:             $$logmsg .= &mt("Existing user [_1] detected in institutional classlist - switched from 'manual' to 'auto' enrollment in section/group [_2].",$uname,$showsec).$access.$linefeed;
  703:         } elsif ($caller eq 'newstudent') {
  704:             $$enrollcount ++;
  705:             $$addresult .= "$first $last ($pid) - $uname ".&mt("enrolled in section/group '[_1]'.",$showsec).$access.$linefeed;
  706:         }
  707:         if ($context eq 'automated') {
  708:             $$logmsg .= &mt('Existing [_1] user [_2] enrolled successfully.',$dom,$uname).$linefeed;
  709:         }
  710:     } else {
  711:            $$logmsg .= &mt('There was a problem updating the classlist db file for user [_1] to show the new enrollment -error: [_2], so no enrollment occurred for this user.',$uname,$classlist_reply).$linefeed;
  712:     }
  713:     return;
  714: }
  715: 
  716: sub datechange_check {
  717:     my ($oldstart,$oldend,$startdate,$enddate) = @_;
  718:     my $datechange = 0;
  719:     unless ($oldstart eq $startdate) {
  720:         $datechange = 1;
  721:     }
  722:     if (!$datechange) {
  723:         if (!$oldend) {
  724:             if ($enddate) {
  725:                 $datechange = 1;
  726:             }
  727:         } elsif ($oldend ne $enddate) {
  728:             $datechange = 1;
  729:         }
  730:     }
  731:     return $datechange;
  732: }
  733: 
  734: sub showaccess {
  735:     my ($end,$start) = @_;
  736:     my $showstart;
  737:     my $showend;
  738:     if ( (!$start) || ($start <= time) ) {
  739:         $showstart = 'immediately';
  740:     } else {
  741:         $showstart = &Apache::lonlocal::locallocaltime($start);
  742:     }
  743:     if (!$end) {
  744:         $showend = 'no end date';
  745:     } else {
  746:         $showend = &Apache::lonlocal::locallocaltime($end);
  747:     }
  748:     my $access_msg = ' '.&mt('Access starts: [_1], ends: [_2].',$showstart,$showend);
  749:     return $access_msg;
  750: }
  751: 
  752: sub parse_classlist {
  753:     my ($tmpdir,$dom,$crs,$class,$placeref,$groupID,$studentsref) = @_;
  754:     my $xmlfile = $tmpdir."/tmp/".$dom."_".$crs."_".$class."_classlist.xml";
  755:     my $uname = '';
  756:     my @state;
  757:     my @items = ('autharg','authtype','email','firstname','generation','lastname','middlename','studentID');
  758:     my $p = HTML::Parser->new
  759:     (
  760:         xml_mode => 1,
  761:         start_h =>
  762:             [sub {
  763:                  my ($tagname, $attr) = @_;
  764:                  push @state, $tagname;
  765:                  if ("@state" eq "students student") {
  766:                      $uname = $attr->{username};
  767:                  }
  768:             }, "tagname, attr"],
  769:          text_h =>
  770:              [sub {
  771:                  my ($text) = @_;
  772:                  if ("@state" eq "students student groupID") {
  773:                      $$studentsref{$uname}[ $$placeref{'groupID'} ] = $groupID;
  774:                  } elsif ("@state" eq "students student startdate") {
  775:                      my $start = $text;
  776:                      unless ($text eq '') {
  777:                          $start = &process_date($text);
  778:                      }
  779:                      $$studentsref{$uname}[ $$placeref{'startdate'} ] = $start; 
  780:                  } elsif ("@state" eq "students student enddate") {
  781:                      my $end = $text;
  782:                      unless ($text eq '') {
  783:                          $end = &process_date($text);
  784:                      }
  785:                      $$studentsref{$uname}[ $$placeref{'enddate'} ] = $end;
  786:                  } else {
  787:                      foreach my $item (@items) {
  788:                          if ("@state" eq "students student $item") {
  789:                              $$studentsref{$uname}[ $$placeref{$item} ] = $text;
  790:                          }
  791:                      }
  792:                  }
  793:                }, "dtext"],
  794:          end_h =>
  795:                [sub {
  796:                    my ($tagname) = @_;
  797:                    pop @state;
  798:                 }, "tagname"],
  799:     );
  800:                                                                                                              
  801:     $p->parse_file($xmlfile);
  802:     $p->eof;
  803:     if (-e "$xmlfile") {
  804:         unlink $xmlfile;
  805:     }
  806:     return;
  807: }
  808: 
  809: sub process_date {
  810:     my $timestr = shift;
  811:     my $timestamp = '';
  812:     if ($timestr =~ m/^\d{4}:\d{2}:\d{2}/) {
  813:         my @entries = split/:/,$timestr;
  814:         for (my $j=0; $j<@entries; $j++) {
  815:             if ( length($entries[$j]) > 1 ) {
  816:                 $entries[$j] =~ s/^0//;
  817:             }
  818:         }
  819:         $entries[1] = $entries[1] - 1;
  820:         $timestamp =  timelocal($entries[5],$entries[4],$entries[3],$entries[2],$entries[1],$entries[0]);
  821:     }
  822:     return $timestamp;
  823: }
  824: 
  825: sub create_password {
  826:     my $passwd = '';
  827:     my @letts = ("a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z");
  828:     for (my $i=0; $i<8; $i++) {
  829:         my $lettnum = int (rand 2);
  830:         my $item = '';
  831:         if ($lettnum) {
  832:             $item = $letts[int( rand(26) )];
  833:             my $uppercase = int(rand 2);
  834:             if ($uppercase) {
  835:                 $item =~ tr/a-z/A-Z/;
  836:             }
  837:         } else {
  838:             $item = int( rand(10) );
  839:         } 
  840:         $passwd .= $item;
  841:     }
  842:     return ($passwd);
  843: }
  844: 
  845: sub get_courseinfo {
  846:     my ($dom,$crs,$courseinfo) = @_;
  847:     my $owner;
  848:     if (defined($dom) && defined($crs)) {
  849:         my %settings = &Apache::lonnet::get('environment',['internal.coursecode','internal.showphoto','description'],$dom,$crs);
  850:         if ( defined($settings{'internal.coursecode'}) ) {
  851:             $$courseinfo{'inst_code'} = $settings{'internal.coursecode'};
  852:         }
  853:         if ( defined($settings{'description'}) ) {
  854:             $$courseinfo{'description'} = $settings{'description'};
  855:         }
  856:         if ( defined($settings{'internal.showphoto'}) ) {
  857:             $$courseinfo{'showphoto'} = $settings{'internal.showphoto'};
  858:         }
  859:     }
  860:     return;
  861: }
  862: 
  863: sub CL_autharg { return 0; }
  864: sub CL_authtype { return 1;}
  865: sub CL_email { return 2;}
  866: sub CL_enddate { return 3;}
  867: sub CL_firstname { return 4;}
  868: sub CL_generation { return 5;}
  869: sub CL_groupID { return 6;}
  870: sub CL_lastname { return 7;}
  871: sub CL_middlename { return 8;}
  872: sub CL_startdate { return 9; }
  873: sub CL_studentID { return 10; }
  874: 
  875: sub photo_response_types {
  876:     my %lt = &Apache::lonlocal::texthash(
  877:                       'same' => 'remained unchanged',
  878:                       'update' => 'were updated',
  879:                       'new' => 'were added',
  880:                       'missing' => 'were missing',
  881:                       'error' => 'were not imported because an error occurred',
  882:                       'nouser' => 'were for users without accounts',
  883:                       'noid' => 'were for users without student IDs',
  884: 					 );
  885:     return %lt;
  886: }
  887: 
  888: 
  889: 1;

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>