Diff for /loncom/xml/londefdef.pm between versions 1.415 and 1.415.4.2

version 1.415, 2010/02/01 12:03:19 version 1.415.4.2, 2010/11/09 21:28:20
Line 2048  sub start_table { Line 2048  sub start_table {
  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);
   
  # 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 ($border ne '') {          if ((defined $border) && ($border > 0)) {
     $table->table_border(1);          #    &Apache::lonnet::logthis("Turning on table borders: $border");
               $table->table_border(1);
               if ($cell_border ne 'none') {
                   $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) && ($cell_border ne 'none')) {
           #    &Apache::lonnet::logthis("Turning on cell borders: $cell_border");
     $table->cell_border(1);      $table->cell_border(1);
  }   }
  if ($theme ne '') {          if (defined $theme) {
     $table->theme($theme);      $table->theme($theme);
  }   }
  if ($align ne '') {   if (defined $align) {
     $table->alignment($align);      $table->alignment($align);
  }   }
   
  # Missing width is most of page width   # Missing width is most of page width
   
  if ($width eq "") {   if (!(defined $width)) {
     $width = '70%';      $width = '70%';
  }   }
   
Line 2722  sub tag_check { Line 2732  sub tag_check {
 #  #
   
 sub cell_config_hash {  sub cell_config_hash {
     my ($align, $rowspan, $colspan) = @_;      my ($align, $rowspan, $colspan, $width) = @_;
     my %config;      my %config;
     if ($align ne '') {      if ($align ne '') {
  $config{'halign'} = $align;   $config{'halign'} = $align;
Line 2733  sub cell_config_hash { Line 2743  sub cell_config_hash {
     if ($rowspan ne '') {      if ($rowspan ne '') {
  $config{'rowspan'} = $rowspan;   $config{'rowspan'} = $rowspan;
     }      }
       if ($width ne '') {
           $config{'width'} = $width;
       }
     return \%config;      return \%config;
 }  }
     
Line 2744  sub start_td_tex { Line 2757  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, undef, 1);      my $align   = &Apache::lonxml::get_param('align', $parstack, $safeeval);
     my $rowspan = &Apache::lonxml::get_param('rowspan', $parstack, $safeeval, undef, 1);      my $rowspan = &Apache::lonxml::get_param('rowspan', $parstack, $safeeval);
     my $colspan = &Apache::lonxml::get_param('colspan', $parstack, $safeeval, undef, 1);      my $colspan = &Apache::lonxml::get_param('colspan', $parstack, $safeeval);
       my $width   = &Apache::lonxml::get_param('TeXwidth', $parstack, $safeeval);
     my $config = &cell_config_hash($align, $rowspan, $colspan);      my $config = &cell_config_hash($align, $rowspan, $colspan, $width);
   
     my $table = $Apache::londefdef::table[-1];      my $table = $Apache::londefdef::table[-1];
     $table->add_cell('', $config);      $table->add_cell('', $config);
Line 3275  sub start_img { Line 3288  sub start_img {
    ['','bottom','middle','top','left','right'],$token,5);     ['','bottom','middle','top','left','right'],$token,5);
  $currentstring .=&Apache::edit::select_arg('TeXwrap:', 'TeXwrap',   $currentstring .=&Apache::edit::select_arg('TeXwrap:', 'TeXwrap',
    ['', 'none','parbox', 'parpic', 'wrapfigure'], $token, 2);     ['', 'none','parbox', 'parpic', 'wrapfigure'], $token, 2);
           my $alt=    &Apache::lonxml::get_param('alt',$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')) {
              $currentstring.='<br /><span class="LC_warning">'.&mt('Warning: the description "[_1]" will be available, even for encrypted URL',$alt).'</span><br />';
           }
  $currentstring .=&Apache::edit::end_row().&Apache::edit::start_spanning_row();   $currentstring .=&Apache::edit::end_row().&Apache::edit::start_spanning_row();
  my $src=    &Apache::lonxml::get_param('src',$parstack,$safeeval);   my $src=    &Apache::lonxml::get_param('src',$parstack,$safeeval);
  my $alt=    &Apache::lonxml::get_param('alt',$parstack,$safeeval);  
  my $width=  &Apache::lonxml::get_param('width',$parstack,$safeeval);   my $width=  &Apache::lonxml::get_param('width',$parstack,$safeeval);
  my $height= &Apache::lonxml::get_param('height',$parstack,$safeeval);   my $height= &Apache::lonxml::get_param('height',$parstack,$safeeval);
   
         if ($token->[2]{'src'}=~/\$/) {          if ($token->[2]{'src'}=~/\$/) {
            $currentstring.='Variable image source';             $currentstring.=&mt('Variable image source');
           } elsif ($token->[2]{'src'}=~/\S/) {
              $currentstring .= '<img src="'.$src.'" alt="'.$alt.'" ';
              if ($width) { $currentstring.=' width="'.$width.'" '; }
              if ($height) { $currentstring.=' height="'.$height.'" '; }
              $currentstring .= ' />';
         } else {          } else {
    $currentstring .= '<img src="'.$src.'" alt="'.$alt.'" ';             $currentstring.=&mt("No image source specified");
    if ($width) { $currentstring.=' width="'.$width.'" '; }  
    if ($height) { $currentstring.=' height="'.$height.'" '; }  
    $currentstring .= ' />';  
         }          }
     } elsif ($target eq 'modified') {      } elsif ($target eq 'modified') {
  my ($osrc,$owidth,$oheight)=   my ($osrc,$owidth,$oheight)=

Removed from v.1.415  
changed lines
  Added in v.1.415.4.2


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