File:  [LON-CAPA] / loncom / enrollment / Enrollment.pm
Revision 1.43: download - view: text, annotated - select for diffs
Fri Aug 20 21:44:59 2010 UTC (13 years, 8 months ago) by raeburn
Branches: MAIN
CVS tags: version_2_9_X, version_2_9_1, version_2_10_X, version_2_10_1, version_2_10_0_RC2, version_2_10_0_RC1, version_2_10_0, loncapaMITrelate_1, language_hyphenation_merge, language_hyphenation, HEAD, BZ4492-merge, BZ4492-feature_horizontal_radioresponse, BZ4492-feature_Support_horizontal_radioresponse, BZ4492-Support_horizontal_radioresponse
- LON-CAPA section is determined from mapping for institutional section.
- Entry in <groupID></groupID> in XML file is not used.

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

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