[LON-CAPA-cvs] cvs: loncom /homework lonhomework.pm

albertel lon-capa-cvs@mail.lon-capa.org
Thu, 28 Feb 2002 01:18:47 -0000


albertel		Wed Feb 27 20:18:47 2002 EDT

  Modified files:              
    /loncom/homework	lonhomework.pm 
  Log:
  - Oops, checking if(defined($var{element}->[0])) brings $var{element}
    into existance if it didn't exist before.
  
  
Index: loncom/homework/lonhomework.pm
diff -u loncom/homework/lonhomework.pm:1.71 loncom/homework/lonhomework.pm:1.72
--- loncom/homework/lonhomework.pm:1.71	Wed Feb 27 15:23:26 2002
+++ loncom/homework/lonhomework.pm	Wed Feb 27 20:18:47 2002
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # The LON-CAPA Homework handler
 #
-# $Id: lonhomework.pm,v 1.71 2002/02/27 20:23:26 albertel Exp $
+# $Id: lonhomework.pm,v 1.72 2002/02/28 01:18:47 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -437,11 +437,12 @@
   &Apache::lonxml::debug("Permissions:$Apache::lonhomework::browse:$Apache::lonhomework::viewgrades:");
   # some times multiple problemmodes are submitted, need to select
   # the last one
-  if ( defined @{ $ENV{'form.problemmode'} } ) {
-    &Apache::lonxml::debug("Problem Modes ".join(':',@{ $ENV{'form.problemmode'} }));
-    my @modes=@{ $ENV{'form.problemmode'} };
+  if ( defined($ENV{'form.problemmode'}) &&
+       defined(@{ $ENV{'form.problemmode'} })) {
+    &Apache::lonxml::debug("3Problem Modes ".$ENV{'form.problemmode'});
+    my $mode=$ENV{'form.problemmode'}->[-1];
     undef $ENV{'form.problemmode'};
-    $ENV{'form.problemmode'}=$modes[-1];
+    $ENV{'form.problemmode'}=$mode;
   }
   &Apache::lonxml::debug("Problem Mode ".$ENV{'form.problemmode'});
   my $file=&Apache::lonnet::filelocation("",$request->uri);