--- loncom/homework/structuretags.pm 2003/07/10 06:17:41 1.194 +++ loncom/homework/structuretags.pm 2003/07/17 18:42:13 1.198 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # definition of tags that give a structure to a document # -# $Id: structuretags.pm,v 1.194 2003/07/10 06:17:41 www Exp $ +# $Id: structuretags.pm,v 1.198 2003/07/17 18:42:13 sakharuk Exp $ # # Copyright Michigan State University Board of Trustees # @@ -39,7 +39,7 @@ use Apache::lonmenu; BEGIN { &Apache::lonxml::register('Apache::structuretags',('block','languageblock','instructorcomment','while','randomlist','problem','library','web','tex','part','preduedate','postanswerdate','solved','notsolved','startouttext','endouttext', -'simpleeditbutton')); +'simpleeditbutton','definetag')); } sub start_web { @@ -57,12 +57,15 @@ sub end_web { sub start_tex { my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_; - if (!($target eq 'tex' || $target eq 'edit' || $target eq 'modified' || + my $result=''; + if (!($target eq 'edit' || $target eq 'modified' || $target eq 'answer' || $target eq 'grade' || $target eq 'meta' )) { &Apache::lonxml::debug("tex 1"); my $bodytext=&Apache::lonxml::get_all_text("/tex",$parser); + } elsif ($target eq 'tex') { + $result=&Apache::lonxml::get_all_text("/tex",$parser); } - return ''; + return $result;; } sub end_tex { @@ -596,6 +599,30 @@ sub end_library { return $result; } +sub start_definetag { + my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_; + + my $result; + + my $name = $token->[2]->{'name'}; + my $skip=&Apache::lonxml::get_all_text("/definetag",$parser); + if ($name=~/^\//) { + $result= + '
'; + } else { + $result= + '
END '.$name.'
'; + } + $skip=~s/\/\>\;/gs; + $result.='
BEGIN '.$name.'
'.$skip.'
'; + return $result; +} + +sub end_definetag { + return ''; +} + sub start_block { my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_; @@ -902,11 +929,17 @@ sub start_part { if ( $target eq "web" ) { $result="
Part is not open to be viewed. It $accessmsg
"; } elsif ( $target eq 'tex' ) { - $result="\\end{minipage}\\vskip 0 mm Part is not open to be viewed. It $accessmsg \\\\\\begin{minipage}{\\textwidth}"; + if (not $ENV{'form.problem_split'}=~/yes/) { + $result="\\end{minipage}\\vskip 0 mm Part is not open to be viewed. It $accessmsg \\\\\\begin{minipage}{\\textwidth}"; + } else { + $result="\\vskip 0 mm Part is not open to be viewed. It $accessmsg \\\\"; + } } } else { if ($target eq 'tex') { - $result.='\noindent \end{minipage}\vskip 0 mm \noindent \begin{minipage}{\textwidth}\noindent'; + if (not $ENV{'form.problem_split'}=~/yes/) { + $result.='\noindent \end{minipage}\vskip 0 mm \noindent \begin{minipage}{\textwidth}\noindent'; + } my $weight = &Apache::lonnet::EXT("resource.$id.weight"); if ($Apache::lonhomework::type eq 'exam') { $result .= '\fbox{\textit{'.$weight.' pt}}';} } @@ -1091,7 +1124,8 @@ sub start_simpleeditbutton { my $url=$ENV{'REQUEST_URI'}; $url=~s/\?.*$//; $result='
'. - 'Simple Problem Editor - Note: it can take up to 10 minutes for changes to take effect for all users.

'; + 'Simple Problem Editor - Note: it can take up to 10 minutes for changes to take effect for all users.'. +&Apache::loncommon::help_open_topic('Caching').'
'; } return $result; }