--- loncom/interface/lontrackstudent.pm 2006/05/30 12:46:09 1.20 +++ loncom/interface/lontrackstudent.pm 2007/02/12 23:58:42 1.22 @@ -1,6 +1,6 @@ # The LearningOnline Network with CAPA # -# $Id: lontrackstudent.pm,v 1.20 2006/05/30 12:46:09 www 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 @@ sub get_data { &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('
'); + } + $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 @@ sub output_results { if (! -s $results_file) { # results file is empty, just let them know there is no data $r->print('

'.&mt('So far, no data has been returned for your request').'

'); - return; + return -1; } if (! open(ACTIVITYDATA,$results_file)) { $r->print('

'.&mt('Unable to read results file.').'

'. @@ -248,7 +257,7 @@ sub output_results { 'You should contact your system administrator '. 'to resolve this issue.'). '

'); - return; + return -2; } ## ## @@ -370,7 +379,7 @@ sub output_results { } $r->print(''.$/);### if (! $count % 50); close(ACTIVITYDATA); - return; + return $count; } ################################################################### @@ -537,9 +546,10 @@ sub handler { # For now, just show all the data, in the future allow selection of # a student my ($sname,$sdom) = split(':',$env{'form.selected_student'}); - if ($sname =~ /^\w*$/ && $sdom =~ /^\w*$/) { + if ($sname =~ /^$LONCAPA::username_re$/ + && $sdom =~ /^$LONCAPA::domain_re$/) { $r->print('

'. - &mt('Recent activity of [_1]@[_2]',$sname,$sdom). + &mt('Recent activity of [_1]:[_2]',$sname,$sdom). '

'); $r->print('

'.&mt(<'); Compiling student activity data can take a long time. @@ -548,7 +558,7 @@ END &get_data($r,\%prog_state,$navmap, 'student:'.$env{'form.selected_student'}); } else { - $r->print('

'.&mt('Unable to process for [_1]@[_2]', + $r->print('

'.&mt('Unable to process for [_1]:[_2]', $sname,$sdom).'

'); } } else {