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

albertel lon-capa-cvs@mail.lon-capa.org
Mon, 12 Feb 2007 23:58:42 -0000


albertel		Mon Feb 12 18:58:42 2007 EDT

  Modified files:              
    /loncom/interface	lontrackstudent.pm 
  Log:
  - now shows one link to do a page reload, and the current link 'show next set of results' only shows up if it is needed (there are more results to see)
  
  
Index: loncom/interface/lontrackstudent.pm
diff -u loncom/interface/lontrackstudent.pm:1.21 loncom/interface/lontrackstudent.pm:1.22
--- loncom/interface/lontrackstudent.pm:1.21	Wed Dec  6 17:22:37 2006
+++ loncom/interface/lontrackstudent.pm	Mon Feb 12 18:58:42 2007
@@ -1,6 +1,6 @@
 # The LearningOnline Network with CAPA
 #
-# $Id: lontrackstudent.pm,v 1.21 2006/12/06 22:22:37 albertel Exp $
+# $Id: lontrackstudent.pm,v 1.22 2007/02/12 23:58:42 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -110,12 +110,21 @@
     &Apache::lonhtmlcommon::Update_PrgWin
         ($r,$prog_state,&mt('Parsing results'));
     #
-    &output_results($r,$results_file,$navmap,$mode);
+    my $last = &output_results($r,$results_file,$navmap,$mode);
     my ($sname,$sdom) = ($mode=~/^student:(.*):(.*)$/);
-    $r->print(&Apache::loncommon::track_student_link(
-				  'View more activity by this student',
-				  $sname,$sdom,undef,
-				  ($env{'form.start'}+$num_records)));
+    
+    my ($text,$inc);
+    if ( $last > 0 && (($last+1) >= $env{'form.start'}+$num_records) ) {
+	$text = 'View more activity by this student';
+	$inc  = $num_records;
+	$r->print(&Apache::loncommon::track_student_link($text,$sname,$sdom,undef,
+							 ($env{'form.start'}+$inc)
+							 ));
+	$r->print('<br />');
+    }
+    $text = 'Resubmit last request to check for newer data';
+    $r->print(&Apache::loncommon::track_student_link($text,$sname,$sdom,undef,
+						     $env{'form.start'}));
 
     &Apache::lonhtmlcommon::Update_PrgWin($r,$prog_state,&mt('Finished!'));
     return;
@@ -239,7 +248,7 @@
     if (! -s $results_file) {
         # results file is empty, just let them know there is no data
         $r->print('<h2>'.&mt('So far, no data has been returned for your request').'</h2>');
-        return;
+        return -1;
     }
     if (! open(ACTIVITYDATA,$results_file)) {
         $r->print('<h2>'.&mt('Unable to read results file.').'</h2>'.
@@ -248,7 +257,7 @@
                       'You should contact your system administrator '.
                       'to resolve this issue.').
                   '</p>');
-        return;
+        return -2;
     }
     ##
     ##
@@ -370,7 +379,7 @@
     }
     $r->print('</table>'.$/);### if (! $count % 50);
     close(ACTIVITYDATA);
-    return;
+    return $count;
 }
 
 ###################################################################