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

albertel lon-capa-cvs@mail.lon-capa.org
Wed, 27 Feb 2002 20:23:26 -0000


albertel		Wed Feb 27 15:23:26 2002 EDT

  Modified files:              
    /loncom/homework	lonhomework.pm 
  Log:
  - form.problemmode can have multiple values submitted, always selct the last one
  
  
Index: loncom/homework/lonhomework.pm
diff -u loncom/homework/lonhomework.pm:1.70 loncom/homework/lonhomework.pm:1.71
--- loncom/homework/lonhomework.pm:1.70	Wed Jan 30 12:39:13 2002
+++ loncom/homework/lonhomework.pm	Wed Feb 27 15:23:26 2002
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # The LON-CAPA Homework handler
 #
-# $Id: lonhomework.pm,v 1.70 2002/01/30 17:39:13 albertel Exp $
+# $Id: lonhomework.pm,v 1.71 2002/02/27 20:23:26 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -435,6 +435,14 @@
   $Apache::lonhomework::browse= &Apache::lonnet::allowed('bre',$ENV{'request.filename'});
   $Apache::lonhomework::viewgrades=&Apache::lonnet::allowed('vgr',$ENV{'request.course.id'});
   &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'} };
+    undef $ENV{'form.problemmode'};
+    $ENV{'form.problemmode'}=$modes[-1];
+  }
   &Apache::lonxml::debug("Problem Mode ".$ENV{'form.problemmode'});
   my $file=&Apache::lonnet::filelocation("",$request->uri);