File:  [LON-CAPA] / loncom / enrollment / Enrollment.pm
Revision 1.33: download - view: text, annotated - select for diffs
Fri Mar 2 21:38:18 2007 UTC (17 years, 3 months ago) by raeburn
Branches: MAIN
CVS tags: version_2_3_X, HEAD
Localization for text
 - sent to screen (if enrollment changes resulted from running "Update Roster Now"), or
 - logged to autoenroll.log log file (if changes resulted from running Autoenroll.pl).

    1: # Automated Enrollment manager
    2: # $Id: Enrollment.pm,v 1.33 2007/03/02 21:38:18 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:             print STDERR &mt("[quant,_1,student]",$switchcount)."\n"; 
  432:             $switchresult = &mt("The following [quant,_1,student] switched sections in this LON-CAPA course:",$switchcount).'<br/><ul><li>'.$switchresult.'</ul><br/><br/>';
  433:         } else {
  434:             $switchresult = &mt("The following [quant,_1,student] switched sections in this LON-CAPA course:",$switchcount)."\n\n".$switchresult."\n\n";
  435:         }
  436:     }
  437:     if ( ($adds) && ($enrollcount == 0) ) {
  438:         $addresult = &mt('There were no new students to add to the course.');
  439:         if ($context eq "updatenow") {
  440:             $addresult .="<br/><br/>";
  441:         } else {
  442:             $addresult .="\n";
  443:         }
  444:     }
  445:     if ( ($drops) && ($dropcount == 0) ) {
  446:         $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.');
  447:         if ($context eq "updatenow") {
  448:             $dropresult .="<br/>";
  449:         } else {
  450:             $dropresult .="\n";
  451:         }
  452:     }
  453:     my $changecount = $enrollcount + $dropcount + $switchcount;
  454:     return ($changecount,$addresult.$photoresult.$dropresult.$switchresult);
  455: }
  456: 
  457: sub create_newuser {
  458:     my ($args,$logmsg,$newusermsg,$enrollcount,$addresult,$longroles,$courseinfo) = @_;
  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);
  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);
  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 ($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 ($context eq 'automated') {
  568:                     $$logmsg .= &mt(' Initial password - sent to ').$emailaddr.$linefeed;
  569:                 }
  570:             } else {
  571:                 if ($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:     }
  579:     return $outcome;
  580: }
  581: 
  582: sub prepare_add {
  583:     my ($authtype,$autharg,$enddate,$startdate,$stuinfo,$place,$dom,$uname,$auth,$authparam,$first,$middle,$last,$gene,$usec,$end,$start,$emailaddr,$pid,$emailenc) = @_;
  584:     $$auth = $$stuinfo[ $$place{'authtype'} ];
  585:     $$authparam = $$stuinfo[ $$place{'autharg'} ];
  586:     $$first = $$stuinfo[ $$place{'firstname'} ];
  587:     $$middle = $$stuinfo[ $$place{'middlename'} ];
  588:     $$last = $$stuinfo[ $$place{'lastname'} ];
  589:     $$gene = $$stuinfo[ $$place{'generation'} ];
  590:     $$usec = $$stuinfo[ $$place{'groupID'} ];
  591:     $$end = $$stuinfo[ $$place{'enddate'} ];
  592:     $$start = $$stuinfo[ $$place{'startdate'} ];
  593:     $$emailaddr = $$stuinfo[ $$place{'email'} ];
  594:     $$pid = $$stuinfo[ $$place{'studentID'} ];
  595:                                                                                   
  596: # remove non alphanumeric values from section
  597:     $$usec =~ s/\W//g;
  598:                                                                                   
  599:     unless ($$emailaddr =~/^[^\@]+\@[^\@]+$/) { $$emailaddr =''; }
  600:     $$emailenc = &HTML::Entities::encode($$emailaddr,'<>&"');
  601:                                                                                   
  602: # Use course defaults where entry is absent
  603:     if ( ($$auth eq '') || (!defined($$auth)) ) {
  604:         $$auth =  $authtype;
  605:     }
  606:     if ( ($$authparam eq '')  || (!defined($$authparam)) )  {
  607:         $$authparam = $autharg;
  608:     }
  609:     if ( ($$end eq '') || (!defined($$end)) )  {
  610:         $$end = $enddate;
  611:     }
  612:     if ( ($$start eq '')  || (!defined($$start)) )  {
  613:         $$start = $startdate;
  614:     }
  615: # Clean up whitespace
  616:     foreach ($dom,$uname,$pid,$first,$middle,$last,$gene,$usec) {
  617:         $$_ =~ s/(\s+$|^\s+)//g;
  618:     }
  619:     return;
  620: }
  621: 
  622: sub execute_add {
  623:     my ($context,$caller,$uname,$dom,$auth,$authparam,$first,$middle,$last,$gene,$pid,$usec,$end,$start,$emailenc,$cid,$addresult,$enrollcount,$linefeed,$logmsg) = @_;
  624: # Get the user's information and authentication
  625:     my %userenv = &Apache::lonnet::get('environment',['firstname','middlename','lastname','generation','id','critnotification','notification','permanentemail'],$dom,$uname);
  626:     my ($tmp) = keys(%userenv);
  627:     if ($tmp =~ /^(con_lost|error)/i) {
  628:         %userenv = ();
  629:     }
  630: # Get the user's e-mail address
  631:     if ($userenv{critnotification} =~ m/%40/) {
  632:         unless ($emailenc eq $userenv{critnotification}) {
  633:             $$logmsg .= &mt('Current critical notification e-mail
  634: - [_1] for [_2] is different to e-mail address in institutional classlist - [_3].',$userenv{critnotification},$uname,$emailenc).$linefeed;
  635:         }
  636:     }
  637:     if ($userenv{notification} =~ m/%40/) {
  638:         unless ($emailenc eq $userenv{notification}) {
  639:             $$logmsg .= &mt('Current standard notification e-mail
  640: - [_1] for [_2] is different to e-mail address in institutional classlist - [_3]',$userenv{notification},$uname,$emailenc).$linefeed;
  641:         }
  642:     }
  643:     if ($userenv{permanentemail} =~ m/%40/) {
  644:         unless ($emailenc eq $userenv{permanentemail}) {
  645:             $$logmsg .= &mt('Current permanent e-mail
  646: - [_1] for [_2] is different to e-mail address in institutional classlist - [_3]',$userenv{permanentemail},$uname,$emailenc).$linefeed;
  647:         }
  648:     }
  649:     my $krbdefdom = '';
  650:     my $currentauth=&Apache::lonnet::queryauthenticate($uname,$dom);
  651:     if ($currentauth=~/^(krb[45]):(.*)/) {
  652:         $currentauth = $1;
  653:         $krbdefdom = $2;
  654:     } elsif ($currentauth=~ /^(unix|internal|localauth):/) {
  655:         $currentauth = $1;
  656:     } else {
  657:         $$logmsg .= &mt('Invalid authentication method [_1] for [_2].',$currentauth,$uname).$linefeed;
  658:     }
  659: # Report if authentication methods are different.
  660:     if ($currentauth ne $auth) {
  661:         $$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;
  662:     } elsif ($auth =~ m/^krb/) {
  663:         if ($krbdefdom ne $authparam) {
  664:             $$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;
  665:         }
  666:     }
  667:                                                                                   
  668: # Check user data
  669:     if ($first  ne $userenv{'firstname'}  ||
  670:         $middle ne $userenv{'middlename'} ||
  671:         $last   ne $userenv{'lastname'}   ||
  672:         $gene   ne $userenv{'generation'} ||
  673:         $pid    ne $userenv{'id'} ||
  674:         $emailenc ne $userenv{'permanentemail'} ) {
  675: # Make the change(s)
  676:         my %changeHash;
  677:         $changeHash{'firstname'}  = $first;
  678:         $changeHash{'middlename'} = $middle;
  679:         $changeHash{'lastname'}   = $last;
  680:         $changeHash{'generation'} = $gene;
  681:         $changeHash{'id'} = $pid;
  682:         $changeHash{'permanentemail'} = $emailenc;
  683:         my $putresult = &Apache::lonnet::put('environment',\%changeHash,$dom,$uname);
  684:         if ($putresult eq 'ok') {
  685:             $$logmsg .= &mt('User information updated for user: [_1]$uname prior to enrollment.',$uname).$linefeed;
  686:         } else {
  687:             $$logmsg .= &mt('There was a problem modifying user data for existing user - [_1] -error: [_2], enrollment will still be attempted.',$uname,$putresult).$linefeed;
  688:         }
  689:     }
  690:                                                                                   
  691: # Assign the role of student in the course.
  692:     my $classlist_reply = &Apache::lonnet::modify_student_enrollment($dom,$uname,$pid,$first,$middle,$last,$gene,$usec,$end,$start,'auto','',$cid);
  693:     if ($classlist_reply eq 'ok') {
  694:         my $access = &showaccess($end,$start);
  695:         my $showsec = $usec;
  696:         if ($usec eq '') {
  697:             $showsec = &mt('none');
  698:         }
  699:         if ($caller eq 'switchtype') {
  700:             $$logmsg .= &mt("Existing user [_1] detected in institutional classlist - switched from 'manual' to 'auto' enrollment in section/group [_2].",$uname,$showsec).$access.$linefeed;
  701:         } elsif ($caller eq 'newstudent') {
  702:             $$enrollcount ++;
  703:             $$addresult .= "$first $last ($pid) - $uname ".&mt("enrolled in section/group '[_1]'.",$showsec).$access.$linefeed;
  704:         }
  705:         if ($context eq 'automated') {
  706:             $$logmsg .= &mt('Existing [_1] user [_2] enrolled successfully.',$dom,$uname).$linefeed;
  707:         }
  708:     } else {
  709:            $$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;
  710:     }
  711:     return;
  712: }
  713: 
  714: sub datechange_check {
  715:     my ($oldstart,$oldend,$startdate,$enddate) = @_;
  716:     my $datechange = 0;
  717:     unless ($oldstart eq $startdate) {
  718:         $datechange = 1;
  719:     }
  720:     if (!$datechange) {
  721:         if (!$oldend) {
  722:             if ($enddate) {
  723:                 $datechange = 1;
  724:             }
  725:         } elsif ($oldend ne $enddate) {
  726:             $datechange = 1;
  727:         }
  728:     }
  729:     return $datechange;
  730: }
  731: 
  732: sub showaccess {
  733:     my ($end,$start) = @_;
  734:     my $showstart;
  735:     my $showend;
  736:     if ( (!$start) || ($start <= time) ) {
  737:         $showstart = 'immediately';
  738:     } else {
  739:         $showstart = &Apache::lonlocal::locallocaltime($start);
  740:     }
  741:     if (!$end) {
  742:         $showend = 'no end date';
  743:     } else {
  744:         $showend = &Apache::lonlocal::locallocaltime($end);
  745:     }
  746:     my $access_msg = ' '.&mt('Access starts: [_1], ends: [_2].',$showstart,$showend);
  747:     return $access_msg;
  748: }
  749: 
  750: sub parse_classlist {
  751:     my ($tmpdir,$dom,$crs,$class,$placeref,$groupID,$studentsref) = @_;
  752:     my $xmlfile = $tmpdir."/tmp/".$dom."_".$crs."_".$class."_classlist.xml";
  753:     my $uname = '';
  754:     my @state;
  755:     my @items = ('autharg','authtype','email','firstname','generation','lastname','middlename','studentID');
  756:     my $p = HTML::Parser->new
  757:     (
  758:         xml_mode => 1,
  759:         start_h =>
  760:             [sub {
  761:                  my ($tagname, $attr) = @_;
  762:                  push @state, $tagname;
  763:                  if ("@state" eq "students student") {
  764:                      $uname = $attr->{username};
  765:                  }
  766:             }, "tagname, attr"],
  767:          text_h =>
  768:              [sub {
  769:                  my ($text) = @_;
  770:                  if ("@state" eq "students student groupID") {
  771:                      $$studentsref{$uname}[ $$placeref{'groupID'} ] = $groupID;
  772:                  } elsif ("@state" eq "students student startdate") {
  773:                      my $start = $text;
  774:                      unless ($text eq '') {
  775:                          $start = &process_date($text);
  776:                      }
  777:                      $$studentsref{$uname}[ $$placeref{'startdate'} ] = $start; 
  778:                  } elsif ("@state" eq "students student enddate") {
  779:                      my $end = $text;
  780:                      unless ($text eq '') {
  781:                          $end = &process_date($text);
  782:                      }
  783:                      $$studentsref{$uname}[ $$placeref{'enddate'} ] = $end;
  784:                  } else {
  785:                      foreach my $item (@items) {
  786:                          if ("@state" eq "students student $item") {
  787:                              $$studentsref{$uname}[ $$placeref{$item} ] = $text;
  788:                          }
  789:                      }
  790:                  }
  791:                }, "dtext"],
  792:          end_h =>
  793:                [sub {
  794:                    my ($tagname) = @_;
  795:                    pop @state;
  796:                 }, "tagname"],
  797:     );
  798:                                                                                                              
  799:     $p->parse_file($xmlfile);
  800:     $p->eof;
  801:     if (-e "$xmlfile") {
  802:         unlink $xmlfile;
  803:     }
  804:     return;
  805: }
  806: 
  807: sub process_date {
  808:     my $timestr = shift;
  809:     my $timestamp = '';
  810:     if ($timestr =~ m/^\d{4}:\d{2}:\d{2}/) {
  811:         my @entries = split/:/,$timestr;
  812:         for (my $j=0; $j<@entries; $j++) {
  813:             if ( length($entries[$j]) > 1 ) {
  814:                 $entries[$j] =~ s/^0//;
  815:             }
  816:         }
  817:         $entries[1] = $entries[1] - 1;
  818:         $timestamp =  timelocal($entries[5],$entries[4],$entries[3],$entries[2],$entries[1],$entries[0]);
  819:     }
  820:     return $timestamp;
  821: }
  822: 
  823: sub create_password {
  824:     my $passwd = '';
  825:     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");
  826:     for (my $i=0; $i<8; $i++) {
  827:         my $lettnum = int (rand 2);
  828:         my $item = '';
  829:         if ($lettnum) {
  830:             $item = $letts[int( rand(26) )];
  831:             my $uppercase = int(rand 2);
  832:             if ($uppercase) {
  833:                 $item =~ tr/a-z/A-Z/;
  834:             }
  835:         } else {
  836:             $item = int( rand(10) );
  837:         } 
  838:         $passwd .= $item;
  839:     }
  840:     return ($passwd);
  841: }
  842: 
  843: sub get_courseinfo {
  844:     my ($dom,$crs,$courseinfo) = @_;
  845:     my $owner;
  846:     if (defined($dom) && defined($crs)) {
  847:         my %settings = &Apache::lonnet::get('environment',['internal.coursecode','internal.showphoto','description'],$dom,$crs);
  848:         if ( defined($settings{'internal.coursecode'}) ) {
  849:             $$courseinfo{'inst_code'} = $settings{'internal.coursecode'};
  850:         }
  851:         if ( defined($settings{'description'}) ) {
  852:             $$courseinfo{'description'} = $settings{'description'};
  853:         }
  854:         if ( defined($settings{'internal.showphoto'}) ) {
  855:             $$courseinfo{'showphoto'} = $settings{'internal.showphoto'};
  856:         }
  857:     }
  858:     return;
  859: }
  860: 
  861: sub CL_autharg { return 0; }
  862: sub CL_authtype { return 1;}
  863: sub CL_email { return 2;}
  864: sub CL_enddate { return 3;}
  865: sub CL_firstname { return 4;}
  866: sub CL_generation { return 5;}
  867: sub CL_groupID { return 6;}
  868: sub CL_lastname { return 7;}
  869: sub CL_middlename { return 8;}
  870: sub CL_startdate { return 9; }
  871: sub CL_studentID { return 10; }
  872: 
  873: sub photo_response_types {
  874:     my %lt = &Apache::lonlocal::texthash(
  875:                       'same' => 'remained unchanged',
  876:                       'update' => 'were updated',
  877:                       'new' => 'were added',
  878:                       'missing' => 'were missing',
  879:                       'error' => 'were not imported because an error occurred',
  880:                       'nouser' => 'were for users without accounts',
  881:                       'noid' => 'were for users without student IDs',
  882: 					 );
  883:     return %lt;
  884: }
  885: 
  886: 
  887: 1;

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