--- loncom/xml/lonxml.pm 2001/05/30 17:42:15 1.82
+++ loncom/xml/lonxml.pm 2001/06/02 03:59:59 1.84
@@ -203,8 +203,8 @@ sub xmlparse {
$safeeval,\%style_for_target,@parstack);
}
} else {
- $result = &callsub("start_$token->[1]", $target, $token,\@parstack,
- \@pars, $safeeval, \%style_for_target);
+ $result = &callsub("start_$token->[1]", $target, $token, \@stack,
+ \@parstack, \@pars, $safeeval, \%style_for_target);
}
} elsif ($token->[0] eq 'E') {
#clear out any tags that didn't end
@@ -225,8 +225,8 @@ sub xmlparse {
}
} else {
- $result = &callsub("end_$token->[1]", $target, $token, \@parstack,
- \@pars,$safeeval, \%style_for_target);
+ $result = &callsub("end_$token->[1]", $target, $token, \@stack,
+ \@parstack, \@pars,$safeeval, \%style_for_target);
}
} else {
&Apache::lonxml::error("Unknown token event :$token->[0]:$token->[1]:");
@@ -287,9 +287,9 @@ sub recurse {
push (@innerstack,$tokenpat->[1]);
push (@innerparstack,&parstring($tokenpat));
&increasedepth($tokenpat);
- $partstring = &callsub("start_$tokenpat->[1]",
- $target, $tokenpat, \@innerparstack,
- \@pat, $safeeval, $style_for_target);
+ $partstring = &callsub("start_$tokenpat->[1]", $target, $tokenpat,
+ \@innerstack, \@innerparstack, \@pat,
+ $safeeval, $style_for_target);
} elsif ($tokenpat->[0] eq 'E') {
#clear out any tags that didn't end
while ($tokenpat->[1] ne $innerstack[$#innerstack]
@@ -297,9 +297,9 @@ sub recurse {
&Apache::lonxml::warning("Unbalanced tags in resource $innerstack['-1']");
pop @innerstack;pop @innerparstack;&decreasedepth($tokenpat);
}
- $partstring = &callsub("end_$tokenpat->[1]",
- $target, $tokenpat, \@innerparstack,
- \@pat, $safeeval, $style_for_target);
+ $partstring = &callsub("end_$tokenpat->[1]", $target, $tokenpat,
+ \@innerstack, \@innerparstack, \@pat,
+ $safeeval, $style_for_target);
} else {
&Apache::lonxml::error("Unknown token event :$tokenpat->[0]:$tokenpat->[1]:");
}
@@ -332,14 +332,15 @@ sub recurse {
}
sub callsub {
- my ($sub,$target,$token,$parstack,$parser,$safeeval,$style)=@_;
+ my ($sub,$target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_;
my $currentstring='';
my $nodefault;
{
my $sub1;
no strict 'refs';
if ($target eq 'edit' && $token->[0] eq 'S') {
- $currentstring = &Apache::edit::tag_start($target,$token,$parstack,$parser,
+ $currentstring = &Apache::edit::tag_start($target,$token,$tagstack,
+ $parstack,$parser,
$safeeval,$style);
}
my $tag=$token->[1];
@@ -353,8 +354,9 @@ sub callsub {
#&Apache::lonxml::debug("Calling sub $sub in $space $metamode
\n");
$sub1="$space\:\:$sub";
$Apache::lonxml::curdepth=join('_',@Apache::lonxml::depthcounter);
- ($currentstring,$nodefault) = &$sub1($target,$token,$parstack,$parser,
- $safeeval,$style);
+ ($currentstring,$nodefault) = &$sub1($target,$token,$tagstack,
+ $parstack,$parser,$safeeval,
+ $style);
} else {
#&Apache::lonxml::debug("NOT Calling sub $sub in $space $metamode
\n");
if ($metamode <1) {
@@ -365,7 +367,7 @@ sub callsub {
}
}
}
- &Apache::lonxml::debug("nodefalt:$nodefault:");
+# &Apache::lonxml::debug("nodefalt:$nodefault:");
if ($currentstring eq '' && $nodefault eq '') {
if ($target eq 'edit') {
&Apache::lonxml::debug("doing default edit for $token->[1]");
@@ -736,6 +738,14 @@ sub warning {
}
}
+sub get_param {
+ my ($param,$parstack,$safeeval,$context) = @_;
+ if ( ! $context ) { $context = -1; }
+ my $args ='';
+ if ( $#$parstack > (-2-$context) ) { $args=$$parstack[$context]; }
+ return &Apache::run::run("{$args;".'return $'.$param.'}',$safeeval); #'
+}
+
sub register_insert {
my @data = split /\n/, &Apache::lonnet::getfile('/home/httpd/lonTabs/insertlist.tab');
my $i;