version 1.68, 2005/09/19 20:41:01
|
version 1.72, 2006/05/30 12:45:36
|
Line 31 use strict;
|
Line 31 use strict;
|
use Apache::lonxml(); |
use Apache::lonxml(); |
use Apache::lonnet; |
use Apache::lonnet; |
use Apache::lonlocal; |
use Apache::lonlocal; |
|
use lib '/home/httpd/lib/perl/'; |
|
use LONCAPA; |
|
|
|
|
BEGIN { |
BEGIN { |
&Apache::lonxml::register('Apache::essayresponse',('essayresponse')); |
&Apache::lonxml::register('Apache::essayresponse',('essayresponse')); |
Line 42 sub start_essayresponse {
|
Line 45 sub start_essayresponse {
|
my $id = &Apache::response::start_response($parstack,$safeeval); |
my $id = &Apache::response::start_response($parstack,$safeeval); |
if ($target eq 'meta') { |
if ($target eq 'meta') { |
$result=&Apache::response::meta_package_write('essayresponse'); |
$result=&Apache::response::meta_package_write('essayresponse'); |
} elsif ($target eq 'web') { |
} elsif ($target eq 'web' && |
|
$Apache::inputtags::status[-1] eq 'CAN_ANSWER') { |
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"},'<>&"'); |
Line 79 sub end_essayresponse {
|
Line 83 sub end_essayresponse {
|
my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_; |
my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_; |
my $part = $Apache::inputtags::part; |
my $part = $Apache::inputtags::part; |
my $id = $Apache::inputtags::response[-1]; |
my $id = $Apache::inputtags::response[-1]; |
my $increment = 1; |
my $increment = &Apache::response::repetition(); |
my $result; |
my $result; |
if ( $target eq 'grade' ) { |
if ( $target eq 'grade' ) { |
my $collaborators = $env{'form.HWCOL'.$part.'_'.$id}; |
my $collaborators = $env{'form.HWCOL'.$part.'_'.$id}; |
Line 118 sub end_essayresponse {
|
Line 122 sub end_essayresponse {
|
&Apache::lonnet::declutter($ENV{'REQUEST_URI'}); |
&Apache::lonnet::declutter($ENV{'REQUEST_URI'}); |
my ($adom,$aname,$apath)= |
my ($adom,$aname,$apath)= |
($essayurl=~/^(\w+)\/(\w+)\/(.*)$/); |
($essayurl=~/^(\w+)\/(\w+)\/(.*)$/); |
$apath=&Apache::lonnet::escape($apath); |
$apath=&escape($apath); |
$apath=~s/\W/\_/gs; |
$apath=~s/\W/\_/gs; |
&Apache::lonnet::put('nohist_essay_'.$apath, |
&Apache::lonnet::put('nohist_essay_'.$apath, |
{ $akey => $response },$adom,$aname); |
{ $akey => $response },$adom,$aname); |
Line 128 sub end_essayresponse {
|
Line 132 sub end_essayresponse {
|
} |
} |
} elsif ($target eq 'edit') { |
} elsif ($target eq 'edit') { |
$result.=&Apache::edit::end_table(); |
$result.=&Apache::edit::end_table(); |
} elsif ($target eq 'tex') { |
|
if ($Apache::lonhomework::type eq 'exam') { |
} elsif ($target eq 'tex' |
my $repetition=&Apache::response::repetition(); |
&& $Apache::lonhomework::type eq 'exam') { |
$result.='\begin{enumerate}'; |
$result .= &Apache::inputtags::exam_score_line($target); |
if ($env{'request.state'} eq "construct" ) {$result.='\item[\strut]';} |
|
for (my $i=0;$i<$repetition;$i++) { |
} elsif ($target eq 'answer') { |
$result.='\item[\textbf{'.($Apache::lonxml::counter+$i). |
$result.=&Apache::response::answer_header($$tagstack[-1]); |
'}.]\textit{'.&mt('Leave blank on scoring form'). |
$result.=&Apache::response::answer_part($$tagstack[-1],''); |
'}\vskip 0 mm'; |
$result.=&Apache::response::answer_footer($$tagstack[-1]); |
} |
|
$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' || |
$target eq 'tex' || $target eq 'analyze') { |
$target eq 'tex' || $target eq 'analyze') { |
&Apache::lonxml::increment_counter($increment); |
&Apache::lonxml::increment_counter($increment); |