--- loncom/homework/structuretags.pm 2002/02/06 16:18:54 1.80 +++ loncom/homework/structuretags.pm 2002/03/20 22:13:19 1.85 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # definition of tags that give a structure to a document # -# $Id: structuretags.pm,v 1.80 2002/02/06 16:18:54 albertel Exp $ +# $Id: structuretags.pm,v 1.85 2002/03/20 22:13:19 sakharuk Exp $ # # Copyright Michigan State University Board of Trustees # @@ -79,7 +79,7 @@ sub page_start { if (!defined($found{'html'})) { $result=&Apache::londefdef::start_html($target,$token,$tagstack,$parstack, $parser,$safeeval); - $head_tag_start=''.&Apache::lonxml::registerurl(); + $head_tag_start=''.&Apache::lonxml::registerurl(undef,$target); } my $body_tag_start; if (!defined($found{'body'})) { @@ -162,7 +162,10 @@ ENDCHECKOUT sub start_problem { my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_; - if ( $Apache::inputtags::part ne '' ) { + # meta is called from lonpublisher, which doesn't uses the normal + # lonhomework method of parsing the file which means that inputtags + # 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]); return ''; @@ -294,7 +297,7 @@ sub start_problem { $result=$token->[4]; $result.=&Apache::edit::handle_insert(); } elsif ($target eq 'tex') { - $result .= '\begin{document}\noindent\textbf{Problem.}\newline'; + $result .= '\begin{document} '; } else { # page_start returned a starting result, delete it if we don't need it $result = ''; @@ -307,8 +310,7 @@ sub end_problem { my $result=''; my $status=$Apache::inputtags::status['-1']; if ($target eq 'grade' || $target eq 'web' || $target eq 'answer' ) { - if ( $target eq 'grade' && $Apache::inputtags::part eq '0' && - $status eq 'CAN_ANSWER') { + if ( $target eq 'grade' && $Apache::inputtags::part eq '0') { # if part is zero, no s existed, so we need to the grading &Apache::inputtags::grade; } elsif ( $target eq 'web' && $Apache::inputtags::part eq '0') { @@ -339,7 +341,7 @@ sub end_problem { &Apache::lonxml::debug("in end_problem with $target, edit"); $result='
'; } elsif ($target eq 'tex') { - $result .= '\end{document}'; + $result .= '\noindent\makebox[9.0cm][b]{\hrulefill}\end{document}'; } return $result; } @@ -605,17 +607,19 @@ sub end_startouttext { $result.=&Apache::edit::start_table($token)."Text Block Delete:". &Apache::edit::deletelist($target,$token) - ." + ." ". &Apache::edit::insertlist($target,$token). - " -\n". - &Apache::edit::editfield($token->[1],$text,"",50,4); + &Apache::edit::end_row().&Apache::edit::start_spanning_row()."\n". + &Apache::edit::editfield($token->[1],$text,"",50,4); } if ($target eq 'modified') { $text=&Apache::lonxml::get_all_text("endouttext",$$parser['-1']); $result=''.&Apache::edit::modifiedfield(); } + if ($target eq 'tex') { + $result .= '\noindent '; + } return $result; } sub start_endouttext {