version 1.212, 2005/07/12 21:50:05
|
version 1.216, 2005/08/16 16:31:14
|
Line 94 sub get_target {
|
Line 94 sub get_target {
|
if ( defined($env{'form.submitted'}) && |
if ( defined($env{'form.submitted'}) && |
( !defined($env{'form.resetdata'})) && |
( !defined($env{'form.resetdata'})) && |
( !defined($env{'form.newrandomization'}))) { |
( !defined($env{'form.newrandomization'}))) { |
return ('grade', 'web'); |
return ('grade', 'web','answer'); |
} else { |
} else { |
return ('web'); |
return ('web','answer'); |
} |
} |
} elsif ($env{'request.state'} eq "construct") { |
} elsif ($env{'request.state'} eq "construct") { |
if ( defined($env{'form.grade_target'}) ) { |
if ( defined($env{'form.grade_target'}) ) { |
Line 668 sub analyze {
|
Line 668 sub analyze {
|
} |
} |
} |
} |
if (scalar(keys(%allparts)) == 0 ) { |
if (scalar(keys(%allparts)) == 0 ) { |
$request->print('<p>'.&mt('Found no analyzable respones in this problem, currently only Numerical, Formula and String response styles are supported.').'</p>'); |
$request->print('<p>'.&mt('Found no analyzable responses in this problem, currently only Numerical, Formula and String response styles are supported.').'</p>'); |
} |
} |
&Apache::lonhtmlcommon::Close_PrgWin($request,\%prog_state); |
&Apache::lonhtmlcommon::Close_PrgWin($request,\%prog_state); |
&analyze_footer($request); |
&analyze_footer($request); |
Line 711 sub editxmlmode {
|
Line 711 sub editxmlmode {
|
$bodytag=&Apache::loncommon::bodytag(); |
$bodytag=&Apache::loncommon::bodytag(); |
} |
} |
my $html=&Apache::lonxml::xmlbegin(); |
my $html=&Apache::lonxml::xmlbegin(); |
$result.=$html.$bodytag.&Apache::lonxml::message_location().' |
$result.=$html.$bodytag. |
|
&renderpage($request,$file,['no_output_web'],1). |
|
&Apache::lonxml::message_location().' |
<form name="lonhomework" method="POST" action="'. |
<form name="lonhomework" method="POST" action="'. |
&HTML::Entities::encode($env{'request.uri'},'<>&"').'">'. |
&HTML::Entities::encode($env{'request.uri'},'<>&"').'">'. |
&Apache::structuretags::remember_problem_state().' |
&Apache::structuretags::remember_problem_state().' |
Line 737 sub editxmlmode {
|
Line 739 sub editxmlmode {
|
# Render the page in whatever target desired. |
# Render the page in whatever target desired. |
# |
# |
sub renderpage { |
sub renderpage { |
my ($request,$file,$targets) = @_; |
my ($request,$file,$targets,$return_string) = @_; |
|
|
my @targets = @{$targets || [&get_target()]}; |
my @targets = @{$targets || [&get_target()]}; |
&Apache::lonhomework::showhashsubset(\%env,'form.'); |
&Apache::lonhomework::showhashsubset(\%env,'form.'); |
Line 771 sub renderpage {
|
Line 773 sub renderpage {
|
my $result = &Apache::lonxml::xmlparse($request, $target, $problem, |
my $result = &Apache::lonxml::xmlparse($request, $target, $problem, |
&setup_vars($target),%mystyle); |
&setup_vars($target),%mystyle); |
undef($Apache::lonhomework::parsing_a_problem); |
undef($Apache::lonhomework::parsing_a_problem); |
if (!$output) { $result = &Apache::lonxml::message_location(); } |
if (!$output) { $result = ''; } |
#$request->print("Result follows:"); |
#$request->print("Result follows:"); |
if ($target eq 'modified') { |
if ($target eq 'modified') { |
&handle_save_or_undo($request,\$problem,\$result); |
&handle_save_or_undo($request,\$problem,\$result); |
Line 792 sub renderpage {
|
Line 794 sub renderpage {
|
#$request->print(":Result ends"); |
#$request->print(":Result ends"); |
#my $td=&tv_interval($t0); |
#my $td=&tv_interval($t0); |
} |
} |
&Apache::lonxml::add_messages(\$overall_result); |
if (!$return_string) { |
$request->print($overall_result); |
&Apache::lonxml::add_messages(\$overall_result); |
$request->rflush(); |
$request->print($overall_result); |
|
$request->rflush(); |
|
} else { |
|
return $overall_result; |
|
} |
} |
} |
|
|
# with no arg it returns a HTML <option> list of the template titles |
# with no arg it returns a HTML <option> list of the template titles |
Line 956 sub handler {
|
Line 962 sub handler {
|
&renderpage($request,$file); |
&renderpage($request,$file); |
} elsif ($env{'form.problemmode'} eq &mt('EditXML') || |
} elsif ($env{'form.problemmode'} eq &mt('EditXML') || |
$env{'form.problemmode'} eq 'EditXML') { |
$env{'form.problemmode'} eq 'EditXML') { |
&renderpage($request,$file,['no_output_web']); |
|
&editxmlmode($request,$file); |
&editxmlmode($request,$file); |
} elsif ($env{'form.problemmode'} eq &mt('Calculate answers')) { |
} elsif ($env{'form.problemmode'} eq &mt('Calculate answers')) { |
&analyze($request,$file); |
&analyze($request,$file); |