--- loncom/homework/externalresponse.pm 2014/01/13 15:29:10 1.26 +++ loncom/homework/externalresponse.pm 2014/12/04 15:41:30 1.27 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # external style responses # -# $Id: externalresponse.pm,v 1.26 2014/01/13 15:29:10 bisitz Exp $ +# $Id: externalresponse.pm,v 1.27 2014/12/04 15:41:30 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -211,7 +211,22 @@ sub end_externalresponse { } my $uploadedflag=0; my $totalsize=0; - &Apache::essayresponse::file_submission($part,$id,\$award,\$uploadedflag,\$totalsize,\@deletions); + my %info; + my $url = &Apache::lonxml::get_param('url',$parstack,$safeeval); + if ($url =~ m{^https?://([^/]+)/}) { + use Socket; + my $ip = gethostbyname($1); + if (length($ip) eq 4) { + $info{'ip'} = inet_ntoa($ip); + } + } elsif ($url =~ m{^/}) { + my $ip = &Apache::lonnet::get_host_ip($Apache::lonnet::perlvar{'lonHostID'}); + if ($ip =~ /^[\d\.]+$/) { + $info{'ip'} = $ip; + } + } + &Apache::essayresponse::file_submission($part,$id,\$award,\$uploadedflag,\$totalsize, + \@deletions,'externalresponse',\%info); $Apache::lonhomework::results{"resource.$part.$id.submission"}=$response; $Apache::lonhomework::results{"resource.$part.$id.awarddetail"}=$award; my %previous=&Apache::response::check_for_previous($response,$part,$id);