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

albertel lon-capa-cvs@mail.lon-capa.org
Fri, 02 Dec 2005 19:40:48 -0000


albertel		Fri Dec  2 14:40:48 2005 EDT

  Modified files:              
    /loncom/homework	grades.pm 
  Log:
  - have it use the cached priv
  
  
Index: loncom/homework/grades.pm
diff -u loncom/homework/grades.pm:1.299 loncom/homework/grades.pm:1.300
--- loncom/homework/grades.pm:1.299	Fri Dec  2 14:20:21 2005
+++ loncom/homework/grades.pm	Fri Dec  2 14:40:47 2005
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # The LON-CAPA Grading handler
 #
-# $Id: grades.pm,v 1.299 2005/12/02 19:20:21 albertel Exp $
+# $Id: grades.pm,v 1.300 2005/12/02 19:40:47 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1852,13 +1852,15 @@
 	    &mt('Message will be sent when you click on Save & Next below.').")\n";
 	$request->print($result);
     }
-    if (&Apache::lonnet::allowed('vgr',$env{'request.course.id'})) {
+    if ($perm{'vgr'}) {
 	$request->print('<br />'.
-	    &Apache::loncommon::track_student_link(&mt('View recent activity'),$uname,$udom,'check'));
+	    &Apache::loncommon::track_student_link(&mt('View recent activity'),
+						   $uname,$udom,'check'));
     }
-    if (&Apache::lonnet::allowed('opa',$env{'request.course.id'})) {
+    if ($perm{'opa'}) {
 	$request->print('<br />'.
-	    &Apache::loncommon::pprmlink(&mt('Set/Change parameters'),$uname,$udom,$symb,'check'));
+	    &Apache::loncommon::pprmlink(&mt('Set/Change parameters'),
+					 $uname,$udom,$symb,'check'));
     }
 
     my %seen = ();
@@ -5524,18 +5526,18 @@
 
 sub init_perm {
     &reset_perm();
-    if (!($perm{'vgr'}=&Apache::lonnet::allowed('vgr',$env{'request.course.id'}))) {
-	if ($perm{'vgr'}=&Apache::lonnet::allowed('vgr',$env{'request.course.id'}.'/'.$env{'request.course.sec'})) {
-	    $perm{'vgr_section'}=$env{'request.course.sec'};
-	} else {
-	    delete($perm{'vgr'});
-	}
-    }
-    if (!($perm{'mgr'}=&Apache::lonnet::allowed('mgr',$env{'request.course.id'}))) {
-	if ($perm{'mgr'}=&Apache::lonnet::allowed('mgr',$env{'request.course.id'}.'/'.$env{'request.course.sec'})) {
-	    $perm{'mgr_section'}=$env{'request.course.sec'};
-	} else {
-	    delete($perm{'mgr'});
+    foreach my $test_perm ('vgr','mgr','opa') {
+
+	my $scope = $env{'request.course.id'};
+	if (!($perm{$test_perm}=&Apache::lonnet::allowed($test_perm,$scope))) {
+
+	    $scope .= '/'.$env{'request.course.sec'};
+	    if ( $perm{$test_perm}=
+		 &Apache::lonnet::allowed($test_perm,$scope)) {
+		$perm{$test_perm.'_section'}=$env{'request.course.sec'};
+	    } else {
+		delete($perm{$test_perm});
+	    }
 	}
     }
 }