Diff for /loncom/homework/grades.pm between versions 1.55 and 1.56

version 1.55, 2002/10/16 19:13:57 version 1.56, 2002/10/16 19:23:48
Line 111  sub response_type { Line 111  sub response_type {
 #--- section, ids and fullnames for each user.  #--- section, ids and fullnames for each user.
 sub getclasslist {  sub getclasslist {
     my ($getsec,$hideexpired) = @_;      my ($getsec,$hideexpired) = @_;
     my $now = time;      my $classlist=&Apache::loncoursedata::get_classlist();
     my %classlist=&Apache::lonnet::dump('classlist',  
  $ENV{'course.'.$ENV{'request.course.id'}.'.domain'},  
  $ENV{'course.'.$ENV{'request.course.id'}.'.num'});  
     my ($tmp) = keys(%classlist);  
     # Bail out if we were unable to get the classlist      # Bail out if we were unable to get the classlist
     return if ($tmp =~ /^(con_lost|error|no_such_host)/i);      return if (! defined($classlist));
       #
     # codes to check for fields in the classlist      my %sections;
     # should contain end:start:id:section:fullname      my %fullnames;
     for (keys %classlist) {      foreach (keys(%$classlist)) {
  my (@fields) = split(/:/,$classlist{$_});          # the following undefs are for 'domain', and 'username' respectively.
  %classlist   = &reformat_classlist(\%classlist) if (scalar(@fields) <= 2);   my (undef,undef,$end,$start,$id,$section,$fullname,$status)=
  last;              @{$classlist->{$_}};
     }  
   
     my (@holdsec,@sections,%allids,%stusec,%fullname);  
     foreach (keys(%classlist)) {  
  my ($end,$start,$id,$section,$fullname)=split(/:/,$classlist{$_});  
  # still a student?   # still a student?
  if (($hideexpired) && ($end) && ($end < $now)) {   if (($hideexpired) && ($status ne 'Active')) {
     next;              delete ($classlist->{$_});
  }              next;
           }
  $section = ($section ne '' ? $section : 'no');   $section = ($section ne '' ? $section : 'no');
  push @holdsec,$section;  
  if ($getsec eq 'all' || $getsec eq $section) {   if ($getsec eq 'all' || $getsec eq $section) {
     push (@{ $classlist{$getsec} }, $_);              $sections{$section}++;
     $allids{$_}  =$id;              $fullnames{$_}=$fullname;
     $stusec{$_}  =$section;          } else {
     $fullname{$_}=$fullname;              delete($classlist->{$_});
  }          }
     }      }
     my %seen = ();      my %seen = ();
     foreach my $item (@holdsec) {      my @sections = sort(keys(%sections));
  push (@sections, $item) unless $seen{$item}++;      return ($classlist,\@sections,\%fullnames);
     }  
     return (\%classlist,\@sections,\%allids,\%stusec,\%fullname);  
 }  
   
 # add id, section and fullname to the classlist.db  
 # done to maintain backward compatibility with older versions  
 sub reformat_classlist {  
     my ($classlist) = shift;  
     foreach (sort keys(%$classlist)) {  
  my ($unam,$udom) = split(/:/);  
  my $section      = &Apache::lonnet::usection($udom,$unam,$ENV{'request.course.id'});  
  my $fullname     = &get_fullname ($unam,$udom);  
  my %userid       = &Apache::lonnet::idrget($udom,($unam));  
  $$classlist{$_}  = $$classlist{$_}.':'.$userid{$unam}.':'.$section.':'.$fullname;  
     }  
     my $putresult = &Apache::lonnet::put  
  ('classlist',\%$classlist,  
  $ENV{'course.'.$ENV{'request.course.id'}.'.domain'},  
  $ENV{'course.'.$ENV{'request.course.id'}.'.num'});  
   
     return %$classlist;  
 }  }
   
 #find user domain  #find user domain
Line 267  sub verifyreceipt { Line 237  sub verifyreceipt {
  '<font size=+1><b>Resource: </b>'.$ENV{'form.url'}.'</font><br><br>'."\n";   '<font size=+1><b>Resource: </b>'.$ENV{'form.url'}.'</font><br><br>'."\n";
   
     my ($string,$contents,$matches) = ('','',0);      my ($string,$contents,$matches) = ('','',0);
     my ($classlist,$seclist,$ids,$stusec,$fullname) = &getclasslist('all','0');      my (undef,undef,$fullname) = &getclasslist('all','0');
       
     foreach (sort {lc($$fullname{$a}) cmp lc($$fullname{$b}) } keys %$fullname) {      foreach (sort {lc($$fullname{$a}) cmp lc($$fullname{$b}) } keys %$fullname) {
  my ($uname,$udom)=split(/\:/);   my ($uname,$udom)=split(/\:/);
  if ($receipt eq    if ($receipt eq 
Line 393  LISTJAVASCRIPT Line 363  LISTJAVASCRIPT
  'onClick="javascript:checkSelect(this.form.stuinfo);" '."\n".   'onClick="javascript:checkSelect(this.form.stuinfo);" '."\n".
  'value="'.$viewgrade.'" />'."\n";   'value="'.$viewgrade.'" />'."\n";
     
     my ($classlist,$seclist,$ids,$stusec,$fullname) = &getclasslist($getsec,'0');      my (undef,undef,$fullname) = &getclasslist($getsec,'0');
           
     $gradeTable.='<table border="0"><tr><td bgcolor="#777777">'.      $gradeTable.='<table border="0"><tr><td bgcolor="#777777">'.
  '<table border="0"><tr bgcolor="#e6ffff">'.   '<table border="0"><tr bgcolor="#e6ffff">'.
Line 840  sub submission { Line 810  sub submission {
     if ($symb eq '') { $request->print("Unable to handle ambiguous references:$url:."); return ''; }      if ($symb eq '') { $request->print("Unable to handle ambiguous references:$url:."); return ''; }
     my $last = ($ENV{'form.lastSub'} eq 'last' ? 'last' : '');      my $last = ($ENV{'form.lastSub'} eq 'last' ? 'last' : '');
     $ENV{'form.vProb'} = $ENV{'form.vProb'} ne '' ? $ENV{'form.vProb'} : 'yes';      $ENV{'form.vProb'} = $ENV{'form.vProb'} ne '' ? $ENV{'form.vProb'} : 'yes';
     my ($classlist,$seclist,$ids,$stusec,$fullname);  
   
     # header info      # header info
     if ($counter == 0) {      if ($counter == 0) {
Line 941  KEYWORDS Line 910  KEYWORDS
   
     # If this is handgraded, then check for collaborators      # If this is handgraded, then check for collaborators
     my @col_fullnames;      my @col_fullnames;
       my ($classlist,$fullname);
     if ($ENV{'form.handgrade'} eq 'yes') {      if ($ENV{'form.handgrade'} eq 'yes') {
  my @col_list;   my @col_list;
  ($classlist,$seclist,$ids,$stusec,$fullname) = &getclasslist('all','0');   ($classlist,undef,$fullname) = &getclasslist('all','0');
  for (keys (%$handgrade)) {   for (keys (%$handgrade)) {
     my $ncol = &Apache::lonnet::EXT('resource.'.$_.      my $ncol = &Apache::lonnet::EXT('resource.'.$_.
     '.maxcollaborators',$symb,$udom,$uname);      '.maxcollaborators',$symb,$udom,$uname);
Line 1301  sub processHandGrade { Line 1271  sub processHandGrade {
  $laststu = $firststu if ($ctr > $ngrade);   $laststu = $firststu if ($ctr > $ngrade);
     }      }
   
     my ($classlist,$seclist,$ids,$stusec,$fullname) = &getclasslist($ENV{'form.section'},'0');      my (undef,undef,$fullname) = &getclasslist($ENV{'form.section'},'0');
     my (@parsedlist,@nextlist);      my (@parsedlist,@nextlist);
     my ($nextflg) = 0;      my ($nextflg) = 0;
     foreach (sort {lc($$fullname{$a}) cmp lc($$fullname{$b}) } keys %$fullname) {      foreach (sort {lc($$fullname{$a}) cmp lc($$fullname{$b}) } keys %$fullname) {
Line 1682  sub viewgrades { Line 1652  sub viewgrades {
   
     #get info for each student      #get info for each student
     #list all the students - with points and grade status      #list all the students - with points and grade status
     my ($classlist,$seclist,$ids,$stusec,$fullname) = &getclasslist($ENV{'form.section'},'0');      my (undef,undef,$fullname) = &getclasslist($ENV{'form.section'},'0');
     my $ctr = 0;      my $ctr = 0;
     foreach (sort {lc($$fullname{$a}) cmp lc($$fullname{$b}) } keys %$fullname) {      foreach (sort {lc($$fullname{$a}) cmp lc($$fullname{$b}) } keys %$fullname) {
  my ($uname,$udom) = split(/:/);   my ($uname,$udom) = split(/:/);
Line 1767  sub editgrades { Line 1737  sub editgrades {
     'ungraded' =>'ungraded_attempted',      'ungraded' =>'ungraded_attempted',
     'nothing'  => '',      'nothing'  => '',
     );      );
     my ($classlist,$seclist,$ids,$stusec,$fullname) = &getclasslist($ENV{'form.section'},'0');      my ($classlist,undef,$fullname) = &getclasslist($ENV{'form.section'},'0');
   
     my (@partid);      my (@partid);
     my %weight = ();      my %weight = ();
Line 2185  sub gradingmenu { Line 2155  sub gradingmenu {
 #--- Menu for grading a section or the whole class ---  #--- Menu for grading a section or the whole class ---
 sub view_edit_entire_class_form {  sub view_edit_entire_class_form {
     my ($symb,$url)=@_;      my ($symb,$url)=@_;
     my ($classlist,$sections) = &getclasslist('all','0');      my ($classlist,$sections,undef) = &getclasslist('all','0');
     my $result.='<table width=100% border=0><tr><td bgcolor=#777777>'."\n";      my $result.='<table width=100% border=0><tr><td bgcolor=#777777>'."\n";
     $result.='<table width=100% border=0><tr bgcolor="#e6ffff"><td>'."\n";      $result.='<table width=100% border=0><tr bgcolor="#e6ffff"><td>'."\n";
     $result.='&nbsp;<b>Grade Entire Section or Class</b></td></tr>'."\n";      $result.='&nbsp;<b>Grade Entire Section or Class</b></td></tr>'."\n";

Removed from v.1.55  
changed lines
  Added in v.1.56


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>