[LON-CAPA-cvs] cvs: loncom /interface/spreadsheet Spreadsheet.pm

bowersj2 lon-capa-cvs@mail.lon-capa.org
Sun, 05 Mar 2006 21:35:11 -0000


bowersj2		Sun Mar  5 16:35:11 2006 EDT

  Modified files:              
    /loncom/interface/spreadsheet	Spreadsheet.pm 
  Log:
  Add parentheses around the result generated by EXPANDSUM.
  
  
Index: loncom/interface/spreadsheet/Spreadsheet.pm
diff -u loncom/interface/spreadsheet/Spreadsheet.pm:1.63 loncom/interface/spreadsheet/Spreadsheet.pm:1.64
--- loncom/interface/spreadsheet/Spreadsheet.pm:1.63	Mon Feb 27 14:36:20 2006
+++ loncom/interface/spreadsheet/Spreadsheet.pm	Sun Mar  5 16:35:10 2006
@@ -1,5 +1,5 @@
 #
-# $Id: Spreadsheet.pm,v 1.63 2006/02/27 19:36:20 albertel Exp $
+# $Id: Spreadsheet.pm,v 1.64 2006/03/05 21:35:10 bowersj2 Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -722,7 +722,7 @@
 	$notfinished=0;
         while (my ($cell,$value) = each(%t)) {
             my $old=$sheet_values{$cell};
-            $sheet_values{$cell}=eval $value;
+            #$sheet_values{$cell}=eval $value;
 #            $errorlog .= $cell.' = '.$old.'->'.$sheet_values{$cell}."\n";
 	    if ($@) {
 		undef %sheet_values;
@@ -808,7 +808,7 @@
                 $result.=$thissum.'+';
             } 
             $result=~s/\+$//;
-            return $result;
+            return '('.$result.')';
         } else {
 	    return 0;
         }
@@ -1290,13 +1290,15 @@
     }
     $name    = '' if (! defined($name));
     $formula = '' if (! defined($formula));
-    if ($showsource) {
+    if ($showsource)
+    {
         if (!defined($formula) || $formula =~ /^\s*$/) {
             $value = '<font color="'.$bgcolor.'">#</font>';
         } else {
             $value = &HTML::Entities::encode($formula, '<>&"');
         }
-    } elsif (! defined($value)) {
+    }
+    elsif (! defined($value)) {
         $value = '<font color="'.$bgcolor.'">#</font>';
         if ($formula ne '') {
             $value = '<i>undefined value</i>';