Diff for /loncom/homework/structuretags.pm between versions 1.118 and 1.124

version 1.118, 2002/09/26 20:45:00 version 1.124, 2002/10/14 14:37:37
Line 347  sub start_problem { Line 347  sub start_problem {
     print $temp_file "$duedate\n";          print $temp_file "$duedate\n";    
     if (not $ENV{'request.symb'} =~ m/\.page_/) {      if (not $ENV{'request.symb'} =~ m/\.page_/) {
  if(not $duedate=~m/1969/) {   if(not $duedate=~m/1969/) {
     $result .= '\begin{document} \noindent\textit{Due date: '.$duedate.'} \vskip 1 mm \begin{minipage}{\textwidth}';      $result .= '\begin{document} \noindent\textit{Due date: '.$duedate.'} \vskip 1 mm\noindent \begin{minipage}{\textwidth}';
  } else {   } else {
     $result .= '\begin{document} \noindent \vskip 1 mm \begin{minipage}{\textwidth}';      $result .= '\begin{document} \noindent \vskip 1 mm \noindent\begin{minipage}{\textwidth}';
  }   }
     } else {      } else {
  $result .= '\vskip 1mm\textit{Due date: '.$duedate.'} \\\\\\\\';   $result .= '\vskip 1mm\textit{Due date: '.$duedate.'} \\\\\\\\';
     }       } 
  } else {   } else {
     if (not $ENV{'request.symb'} =~ m/\.page_/) {      if (not $ENV{'request.symb'} =~ m/\.page_/) {
  $result .= '\begin{document} \noindent \vskip 1 mm\begin{minipage}{\textwidth}';   $result .= '\begin{document} \noindent \vskip 1 mm\noindent\begin{minipage}{\textwidth}';
     } else {      } else {
  $result .= '\vskip 1mm \\\\\\\\';   $result .= '\vskip 1mm \\\\\\\\';
     }       } 
Line 389  sub end_problem { Line 389  sub end_problem {
       $status ne 'UNCHECKEDOUT') {        $status ne 'UNCHECKEDOUT') {
       # if part is zero, no <part>s existed, so we need show the current         # if part is zero, no <part>s existed, so we need show the current 
       # grading status        # grading status
       my $gradestatus = &Apache::inputtags::gradestatus($Apache::inputtags::part);        my $gradestatus = &Apache::inputtags::gradestatus($Apache::inputtags::part,$target);
       #FIXME this is ugly we should just generate tex in inputtags        if ($Apache::lonhomework::type ne 'exam') {$result.= $gradestatus;}
       if ($target eq 'tex') { $gradestatus=&html_to_tex($gradestatus); }  
       $result.= $gradestatus;  
     }      }
     if (      if (
  (($target eq 'web') && ($ENV{'request.state'} ne 'construct')) ||   (($target eq 'web') && ($ENV{'request.state'} ne 'construct')) ||
Line 434  sub end_problem { Line 432  sub end_problem {
   return $result;    return $result;
 }  }
   
 #FIXME I am ugly shoot me  
 sub html_to_tex {  
   my ($string)=@_;  
   $string =~ s/<table>//;  
   $string =~ s/<\/table>//;  
   $string =~ s/<tr([^>]*)>//g;  
   $string =~ s/<\/tr>//g;  
   $string =~ s/<td([^>]*)>//g;  
   $string =~ s/<\/td>//g;  
   $string =~ s/<b>/\\textbf{/g;  
   $string =~ s/<\/b>/}/g;  
   $string =~ s/<br \/>/\\vskip 0 mm /g;  
   $string =~ s/<input([^>]*)>//g;  
   return $string;  
 }  
   
 sub start_library {  sub start_library {
   my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;    my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
Line 640  sub start_part { Line 623  sub start_part {
       if ( $target eq "web" ) {        if ( $target eq "web" ) {
  $result="<br />Part is not open to be viewed. It $accessmsg<br />";   $result="<br />Part is not open to be viewed. It $accessmsg<br />";
       } elsif ( $target eq 'tex' ) {        } elsif ( $target eq 'tex' ) {
  $result="\\vskip 0 mm Part is not open to be viewed. It $accessmsg \\\\";   $result="\\end{minipage}\\vskip 0 mm Part is not open to be viewed. It $accessmsg \\\\\\begin{minipage}{\\textwidth}";
       }        }
     } else {      } else {
       if ($target eq 'tex') {        if ($target eq 'tex') {
  $result='\vskip 0 mm';   $result='\end{minipage}\vskip 0 mm \noindent \begin{minipage}{\textwidth}\noindent';
       }        }
     }      }
   }    }
Line 661  sub end_part { Line 644  sub end_part {
     return &Apache::inputtags::grade;      return &Apache::inputtags::grade;
   }    }
   if ($target eq 'web' || $target eq 'tex' ) {    if ($target eq 'web' || $target eq 'tex' ) {
     my $gradestatus=&Apache::inputtags::gradestatus($Apache::inputtags::part);      my $gradestatus=&Apache::inputtags::gradestatus($Apache::inputtags::part,$target);
     #FIXME this is ugly we should just generate tex in inputtags      if ($Apache::lonhomework::type eq 'exam') {$gradestatus='';}
     if ($target eq 'tex') { $gradestatus=&html_to_tex($gradestatus); }  
     return $gradestatus;      return $gradestatus;
   }    }
   return '';    return '';

Removed from v.1.118  
changed lines
  Added in v.1.124


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>