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

raeburn lon-capa-cvs-allow@mail.lon-capa.org
Thu, 01 May 2008 16:03:34 -0000


raeburn		Thu May  1 12:03:34 2008 EDT

  Modified files:              
    /loncom/homework	grades.pm 
  Log:
  - If no scantron.tab or default.tab exist for course's domain, get a file from /home/httpd/lonTabs - use default_scantronformat.tab if the course domain is not a domain hosted on the server, or scantronformat.tab (a legacy customized file) if it is.
  
  
Index: loncom/homework/grades.pm
diff -u loncom/homework/grades.pm:1.518 loncom/homework/grades.pm:1.519
--- loncom/homework/grades.pm:1.518	Mon Apr 21 12:30:47 2008
+++ loncom/homework/grades.pm	Thu May  1 12:03:34 2008
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # The LON-CAPA Grading handler
 #
-# $Id: grades.pm,v 1.518 2008/04/21 16:30:47 raeburn Exp $
+# $Id: grades.pm,v 1.519 2008/05/01 16:03:34 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -4908,7 +4908,7 @@
   domainconfig user, lines are from this file.
 
   Otherwise, fall back to getting lines from the legacy file on the
-  local server:  /home/httpd/lonTabs/scantronformat.tab    
+  local server:  /home/httpd/lonTabs/default_scantronformat.tab    
 
 =cut
 
@@ -4936,9 +4936,16 @@
         }
     }
     if (!$gottab) {
-        my $fh=Apache::File->new($Apache::lonnet::perlvar{'lonTabDir'}.'/scantronformat.tab');
-        @lines = <$fh>;
-        close($fh);
+        my @domains = &Apache::lonnet::current_machine_domains();
+        if (grep(/^\Q$cdom\E$/,@domains)) {
+            my $fh=Apache::File->new($Apache::lonnet::perlvar{'lonTabDir'}.'/scantronformat.tab');
+            @lines = <$fh>;
+            close($fh);
+        } else {
+            my $fh=Apache::File->new($Apache::lonnet::perlvar{'lonTabDir'}.'/default_scantronformat.tab');
+            @lines = <$fh>;
+            close($fh);
+        }
     }
     return @lines;
 }