--- loncom/lonnet/perl/lonnet.pm 2002/10/07 13:50:36 1.292 +++ loncom/lonnet/perl/lonnet.pm 2002/10/10 14:34:05 1.296 @@ -1,7 +1,7 @@ # The LearningOnline Network # TCP networking package # -# $Id: lonnet.pm,v 1.292 2002/10/07 13:50:36 www Exp $ +# $Id: lonnet.pm,v 1.296 2002/10/10 14:34:05 www Exp $ # # Copyright Michigan State University Board of Trustees # @@ -86,6 +86,8 @@ use GDBM_File; use Apache::Constants qw(:common :http); use HTML::LCParser; use Fcntl qw(:flock); +use Apache::loncoursedata; + my $readit; # --------------------------------------------------------------------- Logging @@ -838,13 +840,16 @@ sub finishuserfileupload { } # Notify homeserver to grep it # - if -(&reply('fetchuserfile:'.$docudom.'/'.$docuname.'/'.$fname,$docuhome) eq 'ok') - { + + my $fetchresult= + &reply('fetchuserfile:'.$docudom.'/'.$docuname.'/'.$fname,$docuhome); + if ($fetchresult eq 'ok') { # # Return the URL to it return '/uploaded/'.$path.$fname; } else { + &logthis('Failed to transfer '.$docudom.'/'.$docuname.'/'.$fname. + ' to host '.$docuhome.': '.$fetchresult); return '/adm/notfound.html'; } } @@ -2320,10 +2325,24 @@ sub modifystudent { return 'error: no such user'; } # -------------------------------------------------- Add student to course list + if ($first eq '' || $last eq '' || $uid eq '') { + # They did not supply us with enough data to enroll the student, so + # we need to pick up more information. + my %tmp = &dump('environment',$udom,$uname, + ['firstname','middlename','lastname', 'generation','id'] + ); + $first = $tmp{'firstname'} if (!defined($first) || $first eq ''); + $middle = $tmp{'middlename'} if (!defined($middle) || $middle eq ''); + $last = $tmp{'lastname'} if (!defined($last) || $last eq ''); + $gene = $tmp{'genename'} if (!defined($gene) || $gene eq ''); + $uid = $tmp{'id'} if (!defined($uid) || $uid eq ''); + } + my $fullname = &Apache::loncoursedata::ProcessFullName($last,$gene, + $first,$middle); $reply=critical('put:'.$ENV{'course.'.$cid.'.domain'}.':'. $ENV{'course.'.$cid.'.num'}.':classlist:'. &escape($uname.':'.$udom).'='. - &escape($end.':'.$start), + &escape(join(':',$end,$start,$uid,$usec,$fullname)), $ENV{'course.'.$cid.'.home'}); unless (($reply eq 'ok') || ($reply eq 'delayed')) { return 'error: '.$reply; @@ -2838,8 +2857,8 @@ sub metadata { $uri=&declutter($uri); # if it is a non metadata possible uri return quickly - if (($uri eq '') || ($uri =~ m|^/*adm/|) || ($uri =~ m|/$|) || - ($uri =~ m|/.meta$|)) { + if (($uri eq '') || (($uri =~ m|^/*adm/|) && ($uri !~ m|^adm/includes|)) || + ($uri =~ m|/$|) || ($uri =~ m|/.meta$|)) { return ''; } my $filename=$uri;