--- loncom/interface/lonwhatsnew.pm	2005/07/08 10:39:49	1.22
+++ loncom/interface/lonwhatsnew.pm	2005/07/15 05:43:42	1.26
@@ -1,5 +1,5 @@
 #
-# $Id: lonwhatsnew.pm,v 1.22 2005/07/08 10:39:49 www Exp $
+# $Id: lonwhatsnew.pm,v 1.26 2005/07/15 05:43:42 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -38,6 +38,7 @@ use Apache::lonnavmaps();
 use Apache::lonuserstate;
 use Apache::Constants qw(:common :http);
 use Time::Local;
+use GDBM_File;
 
 #----------------------------
 # handler
@@ -190,10 +191,12 @@ sub display_actions_box() {
         $r->print('<br /><b><center>You are accessing an invalid course.</center></b><br /><br />');
         return;
     }
-
-    my ($furl,$ferr)=
-           &Apache::lonuserstate::readmap($cdom.'/'.$crs);
-    $r->print('<font size="+1"><a href="'.$furl.'">Go to first resource</a></font><a href="/adm/preferences?action=changecourseinit"></font><br />Change your preferences</a> to suppress display of this screen when accessing courses as Course Coordinator in the future.<br /><hr />');
+    if (tie(my %bighash,'GDBM_File',$env{'request.course.fn'}.'.db',
+	    &GDBM_READER(),0640)) {
+	my $furl=$bighash{'first_url'};
+	$r->print('<font size="+1"><a href="'.$furl.'">Go to first resource</a></font><a href="/adm/preferences?action=changecourseinit"></font><br />Change your preferences</a> to suppress display of this screen when accessing courses as Course Coordinator in the future.<br /><hr />');
+	untie(%bighash);
+    }
 
     my $result;
 
@@ -264,7 +267,7 @@ END
         @bombs = sort { &cmp_title($a,$b,\%res_title) } @bombs;
         foreach my $bomb (@bombs) {
             if ($bombnum %2 == 1) {
-                 $rowColor = $rowColor1;
+		$rowColor = $rowColor1;
             } else {
                 $rowColor = $rowColor2;
             }
@@ -504,7 +507,8 @@ sub display_config_box() {
 sub getitems {
     my ($unread,$ungraded,$bombed,$triggered,$newdiscussions,$tograde,$bombs,$warnings,$rowColor1,$rowColor2,$threshold,$cdom,$crs,$res_title) = @_;
     my $navmap = Apache::lonnavmaps::navmap->new();
-    my @allres=$navmap->retrieveResources();
+    # force retrieve Resource to seed the part id cache we'll need it later
+    my @allres=$navmap->retrieveResources(undef,sub {if ($_[0]->is_problem) { $_[0]->parts();} return 1;});
     my %discussiontime = &Apache::lonnet::dump('discussiontimes',$cdom,$crs);
     my %lastread = &Apache::lonnet::dump('nohist_'.$env{'request.course.id'}.
                 '_discuss',$env{'user.domain'},$env{'user.name'},'lastread');
@@ -561,41 +565,42 @@ sub getitems {
         if ($resource->is_problem()) {
             my $ctr = 0;
             my ($map,$ind,$url)=&Apache::lonnet::decode_symb($symb);
-            my ($partlist,$handgrade,$responseType) = 
-		&Apache::grades::response_type($url,$symb);
+	    my $partlist=$resource->parts();
 	    my $handgradeable;
-	    foreach my $value (values(%{$handgrade})) {
-		if ($value eq 'yes') { $handgradeable=1; last; }
+	    foreach my $part (@$partlist) {
+		if ($resource->handgrade($part) eq 'yes') {
+		    $handgradeable=1; last;
+		}
+	    }
+	    if ($handgradeable) {
+		foreach my $student (keys(%$classlist)) {
+		    my ($uname,$udom) = split(/:/,$student);
+		    my %status=&Apache::grades::student_gradeStatus($url,$symb,$udom,$uname,$partlist);
+		    my $submitted = 0;
+		    my $ungraded = 0;
+		    foreach (keys(%status)) {
+			$submitted = 1 if ($status{$_} ne 'nothing');
+			$ungraded = 1 if ($status{$_} =~ /^ungraded/);
+			my ($foo,$partid,$foo1) = split(/\./,$_);
+			if ($status{'resource.'.$partid.'.submitted_by'} ne '') {
+			    $submitted = 0;
+			}
+		    }
+		    next if (!$submitted || !$ungraded);
+		    $ctr ++;
+		}
+		if ($ctr) {
+		    $$ungraded{$symb}{count} = $ctr;
+		    $$ungraded{$symb}{title} = $title;
+		    push(@{$tograde}, $symb);
+		}
 	    }
-	    next if (!$handgradeable);
- 
-            foreach my $student (keys(%$classlist)) {
-                my ($uname,$udom) = split(/:/,$student);
-                my %status=&Apache::grades::student_gradeStatus($url,$symb,$udom,$uname,$partlist);
-                my $submitted = 0;
-                my $ungraded = 0;
-                foreach (keys(%status)) {
-                    $submitted = 1 if ($status{$_} ne 'nothing');
-                    $ungraded = 1 if ($status{$_} =~ /^ungraded/);
-                    my ($foo,$partid,$foo1) = split(/\./,$_);
-                    if ($status{'resource.'.$partid.'.submitted_by'} ne '') {
-                        $submitted = 0;
-                    }
-                }
-                next if (!$submitted || !$ungraded);
-                $ctr ++;
-            }
-            if ($ctr) {
-                $$ungraded{$symb}{count} = $ctr;
-                $$ungraded{$symb}{title} = $title;
-                push(@{$tograde}, $symb);
-            }
         }
 
 # Check for bombs
         if ($resource->getErrors()) {
             my $errors = $resource->getErrors();
-            $errors =~ s/^,//;
+	    $errors =~ s/^,//;
             my @bombs = split(/,/, $errors);
             my $errorcount = scalar(@bombs);
             my $errorlink = '<a href="/adm/email?display='.