[LON-CAPA-cvs] cvs: loncom /interface/statistics lonsurveyreports.pm
bisitz
lon-capa-cvs-allow@mail.lon-capa.org
Tue, 14 Oct 2008 14:10:49 -0000
This is a MIME encoded message
--bisitz1223993449
Content-Type: text/plain
bisitz Tue Oct 14 10:10:49 2008 EDT
Modified files:
/loncom/interface/statistics lonsurveyreports.pm
Log:
Optimized survey reports:
- Optimized view link
- Added missing &mt() calls
- Added standard warning style to warning messages
- Use LON-CAPA standard table style for HTML survey report (further optimizations possible)
- Set status text box to readonly
--bisitz1223993449
Content-Type: text/plain
Content-Disposition: attachment; filename="bisitz-20081014101049.txt"
Index: loncom/interface/statistics/lonsurveyreports.pm
diff -u loncom/interface/statistics/lonsurveyreports.pm:1.16 loncom/interface/statistics/lonsurveyreports.pm:1.17
--- loncom/interface/statistics/lonsurveyreports.pm:1.16 Sun Sep 14 11:16:30 2008
+++ loncom/interface/statistics/lonsurveyreports.pm Tue Oct 14 10:10:49 2008
@@ -1,6 +1,6 @@
# The LearningOnline Network with CAPA
#
-# $Id: lonsurveyreports.pm,v 1.16 2008/09/14 15:16:30 raeburn Exp $
+# $Id: lonsurveyreports.pm,v 1.17 2008/10/14 14:10:49 bisitz Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -73,7 +73,7 @@
my @Students = @Apache::lonstatistics::Students;
#
if (@Students < 1) {
- $r->print('<h2>There are no students in the sections selected</h2>');
+ $r->print('<p class="LC_warning">'.&mt('There are no students in the sections selected.').'</p>');
}
#
my @CacheButtonHTML =
@@ -182,9 +182,9 @@
}
}
if (! scalar(@SurveyProblems)) {
- $Str = '<h1>'.
- &mt('There are no survey problems in this course').
- '</h1>'.$/;
+ $Str = '<p class="LC_warning">'.
+ &mt('There are no survey problems in this course.').
+ '</p>'.$/;
return $Str;
}
$Str .= '<table>'.$/;
@@ -209,9 +209,9 @@
'<input type="radio" name="problemchoice" id="'.$id.'" '.
'value="'.$value.'" '.$checked.'/>'.'</td>'.
'<td><nobr>'.
- '<label for="'.$id.'">'.$problem->{'res'}->compTitle.'('.$problem->{'seq'}->compTitle.')'.'</label>'.
+ '<label for="'.$id.'">'.$problem->{'res'}->compTitle.' ('.$problem->{'seq'}->compTitle.')'.'</label>'.
(' 'x2).
- qq{<a target="preview" href="$link">view</a>}.'</td></tr>'.$/;
+ '<a target="preview" href="'.$link.'">'.&mt('View survey').'</a>'.'</td></tr>'.$/;
}
$Str .= '</table>';
return $Str;
@@ -326,16 +326,17 @@
}
close($file);
if($something_has_been_output) {
- $r->print('<p><a href="'.$filename.'">'.
- &mt('Your text file.').
+ $r->print('<p class="LC_info"><a href="'.$filename.'">'.
+ &mt('Your text file').
'</a></p>'."\n");
$r->print('<script>'.
'window.document.Statistics.stats_status.value="'.
- &mt('Done compiling text file. See link below to download.').
+ &mt('Done compiling text file. See link below to download.').
'";</script>');
} else {
- $r->print('<h2>'.
- &mt("There is no essay or string response data to output for this survey.").'</h2>');
+ $r->print('<p class="LC_warning">'
+ .&mt('There is no essay or string response data to output for this survey.')
+ .'</h2>');
}
$r->rflush();
return;
@@ -386,8 +387,8 @@
my $warned_about_size = 0;
foreach my $data (@{$data->{'responses'}}) {
if (length($data) > 255 && ! $warned_about_size) {
- $r->print('<p>'.
- &mt('[_1]:[_2] responses to [_3] may be too long to fit Excel spreadsheet.',
+ $r->print('<p class="LC_warning">'.
+ &mt('[_1]:[_2] responses to [_3] may be too long to fit Excel spreadsheet.',
$resource->compTitle,
$resource->part_display($partid),
$respid).
@@ -447,12 +448,12 @@
} #response ids
} # partids
$workbook->close();
- $r->print('<p><a href="'.$filename.'">'.
+ $r->print('<p class="LC_info"><a href="'.$filename.'">'.
&mt('Your Excel spreadsheet.').
'</a></p>'."\n");
$r->print('<script>'.
'window.document.Statistics.stats_status.value="'.
- &mt('Done compiling spreadsheet. See link below to download.').
+ &mt('Done compiling spreadsheet. See link below to download.').
'";</script>');
$r->rflush();
return;
@@ -506,14 +507,17 @@
}
} elsif (exists($data->{'foil_count'}) &&
exists($data->{'foil_responses'})) {
- $Str.='<tr><td colspan="3">'.
- '<table><tr>';
+ $Str.='<tr>'
+ .'<td colspan="3">'
+ .&Apache::loncommon::start_data_table()
+ .&Apache::loncommon::start_data_table_header_row();
my $tmp = '<th>'.join('</th><th>',
(&mt('Foil Name'),
&mt('Foil Text'),
&mt('Option'),
&mt('Frequency'),
- &mt('Percent'))).'</th></tr>';
+ &mt('Percent'))).'</th>'
+ .&Apache::loncommon::end_data_table_header_row();
my @foils = sort(keys(%{$ProblemData->{$partid.'.'.$respid}->{'_Foils'}}));
foreach my $foilid (@foils) {
my $prob_data = $ProblemData->{$partid.'.'.$respid};
@@ -521,7 +525,7 @@
my $foiltext = $prob_data->{'_Foils'}->{$foilid}->{'text'};
my $foilname = $prob_data->{'_Foils'}->{$foilid}->{'name'};
my $rowspan = scalar(@{$prob_data->{'_Options'}});
- my $preamble = '<tr>'.
+ my $preamble = &Apache::loncommon::start_data_table_row().
'<td valign="top" rowspan="'.$rowspan.'">'.
$foilname.'</td>'.
'<td valign="top" rowspan="'.$rowspan.'">'.
@@ -534,11 +538,12 @@
'<td align="right">'.$count.'</td>'.
'<td align="right">'.
sprintf('%.2f',100*$count/$foil_count).'%'.
- '</td></tr>'.$/;
- $preamble = '<tr>';
+ '</td>'.&Apache::loncommon::end_data_table_row().$/;
+ $preamble = &Apache::loncommon::continue_data_table_row(); #&Apache::loncommon::start_data_table_row();
}
}
- $Str.=$tmp.'</table></td></tr>';
+ $Str.=$tmp.&Apache::loncommon::end_data_table()
+ .'</td></tr>';
} elsif (exists($data->{'_count'}) &&
exists($data->{'foil_values'}) &&
exists($data->{'map'})) {
@@ -553,23 +558,23 @@
my $count = $data->{'foil_values'}->{$value};
my $foiltext = $ProblemData->{$partid.'.'.$respid}->{'_Foils'}->{$foilid}->{'text'};
my $foilname = $ProblemData->{$partid.'.'.$respid}->{'_Foils'}->{$foilid}->{'name'};
- $tmp .= '<tr>'.
+ $tmp .= &Apache::loncommon::start_data_table_row().
'<td>'.$foilname.'</td>'.
'<td>'.$foiltext.'</td>'.
'<td align="right">'.$count.'</td>'.
'<td align="right">'.
sprintf("%.2f",$count/$total*100).'%</td>'.
- '</tr>'.$/;
+ &Apache::loncommon::end_data_table_row().$/;
}
- $Str .= '<tr>'.
+ $Str .= &Apache::loncommon::start_data_table_row().
'<th>'.&mt('Foil Name').'</th>'.
'<th>'.&mt('Text').'</th>'.
'<th>'.&mt('Freq').'</th>'.
'<th>'.&mt('Percent').'</th>'.
- '</tr>'.$/.
+ &Apache::loncommon::end_data_table_row().$/.
$tmp;
}
- $Str.= '</table><hr />';
+ $Str.= &Apache::loncommon::end_data_table().'<hr />';
$r->print($Str);
$r->rflush();
}
@@ -655,7 +660,7 @@
#
$Str .= '<nobr>'.&mt('Status: [_1]',
'<input type="text" '.
- 'name="stats_status" size="60" value="" />').
+ 'name="stats_status" size="60" value="" readonly="readonly" />').
'</nobr>'.'</p>';
##
return $Str;
--bisitz1223993449--