[LON-CAPA-cvs] cvs: loncom /interface lonfeedback.pm lonnavmaps.pm

www lon-capa-cvs@mail.lon-capa.org
Mon, 10 Apr 2006 21:55:50 -0000


www		Mon Apr 10 17:55:50 2006 EDT

  Modified files:              
    /loncom/interface	lonfeedback.pm lonnavmaps.pm 
  Log:
  Bug #4718: really show first resource
  
  
Index: loncom/interface/lonfeedback.pm
diff -u loncom/interface/lonfeedback.pm:1.189 loncom/interface/lonfeedback.pm:1.190
--- loncom/interface/lonfeedback.pm:1.189	Mon Apr 10 15:59:53 2006
+++ loncom/interface/lonfeedback.pm	Mon Apr 10 17:55:48 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Feedback
 #
-# $Id: lonfeedback.pm,v 1.189 2006/04/10 19:59:53 albertel Exp $
+# $Id: lonfeedback.pm,v 1.190 2006/04/10 21:55:48 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -744,17 +744,22 @@
 	    }
 	}
     } else {
+	$discussion.='<table bgcolor="#BBBBBB"><tr><td>';
         if (&discussion_open($status) &&
             &Apache::lonnet::allowed('pch',
     	        $env{'request.course.id'}.
 	        ($env{'request.course.sec'}?'/'.$env{'request.course.sec'}:''))) {
 	    if ($outputtarget ne 'tex') {
-		$discussion.='<table bgcolor="#BBBBBB"><tr><td><a href="/adm/feedback?replydisc='.
+		$discussion.='<a href="/adm/feedback?replydisc='.
 		    &Apache::lonnet::escape($ressymb).':::" '.$target.'>'.
 		    '<img src="'.&Apache::loncommon::lonhttpdurl('/adm/lonMisc/chat.gif').'" border="0" />'.
-		    &mt('Post Discussion').'</a></td></tr></table>';
-	    }
+		    &mt('Post Discussion').'</a><br />';
+            }
 	}
+	$discussion.='<a href="/adm/feedback?sendmessageonly=1&symb='.
+	    &Apache::lonnet::escape($ressymb).
+	    '"><img src="'.&Apache::loncommon::lonhttpdurl('/adm/lonMisc/feedback.gif').'" border="0" />'.
+		    &mt('Send Message').'</td></tr></table>';
     }
     return $discussion;
 }
@@ -2284,7 +2289,7 @@
 		'</label></p>';
 	}
     }
-    if ($env{'request.course.id'}) {
+    if (($env{'request.course.id'}) && (!$env{'form.sendmessageonly'})) {
 	if (&discussion_open(undef,$symb) &&
 	    &Apache::lonnet::allowed('pch',
 				     $env{'request.course.id'}.
@@ -2975,7 +2980,7 @@
 # --------------------------- Get query string for limited number of parameters
 
   &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},
-         ['hide','unhide','deldisc','postdata','preview','replydisc','editdisc','cmd','symb','onlyunread','allposts','onlyunmark','previous','markread','markonread','markondisp','toggoff','toggon','modifydisp','changes','navtime','navmaps','navurl','sortposts','applysort','rolefilter','statusfilter','sectionpick','posterlist','userpick','attach','origpage','currnewattach','deloldattach','keepold','allversions','export']);
+         ['hide','unhide','deldisc','postdata','preview','replydisc','editdisc','cmd','symb','onlyunread','allposts','onlyunmark','previous','markread','markonread','markondisp','toggoff','toggon','modifydisp','changes','navtime','navmaps','navurl','sortposts','applysort','rolefilter','statusfilter','sectionpick','posterlist','userpick','attach','origpage','currnewattach','deloldattach','keepold','allversions','export','sendmessageonly']);
   if ($env{'form.editdisc'}) {
       if (!(&editing_allowed())) {
           my $symb=(split(/\:\:\:/,$env{'form.editdisc'}))[0];
Index: loncom/interface/lonnavmaps.pm
diff -u loncom/interface/lonnavmaps.pm:1.376 loncom/interface/lonnavmaps.pm:1.377
--- loncom/interface/lonnavmaps.pm:1.376	Mon Apr 10 17:40:08 2006
+++ loncom/interface/lonnavmaps.pm	Mon Apr 10 17:55:48 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Navigate Maps Handler
 #
-# $Id: lonnavmaps.pm,v 1.376 2006/04/10 21:40:08 albertel Exp $
+# $Id: lonnavmaps.pm,v 1.377 2006/04/10 21:55:48 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -318,32 +318,38 @@
 		      "Close navigation window");
     } 
 
-    my $jumpToFirstHomework = 0;
+
     # Check to see if the student is jumping to next open, do-able problem
     if ($ENV{QUERY_STRING} =~ /^jumpToFirstHomework/) {
-        $jumpToFirstHomework = 1;
         # Find the next homework problem that they can do.
         my $iterator = $navmap->getIterator(undef, undef, undef, 1);
         my $curRes;
         my $foundDoableProblem = 0;
-        my $problemRes;
+        my $minimumduedate;
         
-        while (($curRes = $iterator->next()) && !$foundDoableProblem) {
+        while ($curRes = $iterator->next()) {
             if (ref($curRes) && $curRes->is_problem()) {
                 my $status = $curRes->status();
                 if ($curRes->completable()) {
-                    $problemRes = $curRes;
+                    my $thisduedate=$curRes->duedate();
+                    unless ($foundDoableProblem) {
+                        $minimumduedate=$thisduedate;
+		    }
+                        
                     $foundDoableProblem = 1;
 
-                    # Pop open all previous maps
-                    my $stack = $iterator->getStack();
-                    pop @$stack; # last resource in the stack is the problem
-                                 # itself, which we don't need in the map stack
-                    my @mapPcs = map {$_->map_pc()} @$stack;
-                    $env{'form.filter'} = join(',', @mapPcs);
-
-                    # Mark as both "here" and "jump"
-                    $env{'form.postsymb'} = $curRes->symb();
+                    if ($thisduedate<=$minimumduedate) {
+			# Pop open all previous maps
+			my $stack = $iterator->getStack();
+			pop @$stack; # last resource in the stack is the problem
+			# itself, which we don't need in the map stack
+			my @mapPcs = map {$_->map_pc()} @$stack;
+			$env{'form.filter'} = join(',', @mapPcs);
+			
+			# Mark as both "here" and "jump"
+			$env{'form.postsymb'} = $curRes->symb();
+                        $minimumduedate=$thisduedate;
+		    }
                 }
             }
         }
@@ -355,7 +361,7 @@
     } else {
 	&add_linkitem(\%toplinkitems,'firsthomework',
 		      'location.href="navmaps?jumpToFirstHomework"',
-		      "Show Me My First Homework Problem");
+		      "Show my first due problem");
     }
 
     my $suppressEmptySequences = 0;
@@ -372,8 +378,8 @@
                         };
 	&add_linkitem(\%toplinkitems,'everything',
 		     'location.href="navmaps?sort='.$env{'form.sort'}.'"',
-		      "Show Everything");
-        $r->print("<p><font size='+2'>".&mt("Uncompleted Homework")."</font></p>");
+		      "Show everything");
+        $r->print("<p><font size='+2'>".&mt("Uncompleted Problems")."</font></p>");
         $env{'form.filter'} = '';
         $env{'form.condition'} = 1;
 	$resource_no_folder_link = 1;
@@ -381,7 +387,7 @@
 	&add_linkitem(\%toplinkitems,'uncompleted',
 		      'location.href="navmaps?sort='.$env{'form.sort'}.
 		          '&showOnlyHomework=1"',
-		      "Show Only Uncompleted Homework");
+		      "Show only uncompleted problems");
     }
 
     my %selected=($env{'form.sort'} => 'selected=on');
@@ -1603,11 +1609,11 @@
         if ($condition) {
 	    $link='"navmaps?condition=0&filter=&'.$queryString.
 		'&here='.&Apache::lonnet::escape($here).'"';
-	    $text='Close All Folders';
+	    $text='Close all folders';
         } else {
 	    $link='"navmaps?condition=1&filter=&'.$queryString.
 		'&here='.&Apache::lonnet::escape($here).'"';
-	    $text='Open All Folders';
+	    $text='Open all folders';
         }
 	if ($args->{'caller'} eq 'navmapsdisplay') {
 	    &add_linkitem($args->{'linkitems'},'changefolder',