Annotation of loncom/enrollment/Enrollment.pm, revision 1.34
1.7 albertel 1: # Automated Enrollment manager
1.34 ! raeburn 2: # $Id: Enrollment.pm,v 1.33 2007/03/02 21:38:18 raeburn Exp $
1.7 albertel 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: #
1.1 raeburn 26: package LONCAPA::Enrollment;
27:
28: use Apache::loncoursedata;
29: use Apache::lonnet;
1.32 albertel 30: use Apache::loncommon();
1.8 raeburn 31: use Apache::lonmsg;
1.28 raeburn 32: use Apache::lonlocal;
1.1 raeburn 33: use HTML::Entities;
34: use LONCAPA::Configuration;
1.8 raeburn 35: use Time::Local;
36: use lib '/home/httpd/lib/perl';
1.1 raeburn 37:
38: use strict;
39:
40: sub update_LC {
1.28 raeburn 41: my ($dom,$crs,$adds,$drops,$startdate,$enddate,$authtype,$autharg,$classesref,$groupref,$logmsg,$newusermsg,$context,$phototypes) = @_;
1.19 raeburn 42: # Get institutional code and title of this class
43: my %courseinfo = ();
44: &get_courseinfo($dom,$crs,\%courseinfo);
1.1 raeburn 45: # Get current LON-CAPA student enrollment for this class
46: my $configvars = &LONCAPA::Configuration::read_conf('loncapa.conf');
47: my $cid = $dom."_".$crs;
1.26 raeburn 48: my $roster = &Apache::loncoursedata::get_classlist($dom,$crs);
1.1 raeburn 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;
1.16 raeburn 55: my $lockedtype=&Apache::loncoursedata::CL_LOCKEDTYPE;
1.1 raeburn 56: my @localstudents = ();
1.15 raeburn 57: my @futurestudents = ();
58: my @activestudents = ();
1.18 raeburn 59: my @excludedstudents = ();
1.1 raeburn 60: my $currlist;
61: foreach my $uname (keys %{$roster} ) {
62: if ($uname =~ m/^(.+):$dom$/) {
63: if ($$roster{$uname}[$status] eq "Active") {
1.15 raeburn 64: push @activestudents, $1;
65: @{$$currlist{$1}} = @{$$roster{$uname}};
1.1 raeburn 66: push @localstudents, $1;
1.15 raeburn 67: } elsif ( ($$roster{$uname}[$cstart] > time) && ($$roster{$uname}[$cend] > time || $$roster{$uname}[$cend] == 0 || $$roster{$uname}[$cend] eq '') ) {
68: push @futurestudents, $1;
1.1 raeburn 69: @{$$currlist{$1}} = @{$$roster{$uname}};
1.15 raeburn 70: push @localstudents, $1;
1.18 raeburn 71: } elsif ($$roster{$uname}[$lockedtype] == 1) {
72: push @excludedstudents, $1;
1.1 raeburn 73: }
74: }
75: }
76: my $linefeed = '';
77: my $addresult = '';
78: my $dropresult = '';
1.21 raeburn 79: my $switchresult = '';
1.28 raeburn 80: my $photoresult = '';
1.1 raeburn 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;
1.21 raeburn 88: my $switchcount = 0;
1.1 raeburn 89:
1.19 raeburn 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:
1.8 raeburn 101: srand( time() ^ ($$ + ($$ << 15)) ); # Seed rand in case initial passwords have to be generated for new users.
102:
1.1 raeburn 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) {
1.18 raeburn 149: if (grep/^$uname$/,@excludedstudents) {
1.33 raeburn 150: $$logmsg .= &mt('No re-enrollment for [_1] - user was previously manually unenrolled and locked.',$uname).$linefeed;
1.18 raeburn 151: } elsif (@{$allenrolled{$uname}} > 1) {
1.1 raeburn 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) {
1.33 raeburn 173: $$logmsg .= &mt('[_1] appears in classlists for more than one section of this course, i.e. in sections: ',$uname);
1.1 raeburn 174: foreach (@sections) {
1.5 raeburn 175: $$logmsg .= " $_,";
1.1 raeburn 176: }
1.5 raeburn 177: chop($$logmsg);
1.33 raeburn 178: $$logmsg .= '. '.&mt('Because of this ambiguity, no enrollment action was taken for this student.').$linefeed;
1.1 raeburn 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 = ();
1.3 raeburn 187: my %unameFromINid = ();
1.1 raeburn 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: }
1.28 raeburn 198:
1.5 raeburn 199: # Explicitly allow access to creation/modification of students if called as an automated process.
200: if ($context eq 'automated') {
1.22 albertel 201: $env{'allowed.cst'}='F';
1.5 raeburn 202: }
203:
1.1 raeburn 204: # Compare IDs with existing LON-CAPA enrollment for this class
205: foreach my $uname (@okusers) {
1.5 raeburn 206: unless ($uname eq '') {
207: my %uidhash=&Apache::lonnet::idrget($dom,$uname);
208: my @stuinfo = @{$enrollinfo{$uname}};
1.15 raeburn 209: my $access = '';
1.5 raeburn 210: if (grep/^$uname$/,@localstudents) {
1.1 raeburn 211: # Check for studentID changes
1.5 raeburn 212: if ( ($uidhash{$uname}) && ($uidhash{$uname} !~ /error\:/) ) {
213: unless ( ($uidhash{$uname}) eq ($stuinfo[ $place{studentID} ]) ) {
1.33 raeburn 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;
1.5 raeburn 215: }
1.1 raeburn 216: }
1.16 raeburn 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/) {
1.33 raeburn 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;
1.16 raeburn 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) {
1.33 raeburn 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;
1.21 raeburn 238: if ($context eq 'automated') {
1.33 raeburn 239: $$logmsg .= &mt("Section switch for [_1] from '[_2]' to '[_3]'.",$uname,$showoldsec,$usec).$linefeed;
1.21 raeburn 240: }
241: $switchcount ++;
1.16 raeburn 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: }
1.1 raeburn 246: # Check for section changes
1.15 raeburn 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) ) {
1.16 raeburn 250: my $datechange = &datechange_check($$currlist{$uname}[$cstart],$$currlist{$uname}[$cend],$startdate,$enddate);
1.15 raeburn 251: if ($datechange) {
1.16 raeburn 252: my $modify_access_result = &Apache::lonnet::modify_student_enrollment($dom,$uname,undef,undef,undef,undef,undef,$stuinfo[ $place{groupID} ],$enddate,$startdate,'auto','',$cid);
1.15 raeburn 253: $access = &showaccess($enddate,$startdate);
254: if ($modify_access_result =~ /^ok/) {
1.33 raeburn 255: $$logmsg .= &mt('Change in access dates for [_1].',$uname).$access.$linefeed;
1.15 raeburn 256: } else {
1.33 raeburn 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;
1.15 raeburn 258: }
259: }
260: }
261: } else {
1.5 raeburn 262: if ( ($$currlist{$uname}[$type] eq "auto") && ($adds == 1) ) {
1.10 raeburn 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') {
1.15 raeburn 272: my $modify_section_result;
273: if (grep/^$uname$/,@activestudents) {
1.16 raeburn 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);
1.15 raeburn 275: } else {
1.16 raeburn 276: $modify_section_result = &Apache::lonnet::modify_student_enrollment($dom,$uname,undef,undef,undef,undef,undef,$stuinfo[ $place{groupID} ],$enddate,$startdate,'auto','',$cid);
1.15 raeburn 277: $access = &showaccess($enddate,$startdate);
278: }
1.10 raeburn 279: if ($modify_section_result =~ /^ok/) {
1.33 raeburn 280: $switchresult .= &mt("Section for [_1] switched from old section: '[_2]' to new section: '[_3]'.",$uname,$$currlist{$uname}[$sec],$stuinfo[ $place{groupID} ]).$access.$linefeed;
1.21 raeburn 281: if ($context eq 'automated') {
1.33 raeburn 282: $$logmsg .= &mt('Section switch for [_1] from [_2] to [_3]',$uname,$$currlist{$uname}[$sec],$stuinfo[ $place{groupID} ]).$linefeed;
1.21 raeburn 283: }
284: $switchcount ++;
1.10 raeburn 285: } else {
1.33 raeburn 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;
1.10 raeburn 287: }
1.5 raeburn 288: } else {
1.33 raeburn 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;
1.5 raeburn 290: }
1.1 raeburn 291: }
292: }
1.5 raeburn 293: } else {
1.1 raeburn 294: # Check for changed usernames by checking studentIDs
1.5 raeburn 295: if ( ($stuinfo[ $place{studentID} ] ne '') && (grep/^$stuinfo[ $place{studentID} ]$/,@LCids) ) {
1.27 raeburn 296: foreach my $match ( @{ $unameFromLCid{ $stuinfo[ $place{studentID} ] } } ) {
1.33 raeburn 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} ]);
1.27 raeburn 298: if (grep/^$match$/,@okusers) {
1.33 raeburn 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).' ';
1.27 raeburn 300: } else {
301: unless ($drops == 1) {
1.33 raeburn 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).' ';
1.5 raeburn 303: }
1.1 raeburn 304: }
1.33 raeburn 305: $$logmsg .= &mt('Because of this student ID conflict, the new username - [_1] - has not been added to the LON-CAPA classlist',$uname).$linefeed;
1.1 raeburn 306: }
1.5 raeburn 307: } elsif ($adds == 1) {
1.16 raeburn 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);
1.1 raeburn 310: # Check for existing account in this LON-CAPA domain for this username
1.5 raeburn 311: my $uhome=&Apache::lonnet::homeserver($uname,$dom);
312: if ($uhome eq 'no_host') { # User does not exist
1.19 raeburn 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: };
1.20 raeburn 334: my $outcome = &create_newuser($args,$logmsg,$newusermsg,\$enrollcount,\$addresult,\%longroles,\%courseinfo);
1.5 raeburn 335: } else {
1.16 raeburn 336: &execute_add($context,'newstudent',$uname,$dom,$auth,$authparam,$first,$middle,$last,$gene,$pid,$usec,$end,$start,$emailenc,$cid,\$addresult,\$enrollcount,$linefeed,$logmsg);
1.3 raeburn 337: }
1.31 raeburn 338: if ($courseinfo{'showphoto'}) {
1.28 raeburn 339: my ($result,$resulttype) =
340: &Apache::lonnet::auto_checkphotos($uname,$dom,$pid);
341: if ($resulttype) {
342: push(@{$$phototypes{$resulttype}},$uname);
343: }
344: }
1.1 raeburn 345: }
346: }
347: }
348: }
1.31 raeburn 349: if ($courseinfo{'showphoto'}) {
1.28 raeburn 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>'.
1.29 albertel 357: &mt('For [_1] students, photos ',$numphoto).
358: $lt{$type}.'</b><ul><li>';
1.28 raeburn 359: } else {
1.33 raeburn 360: $photoresult .= "\n".&mt("For [quant,_1,student], photos ",$numphoto).
1.29 albertel 361: $lt{$type}."\n";
1.28 raeburn 362: }
363: foreach my $user (@{$$phototypes{$type}}) {
364: $photoresult .= $user.$linefeed;
365: }
366: if ($context eq 'updatenow') {
367: $photoresult = substr($photoresult,0,
1.29 albertel 368: rindex($photoresult,"<li>"));
1.28 raeburn 369: $photoresult .= '</ul><br />';
370: } else {
371: $photoresult .= "\n";
372: }
373: }
374: }
375: }
376: }
377:
1.1 raeburn 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 ]}} ) {
1.33 raeburn 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;
1.1 raeburn 388: push @saved,$uname;
389: }
390: } elsif (@saved == 0) {
1.16 raeburn 391: my $drop_reply = &Apache::lonnet::modifystudent($dom,$uname,'','','',undef,undef,undef,undef,$$currlist{$uname}[$sec],time,undef,undef,undef,undef,'auto','',$cid);
1.1 raeburn 392: if ($drop_reply !~ /^ok/) {
1.33 raeburn 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;
1.1 raeburn 394: } else {
395: $dropcount ++;
396: my %userenv = &Apache::lonnet::get('environment',['firstname','lastname','id'],$dom,$uname);
1.33 raeburn 397: $dropresult .= $userenv{'firstname'}." ".$userenv{'lastname'}." (".$userenv{'id'}.") - ".$uname.' '.&mt("dropped from section/group: '[_1]'.",$$currlist{$uname}[$sec]).$linefeed;
1.8 raeburn 398: if ($context eq 'automated') {
1.33 raeburn 399: $$logmsg .= &mt('User [_1] student role expired from course.',$uname).$linefeed;
1.8 raeburn 400: }
1.1 raeburn 401: }
402: }
403: }
404: }
405: }
406: }
1.5 raeburn 407:
408: # Terminated explictly allowed access to student creation/modification
409: if ($context eq 'automated') {
1.22 albertel 410: delete($env{'allowed.cst'});
1.5 raeburn 411: }
1.1 raeburn 412: if ($enrollcount > 0) {
413: if ($context eq "updatenow") {
1.6 raeburn 414: $addresult = substr($addresult,0,rindex($addresult,"<li>"));
1.33 raeburn 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/>';
1.1 raeburn 416: } else {
1.33 raeburn 417: $addresult = &mt("The following [quant,_1,student was,students were] added to this LON-CAPA course:",$enrollcount)."\n\n".$addresult."\n\n";
1.21 raeburn 418: }
1.1 raeburn 419: }
420: if ($dropcount > 0) {
421: if ($context eq "updatenow") {
1.6 raeburn 422: $dropresult = substr($dropresult,0,rindex($dropresult,"<li>"));
1.33 raeburn 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/>';
1.1 raeburn 424: } else {
1.33 raeburn 425: $dropresult = &mt("The following [quant,_1,student was,students were] expired from this LON-CAPA course:",$dropcount)."\n\n".$dropresult."\n\n";
1.1 raeburn 426: }
427: }
1.21 raeburn 428: if ($switchcount > 0) {
429: if ($context eq "updatenow") {
430: $switchresult = substr($switchresult,0,rindex($switchresult,"<li>"));
1.33 raeburn 431: $switchresult = &mt("The following [quant,_1,student] switched sections in this LON-CAPA course:",$switchcount).'<br/><ul><li>'.$switchresult.'</ul><br/><br/>';
1.21 raeburn 432: } else {
1.33 raeburn 433: $switchresult = &mt("The following [quant,_1,student] switched sections in this LON-CAPA course:",$switchcount)."\n\n".$switchresult."\n\n";
1.21 raeburn 434: }
435: }
1.1 raeburn 436: if ( ($adds) && ($enrollcount == 0) ) {
1.33 raeburn 437: $addresult = &mt('There were no new students to add to the course.');
1.1 raeburn 438: if ($context eq "updatenow") {
439: $addresult .="<br/><br/>";
440: } else {
441: $addresult .="\n";
442: }
443: }
444: if ( ($drops) && ($dropcount == 0) ) {
1.33 raeburn 445: $dropresult = &mt('There were no students with roles to expire because all active students previously added to the course from institutional classlist(s) are still officially registered.');
1.1 raeburn 446: if ($context eq "updatenow") {
447: $dropresult .="<br/>";
448: } else {
449: $dropresult .="\n";
450: }
451: }
1.21 raeburn 452: my $changecount = $enrollcount + $dropcount + $switchcount;
1.28 raeburn 453: return ($changecount,$addresult.$photoresult.$dropresult.$switchresult);
1.6 raeburn 454: }
1.1 raeburn 455:
1.19 raeburn 456: sub create_newuser {
457: my ($args,$logmsg,$newusermsg,$enrollcount,$addresult,$longroles,$courseinfo) = @_;
458: my $auth = $args->{'auth'};
459: my $authparam = $args->{'authparam'};
460: my $emailenc = $args->{'emailenc'};
461: my $udom = $args->{'udom'};
462: my $uname = $args->{'uname'};
463: my $pid = $args->{'pid'};
464: my $first = $args->{'first'};
465: my $middle = $args->{'middle'};
466: my $last = $args->{'last'} ;
467: my $gene = $args->{'gene'};
468: my $usec = $args->{'usec'};
469: my $end = $args->{'end'};
470: my $start = $args->{'start'};
471: my $emailaddr = $args->{'emailaddr'};
472: my $cid = $args->{'cid'};
473: my $crs = $args->{'crs'};
474: my $cdom = $args->{'cdom'};
475: my $context = $args->{'context'};
476: my $linefeed = $args->{'linefeed'};
477: my $role = $args->{'role'};
478: my $create_passwd = 0;
479: my $authchk = '';
480: my $outcome;
481: unless ($authparam eq '') { $authchk = 'ok'; };
482: # If no account exists and passwords should be generated
483: if ($auth eq "internal") {
484: if ($authparam eq '') {
485: $authparam = &create_password();
486: if ($authparam eq '') {
487: $authchk = '';
488: } else {
489: $create_passwd = 1;
490: $authchk = 'ok';
491: }
492: }
493: } elsif ($auth eq "localauth") {
1.34 ! raeburn 494: ($authparam,$create_passwd,$authchk) = &Apache::lonnet::auto_create_password($crs,$cdom,$authparam,$udom);
1.19 raeburn 495: } elsif ($auth =~ m/^krb/) {
496: if ($authparam eq '') {
1.33 raeburn 497: $$logmsg .= &mt('No Kerberos domain was provided for the new user - [_1], so the new user was not enrolled in the course',$uname).$linefeed;
1.19 raeburn 498: $authchk = 'invalid';
499: }
500: } else {
501: $authchk = 'invalid';
1.33 raeburn 502: $$logmsg .= &mt('An invalid authentication type was provided for the new user - [_1], so the user was not enrolled in the course.',$uname).$linefeed;
1.34 ! raeburn 503: }
1.19 raeburn 504: if ($authchk eq 'ok') {
505: # Now create user.
506: my $type = 'auto';
507: my $userurl = '/'.$cdom.'/'.$crs;
508: if ($usec ne '') {
509: $userurl .= '/'.$usec;
510: }
511: if ($context eq 'createowner' || $context eq 'createcourse') {
512: my $result = &Apache::lonnet::modifyuser($udom,$uname,$pid,$auth,$authparam,$first,$middle,$last,$gene,'1',undef,$emailaddr);
513: if ($result eq 'ok' && $context eq 'createcourse') {
1.32 albertel 514: $outcome = &Apache::loncommon::commit_standardrole($udom,$uname,$userurl,$role,$start,$end,$cdom,$crs,$usec);
1.19 raeburn 515: unless ($outcome =~ /^Error:/) {
516: $outcome = 'ok';
517: }
518: } else {
519: $outcome = $result;
520: }
521: } else {
522: $outcome=&Apache::lonnet::modifystudent($udom,$uname,$pid,$auth,$authparam,$first,$middle,$last,$gene,$usec,$end,$start,'',undef,$emailaddr,'auto','',$cid);
523: }
524: if ($outcome eq 'ok') {
525: my $access = &showaccess($end,$start);
1.33 raeburn 526: my $showsec = $usec;
527: if ($usec eq '') {
528: $showsec = &mt('none');
529: }
530: $$addresult .= "$first $last ($pid) - $uname ".&mt("enrolled in section/group: '[_1]'.",$showsec).$access.$linefeed;
1.19 raeburn 531: unless ($context eq 'createowner' || $context eq 'createcourse') {
532: $$enrollcount ++;
533: }
534: if ($context eq 'automated') {
1.33 raeburn 535: $$logmsg .= &mt('New [_1] user [_2] added successfully.',$udom,$uname);
1.19 raeburn 536: }
537: unless ($emailenc eq '' || $context eq 'createowner' || $context eq 'createcourse') {
538: my %emailHash;
539: $emailHash{'critnotification'} = $emailenc;
540: $emailHash{'notification'} = $emailenc;
1.23 raeburn 541: $emailHash{'permanentemail'} = $emailenc;
1.19 raeburn 542: my $putresult = &Apache::lonnet::put('environment',\%emailHash,$udom,$uname);
543: }
544: if ($create_passwd) {
545: # Send e-mail with initial password to new user at $emailaddr.
546: # If e-mail address is invalid, send password via message to courseowner i
547: # (if automated call) or to user if roster update.
548: if ($emailaddr eq '') {
1.33 raeburn 549: $$newusermsg .= &mt(' username: [_1], password: [_2]',$uname,$authparam).$linefeed."\n";
1.19 raeburn 550: } else {
1.33 raeburn 551: my $subject = &mt('New LON-CAPA account');
1.19 raeburn 552: my $body;
553: if ($context eq 'createowner') {
1.33 raeburn 554: $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";
1.19 raeburn 555: } elsif ($context eq 'createcourse') {
1.33 raeburn 556: $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";
1.19 raeburn 557: } else {
558: my $access_start = 'immediately';
559: if ($start > 0) {
560: $access_start = localtime($start)
561: }
1.33 raeburn 562: $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";
1.19 raeburn 563: }
564: &Apache::lonmsg::sendemail($emailaddr,$subject,$body);
565: }
566: if ($context eq 'automated') {
1.33 raeburn 567: $$logmsg .= &mt(' Initial password - sent to ').$emailaddr.$linefeed;
1.19 raeburn 568: }
569: } else {
570: if ($context eq 'automated') {
571: $$logmsg .= $linefeed;
572: }
573: }
574: } else {
1.33 raeburn 575: $$logmsg .= &mt('An error occurred adding new user [_1] - [_2].',$uname,$outcome).$linefeed;
1.19 raeburn 576: }
1.34 ! raeburn 577: } else {
! 578: $$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;
1.19 raeburn 579: }
580: return $outcome;
581: }
582:
1.16 raeburn 583: sub prepare_add {
584: my ($authtype,$autharg,$enddate,$startdate,$stuinfo,$place,$dom,$uname,$auth,$authparam,$first,$middle,$last,$gene,$usec,$end,$start,$emailaddr,$pid,$emailenc) = @_;
585: $$auth = $$stuinfo[ $$place{'authtype'} ];
586: $$authparam = $$stuinfo[ $$place{'autharg'} ];
587: $$first = $$stuinfo[ $$place{'firstname'} ];
588: $$middle = $$stuinfo[ $$place{'middlename'} ];
589: $$last = $$stuinfo[ $$place{'lastname'} ];
590: $$gene = $$stuinfo[ $$place{'generation'} ];
591: $$usec = $$stuinfo[ $$place{'groupID'} ];
592: $$end = $$stuinfo[ $$place{'enddate'} ];
593: $$start = $$stuinfo[ $$place{'startdate'} ];
594: $$emailaddr = $$stuinfo[ $$place{'email'} ];
595: $$pid = $$stuinfo[ $$place{'studentID'} ];
596:
597: # remove non alphanumeric values from section
598: $$usec =~ s/\W//g;
599:
600: unless ($$emailaddr =~/^[^\@]+\@[^\@]+$/) { $$emailaddr =''; }
601: $$emailenc = &HTML::Entities::encode($$emailaddr,'<>&"');
602:
603: # Use course defaults where entry is absent
604: if ( ($$auth eq '') || (!defined($$auth)) ) {
605: $$auth = $authtype;
606: }
607: if ( ($$authparam eq '') || (!defined($$authparam)) ) {
608: $$authparam = $autharg;
609: }
610: if ( ($$end eq '') || (!defined($$end)) ) {
611: $$end = $enddate;
612: }
613: if ( ($$start eq '') || (!defined($$start)) ) {
614: $$start = $startdate;
615: }
616: # Clean up whitespace
617: foreach ($dom,$uname,$pid,$first,$middle,$last,$gene,$usec) {
618: $$_ =~ s/(\s+$|^\s+)//g;
619: }
620: return;
621: }
622:
623: sub execute_add {
624: my ($context,$caller,$uname,$dom,$auth,$authparam,$first,$middle,$last,$gene,$pid,$usec,$end,$start,$emailenc,$cid,$addresult,$enrollcount,$linefeed,$logmsg) = @_;
625: # Get the user's information and authentication
1.23 raeburn 626: my %userenv = &Apache::lonnet::get('environment',['firstname','middlename','lastname','generation','id','critnotification','notification','permanentemail'],$dom,$uname);
1.16 raeburn 627: my ($tmp) = keys(%userenv);
628: if ($tmp =~ /^(con_lost|error)/i) {
629: %userenv = ();
630: }
631: # Get the user's e-mail address
632: if ($userenv{critnotification} =~ m/%40/) {
633: unless ($emailenc eq $userenv{critnotification}) {
1.33 raeburn 634: $$logmsg .= &mt('Current critical notification e-mail
635: - [_1] for [_2] is different to e-mail address in institutional classlist - [_3].',$userenv{critnotification},$uname,$emailenc).$linefeed;
1.16 raeburn 636: }
637: }
638: if ($userenv{notification} =~ m/%40/) {
1.23 raeburn 639: unless ($emailenc eq $userenv{notification}) {
1.33 raeburn 640: $$logmsg .= &mt('Current standard notification e-mail
641: - [_1] for [_2] is different to e-mail address in institutional classlist - [_3]',$userenv{notification},$uname,$emailenc).$linefeed;
1.16 raeburn 642: }
643: }
1.23 raeburn 644: if ($userenv{permanentemail} =~ m/%40/) {
645: unless ($emailenc eq $userenv{permanentemail}) {
1.33 raeburn 646: $$logmsg .= &mt('Current permanent e-mail
647: - [_1] for [_2] is different to e-mail address in institutional classlist - [_3]',$userenv{permanentemail},$uname,$emailenc).$linefeed;
1.23 raeburn 648: }
649: }
1.16 raeburn 650: my $krbdefdom = '';
651: my $currentauth=&Apache::lonnet::queryauthenticate($uname,$dom);
652: if ($currentauth=~/^(krb[45]):(.*)/) {
653: $currentauth = $1;
654: $krbdefdom = $2;
655: } elsif ($currentauth=~ /^(unix|internal|localauth):/) {
656: $currentauth = $1;
657: } else {
1.33 raeburn 658: $$logmsg .= &mt('Invalid authentication method [_1] for [_2].',$currentauth,$uname).$linefeed;
1.16 raeburn 659: }
660: # Report if authentication methods are different.
661: if ($currentauth ne $auth) {
1.33 raeburn 662: $$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;
1.16 raeburn 663: } elsif ($auth =~ m/^krb/) {
664: if ($krbdefdom ne $authparam) {
1.33 raeburn 665: $$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;
1.16 raeburn 666: }
667: }
668:
669: # Check user data
670: if ($first ne $userenv{'firstname'} ||
671: $middle ne $userenv{'middlename'} ||
672: $last ne $userenv{'lastname'} ||
673: $gene ne $userenv{'generation'} ||
1.23 raeburn 674: $pid ne $userenv{'id'} ||
675: $emailenc ne $userenv{'permanentemail'} ) {
1.16 raeburn 676: # Make the change(s)
677: my %changeHash;
678: $changeHash{'firstname'} = $first;
679: $changeHash{'middlename'} = $middle;
680: $changeHash{'lastname'} = $last;
681: $changeHash{'generation'} = $gene;
682: $changeHash{'id'} = $pid;
1.23 raeburn 683: $changeHash{'permanentemail'} = $emailenc;
1.16 raeburn 684: my $putresult = &Apache::lonnet::put('environment',\%changeHash,$dom,$uname);
685: if ($putresult eq 'ok') {
1.33 raeburn 686: $$logmsg .= &mt('User information updated for user: [_1]$uname prior to enrollment.',$uname).$linefeed;
1.16 raeburn 687: } else {
1.33 raeburn 688: $$logmsg .= &mt('There was a problem modifying user data for existing user - [_1] -error: [_2], enrollment will still be attempted.',$uname,$putresult).$linefeed;
1.16 raeburn 689: }
690: }
691:
692: # Assign the role of student in the course.
693: my $classlist_reply = &Apache::lonnet::modify_student_enrollment($dom,$uname,$pid,$first,$middle,$last,$gene,$usec,$end,$start,'auto','',$cid);
694: if ($classlist_reply eq 'ok') {
695: my $access = &showaccess($end,$start);
1.33 raeburn 696: my $showsec = $usec;
697: if ($usec eq '') {
698: $showsec = &mt('none');
699: }
1.16 raeburn 700: if ($caller eq 'switchtype') {
1.33 raeburn 701: $$logmsg .= &mt("Existing user [_1] detected in institutional classlist - switched from 'manual' to 'auto' enrollment in section/group [_2].",$uname,$showsec).$access.$linefeed;
1.16 raeburn 702: } elsif ($caller eq 'newstudent') {
703: $$enrollcount ++;
1.33 raeburn 704: $$addresult .= "$first $last ($pid) - $uname ".&mt("enrolled in section/group '[_1]'.",$showsec).$access.$linefeed;
1.16 raeburn 705: }
706: if ($context eq 'automated') {
1.33 raeburn 707: $$logmsg .= &mt('Existing [_1] user [_2] enrolled successfully.',$dom,$uname).$linefeed;
1.16 raeburn 708: }
709: } else {
1.33 raeburn 710: $$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;
1.16 raeburn 711: }
712: return;
713: }
714:
715: sub datechange_check {
716: my ($oldstart,$oldend,$startdate,$enddate) = @_;
717: my $datechange = 0;
718: unless ($oldstart eq $startdate) {
719: $datechange = 1;
720: }
721: if (!$datechange) {
722: if (!$oldend) {
723: if ($enddate) {
724: $datechange = 1;
725: }
726: } elsif ($oldend ne $enddate) {
727: $datechange = 1;
728: }
729: }
730: return $datechange;
731: }
732:
1.15 raeburn 733: sub showaccess {
734: my ($end,$start) = @_;
735: my $showstart;
736: my $showend;
737: if ( (!$start) || ($start <= time) ) {
738: $showstart = 'immediately';
739: } else {
740: $showstart = &Apache::lonlocal::locallocaltime($start);
741: }
742: if (!$end) {
743: $showend = 'no end date';
744: } else {
745: $showend = &Apache::lonlocal::locallocaltime($end);
746: }
1.33 raeburn 747: my $access_msg = ' '.&mt('Access starts: [_1], ends: [_2].',$showstart,$showend);
1.15 raeburn 748: return $access_msg;
749: }
750:
1.1 raeburn 751: sub parse_classlist {
1.6 raeburn 752: my ($tmpdir,$dom,$crs,$class,$placeref,$groupID,$studentsref) = @_;
1.5 raeburn 753: my $xmlfile = $tmpdir."/tmp/".$dom."_".$crs."_".$class."_classlist.xml";
1.6 raeburn 754: my $uname = '';
755: my @state;
1.8 raeburn 756: my @items = ('autharg','authtype','email','firstname','generation','lastname','middlename','studentID');
1.6 raeburn 757: my $p = HTML::Parser->new
758: (
759: xml_mode => 1,
760: start_h =>
761: [sub {
762: my ($tagname, $attr) = @_;
763: push @state, $tagname;
764: if ("@state" eq "students student") {
765: $uname = $attr->{username};
766: }
767: }, "tagname, attr"],
768: text_h =>
769: [sub {
770: my ($text) = @_;
771: if ("@state" eq "students student groupID") {
772: $$studentsref{$uname}[ $$placeref{'groupID'} ] = $groupID;
1.8 raeburn 773: } elsif ("@state" eq "students student startdate") {
774: my $start = $text;
775: unless ($text eq '') {
776: $start = &process_date($text);
777: }
778: $$studentsref{$uname}[ $$placeref{'startdate'} ] = $start;
779: } elsif ("@state" eq "students student enddate") {
780: my $end = $text;
781: unless ($text eq '') {
782: $end = &process_date($text);
783: }
784: $$studentsref{$uname}[ $$placeref{'enddate'} ] = $end;
1.6 raeburn 785: } else {
786: foreach my $item (@items) {
787: if ("@state" eq "students student $item") {
788: $$studentsref{$uname}[ $$placeref{$item} ] = $text;
789: }
790: }
791: }
792: }, "dtext"],
793: end_h =>
794: [sub {
795: my ($tagname) = @_;
796: pop @state;
797: }, "tagname"],
798: );
799:
800: $p->parse_file($xmlfile);
801: $p->eof;
1.8 raeburn 802: if (-e "$xmlfile") {
803: unlink $xmlfile;
804: }
1.3 raeburn 805: return;
1.1 raeburn 806: }
807:
1.8 raeburn 808: sub process_date {
809: my $timestr = shift;
810: my $timestamp = '';
811: if ($timestr =~ m/^\d{4}:\d{2}:\d{2}/) {
812: my @entries = split/:/,$timestr;
813: for (my $j=0; $j<@entries; $j++) {
814: if ( length($entries[$j]) > 1 ) {
815: $entries[$j] =~ s/^0//;
816: }
817: }
818: $entries[1] = $entries[1] - 1;
819: $timestamp = timelocal($entries[5],$entries[4],$entries[3],$entries[2],$entries[1],$entries[0]);
820: }
821: return $timestamp;
822: }
823:
1.1 raeburn 824: sub create_password {
1.8 raeburn 825: my $passwd = '';
1.11 raeburn 826: 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");
1.8 raeburn 827: for (my $i=0; $i<8; $i++) {
828: my $lettnum = int (rand 2);
829: my $item = '';
830: if ($lettnum) {
831: $item = $letts[int( rand(26) )];
832: my $uppercase = int(rand 2);
833: if ($uppercase) {
834: $item =~ tr/a-z/A-Z/;
835: }
836: } else {
837: $item = int( rand(10) );
838: }
839: $passwd .= $item;
840: }
841: return ($passwd);
1.9 raeburn 842: }
843:
1.19 raeburn 844: sub get_courseinfo {
845: my ($dom,$crs,$courseinfo) = @_;
846: my $owner;
847: if (defined($dom) && defined($crs)) {
1.31 raeburn 848: my %settings = &Apache::lonnet::get('environment',['internal.coursecode','internal.showphoto','description'],$dom,$crs);
1.19 raeburn 849: if ( defined($settings{'internal.coursecode'}) ) {
850: $$courseinfo{'inst_code'} = $settings{'internal.coursecode'};
851: }
852: if ( defined($settings{'description'}) ) {
853: $$courseinfo{'description'} = $settings{'description'};
854: }
1.31 raeburn 855: if ( defined($settings{'internal.showphoto'}) ) {
856: $$courseinfo{'showphoto'} = $settings{'internal.showphoto'};
1.28 raeburn 857: }
1.19 raeburn 858: }
859: return;
860: }
861:
1.1 raeburn 862: sub CL_autharg { return 0; }
863: sub CL_authtype { return 1;}
864: sub CL_email { return 2;}
865: sub CL_enddate { return 3;}
866: sub CL_firstname { return 4;}
867: sub CL_generation { return 5;}
868: sub CL_groupID { return 6;}
869: sub CL_lastname { return 7;}
870: sub CL_middlename { return 8;}
871: sub CL_startdate { return 9; }
872: sub CL_studentID { return 10; }
873:
1.28 raeburn 874: sub photo_response_types {
1.29 albertel 875: my %lt = &Apache::lonlocal::texthash(
1.28 raeburn 876: 'same' => 'remained unchanged',
877: 'update' => 'were updated',
878: 'new' => 'were added',
879: 'missing' => 'were missing',
880: 'error' => 'were not imported because an error occurred',
881: 'nouser' => 'were for users without accounts',
882: 'noid' => 'were for users without student IDs',
1.29 albertel 883: );
1.28 raeburn 884: return %lt;
885: }
886:
887:
1.1 raeburn 888: 1;
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>