[LON-CAPA-cvs] cvs: loncom(version_0_6) /interface lonspreadsheet.pm

albertel lon-capa-cvs@mail.lon-capa.org
Fri, 14 Mar 2003 21:34:04 -0000


albertel		Fri Mar 14 16:34:04 2003 EDT

  Modified files:              (Branch: version_0_6)
    /loncom/interface	lonspreadsheet.pm 
  Log:
  - backport of 1.174, parameter cascading works now
  
  
Index: loncom/interface/lonspreadsheet.pm
diff -u loncom/interface/lonspreadsheet.pm:1.160 loncom/interface/lonspreadsheet.pm:1.160.2.1
--- loncom/interface/lonspreadsheet.pm:1.160	Mon Jan  6 14:43:01 2003
+++ loncom/interface/lonspreadsheet.pm	Fri Mar 14 16:34:04 2003
@@ -1,5 +1,5 @@
 #
-# $Id: lonspreadsheet.pm,v 1.160 2003/01/06 19:43:01 matthew Exp $
+# $Id: lonspreadsheet.pm,v 1.160.2.1 2003/03/14 21:34:04 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -2094,8 +2094,27 @@
     # second, check map parms
     my $thisparm = $parmhash{$symbparm};
     return $thisparm if (defined($thisparm));
+
     # first, check default
-    return &Apache::lonnet::metadata($fn,$rwhat.'.default');
+    $thisparm = &Apache::lonnet::metadata($fn,$rwhat.'.default');
+    return $thisparm if (defined($thisparm));
+
+    #Cascade Up
+    my $space=$what;
+    $space=~s/\.\w+$//;
+    if ($space ne '0') {
+	my @parts=split(/_/,$space);
+	my $id=pop(@parts);
+	my $part=join('_',@parts);
+	if ($part eq '') { $part='0'; }
+	my $newwhat=$rwhat;
+	$newwhat=~s/\Q$space\E/$part/;
+	my $partgeneral=&parmval($newwhat,$symb,$uname,$udom,$csec);
+	if (defined($partgeneral)) { return $partgeneral; }
+    }
+
+    #nothing defined
+    return '';
 }