--- loncom/homework/essayresponse.pm 2003/01/22 17:29:21 1.17
+++ loncom/homework/essayresponse.pm 2003/01/24 18:45:23 1.21
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# essay (ungraded) style responses
#
-# $Id: essayresponse.pm,v 1.17 2003/01/22 17:29:21 www Exp $
+# $Id: essayresponse.pm,v 1.21 2003/01/24 18:45:23 www Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -31,6 +31,7 @@
package Apache::essayresponse;
use strict;
use Apache::lonxml;
+use Apache::lonnet;
BEGIN {
&Apache::lonxml::register('Apache::essayresponse',('essayresponse'));
@@ -48,6 +49,7 @@ sub start_essayresponse {
my $ncol= &Apache::lonnet::EXT("resource.$part".'_'."$id.maxcollaborators");
my $coll= &HTML::Entities::encode($Apache::lonhomework::history{"resource.$part.$id.collaborators"});
my $uploadedfiletypes= &Apache::lonnet::EXT("resource.$part".'_'."$id.uploadedfiletypes");
+ $uploadedfiletypes=~s/[^\w\,]//g;
my $uploadedfile= &HTML::Entities::encode($Apache::lonhomework::history{"resource.$part.$id.uploadedfile"});
$result='
Submit a file: Allowed filetypes: '.$uploadedfiletypes.' (Hand in a file you have prepared on your computer) |
'. ''. @@ -87,6 +96,18 @@ sub end_essayresponse { $Apache::lonhomework::results{"resource.$part.$id.collaborators"}=$collaborators if ($collaborators ne $previous_list); } + my $filename= $ENV{'form.HWFILE'.$part.'_'.$id.'.filename'}; + if ($filename =~ /[^\s]/) { + my $uploadedfiletypes= &Apache::lonnet::EXT("resource.$part".'_'."$id.uploadedfiletypes"); + $uploadedfiletypes=~s/[^\w\,]//g; + $uploadedfiletypes=','.$uploadedfiletypes.','; + my ($extension)=($filename=~/\.(\w+)$/); + if ($uploadedfiletypes=~/\,$extension\,/i) { + $Apache::lonhomework::results{"resource.$part.$id.uploadedfile"}=$filename; + $Apache::lonhomework::results{"resource.$part.$id.uploadedurl"}= + &Apache::lonnet::userfileupload('HWFILE'.$part.'_'.$id); + } + } if ( defined $ENV{'form.submitted'}) { my $response = $ENV{'form.HWVAL'.$id}; if ( $response =~ /[^\s]/) { @@ -108,7 +129,7 @@ sub end_essayresponse { if ($Apache::lonhomework::type eq 'exam') { $result.='\begin{enumerate}\item[\textbf{'.$Apache::lonxml::counter.'}.]\textit{Live blank on scoring form}\vskip 0 mm'; &Apache::lonxml::increment_counter(); - $result.= '\item[\textbf{'.$Apache::lonxml::counter.'}.]\textit{Live blank on scoring form}\vskip 0 mm \end{enumerate}'; + $result.= '\item[\textbf{'.$Apache::lonxml::counter.'}.]\textit{Leave blank on scoring form}\vskip 0 mm \end{enumerate}'; &Apache::lonxml::increment_counter(); } } |