--- loncom/homework/essayresponse.pm 2008/11/16 02:46:25 1.91 +++ 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.91 2008/11/16 02:46:25 raeburn Exp $ +# $Id: essayresponse.pm,v 1.94 2008/12/15 20:00:21 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -26,21 +26,6 @@ # http://www.lon-capa.org/ # -=pod - -=head1 NAME - -Apache::easyresponse - -=head1 SYNOPSIS - -Handler to evaluate essay (ungraded) style responses. - -This is part of the LearningOnline Network with CAPA project -described at http://www.lon-capa.org. - -=cut - package Apache::essayresponse; use strict; use Apache::lonxml(); @@ -66,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.= ' '; } @@ -95,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') { @@ -288,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) { @@ -323,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; @@ -415,3 +411,37 @@ sub check_collaborators { 1; __END__ + + +=pod + +=head1 NAME + +Apache::easyresponse + +=head1 SYNOPSIS + +Handler to evaluate essay (ungraded) style responses. + +This is part of the LearningOnline Network with CAPA project +described at http://www.lon-capa.org. + +=head1 SUBROUTINES + +=over + +=item start_essayresponse() + +=item end_essayresponse() + +=item format_prior_response() + +=item file_submission() + +=item delete_form_items() + +=item check_collaborators() + +=back + +=cut