Diff for /loncom/xml/londefdef.pm between versions 1.415.4.6 and 1.424

version 1.415.4.6, 2011/11/15 17:34:19 version 1.424, 2010/10/19 19:33:21
Line 43  use Apache::lonnet; Line 43  use Apache::lonnet;
 use strict;  use strict;
 use Apache::lonxml;  use Apache::lonxml;
 use Apache::lontable;  use Apache::lontable;
 use Apache::File();  
 use Image::Magick;  use Image::Magick;
 use Apache::lonmenu();  use Apache::lonmenu();
 use Apache::lonmeta();  use Apache::lonmeta();
 use Apache::lonlocal;  use Apache::lonlocal;
 use Apache::loncommon();  
 use Apache::Constants qw(:common);  use Apache::Constants qw(:common);
 use File::Basename;  use File::Basename;
 use LONCAPA();  use LONCAPA();
Line 590  sub start_body { Line 588  sub start_body {
 sub edit_controls {  sub edit_controls {
     my ($nochgview) = @_;      my ($nochgview) = @_;
     my $result .= '      my $result .= '
 <form method="post" action="">  <form method="post">
 <div class="LC_edit_problem_header">';  <div class="LC_edit_problem_header">';
     unless ($nochgview) {      unless ($nochgview) {
         $result .= '          $result .= '
Line 602  sub edit_controls { Line 600  sub edit_controls {
     $result .= '      $result .= '
 <div><input type="submit" name="editmode" accesskey="e" value="'.&mt('Edit').'" />';  <div><input type="submit" name="editmode" accesskey="e" value="'.&mt('Edit').'" />';
     if (($env{'request.course.id'}) && ($env{'form.forceedit'})) {      if (($env{'request.course.id'}) && ($env{'form.forceedit'})) {
         my $viewtext = &mt('Course View');          $result .= ('&nbsp;' x 3).'<input type="button" value="'.&mt('Course View').'" onclick="javascript:location.href=currentURL" />';
         if (&Apache::loncommon::course_type() eq 'Community') {  
             $viewtext = &mt('Community View');  
         }  
         $result .= ('&nbsp;' x 3).'<input type="button" value="'.  
                    $viewtext.'" onclick="javascript:location.href=currentURL" />';  
     }      }
     $result .= '</div>      $result .= '</div>
 </div>  </div>
Line 2045  sub start_table { Line 2038  sub start_table {
     } elsif ($target eq 'tex') {      } elsif ($target eq 'tex') {
  &disable_para(); # Can't have paras in a table.   &disable_para(); # Can't have paras in a table.
   
   
    #  New table code:
   
  #  Get the parameters that we can do something about:   #  Get the parameters that we can do something about:
   
  my $border = &Apache::lonxml::get_param('border', $parstack, $safeeval, undef, 0);   my $border = &Apache::lonxml::get_param('border', $parstack, $safeeval, undef, 0);
  my $width  = &Apache::lonxml::get_param('TeXwidth', $parstack, $safeeval, undef, 0);   my $width  = &Apache::lonxml::get_param('TeXwidth', $parstack, $safeeval, undef, 0);
  my $theme  = &Apache::lonxml::get_param('TeXtheme', $parstack, $safeeval, undef, 0);   my $theme  = &Apache::lonxml::get_param('TeXtheme', $parstack, $safeeval, undef, 0);
  my $align  = &Apache::lonxml::get_param('align', $parstack, $safeeval, undef, 0);   my $align  = &Apache::lonxml::get_param('align', $parstack, $safeeval, undef, 0);
         my $cell_border = &Apache::lonxml::get_param('rules', $parstack, $safeeval, undef, 0);   my $cell_border = &Apache::lonxml::get_param('rules', $parstack, $safeeval, undef, 0);
   
  # The only thing that needs any figuring out is the width.. and then only if it is   # The only thing that needs any figuring out is the width.. and then only if it is
  # a percent. If not it's assumed to be some valid TeX measurement unit e.g. 3.0cm   # a percent. If not it's assumed to be some valid TeX measurement unit e.g. 3.0cm
  #   #
   
  my $table = new Apache::lontable();   my $table = new Apache::lontable();
         if ((defined $border) && ($border > 0)) {   if ((defined $border) && ($border > 0)) {
         #    &Apache::lonnet::logthis("Turning on table borders: $border");   #    &Apache::lonnet::logthis("Turning on table borders: $border");
             $table->table_border(1);      $table->table_border(1);
             if (!defined $cell_border) {      if ($cell_border ne 'none') {
                 $table->cell_border(1); # Default for rules is all if rules not defined.   $table->cell_border(1); # html specs that border turns on both...unless rules='none'.
             }      }
         }   }
    # Only all or nothing for cell borders for now:
   
         if ((defined $cell_border)) {   if ((defined $cell_border) && ($cell_border ne 'none')) {
             if ($cell_border eq 'all') {   #    &Apache::lonnet::logthis("Turning on cell borders: $cell_border");
                 $table->cell_border(1);      $table->cell_border(1);
             } elsif ($cell_border eq 'rows') {   }
                 $table->cell_border(2);   if (defined $theme) {
             } elsif ($cell_border eq 'cols') {  
                 $table->cell_border(3);  
             } elsif($cell_border eq 'groups') {  
                 $table->cell_border(4);  
             } else {  
                 $table->cell_border(0);  
             }  
         }  
         if (defined $theme) {  
     $table->theme($theme);      $table->theme($theme);
  }   }
  if (defined $align) {   if (defined $align) {
Line 2091  sub start_table { Line 2079  sub start_table {
  if (!(defined $width)) {   if (!(defined $width)) {
     $width = '70%';      $width = '70%';
  }   }
   
  # If a percentage, need to calculate what this means in terms of   # If a percentage, need to calculate what this means in terms of
  # page width:   # page width:
   
Line 2106  sub start_table { Line 2094  sub start_table {
  push(@Apache::londefdef::table, $table);   push(@Apache::londefdef::table, $table);
         $currentstring.=' \keephidden{NEW TABLE ENTRY}';          $currentstring.=' \keephidden{NEW TABLE ENTRY}';
   
    #--------------------------------------------------------
    #  Old table code here.
    #--------------------------------------------------------
   
   
    if (0) {
    push(@Apache::londefdef::table, {}); 
    $Apache::londefdef::table[-1]{'row_number'} = -1;
           #maximum table's width (default coincides with text line length)
    if ($#Apache::londefdef::table==0) {
       $textwidth=&recalc($env{'form.textwidth'}); #result is always in mm
       $textwidth=~/(\d+\.?\d*)/;
       $textwidth=0.85*$1; #accounts "internal" LaTeX space for table frame
    } else {
       if ($Apache::londefdef::table[-2]{'TeXlen'}[$Apache::londefdef::table[-2]{'row_number'}][$Apache::londefdef::table[-2]{'counter_columns'}]=~/\d/) {
    #the maximum width of nested table is determined by LATeX width of parent cell
    $textwidth=$Apache::londefdef::table[-2]{'TeXlen'}[$Apache::londefdef::table[-2]{'row_number'}][$Apache::londefdef::table[-2]{'counter_columns'}]; 
       } else {
                 #try to use all space not used before (minus 5% for LaTeX table internal) - rather silly
    $textwidth=$Apache::londefdef::table[-2]{'width'};
    for (my $i=0;$i<$Apache::londefdef::table[-2]{'counter_columns'};$i++) {
       $textwidth=$textwidth-$Apache::londefdef::table[-2]{'TeXlen'}[0][$i];
    }
       }
    }
   
    # width either comes forced from the TeXwidth or the width parameters.
    # in either case it can be a percentage or absolute width.
    # in the width case we ignore absolute width 
    my $TeXwidth = &Apache::lonxml::get_param('TeXwidth',$parstack,$safeeval,undef,0);
    if (!defined($TeXwidth)) {
       my $htmlwidth = &Apache::lonxml::get_param('width',$parstack,
          $safeeval,undef,1);
       if ($htmlwidth =~ /%/) {
    $TeXwidth = $htmlwidth;
       } else { 
    $TeXwidth = $textwidth;
       }
    }
    # if the width is specified as a % it is converted to an absolute width.
    # otherwise.. just plugged right in the hash
   
    if ($TeXwidth=~/%/) {
       $TeXwidth=~/(\d+)/;
               $Apache::londefdef::table[-1]{'width'}=$1*$textwidth/100;
    } else {
       $Apache::londefdef::table[-1]{'width'}=$TeXwidth;
    }
           #  In the end, however the table width cannot be wider than $textwidth...
   
    if ($Apache::londefdef::table[-1]{'width'} > $textwidth) {
       $Apache::londefdef::table[-1]{'width'} = $textwidth;
    }
           #table's border
    my $border = &Apache::lonxml::get_param('border',$parstack,$safeeval); 
           my $permission=&Apache::lonxml::get_param('TeXDropEmptyColumns',$parstack,$safeeval,undef,0);
    unless (defined $border) { $border = 0; }
    if ($border) { 
       $Apache::londefdef::table[-1]{'hinc'} = '\hline '; 
       $Apache::londefdef::table[-1]{'vinc'} = '&'; 
       $Apache::londefdef::table[-1]{'vvinc'} = '|';
    } else {
       $Apache::londefdef::table[-1]{'hinc'} = ''; 
       $Apache::londefdef::table[-1]{'vinc'} = '&'; 
       $Apache::londefdef::table[-1]{'vvinc'} = '';
    }
    if ($#Apache::londefdef::table==0) {
       #    Note that \newline seems to destroy the alignment envs.
       # $Apache::londefdef::table[-1]{'output'}='\strut\newline\strut\setlength{\tabcolsep}{1 mm}';
       $Apache::londefdef::table[-1]{'output'}='\strut'.'\\\\'."\n".'\strut\setlength{\tabcolsep}{1 mm}';
    }
    $Apache::londefdef::table[-1]{'output'}.=' \noindent \begin{tabular} ';
           $Apache::londefdef::table[-1]{'TeXlen'}=[];
           $Apache::londefdef::table[-1]{'objectlen'}=[];
           $Apache::londefdef::table[-1]{'objectsignal'}=[];
           $Apache::londefdef::table[-1]{'maxlen'}=[];
           $Apache::londefdef::table[-1]{'minlen'}=[];
           $Apache::londefdef::table[-1]{'content'}=[];
           $Apache::londefdef::table[-1]{'align'}=[];
           $currentstring.=' \keephidden{NEW TABLE ENTRY}';
       }
   
     }      }
     return $currentstring;      return $currentstring;
 }  }
Line 2118  sub end_table { Line 2188  sub end_table {
     } elsif ($target eq 'tex') {      } elsif ($target eq 'tex') {
   
   
    #  New table code:
   
  my $table = pop(@Apache::londefdef::table);   my $table = pop(@Apache::londefdef::table);
  my $t     = $table->generate();   my $t     = $table->generate();
    # &Apache::lonnet::logthis("Generating string");
  $currentstring = $t->generate_string();   $currentstring = $t->generate_string();
    # &Apache::lonnet::logthis("Generated: $currentstring");
  &enable_para();   &enable_para();
  #--------------------------------------------------------------   #--------------------------------------------------------------
  #  Old table code:   #  Old table code:
Line 2659  sub tag_check { Line 2733  sub tag_check {
 #  #
   
 sub cell_config_hash {  sub cell_config_hash {
     my ($align, $rowspan, $colspan, $width) = @_;      my ($align, $rowspan, $colspan) = @_;
     if ($rowspan ne '') {  
         $rowspan =~ s/^\s+|\s+$//g;  
     }  
     if ($colspan ne '') {  
         $colspan =~ s/^\s+|\s+$//g;  
     }  
     my %config;      my %config;
     if ($align ne '') {      if ($align ne '') {
  $config{'halign'} = $align;   $config{'halign'} = $align;
     }      }
     if (($colspan =~ /^\d+$/) && ($colspan > 0)) {      if ($colspan ne "") {
  $config{'colspan'} = $colspan;   $config{'colspan'} = $colspan;
     }      }
     if (($rowspan =~ /^\d+$/) && ($rowspan > 0)) {      if ($rowspan ne '') {
  $config{'rowspan'} = $rowspan;   $config{'rowspan'} = $rowspan;
     }      }
     if ($width ne '') {  
         $config{'width'} = $width;  
     }  
     return \%config;      return \%config;
 }  }
     
Line 2690  sub start_td_tex { Line 2755  sub start_td_tex {
     # attributes, but empty of text.  end_td_tex will      # attributes, but empty of text.  end_td_tex will
     # fetch the contents from the recursive parse and      # fetch the contents from the recursive parse and
     # fill the cell with them:      # fill the cell with them:
     my $align   = &Apache::lonxml::get_param('align', $parstack, $safeeval);      my $align   = &Apache::lonxml::get_param('align', $parstack, $safeeval, undef, 1);
     my $rowspan = &Apache::lonxml::get_param('rowspan', $parstack, $safeeval);      my $rowspan = &Apache::lonxml::get_param('rowspan', $parstack, $safeeval, undef, 1);
     my $colspan = &Apache::lonxml::get_param('colspan', $parstack, $safeeval);      my $colspan = &Apache::lonxml::get_param('colspan', $parstack, $safeeval, undef, 1);
     my $width   = &Apache::lonxml::get_param('TeXwidth', $parstack, $safeeval);  
     my $config = &cell_config_hash($align, $rowspan, $colspan, $width);      my $config = &cell_config_hash($align, $rowspan, $colspan);
   
     my $table = $Apache::londefdef::table[-1];      my $table = $Apache::londefdef::table[-1];
     $table->add_cell('', $config);      $table->add_cell('', $config);
Line 3105  sub start_img { Line 3170  sub start_img {
    # Render unto browsers that which are the browser's...     # Render unto browsers that which are the browser's...
   
     if ($target eq 'web' || $target eq 'webgrade') {      if ($target eq 'web' || $target eq 'webgrade') {
  if ($env{'browser.imagesuppress'} ne 'on') {          my $enc = ('yes' eq 
     my $enc = ('yes' eq                      lc(&Apache::lonxml::get_param('encrypturl',$parstack,
        lc(&Apache::lonxml::get_param('encrypturl',$parstack,                        $safeeval)));
      $safeeval)));          $currentstring.=&Apache::lonenc::encrypt_ref($token,{'src'=>$src},
     $currentstring.=&Apache::lonenc::encrypt_ref($token,{'src'=>$src},                           $enc);
  $enc);  
  } else {  
     my $alttag = &Apache::lonxml::get_param('alt',$parstack,$safeeval,  
     undef,1);  
     if (!$alttag) {  
  $alttag = &Apache::lonmeta::alttag($Apache::lonxml::pwd[-1],  
    $src);  
     }  
     $currentstring.='[IMAGE: '.$alttag.']';  
  }  
   
  # and render unto TeX that which is LaTeX  
   
       # and render unto TeX that which is LaTeX
     } elsif ($target eq 'tex') {      } elsif ($target eq 'tex') {
  #   #
  #  The alignment will require some superstructure to be put around   #  The alignment will require some superstructure to be put around
Line 3223  sub start_img { Line 3277  sub start_img {
    ['', 'none','parbox', 'parpic', 'wrapfigure'], $token, 2);     ['', 'none','parbox', 'parpic', 'wrapfigure'], $token, 2);
         my $alt=    &Apache::lonxml::get_param('alt',$parstack,$safeeval);          my $alt=    &Apache::lonxml::get_param('alt',$parstack,$safeeval);
         my $enc=    &Apache::lonxml::get_param('encrypturl',$parstack,$safeeval);          my $enc=    &Apache::lonxml::get_param('encrypturl',$parstack,$safeeval);
    
  $currentstring .=&Apache::edit::select_arg('Encrypt URL:','encrypturl',   $currentstring .=&Apache::edit::select_arg('Encrypt URL:','encrypturl',
    ['no','yes'], $token, 2);     ['no','yes'], $token, 2);
         if (($alt=~/\S/) && (lc($enc) eq 'yes')) {          if (($alt=~/\S/) && (lc($enc) eq 'yes')) {
Line 3237  sub start_img { Line 3291  sub start_img {
         if ($token->[2]{'src'}=~/\$/) {          if ($token->[2]{'src'}=~/\$/) {
            $currentstring.=&mt('Variable image source');             $currentstring.=&mt('Variable image source');
         } elsif ($token->[2]{'src'}=~/\S/) {          } elsif ($token->[2]{'src'}=~/\S/) {
            $currentstring .= '<img src="'.$src.'" alt="'.$alt.'" ';     $currentstring .= '<img src="'.$src.'" alt="'.$alt.'" ';
            if ($width) { $currentstring.=' width="'.$width.'" '; }     if ($width) { $currentstring.=' width="'.$width.'" '; }
            if ($height) { $currentstring.=' height="'.$height.'" '; }     if ($height) { $currentstring.=' height="'.$height.'" '; }
            $currentstring .= ' />';     $currentstring .= ' />';
         } else {          } else {
            $currentstring.=&mt("No image source specified");             $currentstring.=&mt("No image source specified");
         }          }
Line 3311  sub start_applet { Line 3365  sub start_applet {
     &Apache::lonxml::extlink($archive);      &Apache::lonxml::extlink($archive);
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web' || $target eq 'webgrade') {      if ($target eq 'web' || $target eq 'webgrade') {
  if ($env{'browser.appletsuppress'} ne 'on') {          $currentstring = &Apache::lonenc::encrypt_ref($token,
             $currentstring = $token->[4];                                                        {'code'=>$code,
  } else {                                                         'archive'=>$archive}
     my $alttag= &Apache::lonxml::get_param('alt',$parstack,                                                       );
    $safeeval,undef,1);  
     unless ($alttag) {  
  $alttag=&Apache::lonmeta::alttag($Apache::lonxml::pwd[-1],  
  $code);  
     }  
     $currentstring='[APPLET: '.$alttag.']';  
  }  
     } elsif ($target eq 'tex') {      } elsif ($target eq 'tex') {
  # Turn off some stuff we can't be inside thank you LaTeX          # Turn off some stuff we can't be inside thank you LaTeX
   
   
  my $restart_sub = 0;   my $restart_sub = 0;
  my $restart_sup = 0;   my $restart_sup = 0;
Line 3388  sub start_embed { Line 3434  sub start_embed {
     &Apache::lonxml::extlink($src);      &Apache::lonxml::extlink($src);
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web' || $target eq 'webgrade') {      if ($target eq 'web' || $target eq 'webgrade') {
  if ($env{'browser.embedsuppress'} ne 'on') {      $currentstring=&Apache::lonenc::encrypt_ref($token,{'src'=>$src}); 
     $currentstring=&Apache::lonenc::encrypt_ref($token,{'src'=>$src});  
  } else {  
     my $alttag=&Apache::lonxml::get_param  
  ('alt',$parstack,$safeeval,undef,1);  
     unless ($alttag) {  
  $alttag=&Apache::lonmeta::alttag($Apache::lonxml::pwd[-1],$src);  
     }  
     $currentstring='[EMBED: '.$alttag.']';  
  }  
     } elsif ($target eq 'tex') {      } elsif ($target eq 'tex') {
     }       } 
     return $currentstring;      return $currentstring;
Line 3407  sub end_embed { Line 3444  sub end_embed {
     my ($target,$token) = @_;      my ($target,$token) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web' || $target eq 'webgrade') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring = $token->[2];               $currentstring = $token->[2];
     } elsif ($target eq 'tex') {        } elsif ($target eq 'tex') {
     }           # ./.
       }
     return $currentstring;      return $currentstring;
 }  }
   
Line 3830  sub end_col { Line 3868  sub end_col {
   
 #-- <colgroup> tag (end tag optional)  #-- <colgroup> tag (end tag optional)
 sub start_colgroup {  sub start_colgroup {
     my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style) = @_;      my ($target,$token) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web' || $target eq 'webgrade') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring = $token->[4];        $currentstring = $token->[4];     
     }      } 
     if ($target eq 'tex') {  
         # TODO: Ensure this tag is in a table:  
   
         # Fetch the attributes and build the hash for the  
         # call to define_colgroup.  
   
         my $span    = &Apache::lonxml::get_param('span',   $parstack, $safeeval);  
         my $halign  = &Apache::lonxml::get_param('halign', $parstack, $safeeval);  
   
         my %colgroup_params;  
         if ($span ne '') {  
             $colgroup_params{'span'} = $span;  
         }  
         if ($halign ne '') {  
             $colgroup_params{'halign'} = $halign;  
         }  
   
         my $table = $Apache::londefdef::table[-1];  
         $table->define_colgroup(\%colgroup_params);  
   
     }  
     return $currentstring;      return $currentstring;
 }  }
   
Line 3868  sub end_colgroup { Line 3885  sub end_colgroup {
     return $currentstring;      return $currentstring;
 }  }
   
   
 #-- <del> tag (end tag required)  #-- <del> tag (end tag required)
 sub start_del {  sub start_del {
     my ($target,$token) = @_;      my ($target,$token) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web' || $target eq 'webgrade') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring = $token->[4];        $currentstring = $token->[4];     
       } elsif ($target eq 'tex') {
    &disable_para();
    $currentstring .= '\st{';  
     }       } 
     return $currentstring;      return $currentstring;
 }  }
Line 3882  sub end_del { Line 3903  sub end_del {
     my ($target,$token) = @_;      my ($target,$token) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web' || $target eq 'webgrade') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring = $token->[2];       $currentstring = $token->[2];     
       } elsif ($target eq 'tex') {
    &enable_para();
    $currentstring = '}';
     }       } 
     return $currentstring;      return $currentstring;
 }  }
Line 4341  sub start_tbody { Line 4365  sub start_tbody {
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web' || $target eq 'webgrade') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring = $token->[4];        $currentstring = $token->[4];     
     }  
     if ($target eq 'tex') {  
         # TODO: Ensure this tag is within a table:  
   
         my $table = $Apache::londefdef::table[-1];  
         $table->start_body();  
     }       } 
     return $currentstring;      return $currentstring;
 }  }
Line 4356  sub end_tbody { Line 4374  sub end_tbody {
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web' || $target eq 'webgrade') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring = $token->[2];       $currentstring = $token->[2];    
     }  
     if($target eq 'tex') {  
         # TODO: Ensure this tag is within a table:  
   
         my $table = $Apache::londefdef::table[-1];  
         $table->end_body();  
     }       } 
     return $currentstring;      return $currentstring;
 }  }
Line 4372  sub start_tfoot { Line 4384  sub start_tfoot {
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web' || $target eq 'webgrade') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring = $token->[4];        $currentstring = $token->[4];     
     }  
     if ($target eq 'tex') {  
         # TODO: ensure this is within a table tag.  
         my $table = $Apache::londefdef::table[-1];  
         $table->start_foot();  
     }       } 
     return $currentstring;      return $currentstring;
 }  }
Line 4386  sub end_tfoot { Line 4393  sub end_tfoot {
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web' || $target eq 'webgrade') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring = $token->[2];       $currentstring = $token->[2];    
     }  
     if ($target eq 'tex') {  
         #  TODO: Ensure this is in side a table  
         my $table = $Apache::londefdef::table[-1];  
         $table->end_foot();  
     }       } 
     return $currentstring;      return $currentstring;
 }  }
Line 4401  sub start_thead { Line 4403  sub start_thead {
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web' || $target eq 'webgrade') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring = $token->[4];        $currentstring = $token->[4];     
     }  
     if ($target eq 'tex') {  
         # Assume we're in a table... TODO: Verify that and ignore tag if not.  
         my $table = $Apache::londefdef::table[-1];  
         $table->start_head();  
     }       } 
     return $currentstring;      return $currentstring;
 }  }
Line 4415  sub end_thead { Line 4412  sub end_thead {
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web' || $target eq 'webgrade') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring = $token->[2];       $currentstring = $token->[2];    
     }  
     if ($target eq 'tex') {  
         # TODO: Verify we are in a table and ignore tag if not.  
   
         my $table = $Apache::londefdef::table[-1];  
         $table->end_head();  
     }       } 
     return $currentstring;      return $currentstring;
 }  }
Line 4624  sub get_eps_image { Line 4615  sub get_eps_image {
   
  #if replication failed try to produce eps file dynamically   #if replication failed try to produce eps file dynamically
  $src=~s/\.ps$/\.eps/;   $src=~s/\.ps$/\.eps/;
  my $temp_file;   if (open(FILE,">>/home/httpd/prtspool/$env{'user.name'}_$env{'user.domain'}_printout.dat")) {
  open(FILE,">>/home/httpd/prtspool/$env{'user.name'}_$env{'user.domain'}_printout.dat");      my $newsrc=$orig_src;
  my $newsrc=$orig_src;      $newsrc =~ s|(.*)/res/|/home/httpd/html/res/|;
  $newsrc =~ s|(.*)/res/|/home/httpd/html/res/|;      &Apache::lonxml::debug("queueing $newsrc for dynamic eps production.");
  &Apache::lonxml::debug("queueing $newsrc for dynamic eps production.");      print FILE ("$newsrc\n");
  print FILE ("$newsrc\n");      close(FILE);
  close(FILE);                  }
  $src=~s|/home/httpd/html/res|/home/httpd/prtspool|;   $src=~s|/home/httpd/html/res|/home/httpd/prtspool|;
  $src=~s|/home/([^/]*)/public_html/|/home/httpd/prtspool/$1/|;   $src=~s|/home/([^/]*)/public_html/|/home/httpd/prtspool/$1/|;
  if ($sext ne "") { # Put the ext. back in to uniquify.   if ($sext ne "") { # Put the ext. back in to uniquify.
Line 4663  sub get_eps_image { Line 4654  sub get_eps_image {
 sub eps_generation {  sub eps_generation {
     my ($src,$file,$width_param) = @_;           my ($src,$file,$width_param) = @_;     
     my $filename = "/home/httpd/prtspool/$env{'user.name'}_$env{'user.domain'}_printout.dat";      my $filename = "/home/httpd/prtspool/$env{'user.name'}_$env{'user.domain'}_printout.dat";
     my $temp_file = Apache::File->new('>>'.$filename);       if (open(my $tmpfile,">>$filename")) { 
     print $temp_file "$src\n";          print $tmpfile "$src\n";
           close($tmpfile);
       }
     my $newsrc = $src;      my $newsrc = $src;
     $newsrc =~ s/(\.bmp|\.gif|\.jpg|\.jpeg)$/\.eps/i;      $newsrc =~ s/(\.bmp|\.gif|\.jpg|\.jpeg)$/\.eps/i;
     $newsrc=~s{/home/httpd/html/res}{};      $newsrc=~s{/home/httpd/html/res}{};
Line 4851  sub latex_header { Line 4844  sub latex_header {
  "\\usepackage{xcolor}\n".   "\\usepackage{xcolor}\n".
  '\usepackage{calc}'.   '\usepackage{calc}'.
  '\usepackage{amsmath}'.   '\usepackage{amsmath}'.
       '\usepackage{soul}',
  '\usepackage{amssymb}'.   '\usepackage{amssymb}'.
  '\usepackage{amsfonts}'.   '\usepackage{amsfonts}'.
  '\usepackage{amsthm}'.   '\usepackage{amsthm}'.

Removed from v.1.415.4.6  
changed lines
  Added in v.1.424


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