version 1.35, 2004/05/10 23:09:18
|
version 1.43, 2004/10/26 21:27:10
|
Line 44 sub start_essayresponse {
|
Line 44 sub start_essayresponse {
|
$result=&Apache::response::meta_package_write('essayresponse'); |
$result=&Apache::response::meta_package_write('essayresponse'); |
} elsif ($target eq 'web') { |
} elsif ($target eq 'web') { |
my $part= $Apache::inputtags::part; |
my $part= $Apache::inputtags::part; |
|
|
my $ncol= &Apache::lonnet::EXT("resource.$part".'_'."$id.maxcollaborators"); |
my $ncol= &Apache::lonnet::EXT("resource.$part".'_'."$id.maxcollaborators"); |
my $coll= &HTML::Entities::encode($Apache::lonhomework::history{"resource.$part.$id.collaborators"},'<>&"'); |
my $coll= &HTML::Entities::encode($Apache::lonhomework::history{"resource.$part.$id.collaborators"},'<>&"'); |
my $uploadedfiletypes= &Apache::lonnet::EXT("resource.$part".'_'."$id.uploadedfiletypes"); |
my $uploadedfiletypes= &Apache::lonnet::EXT("resource.$part".'_'."$id.uploadedfiletypes"); |
Line 67 sub start_essayresponse {
|
Line 66 sub start_essayresponse {
|
} |
} |
if ($uploadedfiletypes) { |
if ($uploadedfiletypes) { |
$result.='<tr><td>'.&mt('Submit a file:'). |
$result.='<tr><td>'.&mt('Submit a file:'). |
' <input type="file" size="50" name="HWFILE'. |
' <br /><input type="file" size="50" name="HWFILE'. |
$part.'_'.$id.'" onFocus="this.form.enctype='. |
$part.'_'.$id.'" onFocus="this.form.enctype='. |
"'multipart/form-data'".';" /><br />'. |
"'multipart/form-data'".';" /><br />'. |
&mt('Allowed filetypes: <b>[_1]</b>',$uploadedfiletypes). |
&mt('Allowed filetypes: <b>[_1]</b>',$uploadedfiletypes).'<br />'. |
|
'<strong>OR:</strong><br /><a href='."'".'javascript:void(window.open("/adm/portfolio?mode=selectfile&fieldname=HWPORT'.$part.'_'.$id.'","cat","height=400,'. |
|
'width=500,scrollbars=1,resizable=1,menubar=0,location=1"))'."'".'>Select Portfolio Files</a>'. |
|
'<br />'. |
|
'<input type="text" size="50" name="HWPORT'.$part.'_'.$id.'" value="" />'. |
'<br />'; |
'<br />'; |
if ($uploadedfile) { |
if ($portfile=~/[^\s]/){ |
|
$result.="Portfolio files previously selected: <strong>".$Apache::lonhomework::history{"resource.$part.$id.portfiles"}."</strong><br />"; |
|
} |
|
|
|
if ($uploadedfile) { |
my $url=$Apache::lonhomework::history{"resource.$part.$id.uploadedurl"}; |
my $url=$Apache::lonhomework::history{"resource.$part.$id.uploadedurl"}; |
push (@Apache::lonxml::extlinks,$url); |
push (@Apache::lonxml::extlinks,$url); |
&Apache::lonnet::allowuploaded('/adm/essayresponse',$url); |
&Apache::lonnet::allowuploaded('/adm/essayresponse',$url); |
Line 109 sub end_essayresponse {
|
Line 116 sub end_essayresponse {
|
} elsif ( defined($ENV{'form.submitted'}) ) { |
} elsif ( defined($ENV{'form.submitted'}) ) { |
my $response = $ENV{'form.HWVAL_'.$id}; |
my $response = $ENV{'form.HWVAL_'.$id}; |
my $filename= $ENV{'form.HWFILE'.$part.'_'.$id.'.filename'}; |
my $filename= $ENV{'form.HWFILE'.$part.'_'.$id.'.filename'}; |
if (( $response =~ /[^\s]/) || ($filename =~ /[^\s]/)) { |
my $portfiles = $ENV{'form.HWPORT'.$part.'_'.$id}; |
|
if (( $response =~ /[^\s]/) || ($filename =~ /[^\s]/) || ($portfiles =~ /[^\s]/)) { |
my $award; |
my $award; |
if ($ENV{'form.HWDRAFT'.$part.'_'.$id} eq 'yes') { |
if ($ENV{'form.HWDRAFT'.$part.'_'.$id} eq 'yes') { |
$award='SUBMITTED'; |
$award='SUBMITTED'; |
} else { |
} else { |
$award='DRAFT'; |
$award='DRAFT'; |
Line 131 sub end_essayresponse {
|
Line 139 sub end_essayresponse {
|
$award='INVALID_FILETYPE'; |
$award='INVALID_FILETYPE'; |
} |
} |
} |
} |
|
if ($portfiles =~ /[^\s]/) { |
|
$Apache::lonhomework::results{"resource.$part.$id.portfiles"}=$portfiles; |
|
$Apache::lonhomework::results{"resource.$part.$id.uploadedurl"}=$portfiles; |
|
$uploadedflag=1; |
|
} |
$Apache::lonhomework::results{"resource.$part.$id.submission"}=$response; |
$Apache::lonhomework::results{"resource.$part.$id.submission"}=$response; |
$Apache::lonhomework::results{"resource.$part.$id.awarddetail"}=$award; |
$Apache::lonhomework::results{"resource.$part.$id.awarddetail"}=$award; |
my %previous=&Apache::response::check_for_previous($response,$part,$id); |
my %previous=&Apache::response::check_for_previous($response,$part,$id); |
Line 152 sub end_essayresponse {
|
Line 165 sub end_essayresponse {
|
&Apache::lonnet::put('nohist_essay_'.$apath, |
&Apache::lonnet::put('nohist_essay_'.$apath, |
{ $akey => $response },$adom,$aname); |
{ $akey => $response },$adom,$aname); |
} |
} |
} |
} |
} |
} |
} |
} |
} elsif ($target eq 'edit') { |
} elsif ($target eq 'edit') { |
$result.=&Apache::edit::end_table(); |
$result.=&Apache::edit::end_table(); |
} elsif ($target eq 'tex') { |
} elsif ($target eq 'tex') { |
if ($Apache::lonhomework::type eq 'exam') { |
if ($Apache::lonhomework::type eq 'exam') { |
my $repetition=&Apache::response::repetition(); |
my $repetition=&Apache::response::repetition(); |
$result.='\begin{enumerate}'; |
$result.='\begin{enumerate}'; |
|
if ($ENV{'request.state'} eq "construct" ) {$result.='\item[\strut]';} |
for (my $i=0;$i<$repetition;$i++) { |
for (my $i=0;$i<$repetition;$i++) { |
$result.='\item[\textbf{'.($Apache::lonxml::counter+$i). |
$result.='\item[\textbf{'.($Apache::lonxml::counter+$i). |
'}.]\textit{'.&mt('Leave blank on scoring form'). |
'}.]\textit{'.&mt('Leave blank on scoring form'). |
'}\vskip 0 mm'; |
'}\vskip 0 mm'; |
} |
} |
$result.= '\end{enumerate}'; |
$result.= '\end{enumerate}'; |
|
$increment=$repetition; |
} |
} |
} |
} |
if ($target eq 'grade' || $target eq 'web' || $target eq 'answer' || |
if ($target eq 'grade' || $target eq 'web' || $target eq 'answer' || |
Line 174 sub end_essayresponse {
|
Line 189 sub end_essayresponse {
|
&Apache::lonxml::increment_counter($increment); |
&Apache::lonxml::increment_counter($increment); |
} |
} |
&Apache::response::end_response; |
&Apache::response::end_response; |
|
|
return $result; |
return $result; |
} |
} |
|
|