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

foxr lon-capa-cvs@mail.lon-capa.org
Mon, 29 Aug 2005 10:06:09 -0000


foxr		Mon Aug 29 06:06:09 2005 EDT

  Modified files:              
    /loncom/homework	grades.pm 
  Log:
  Allow get_codes to accept parameters for code name, cdom and cnum as well
  as use form vars.
  
  
Index: loncom/homework/grades.pm
diff -u loncom/homework/grades.pm:1.279 loncom/homework/grades.pm:1.280
--- loncom/homework/grades.pm:1.279	Fri Aug 12 18:14:12 2005
+++ loncom/homework/grades.pm	Mon Aug 29 06:06:07 2005
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # The LON-CAPA Grading handler
 #
-# $Id: grades.pm,v 1.279 2005/08/12 22:14:12 albertel Exp $
+# $Id: grades.pm,v 1.280 2005/08/29 10:06:07 foxr Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -4869,9 +4869,16 @@
 }
 
 sub get_codes {
-    my $old_name=$env{'form.scantron_CODElist'};
-    my $cdom =$env{'course.'.$env{'request.course.id'}.'.domain'};
-    my $cnum =$env{'course.'.$env{'request.course.id'}.'.num'};
+    my ($old_name, $cdom, $cnum) = @_;
+    if (!$old_name) {
+	$old_name=$env{'form.scantron_CODElist'};
+    }
+    if (!$cdom) {
+	$cdom =$env{'course.'.$env{'request.course.id'}.'.domain'};
+    }
+    if (!$cnum) {
+	$cnum =$env{'course.'.$env{'request.course.id'}.'.num'};
+    }
     my %result=&Apache::lonnet::get('CODEs',[$old_name,"type\0$old_name"],
 				    $cdom,$cnum);
     my %allcodes;