[LON-CAPA-cvs] cvs: loncom(version_2_10_X) /xml londefdef.pm

raeburn raeburn@source.lon-capa.org
Mon, 16 Aug 2010 16:14:32 -0000


raeburn		Mon Aug 16 16:14:32 2010 EDT

  Modified files:              (Branch: version_2_10_X)
    /loncom/xml	londefdef.pm 
  Log:
  - Backport 1.418, 1.419, 1.420, 1.421.
  
  
Index: loncom/xml/londefdef.pm
diff -u loncom/xml/londefdef.pm:1.415 loncom/xml/londefdef.pm:1.415.4.1
--- loncom/xml/londefdef.pm:1.415	Mon Feb  1 12:03:19 2010
+++ loncom/xml/londefdef.pm	Mon Aug 16 16:14:32 2010
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Tags Default Definition Module 
 #
-# $Id: londefdef.pm,v 1.415 2010/02/01 12:03:19 foxr Exp $
+# $Id: londefdef.pm,v 1.415.4.1 2010/08/16 16:14:32 raeburn Exp $
 # 
 #
 # Copyright Michigan State University Board of Trustees
@@ -2048,26 +2048,36 @@
 	my $width  = &Apache::lonxml::get_param('TeXwidth', $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 $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
 	# a percent. If not it's assumed to be some valid TeX measurement unit e.g. 3.0cm
 	#
 
 	my $table = new Apache::lontable();
-	if ($border ne '') {
-	    $table->table_border(1);
+        if ((defined $border) && ($border > 0)) {
+        #    &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);
 	}
-	if ($theme ne '') {
+        if (defined $theme) {
 	    $table->theme($theme);
 	}
-	if ($align ne '') {
+	if (defined $align) {
 	    $table->alignment($align);
 	}
 
 	# Missing width is most of page width
 
-	if ($width eq "") {
+	if (!(defined $width)) {
 	    $width = '70%';
 	}
 	
@@ -3275,21 +3285,28 @@
 						   ['','bottom','middle','top','left','right'],$token,5);
 	$currentstring .=&Apache::edit::select_arg('TeXwrap:', 'TeXwrap',
 						   ['', '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',
 						   ['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();
 	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 $height= &Apache::lonxml::get_param('height',$parstack,$safeeval);
 
         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 {
-	   $currentstring .= '<img src="'.$src.'" alt="'.$alt.'" ';
-	   if ($width) { $currentstring.=' width="'.$width.'" '; }
-	   if ($height) { $currentstring.=' height="'.$height.'" '; }
-	   $currentstring .= ' />';
+           $currentstring.=&mt("No image source specified");
         }
     } elsif ($target eq 'modified') {
 	my ($osrc,$owidth,$oheight)=