".$ENV{'course.'.$ENV{'request.course.id'}.'.description'}.
+ $r->print("".$env{'course.'.$env{'request.course.id'}.'.description'}.
" ".localtime(time)."
");
#
if ($chosen_output->{'base'} !~ /^final table/) {
@@ -642,14 +682,6 @@ sub html_initialize {
#
# Compute the column widths and output the sequence titles
my $total_count;
- ($navmap,@sequences) =
- &Apache::lonstatistics::sequences_with_assessments();
- if (! ref($navmap)) {
- # Unable to get data, so bail out
- $r->print("".
- &mt('Unable to retrieve course information.').
- '
');
- }
#
# Compute sequence widths
my $starttime = Time::HiRes::time;
@@ -663,7 +695,7 @@ sub html_initialize {
# Use 1 digit for a space
$width{$symb}->{'width_sum'} += 1;
}
- $total_count += $width{$symb}->{'num_assess_parts'};
+ $total_count += &count_parts($navmap,$seq);
# Use 3 digits for the sum
$width{$symb}->{'width_sum'} += 3;
}
@@ -679,18 +711,8 @@ sub html_initialize {
#
if ($chosen_output->{'every_problem'}) {
# one problem per digit
- $width{$symb}->{'width_parts'}=0;
- $starttime = Time::HiRes::time;
- my @resources =
- $navmap->retrieveResources($seq,sub { shift->is_problem(); },
- 0,0,0);
- $starttime = Time::HiRes::time;
- foreach my $res (@resources) {
- my @parts = $res->parts;
- $width{$symb}->{'width_parts'} += scalar(@parts);
- }
- &Apache::lonnet::logthis('2elapsed:'.(Time::HiRes::time-$starttime)); $width{$symb}->{'width_problem'} +=
- $width{$symb}->{'width_parts'};
+ $width{$symb}->{'width_parts'}= &count_parts($navmap,$seq);
+ $width{$symb}->{'width_problem'} += $width{$symb}->{'width_parts'};
} else {
$width{$symb}->{'width_problem'} = 0;
}
@@ -710,6 +732,76 @@ sub html_initialize {
$Str .= "";
$r->print($Str);
$r->rflush();
+
+ $r->print(<
+// get the left offset of a given widget as an absolute position
+function getLeftOffset (element) {
+ return collect(element, "offsetLeft");
+}
+
+// get the top offset of a given widget as an absolute position
+function getTopOffset (element) {
+ return collect(element, "offsetTop");
+}
+
+function collect(element, att) {
+ var val = 0;
+ while(element) {
+ val += element[att];
+ element = element.offsetParent;
+ }
+ return val;
+}
+
+var currentDiv;
+var oldBorder;
+var currentElement;
+function popup_score(element, score) {
+ popdown_score();
+ var left = getLeftOffset(element);
+ var top = getTopOffset(element);
+ var div = document.createElement("div");
+ div.style.border = "1px solid #8888FF";
+ div.style.backgroundColor = "#CCCCFF";
+ div.appendChild(document.createTextNode(score));
+ div.style.position = "absolute";
+ div.style.top = (top - 25) + "px";
+ div.style.left = (left - 10) + "px";
+ currentDiv = div;
+ document.body.insertBefore(div, document.body.childNodes[0]);
+ oldBorder = element.style.border;
+ element.style.border = "1px solid yellow";
+ currentElement = element;
+}
+
+function popdown_score() {
+ if (currentDiv) {
+ document.body.removeChild(currentDiv);
+ }
+ if (currentElement) {
+ currentElement.style.border = oldBorder;
+ }
+ currentDiv = undefined;
+}
+
+JS
+
+ #
+ # Let the user know what we are doing
+ my $studentcount = scalar(@Apache::lonstatistics::Students);
+ if ($env{'form.SelectedStudent'}) {
+ $studentcount = '1';
+ }
+ #
+ # Initialize progress window
+ %prog_state=&Apache::lonhtmlcommon::Create_PrgWin
+ ($r,'HTML Chart Status',
+ 'HTML Chart Progress', $studentcount,
+ 'inline',undef,'Statistics','stats_status');
+ #
+ &Apache::lonhtmlcommon::Update_PrgWin($r,\%prog_state,
+ 'Processing first student');
return;
}
@@ -737,7 +829,7 @@ sub html_outputstudent {
my %StudentsData;
my @tmp = &Apache::loncoursedata::get_current_state
($student->{'username'},$student->{'domain'},undef,
- $ENV{'request.course.id'});
+ $env{'request.course.id'});
if ((scalar @tmp > 0) && ($tmp[0] !~ /^error:/)) {
%StudentsData = @tmp;
}
@@ -753,7 +845,7 @@ sub html_outputstudent {
my $studentstats;
my $PerformanceStr = '';
foreach my $seq (@sequences) {
- &Apache::lonnet::logthis('computing student data for '.$seq->compTitle);
+ my $symb = $seq->symb;
my ($performance,$performance_length,$score,$seq_max,$rawdata);
if ($chosen_output->{'tries'}) {
($performance,$performance_length,$score,$seq_max,$rawdata) =
@@ -762,14 +854,17 @@ sub html_outputstudent {
} else {
($performance,$performance_length,$score,$seq_max,$rawdata) =
&student_performance_on_sequence($student,\%StudentsData,
- $navmap,$seq,$show_links);
+ $navmap,$seq,$show_links,
+ $chosen_output->{ignore_weight});
}
my $ratio='';
- if ($chosen_output->{'every_problem'}) {
+ if ($chosen_output->{'every_problem'} &&
+ $chosen_output->{'sequence_sum'}) {
$ratio .= ' ';
}
if ($chosen_output->{'sequence_sum'} && $score ne ' ') {
- $ratio .= sprintf("%3.0f",$score);
+ my $score .= sprintf("%3.0f",$score);
+ $ratio .= (' 'x(3-length($score))).$score;
} elsif($chosen_output->{'sequence_sum'}) {
$ratio .= ' 'x3;
}
@@ -784,15 +879,15 @@ sub html_outputstudent {
$performance = '';
$performance_length=0;
}
- $performance .= ' 'x($width{$seq->symb}->{'width_total'} -
+ $performance .= ' 'x($width{$symb}->{'width_total'} -
$performance_length -
- $width{$seq->symb}->{'width_sum'}).
+ $width{$symb}->{'width_sum'}).
$ratio;
#
$Str .= $performance.$padding;
#
- $studentstats->{$seq->symb}->{'score'}= $score;
- $studentstats->{$seq->symb}->{'max'} = $seq_max;
+ $studentstats->{$symb}->{'score'}= $score;
+ $studentstats->{$symb}->{'max'} = $seq_max;
}
#
# Total it up and store the statistics info.
@@ -812,6 +907,7 @@ sub html_outputstudent {
$score = ' ' x $total_sum_width;
} else {
$score = sprintf("%.0f",$score);
+ $score = (' 'x(3-length($score))).$score;
}
$Str .= ' '.' 'x($total_sum_width-length($score)).$score.' / '.$max;
$Str .= " \n";
@@ -819,6 +915,7 @@ sub html_outputstudent {
$r->print($Str);
#
$r->rflush();
+ &Apache::lonhtmlcommon::Increment_PrgWin($r,\%prog_state,'last student');
return;
}
@@ -836,7 +933,8 @@ sub html_finish {
}
}
$r->rflush();
- undef($navmap);
+ &Apache::lonhtmlcommon::Close_PrgWin($r,\%prog_state);
+ &html_cleanup();
return;
}
@@ -870,6 +968,7 @@ sub StudentAverageTotal {
}
sub SingleStudentTotal {
+ return if (! defined($navmap));
my $student = &Apache::lonstatistics::current_student();
my $Str = ''.&mt('Summary table for [_1] ([_2]@[_3])',
$student->{'fullname'},
@@ -887,7 +986,7 @@ sub SingleStudentTotal {
$Str .= ''.&mt('Maximum').' | '."