[LON-CAPA-cvs] cvs: modules /raeburn checkscantron.pm

raeburn lon-capa-cvs-allow@mail.lon-capa.org
Tue, 11 Mar 2008 04:43:37 -0000


raeburn		Tue Mar 11 00:43:37 2008 EDT

  Modified files:              
    /modules/raeburn	checkscantron.pm 
  Log:
  Check the user has permission to manage scantron grading in the course.
  
  
Index: modules/raeburn/checkscantron.pm
diff -u modules/raeburn/checkscantron.pm:1.1 modules/raeburn/checkscantron.pm:1.2
--- modules/raeburn/checkscantron.pm:1.1	Mon Mar 10 20:25:12 2008
+++ modules/raeburn/checkscantron.pm	Tue Mar 11 00:43:35 2008
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Checking scantron submission date
 #
-# $Id: checkscantron.pm,v 1.1 2008/03/11 00:25:12 raeburn Exp $
+# $Id: checkscantron.pm,v 1.2 2008/03/11 04:43:35 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -56,16 +56,24 @@
     &Apache::lonhtmlcommon::add_breadcrumb
     ({href=>"/adm/checkscantron",
       text=>"Select sequence/scantron file"});
-    if ($env{'form.checksubmissions'}) {
-        &Apache::lonhtmlcommon::add_breadcrumb
-        ({href=>"/adm/checkscantron",
-          text=>"Submission check result"});
-        $r->print(&Apache::lonhtmlcommon::breadcrumbs('Scantron verification'));
-        &print_result($r);
+    if ($env{'request.course.id'}) {
+        if (&Apache::lonnet::allowed('mgr',$env{'request.course.id'})) {
+            if ($env{'form.checksubmissions'}) {
+                &Apache::lonhtmlcommon::add_breadcrumb
+                ({href=>"/adm/checkscantron",
+                  text=>"Submission check result"});
+                $r->print(&Apache::lonhtmlcommon::breadcrumbs('Scantron verification'));
+                &print_result($r);
+            } else {
+                $r->print(&Apache::lonhtmlcommon::breadcrumbs('Scantron verification'));
+                $r->print('<br />');
+                &scantron_selectphase($r);
+            }
+        } else {
+            $r->print(&mt('You do not have permission to carry out scantron verification.'));  
+        }
     } else {
-        $r->print(&Apache::lonhtmlcommon::breadcrumbs('Scantron verification'));
-        $r->print('<br />');
-        &scantron_selectphase($r);
+        $r->print(&mt('You must be in a course to carry out scantron verification.'));
     }
     $r->print(&Apache::loncommon::end_page());
     return OK;