--- loncom/homework/essayresponse.pm 2008/11/20 14:37:37 1.92 +++ loncom/homework/essayresponse.pm 2008/12/15 20:00:21 1.94 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # essay (ungraded) style responses # -# $Id: essayresponse.pm,v 1.92 2008/11/20 14:37:37 jms Exp $ +# $Id: essayresponse.pm,v 1.94 2008/12/15 20:00:21 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -51,6 +51,10 @@ sub start_essayresponse { 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 $maxfilesize=&Apache::lonnet::EXT("resource.$part".'_'."$id.maxfilesize"); + if (!defined($maxfilesize)) { + $maxfilesize = 10.0; #FIXME This should become a domain configuration + } if ( $Apache::lonhomework::type eq 'survey' ) { $result.= ' '; } @@ -80,8 +84,14 @@ sub start_essayresponse { $result .= &check_collaborators($ncol,$coll) if ($coll =~ /\w+/); $result .=''; } - $result.=&Apache::inputtags::file_selector($part,$id, - $uploadedfiletypes,'both'); + my $filesfrom = 'both'; + my $stuname = &Apache::lonnet::EXT('user.name'); + my $studom = &Apache::lonnet::EXT('user.domain'); + if (!&Apache::lonnet::usertools_access($stuname,$studom,'portfolio')) { + $filesfrom = 'uploadonly'; + } + $result.=&Apache::inputtags::file_selector($part,$id,$uploadedfiletypes, + $filesfrom,undef,$maxfilesize); $result.=''; } elsif ($target eq 'web' && $Apache::inputtags::status[-1] ne 'CAN_ANSWER') { @@ -273,7 +283,7 @@ sub file_submission { } my $maxfilesize=&Apache::lonnet::EXT("resource.$part".'_'."$id.maxfilesize"); if (!$maxfilesize) { - $maxfilesize = 100.0; #FIXME This should become a domain configuration + $maxfilesize = 10.0; #FIXME This should become a domain configuration } my %dirlist; foreach my $file (@acceptable_files) { @@ -308,12 +318,13 @@ sub file_submission { if ($which eq 'filename') { &delete_form_items($jspart,$id); } + } else { + push(@accepted_files,$file); } } else { push(@accepted_files,$file); } } - my $uploadedfiletypes= &Apache::lonnet::EXT("resource.$part".'_'."$id.uploadedfiletypes"); $Apache::lonhomework::results{"resource.$part.$id.$which"}=join(',',@accepted_files); if (($$award eq 'INVALID_FILETYPE') || ($award eq 'EXCESS_FILESIZE')) { return; @@ -433,4 +444,4 @@ described at http://www.lon-capa.org. =back -=cut \ No newline at end of file +=cut