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

albertel lon-capa-cvs@mail.lon-capa.org
Wed, 09 Aug 2006 20:47:34 -0000


albertel		Wed Aug  9 16:47:34 2006 EDT

  Modified files:              
    /loncom/interface	lonparmset.pm 
  Log:
  - there is a parameter called 'type' so just ending in .type doesn't mean
    it's a type, now if value exists and value.type also exist than
    value must be a value and not a type
  
  
Index: loncom/interface/lonparmset.pm
diff -u loncom/interface/lonparmset.pm:1.329 loncom/interface/lonparmset.pm:1.330
--- loncom/interface/lonparmset.pm:1.329	Wed Aug  9 16:43:56 2006
+++ loncom/interface/lonparmset.pm	Wed Aug  9 16:47:32 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Handler to set parameters for assessments
 #
-# $Id: lonparmset.pm,v 1.329 2006/08/09 20:43:56 albertel Exp $
+# $Id: lonparmset.pm,v 1.330 2006/08/09 20:47:32 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -3314,14 +3314,16 @@
 }
 
 sub components {
-    my ($key,$uname,$udom,$exeuser,$exedomain)=@_;
-    my $typeflag=0;
-    if ($key=~/\.type$/) {
+    my ($key,$uname,$udom,$exeuser,$exedomain,$typeflag)=@_;
+
+    if ($typeflag) {
 	$key=~s/\.type$//;
-        $typeflag=1;
     }
+
+    my ($middle,$part,$name)=
+	($key=~/^$env{'request.course.id'}\.(?:(.+)\.)*([\w\s]+)\.(\w+)$/);
     my $issection;
-    my ($middle,$part,$name)=($key=~/^$env{'request.course.id'}\.(?:(.+)\.)*([\w\s]+)\.(\w+)$/);
+
     my $section=&mt('All Students');
     if ($middle=~/^\[(.*)\]/) {
 	$issection=$1;
@@ -3345,7 +3347,7 @@
 	$realmdescription=&mt('resource').' '.&Apache::lonnet::gettitle($middle);
     }
     my $what=$part.'.'.$name;
-    return ($realm,$section,$name,$part,$typeflag,
+    return ($realm,$section,$name,$part,
 	    $what,$middle,$uname,$udom,$issection,$realmdescription);
 }
 
@@ -3451,9 +3453,10 @@
 	my $makenewrow=0;
 	my %istype=();
 	foreach my $changed (reverse(sort(@changes))) {
-            my $value=$parmlog{$id}{'logentry'}->{$changed};
-            my ($realm,$section,$parmname,$part,$typeflag,$what,$middle,$uname,$udom,$issection,$realmdescription)=
-		&components($changed,$parmlog{$id}{'uname'},$parmlog{$id}{'udom'});
+            my $value=$parmlog{$id}{'logentry'}{$changed};
+	    my $typeflag = (!exists($parmlog{$id}{'logentry'}{$changed.'.type'}));
+            my ($realm,$section,$parmname,$part,$what,$middle,$uname,$udom,$issection,$realmdescription)=
+		&components($changed,$parmlog{$id}{'uname'},$parmlog{$id}{'udom'},undef,undef,$typeflag);
 	    if ($typeflag) {
 		$istype{$parmname}=$value; 
 		if (!$env{'form.includetypes'}) { next; }