--- loncom/homework/inputtags.pm 2008/12/10 22:47:31 1.248.2.1
+++ loncom/homework/inputtags.pm 2009/09/14 16:39:21 1.248.4.1
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# input definitons
#
-# $Id: inputtags.pm,v 1.248.2.1 2008/12/10 22:47:31 raeburn Exp $
+# $Id: inputtags.pm,v 1.248.4.1 2009/09/14 16:39:21 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -427,13 +427,14 @@ sub end_hiddenline {
# $part -> partid
# $id -> responseid
# $uploadefiletypes -> comma seperated list of extensions allowed or * for any
-# $which -> 'uploadedonly' -> only newly uploaded files
+# $which -> 'uploadonly' -> only newly uploaded files
# 'portfolioonly' -> only allow files from portfolio
# 'both' -> allow files from either location
# $extratext -> additional text to go between the link and the input box
+# $maxfilesize -> maximum cumulative filesize for submitted files (in MB).
# returns a table row
sub file_selector {
- my ($part,$id,$uploadedfiletypes,$which,$extratext)=@_;
+ my ($part,$id,$uploadedfiletypes,$which,$extratext,$maxfilesize)=@_;
if (!$uploadedfiletypes) { return ''; }
my $jspart=$part;
@@ -442,9 +443,16 @@ sub file_selector {
my $result;
$result.='
';
- if ($uploadedfiletypes ne '*') {
- $result.=
- &mt('Allowed filetypes: [_1]',$uploadedfiletypes).' ';
+ if (($uploadedfiletypes ne '*') || ($maxfilesize)) {
+ if ($uploadedfiletypes ne '*') {
+ $result.=
+ &mt('Allowed filetypes: [_1]',''.$uploadedfiletypes.'').' ';
+ }
+ if ($maxfilesize) {
+ $result.=&mt('Combined size of files not to exceed: [_1] MB[_2].',
+ ''.$maxfilesize.'').' ';
+ }
+ $result .= ' ';
}
if ($which eq 'uploadonly' || $which eq 'both') {
$result.=&mt('Submit a file: (only one file can be uploaded)').
@@ -461,7 +469,6 @@ sub file_selector {
''.
' ';
$result .= &show_past_portfile_submission($part,$id);
-
}
$result.='
';
return $result;
@@ -769,7 +776,6 @@ sub decideoutput {
$message = &mt('Submission won\'t be graded. The combined size of submitted files exceeded the amount allowed.');
$css_class=$possible_class{'not_charged_try'};
$button=1;
-
} elsif ($award eq 'INVALID_FILETYPE') {
$message = &mt('Submission won\'t be graded. The type of file submitted is not allowed.');
$css_class=$possible_class{'not_charged_try'};
@@ -848,14 +854,27 @@ sub decideoutput {
my (undef,undef,$domain,$user)=&Apache::lonnet::whichuser();
foreach my $resid(@Apache::inputtags::response){
if ($Apache::lonhomework::history{"resource.$part.$resid.handback"}) {
- $message.=' ';
+ if ($target eq 'tex') {
+ $message.= "\\\\\n";
+ } else {
+ $message.=' ';
+ }
my @files = split(/\s*,\s*/,
$Apache::lonhomework::history{"resource.$part.$resid.handback"});
my $file_msg;
foreach my $file (@files) {
- $file_msg.= ' '.$file.'';
+ if ($target eq 'tex') {
+ $file_msg.= "\\\\\n".$file;
+ } else {
+ $file_msg.= ' '.$file.'';
+ }
}
$message .= &mt('Returned file(s): [_1]',$file_msg);
+ if ($target eq 'tex') {
+ $message.= "\\\\\n";
+ } else {
+ $message.=' ';
+ }
}
}
@@ -1177,7 +1196,7 @@ sub get_grade_messages {
$trystr = '\vskip 0 mm ';
}
} else {
- $trystr = "
".$tries_text." $tries";
+ $trystr = '
'.$tries_text." $tries";
if ($Apache::lonhomework::parsing_a_task) {
} elsif($env{'request.state'} ne 'construct') {
$trystr.="/$maxtries";
@@ -1186,7 +1205,7 @@ sub get_grade_messages {
$trystr.="/".$Apache::inputtags::params{'maxtries'};
}
}
- $trystr.="