';
}
@@ -454,7 +488,7 @@ sub start_standalone {
sub end_standalone {
my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_;
my $result='';
- if ($target eq 'web' ) {
+ if ($target eq 'web' || $target eq 'webgrade' ) {
if ( $env{'request.course.id'} ) {
} else {
$result=' |
';
@@ -468,14 +502,15 @@ sub start_comment {
my $result='';
if ($target eq 'edit') {
$result=&Apache::edit::tag_start($target,$token);
- my $bodytext=&Apache::lonxml::get_all_text("/comment",$parser);
+ my $bodytext=&Apache::lonxml::get_all_text("/comment",$parser,$style);
$result.=&Apache::edit::editfield($token->[1],$bodytext,'',80,4)
} elsif ( $target eq 'modified') {
$result=$token->[4].&Apache::edit::modifiedfield("/comment",$parser);
- } elsif ( $target eq 'web' || $target eq 'tex' || $target eq 'grade' ||
- $target eq 'answer' || $target eq 'meta' || $target eq 'analyze') {
+ } elsif ( $target eq 'web' || $target eq 'tex' || $target eq 'grade' ||
+ $target eq 'answer' || $target eq 'meta' || $target eq 'analyze' ||
+ $target eq 'webgrade') {
#normally throw away comments
- my $bodytext=&Apache::lonxml::get_all_text("/comment",$parser);
+ my $bodytext=&Apache::lonxml::get_all_text("/comment",$parser,$style);
}
return $result;
}
@@ -502,9 +537,11 @@ sub xmlparse {
@Apache::scripttag::parser_env;
my @parser;
&Apache::lonxml::newparser(\@parser,\$string);
+ &Apache::lonxml::startredirection();
my $result=&Apache::lonxml::inner_xmlparse($target,$tagstack,
$parstack,\@parser,
$safeeval,$style);
+ $result.=&Apache::lonxml::endredirection();
&Apache::lonxml::debug("target is $target xmlparse recursion ending with $result");
return $result;
}
@@ -513,7 +550,7 @@ sub start_num {
my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style) = @_;
my $result = '';
my $inside = &Apache::lonxml::get_all_text_unbalanced("/num",$parser);
- if ($target eq 'tex' || $target eq 'web') {
+ if ($target eq 'tex' || $target eq 'web' || $target eq 'webgrade') {
$inside=&Apache::run::evaluate($inside,$safeeval,$$parstack[-1]);
if (!$Apache::lonxml::default_homework_loaded) {
&Apache::lonxml::default_homework_load($safeeval);
@@ -534,9 +571,9 @@ sub end_num {
sub start_parse {
my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style) = @_;
my $result = '';
- if ( $target eq 'web' || $target eq 'tex' ||
- $target eq 'grade' || $target eq 'answer' ||
- $target eq 'analyze') {
+ if ( $target eq 'web' || $target eq 'tex' ||
+ $target eq 'grade' || $target eq 'answer' ||
+ $target eq 'analyze'|| $target eq 'webgrade') {
my $inside = &Apache::lonxml::get_all_text_unbalanced("/parse",$parser);
$inside=&Apache::run::evaluate($inside,$safeeval,$$parstack[-1]);
if (!$Apache::lonxml::default_homework_loaded) {
@@ -544,6 +581,13 @@ sub start_parse {
}
@Apache::scripttag::parser_env = @_;
$result=&Apache::run::run("return &xmlparse(q\0$inside\0);",$safeeval);
+ if ($target eq 'grade' || $target eq 'answer' ||
+ $target eq 'analyze') {
+ # grade/answer/analyxe should produce no output but if we
+ # are redirecting, the redirecter should know what to do
+ # with the output
+ if (!$Apache::lonxml::redirection) { $result=''; }
+ }
}
return $result;
}
@@ -557,9 +601,9 @@ sub end_parse {
sub start_algebra {
my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style) = @_;
my $result = '';
- if ( $target eq 'web' || $target eq 'tex' ||
- $target eq 'grade' || $target eq 'answer' ||
- $target eq 'analyze') {
+ if ( $target eq 'web' || $target eq 'tex' ||
+ $target eq 'grade' || $target eq 'answer' ||
+ $target eq 'analyze' || $target eq 'webgrade') {
my $inside = &Apache::lonxml::get_all_text_unbalanced("/algebra",$parser);
$inside = &Apache::run::evaluate($inside,$safeeval,$$parstack[-1]);
if ($target eq 'web' || $target eq 'tex' || $target eq 'analyze') {