version 1.63, 2005/04/08 19:21:52
|
version 1.66, 2005/05/03 19:22:58
|
Line 50 sub start_essayresponse {
|
Line 50 sub start_essayresponse {
|
$uploadedfiletypes=~s/[^\w\,]//g; |
$uploadedfiletypes=~s/[^\w\,]//g; |
$result='<br /><table border="1">'; |
$result='<br /><table border="1">'; |
$result.='<tr><td>'. |
$result.='<tr><td>'. |
|
'<label>'. |
'<input type="radio" name="HWDRAFT'.$part.'_'.$id.'" value="yes" checked="checked" /> '. |
'<input type="radio" name="HWDRAFT'.$part.'_'.$id.'" value="yes" checked="checked" /> '. |
&mt('Submit entries below as answer to receive credit').' <br />'. |
&mt('Submit entries below as answer to receive credit'). |
'<input type="radio" name="HWDRAFT'.$part.'_'.$id.'" value="no" /> '. |
'</label> <br />'. |
|
'<label>'. |
|
'<input type="radio" name="HWDRAFT'.$part.'_'.$id.'" value="no" /> '. |
&mt('Save entries below as a draft answer (not submitting them for credit yet)'). |
&mt('Save entries below as a draft answer (not submitting them for credit yet)'). |
' </td></tr>'; |
'</label>'. |
|
' </td></tr>'; |
if ($ncol > 0) { |
if ($ncol > 0) { |
$result .='<tr><td>'. |
$result .='<tr><td>'.'<label>'. |
'Collaborators: <input type="text" size="70" max="80" name="HWCOL'. |
'Collaborators: <input type="text" size="70" max="80" name="HWCOL'. |
$part.'_'.$id.'" value="'.$coll.'" /><br />'. |
$part.'_'.$id.'" value="'.$coll.'" /><br />'. |
&mt('(Enter maximum [_1] collaborators using username or username@domain, e.g. smithje or smithje@[_2].)',$ncol,$env{'user.domain'}).'<br />'; |
&mt('(Enter maximum [_1] collaborators using username or username@domain, e.g. smithje or smithje@[_2].)',$ncol,$env{'user.domain'}). |
|
'</label><br />'; |
$result .= &check_collaborators($ncol,$coll) if ($coll =~ /\w+/); |
$result .= &check_collaborators($ncol,$coll) if ($coll =~ /\w+/); |
$result .='</td></tr>'; |
$result .='</td></tr>'; |
} |
} |
Line 159 sub file_submission {
|
Line 164 sub file_submission {
|
$Apache::lonhomework::results{"resource.$part.$id.$which"}=$files; |
$Apache::lonhomework::results{"resource.$part.$id.$which"}=$files; |
my @submitted_files = split(/,/,$files); |
my @submitted_files = split(/,/,$files); |
my $uploadedfiletypes= &Apache::lonnet::EXT("resource.$part".'_'."$id.uploadedfiletypes"); |
my $uploadedfiletypes= &Apache::lonnet::EXT("resource.$part".'_'."$id.uploadedfiletypes"); |
$uploadedfiletypes=~s/[^\w\,]//g; |
if ($uploadedfiletypes) { |
$uploadedfiletypes=','.$uploadedfiletypes.','; |
$uploadedfiletypes=~s/[^\w\,]//g; |
foreach my $file (@submitted_files) { |
$uploadedfiletypes=','.$uploadedfiletypes.','; |
my ($extension)=($file=~/\.(\w+)$/); |
foreach my $file (@submitted_files) { |
unless ($uploadedfiletypes=~/\,$extension\,/i) { |
my ($extension)=($file=~/\.(\w+)$/); |
$$award='INVALID_FILETYPE'; |
unless ($uploadedfiletypes=~/\,$extension\,/i) { |
|
$$award='INVALID_FILETYPE'; |
|
} |
} |
} |
} |
} |
if ($$award ne 'INVALID_FILETYPE' && ref($uploadedflag)) { |
if ($$award ne 'INVALID_FILETYPE' && ref($uploadedflag)) { |
Line 172 sub file_submission {
|
Line 179 sub file_submission {
|
} |
} |
if ($$award ne 'INVALID_FILETYPE' && $which eq 'portfiles') { |
if ($$award ne 'INVALID_FILETYPE' && $which eq 'portfiles') { |
my ($symb,$crsid,$domain,$name)=&Apache::lonxml::whichuser(); |
my ($symb,$crsid,$domain,$name)=&Apache::lonxml::whichuser(); |
&Apache::lonnet::unmark_as_readonly($domain,$name,$symb.$crsid); |
&Apache::lonnet::unmark_as_readonly($domain,$name,[$symb,$crsid]); |
&Apache::lonnet::mark_as_readonly($domain,$name,\@submitted_files,$symb.$crsid); |
&Apache::lonnet::mark_as_readonly($domain,$name,\@submitted_files,[$symb,$crsid]); |
&Apache::lonnet::clear_selected_files($name); |
&Apache::lonnet::clear_selected_files($name); |
} |
} |
if ($$award ne 'INVALID_FILETYPE' && $which eq 'filename') { |
if ($$award ne 'INVALID_FILETYPE' && $which eq 'filename') { |
Line 186 sub file_submission {
|
Line 193 sub file_submission {
|
} elsif ($which eq 'portfiles' && |
} elsif ($which eq 'portfiles' && |
$Apache::lonhomework::history{"resource.$part.$id.$which"}) { |
$Apache::lonhomework::history{"resource.$part.$id.$which"}) { |
my ($symb,$crsid,$domain,$name)=&Apache::lonxml::whichuser(); |
my ($symb,$crsid,$domain,$name)=&Apache::lonxml::whichuser(); |
&Apache::lonnet::unmark_as_readonly($domain,$name,$symb.$crsid); |
&Apache::lonnet::unmark_as_readonly($domain,$name,[$symb,$crsid]); |
$Apache::lonhomework::results{"resource.$part.$id.$which"}=""; |
$Apache::lonhomework::results{"resource.$part.$id.$which"}=""; |
} |
} |
} |
} |