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

albertel lon-capa-cvs@mail.lon-capa.org
Fri, 20 Jun 2003 17:25:48 -0000


albertel		Fri Jun 20 13:25:48 2003 EDT

  Modified files:              
    /loncom/homework	grades.pm 
  Log:
  - removing dead code
  - start of BUG#1862
  
  
Index: loncom/homework/grades.pm
diff -u loncom/homework/grades.pm:1.101 loncom/homework/grades.pm:1.102
--- loncom/homework/grades.pm:1.101	Wed Jun 18 14:59:20 2003
+++ loncom/homework/grades.pm	Fri Jun 20 13:25:48 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # The LON-CAPA Grading handler
 #
-# $Id: grades.pm,v 1.101 2003/06/18 18:59:20 albertel Exp $
+# $Id: grades.pm,v 1.102 2003/06/20 17:25:48 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -147,43 +147,6 @@
     return ($classlist,\@sections,\%fullnames);
 }
 
-#find user domain
-sub finduser {
-    my ($name) = @_;
-    my $domain = '';
-    if ( $Apache::grades::viewgrades eq 'F' ) {
-	my %classlist=&Apache::lonnet::dump('classlist',
-					    $ENV{'course.'.$ENV{'request.course.id'}.'.domain'},
-					    $ENV{'course.'.$ENV{'request.course.id'}.'.num'});
-	my (@fields) = grep /^$name:/, keys %classlist;
-	($name, $domain) = split(/:/,$fields[0]);
-	return ($name,$domain);
-    } else {
-	return ($ENV{'user.name'},$ENV{'user.domain'});
-    }
-}
-
-#--- Prompts a user to enter a username.
-sub moreinfo {
-    my ($request,$reason) = @_;
-    $request->print("Unable to process request: $reason");
-    if ( $Apache::grades::viewgrades eq 'F' ) {
-	$request->print('<form action="/adm/grades" method="post">'."\n");
-	if ($ENV{'form.url'}) {
-	    $request->print('<input type="hidden" name="url" value="'.$ENV{'form.url'}.'" />'."\n");
-	}
-	if ($ENV{'form.symb'}) {
-	    $request->print('<input type="hidden" name="symb" value="'.$ENV{'form.symb'}.'" />'."\n");
-	}
-	$request->print('<input type="hidden" name="command" value="'.$ENV{'form.command'}.'" />'."\n");
-	$request->print("Student:".'<input type="text" name="student" value="'.$ENV{'form.student'}.'" />'."<br />\n");
-	$request->print("Domain:".'<input type="text" name="domain" value="'.$ENV{'user.domain'}.'" />'."<br />\n");
-	$request->print('<input type="submit" name="submit" value="ReSubmit" />'."<br />\n");
-	$request->print('</form>');
-    }
-    return '';
-}
-
 #--- Retrieve the grade status of a student for all the parts
 sub student_gradeStatus {
     my ($url,$symb,$udom,$uname,$partlist) = @_;
@@ -1050,7 +1013,7 @@
 
     (my $url=$ENV{'form.url'})=~s-^http://($ENV{'SERVER_NAME'}|$ENV{'HTTP_HOST'})--;
     my ($uname,$udom)     = ($ENV{'form.student'},$ENV{'form.userdom'});
-    ($uname,$udom)        = &finduser($uname) if $udom eq '';
+
     $ENV{'form.fullname'} = &get_fullname ($uname,$udom) if $ENV{'form.fullname'} eq '';
 
     my $symb=($ENV{'form.symb'} ne '' ? $ENV{'form.symb'} : (&Apache::lonnet::symbread($url)));
@@ -3396,7 +3359,8 @@
 
 sub handler {
     my $request=$_[0];
-    
+
+    undef(%Apache::grades::perm);
     if ($ENV{'browser.mathml'}) {
 	$request->content_type('text/xml');
     } else {
@@ -3441,7 +3405,21 @@
 	    }
 	}
     } else {
-	$Apache::grades::viewgrades=&Apache::lonnet::allowed('vgr',$ENV{'request.course.id'});
+	if (!($Apache::grades::perm{'vgr'}=&Apache::lonnet::allowed('vgr',$ENV{'request.course.id'}))) {
+	    if ($Apache::grades::perm{'vgr'}=&Apache::lonnet::allowed('vgr',$ENV{'request.course.id'}.'/'.$ENV{'request.course.sec'})) {
+		$Apache::grades::perm{'vgr_section'}=$ENV{'request.course.sec'};
+	    } else {
+		delete($Apache::grades::perm{'vgr'});
+	    }
+	}
+	if (!($Apache::grades::perm{'mgr'}=&Apache::lonnet::allowed('mgr',$ENV{'request.course.id'}))) {
+	    if ($Apache::grades::perm{'mgr'}=&Apache::lonnet::allowed('mgr',$ENV{'request.course.id'}.'/'.$ENV{'request.course.sec'})) {
+		$Apache::grades::perm{'mgr_section'}=$ENV{'request.course.sec'};
+	    } else {
+		delete($Apache::grades::perm{'mgr'});
+	    }
+	}
+
 	if ($command eq 'submission') {
 	    ($ENV{'form.student'} eq '' ? &listStudents($request) : &submission($request,0,0));
 	} elsif ($command eq 'pickStudentPage') {