--- loncom/homework/structuretags.pm 2003/02/07 21:50:12 1.145 +++ loncom/homework/structuretags.pm 2003/02/07 22:03:21 1.146 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # definition of tags that give a structure to a document # -# $Id: structuretags.pm,v 1.145 2003/02/07 21:50:12 albertel Exp $ +# $Id: structuretags.pm,v 1.146 2003/02/07 22:03:21 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -43,7 +43,7 @@ BEGIN { sub start_web { my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_; - my $bodytext=&Apache::lonxml::get_all_text("/web",$$parser[$#$parser]); + my $bodytext=&Apache::lonxml::get_all_text("/web",$parser); if ($target eq 'web') { return $bodytext; } @@ -56,7 +56,7 @@ sub end_web { sub start_tex { my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_; - my $bodytext=&Apache::lonxml::get_all_text("/tex",$$parser[$#$parser]); + my $bodytext=&Apache::lonxml::get_all_text("/tex",$parser); if ($target eq 'tex') { return $bodytext.' '; } @@ -245,7 +245,7 @@ sub start_problem { # won't get reset if ( $Apache::inputtags::part ne '' && $target != 'meta' ) { &Apache::lonxml::error('Only one problem allowed in a .problem file'); - my $bodytext=&Apache::lonxml::get_all_text("/problem",$$parser[-1]); + my $bodytext=&Apache::lonxml::get_all_text("/problem",$parser); return ''; } #intialize globals @@ -526,7 +526,7 @@ sub start_block { $result='1'; } if ( ! $result ) { - my $skip=&Apache::lonxml::get_all_text("/block",$$parser[-1]); + my $skip=&Apache::lonxml::get_all_text("/block",$parser); &Apache::lonxml::debug("skipping ahead :$skip: $$parser[-1]"); } $result=''; @@ -589,7 +589,7 @@ sub start_randomlist { my $result; if ($target eq 'answer' || $target eq 'grade' || $target eq 'web' || $target eq 'tex' || $target eq 'analyze') { - my $body= &Apache::lonxml::get_all_text("/randomlist",$$parser[$#$parser]); + my $body= &Apache::lonxml::get_all_text("/randomlist",$parser); my $b_parser= HTML::TokeParser->new(\$body); my $b_tok; my @randomlist; @@ -674,7 +674,7 @@ sub start_part { $expression.='$external::gradestatus="'.$Apache::lonhomework::history{"resource.$id.solved"}.'";'; &Apache::run::run($expression,$safeeval); if ( $status eq 'CLOSED' ) { - my $bodytext=&Apache::lonxml::get_all_text("/part",$$parser[$#$parser]); + my $bodytext=&Apache::lonxml::get_all_text("/part",$parser); if ( $target eq "web" ) { $result="
Part is not open to be viewed. It $accessmsg
"; } elsif ( $target eq 'tex' ) { @@ -729,7 +729,7 @@ sub start_preduedate { if ($Apache::inputtags::status['-1'] ne 'CAN_ANSWER' && $Apache::inputtags::status['-1'] ne 'CANNOT_ANSWER' && $Apache::inputtags::status['-1'] ne 'SHOW_ANSWER') { - &Apache::lonxml::get_all_text("/preduedate",$$parser[$#$parser]); + &Apache::lonxml::get_all_text("/preduedate",$parser); } } return ''; @@ -743,7 +743,7 @@ sub start_postanswerdate { my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_; if ($target eq 'web' || $target eq 'grade' || $target eq 'tex') { if ($Apache::inputtags::status['-1'] ne 'SHOW_ANSWER') { - &Apache::lonxml::get_all_text("/postanswerdate",$$parser[$#$parser]); + &Apache::lonxml::get_all_text("/postanswerdate",$parser); } } elsif ($target eq 'tex') { return '\vskip 0 mm \noindent'; @@ -762,7 +762,7 @@ sub start_notsolved { &Apache::lonxml::debug("not solved has :$gradestatus:"); if ($gradestatus =~ /^correct/) { &Apache::lonxml::debug("skipping"); - &Apache::lonxml::get_all_text("/notsolved",$$parser[$#$parser]); + &Apache::lonxml::get_all_text("/notsolved",$parser); } } return ''; @@ -777,7 +777,7 @@ sub start_solved { if ($target eq 'web' || $target eq 'grade' || $target eq 'answer' || $target eq 'tex') { my $gradestatus=$Apache::lonhomework::history{"resource.$Apache::inputtags::part.solved"}; if ($gradestatus !~ /^correct/) { - &Apache::lonxml::get_all_text("/solved",$$parser[$#$parser]); + &Apache::lonxml::get_all_text("/solved",$parser); } } return ''; @@ -799,7 +799,7 @@ sub end_startouttext { my $text=''; if ($target eq 'edit') { - $text=&Apache::lonxml::get_all_text("endouttext",$$parser[-1]); + $text=&Apache::lonxml::get_all_text("endouttext",$parser); $result.=&Apache::edit::start_table($token)."Text Block Delete:". &Apache::edit::deletelist($target,$token) @@ -810,7 +810,7 @@ sub end_startouttext { &Apache::edit::editfield($token->[1],$text,"",80,4); } if ($target eq 'modified') { - $text=&Apache::lonxml::get_all_text("endouttext",$$parser['-1']); + $text=&Apache::lonxml::get_all_text("endouttext",$parser); $result=''.&Apache::edit::modifiedfield(); } if ($target eq 'tex') { @@ -835,7 +835,7 @@ sub end_endouttext { } sub delete_startouttext { my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_; -# my $text=&Apache::lonxml::get_all_text("endouttext",$$parser['-1']); +# my $text=&Apache::lonxml::get_all_text("endouttext",$parser); my $text=$$parser['-1']->get_text("/endouttext"); my $ntoken=$$parser['-1']->get_token(); &Apache::lonxml::debug("Deleting :$text: and :$ntoken->[0]:$ntoken->[1]:$ntoken->[2]: for startouttext");