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

albertel lon-capa-cvs@mail.lon-capa.org
Thu, 14 Dec 2006 20:08:16 -0000


albertel		Thu Dec 14 15:08:16 2006 EDT

  Modified files:              (Branch: version_2_3_X)
    /loncom/interface	lonparmset.pm 
  Log:
  - backport 1.352 1.353
  
  
Index: loncom/interface/lonparmset.pm
diff -u loncom/interface/lonparmset.pm:1.350 loncom/interface/lonparmset.pm:1.350.2.1
--- loncom/interface/lonparmset.pm:1.350	Mon Dec  4 21:55:53 2006
+++ loncom/interface/lonparmset.pm	Thu Dec 14 15:08:15 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Handler to set parameters for assessments
 #
-# $Id: lonparmset.pm,v 1.350 2006/12/05 02:55:53 albertel Exp $
+# $Id: lonparmset.pm,v 1.350.2.1 2006/12/14 20:08:15 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -122,7 +122,10 @@
 # load caches
     &cacheparmhash();
 
-    my $useropt=&Apache::lonnet::get_userresdata($uname,$udom);
+    my $useropt;
+    if ($uname ne '' && $udom ne '') {
+	$useropt = &Apache::lonnet::get_userresdata($uname,$udom);
+    }
 
     my $result='';
     my @outpar=();
@@ -173,7 +176,7 @@
     }
 
 # ------------------------------------------------------ fourth, back to course
-    if (defined($csec)) {
+    if ($csec ne '') {
         if (defined($$courseopt{$seclevel})) {
 	    $outpar[9]=$$courseopt{$seclevel};
 	    $result=9;
@@ -189,7 +192,7 @@
 	}
     }
 # ------------------------------------------------------ fifth, check course group
-    if (defined($cgroup)) {
+    if ($cgroup ne '') {
         if (defined($$courseopt{$grplevel})) {
             $outpar[6]=$$courseopt{$grplevel};
             $result=6;
@@ -206,7 +209,7 @@
 
 # ---------------------------------------------------------- fifth, check user
 
-    if (defined($uname)) {
+    if ($uname ne '') {
 	if (defined($$useropt{$courselevel})) {
 	    $outpar[3]=$$useropt{$courselevel};
 	    $result=3;
@@ -270,9 +273,7 @@
 sub rulescache {
     my $id=shift;
     if ($rulesid ne $env{'request.course.id'}) {
-	%rules=();
-    }
-    unless (defined($rules{$id})) {
+	&& !defined($rules{$id})) {
 	my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'};
 	my $crs = $env{'course.'.$env{'request.course.id'}.'.num'};
 	%rules=&Apache::lonnet::dump('parmdefactions',$dom,$crs);