--- loncom/interface/statistics/lonstathelpers.pm 2004/12/07 16:04:06 1.34
+++ loncom/interface/statistics/lonstathelpers.pm 2005/02/23 23:51:18 1.39
@@ -1,6 +1,6 @@
# The LearningOnline Network with CAPA
#
-# $Id: lonstathelpers.pm,v 1.34 2004/12/07 16:04:06 matthew Exp $
+# $Id: lonstathelpers.pm,v 1.39 2005/02/23 23:51:18 matthew Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -282,16 +282,6 @@ END
return $Str;
}
-sub get_title {
- my ($title,$src) = @_;
- if ($title eq '') {
- ($title) = ($src =~ m|/([^/]+)$|);
- } else {
- $title =~ s/\:/:/g;
- }
- return $title;
-}
-
sub new_accumulator {
my ($title,$src,$symb,$seq_id,$inputname) = @_;
my $target;
@@ -311,7 +301,7 @@ sub new_accumulator {
' '.$res->compTitle.''.
(' 'x2).'src.'?symb='.
- &Apache::lonnet::escape($res->{'symb'}).'">view'.
+ &Apache::lonnet::escape($res->symb).'">view'.
''.$/;
} else {
if (defined($target)) {
@@ -1341,9 +1331,7 @@ sub manage_caches {
if (defined($update_message)) {
$r->print($update_message);
}
- &Apache::lonstatistics::Gather_Full_Student_Data($r,$formname,
- $inputname);
-
+ &gather_full_student_data($r,$formname,$inputname);
}
#
my @Buttons =
@@ -1365,8 +1353,90 @@ sub manage_caches {
return @Buttons;
}
+sub gather_full_student_data {
+ my ($r,$formname,$inputname) = @_;
+ my $status_type;
+ if (defined($formname)) {
+ $status_type = 'inline';
+ } else {
+ $status_type = 'popup';
+ }
+ my $c = $r->connection();
+ #
+ &Apache::loncoursedata::clear_internal_caches();
+ #
+ my @Students = @Apache::lonstatistics::Students;
+ #
+ # Open the progress window
+ my %prog_state=&Apache::lonhtmlcommon::Create_PrgWin
+ ($r,&mt('Student Data Compilation Status'),
+ &mt('Student Data Compilation Progress'), scalar(@Students),
+ $status_type,undef,$formname,$inputname);
+ #
+ while (my $student = shift @Students) {
+ return if ($c->aborted());
+ my $status = &Apache::loncoursedata::ensure_current_full_data
+ ($student->{'username'},$student->{'domain'},
+ $ENV{'request.course.id'});
+ &Apache::lonhtmlcommon::Increment_PrgWin($r,\%prog_state,
+ &mt('last student'));
+ }
+ &Apache::lonhtmlcommon::Close_PrgWin($r,\%prog_state);
+ $r->rflush();
+ return;
+}
+
+####################################################
+####################################################
+
+=pod
+=item &submission_report_form
+Input: The originating reportSelected value for the current stats page.
+
+Output: Scalar containing HTML with needed form elements and a link to
+the student submission reports page.
+
+=cut
+
+####################################################
+####################################################
+sub submission_report_form {
+ my ($original_report) = @_;
+ # Note: In the link below we change the reportSelected value. If
+ # the user hits the 'back' button on the browser after getting their
+ # student submissions report, this value may still be around. So we
+ # output a script block to set it properly. If the $original_report
+ # value is unset, you are just asking for trouble.
+ if (! defined($original_report)) {
+ &Apache::lonnet::logthis
+ ('someone called lonstathelpers::submission_report_form without '.
+ ' enough input.');
+ }
+ my $html = $/.
+ ''.
+ ''.
+ ''.
+ '';
+ my $output_selector = $/.''.$/;
+ my $link = '';
+ $html.= &mt('View data as [_1] [_2]go[_3]',$output_selector,
+ $link,'').$/;
+ return $html
+}
####################################################
####################################################