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

raeburn raeburn@source.lon-capa.org
Thu, 18 Nov 2010 17:42:15 -0000


raeburn		Thu Nov 18 17:42:15 2010 EDT

  Modified files:              
    /loncom/xml	londefdef.pm 
  Log:
  - Validation of colspan and rowspan attributes.
  
  
Index: loncom/xml/londefdef.pm
diff -u loncom/xml/londefdef.pm:1.425 loncom/xml/londefdef.pm:1.426
--- loncom/xml/londefdef.pm:1.425	Mon Nov  1 10:52:09 2010
+++ loncom/xml/londefdef.pm	Thu Nov 18 17:42:15 2010
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Tags Default Definition Module 
 #
-# $Id: londefdef.pm,v 1.425 2010/11/01 10:52:09 foxr Exp $
+# $Id: londefdef.pm,v 1.426 2010/11/18 17:42:15 raeburn Exp $
 # 
 #
 # Copyright Michigan State University Board of Trustees
@@ -2314,14 +2314,20 @@
 
 sub cell_config_hash {
     my ($align, $rowspan, $colspan, $width) = @_;
+    if ($rowspan ne '') {
+        $rowspan =~ s/^\s+|\s+$//g; 
+    }
+    if ($colspan ne '') {
+        $colspan =~ s/^\s+|\s+$//g;
+    }
     my %config;
     if ($align ne '') {
 	$config{'halign'} = $align;
     }
-    if ($colspan ne "") {
+    if (($colspan =~ /^\d+$/) && ($colspan > 0)) {
 	$config{'colspan'} = $colspan;
     }
-    if ($rowspan ne '') {
+    if (($rowspan =~ /^\d+$/) && ($rowspan > 0)) {
 	$config{'rowspan'} = $rowspan;
     }
     if ($width ne '') {