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

albertel lon-capa-cvs@mail.lon-capa.org
Thu, 30 Jun 2005 17:56:30 -0000


albertel		Thu Jun 30 13:56:30 2005 EDT

  Modified files:              
    /loncom/interface	loncommon.pm lontrackstudent.pm 
  Log:
  - can now see earlier records in track student
  
  
Index: loncom/interface/loncommon.pm
diff -u loncom/interface/loncommon.pm:1.267 loncom/interface/loncommon.pm:1.268
--- loncom/interface/loncommon.pm:1.267	Mon Jun  6 16:31:24 2005
+++ loncom/interface/loncommon.pm	Thu Jun 30 13:56:28 2005
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # a pile of common routines
 #
-# $Id: loncommon.pm,v 1.267 2005/06/06 20:31:24 www Exp $
+# $Id: loncommon.pm,v 1.268 2005/06/30 17:56:28 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1984,19 +1984,20 @@
 }
 
 sub track_student_link {
-    my ($linktext,$sname,$sdom,$target) = @_;
-    my $link ="/adm/trackstudent";
+    my ($linktext,$sname,$sdom,$target,$start) = @_;
+    my $link ="/adm/trackstudent?";
     my $title = 'View recent activity';
     if (defined($sname) && $sname !~ /^\s*$/ &&
         defined($sdom)  && $sdom  !~ /^\s*$/) {
-        $link .= "?selected_student=$sname:$sdom";
+        $link .= "selected_student=$sname:$sdom";
         $title .= ' of this student';
-    }
+    } 
     if (defined($target) && $target !~ /^\s*$/) {
         $target = qq{target="$target"};
     } else {
         $target = '';
     }
+    if ($start) { $link.='&start='.$start; }
     return qq{<a href="$link" title="$title" $target>$linktext</a>};
 }
 
Index: loncom/interface/lontrackstudent.pm
diff -u loncom/interface/lontrackstudent.pm:1.15 loncom/interface/lontrackstudent.pm:1.16
--- loncom/interface/lontrackstudent.pm:1.15	Thu Apr  7 02:56:23 2005
+++ loncom/interface/lontrackstudent.pm	Thu Jun 30 13:56:28 2005
@@ -1,6 +1,6 @@
 # The LearningOnline Network with CAPA
 #
-# $Id: lontrackstudent.pm,v 1.15 2005/04/07 06:56:23 albertel Exp $
+# $Id: lontrackstudent.pm,v 1.16 2005/06/30 17:56:28 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -49,6 +49,8 @@
 use Apache::lonlocal;
 use Time::HiRes;
 
+my $num_records=500;
+
 sub get_data {
     my ($r,$prog_state,$navmap,$mode) = @_;
     ##
@@ -107,6 +109,12 @@
         ($r,$prog_state,&mt('Parsing results'));
     #
     &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)));
+
     &Apache::lonhtmlcommon::Update_PrgWin($r,$prog_state,&mt('Finished!'));
     return;
 }
@@ -188,6 +196,7 @@
     my $home = $env{'course.'.$cid.'.home'};
     my $course = $env{'course.'.$cid.'.num'};
     my $prefix = $course.'_'.$domain.'_';
+    my $start = ($env{'form.start'}+0);
     #
     my %table = &table_names();
     #
@@ -200,7 +209,7 @@
             LEFT JOIN $table{'student'}  AS C ON C.student_id=A.student_id 
             LEFT JOIN $table{'machine'}  AS E ON E.machine_id=A.machine_id
             ORDER BY A.time DESC
-            LIMIT 500
+            LIMIT $start, $num_records
         };
     } elsif ($mode =~ /^student:(.*):(.*)$/) {
         my $student = $1.':'.$2;
@@ -212,7 +221,7 @@
                 LEFT JOIN $table{'machine'}  AS E ON E.machine_id=A.machine_id
                 WHERE C.student='$student'
                 ORDER BY A.time DESC
-                LIMIT 500
+                LIMIT $start, $num_records
             };
     }
     $query =~ s|$/||g;
@@ -262,7 +271,7 @@
             '<th align="left">'.&mt('Data').'</th>'.
             '</tr>'.$/;
     }
-    my $count = -1;
+    my $count = $env{'form.start'}-1;
     $r->rflush();
     ##
     ##
@@ -336,7 +345,7 @@
 	$values = &display_values($action,$values);
         #
         # Build the row for output
-        my $tablerow = qq{<tr class="$class">};
+        my $tablerow = qq{<tr class="$class"><td>}.($count+1).qq{</td>};
         if ($src =~ m|^/adm/|) {
             $tablerow .= 
                 '<td valign="top"><nobr>'.$title.'</nobr></td>';
@@ -357,7 +366,7 @@
             '</tr>';
         $r->print($tablerow.$/);
     }
-    $r->print('</table>'.$/) if (! $count % 50);
+    $r->print('</table>'.$/);### if (! $count % 50);
     close(ACTIVITYDATA);
     return;
 }
@@ -488,7 +497,7 @@
     #
     # Extract form elements from query string
     &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},
-                                            ['selected_student']);
+                                            ['selected_student','start']);
     #
     # We will almost always need this...
     my $navmap = Apache::lonnavmaps::navmap->new();