';
return $Str;
}
@@ -472,6 +490,7 @@ my @OutputDataOptions =
grand_maximum => 1,
summary_table => 1,
maximum_row => 1,
+ ignore_weight => 0,
shortdesc => 'Total Score and Maximum Possible for each '.
'Sequence or Folder',
longdesc => 'The score of each student as well as the '.
@@ -490,6 +509,7 @@ my @OutputDataOptions =
grand_maximum => 1,
summary_table => 1,
maximum_row => 1,
+ ignore_weight => 0,
shortdesc => 'Score on each Problem Part',
longdesc =>'The students score on each problem part, computed as'.
'the part weight * part awarded',
@@ -507,6 +527,7 @@ my @OutputDataOptions =
grand_maximum => 0,
summary_table => 0,
maximum_row => 0,
+ ignore_weight => 0,
shortdesc => 'Number of Tries before success on each Problem Part',
longdesc =>'The number of tries before success on each problem part.',
non_html_notes => 'negative values indicate an incorrect problem',
@@ -524,6 +545,7 @@ my @OutputDataOptions =
grand_maximum => 1,
summary_table => 1,
maximum_row => 0,
+ ignore_weight => 1,
shortdesc => 'Number of Problem Parts completed successfully.',
longdesc => 'The Number of Problem Parts completed successfully and '.
'the maximum possible for each student',
@@ -622,17 +644,21 @@ Return a line of the chart for a student
my @sequences;
my $navmap; # Have to keep this around since weakref is a bit zealous
+sub html_cleanup {
+ undef(%prog_state);
+ undef(%width);
+ #
+ undef($navmap);
+ undef(@sequences);
+}
+
sub html_initialize {
my ($r) = @_;
#
$padding = ' 'x3;
$count = 0;
$nodata_count = 0;
- undef(%prog_state);
- undef(%width);
- #
- undef($navmap);
- undef(@sequences);
+ &html_cleanup();
($navmap,@sequences) =
&Apache::lonstatistics::selected_sequences_with_assessments();
if (! ref($navmap)) {
@@ -641,12 +667,25 @@ sub html_initialize {
&mt('Unable to retrieve course information.').
'');
}
+
+ # If we're showing links, show a checkbox to open in new
+ # windows.
+ if ($show_links ne 'no') {
+ my $labeltext = &mt('Show links in new window:');
+ $r->print(<new_window = true;
+
+NEW_WINDOW_CHECKBOX
+ }
+
#
$r->print("
");
#
if ($chosen_output->{'base'} !~ /^final table/) {
- $r->print("
".$chosen_output->{'shortdesc'}."
");
+ $r->print("
".&mt($chosen_output->{'shortdesc'})."
");
}
my $Str = "
\n";
# First, the @StudentData fields need to be listed
@@ -674,8 +713,8 @@ sub html_initialize {
$width{$symb}->{'width_sum'} += 1;
}
$total_count += &count_parts($navmap,$seq);
- # Use 3 digits for the sum
- $width{$symb}->{'width_sum'} += 3;
+ # Use 6 digits for the sum
+ $width{$symb}->{'width_sum'} += 6;
}
# Compute width of maximum
if ($chosen_output->{'sequence_max'}) {
@@ -683,8 +722,8 @@ sub html_initialize {
# One digit for the '/'
$width{$symb}->{'width_sum'} +=1;
}
- # Use 3 digits for the total
- $width{$symb}->{'width_sum'}+=3;
+ # Use 6 digits for the total
+ $width{$symb}->{'width_sum'}+=6;
}
#
if ($chosen_output->{'every_problem'}) {
@@ -710,6 +749,58 @@ 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 currentElement;
+function popup_score(element, score) {
+ popdown_score();
+ var left = getLeftOffset(element);
+ var top = getTopOffset(element);
+ var div = document.createElement("div");
+ div.className = "LC_chrt_popup";
+ 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]);
+ element.className = "LC_chrt_popup_up";
+ currentElement = element;
+}
+
+function popdown_score() {
+ if (currentDiv) {
+ document.body.removeChild(currentDiv);
+ }
+ if (currentElement) {
+ currentElement.className = 'LC_chrt_popup_exists';
+ }
+ currentDiv = undefined;
+}
+
+JS
+
#
# Let the user know what we are doing
my $studentcount = scalar(@Apache::lonstatistics::Students);
@@ -753,12 +844,20 @@ sub html_outputstudent {
my @tmp = &Apache::loncoursedata::get_current_state
($student->{'username'},$student->{'domain'},undef,
$env{'request.course.id'});
- if ((scalar @tmp > 0) && ($tmp[0] !~ /^error:/)) {
+ if ((scalar @tmp > 0) && ($tmp[0] !~ /^error:(.*)/)) {
%StudentsData = @tmp;
- }
- if (scalar(@tmp) < 1) {
+ } else {
+ my $error = $1;
+ if (scalar(@tmp) < 1) {
+ $Str .= ''
+ .&mt('No Course Data')
+ .''."\n";
+ } else {
+ $Str .= ''
+ .&mt('Error getting student data ([_1])',$error)
+ .''."\n";
+ }
$nodata_count++;
- $Str .= 'No Course Data'."\n";
$r->print($Str);
$r->rflush();
return;
@@ -777,7 +876,8 @@ 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'} &&
@@ -785,16 +885,17 @@ sub html_outputstudent {
$ratio .= ' ';
}
if ($chosen_output->{'sequence_sum'} && $score ne ' ') {
- my $score .= sprintf("%3.0f",$score);
- $ratio .= (' 'x(3-length($score))).$score;
+ my $score .= sprintf("%3.2f",$score);
+ $ratio .= (' 'x(6-length($score))).$score;
} elsif($chosen_output->{'sequence_sum'}) {
- $ratio .= ' 'x3;
+ $ratio .= ' 'x6;
}
if ($chosen_output->{'sequence_max'}) {
if ($chosen_output->{'sequence_sum'}) {
$ratio .= '/';
}
- $ratio .= sprintf("%3.0f",$seq_max);
+ my $sequence_total=sprintf("%3.2f",$seq_max);
+ $ratio .= $sequence_total.(' 'x(6-length($sequence_total)));
}
#
if (! $chosen_output->{'every_problem'}) {
@@ -828,8 +929,8 @@ sub html_outputstudent {
if (! defined($score)) {
$score = ' ' x $total_sum_width;
} else {
- $score = sprintf("%.0f",$score);
- $score = (' 'x(3-length($score))).$score;
+ $score = sprintf("%.2f",$score);
+ $score = (' 'x(6-length($score))).$score;
}
$Str .= ' '.' 'x($total_sum_width-length($score)).$score.' / '.$max;
$Str .= " \n";
@@ -856,18 +957,18 @@ sub html_finish {
}
$r->rflush();
&Apache::lonhtmlcommon::Close_PrgWin($r,\%prog_state);
- undef($navmap);
+ &html_cleanup();
return;
}
sub StudentAverageTotal {
my $Str = '