Annotation of loncom/interface/statistics/lonstudentassessment.pm, revision 1.158
1.1 stredwic 1: # The LearningOnline Network with CAPA
2: #
1.158 ! bisitz 3: # $Id: lonstudentassessment.pm,v 1.157 2009/09/22 14:28:56 bisitz Exp $
1.1 stredwic 4: #
5: # Copyright Michigan State University Board of Trustees
6: #
7: # This file is part of the LearningOnline Network with CAPA (LON-CAPA).
8: # LON-CAPA is free software; you can redistribute it and/or modify
9: # it under the terms of the GNU General Public License as published by
10: # the Free Software Foundation; either version 2 of the License, or
11: # (at your option) any later version.
12: #
13: # LON-CAPA is distributed in the hope that it will be useful,
14: # but WITHOUT ANY WARRANTY; without even the implied warranty of
15: # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16: # GNU General Public License for more details.
17: #
18: # You should have received a copy of the GNU General Public License
19: # along with LON-CAPA; if not, write to the Free Software
20: # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21: #
22: # /home/httpd/html/adm/gpl.txt
23: #
24: # http://www.lon-capa.org/
25: #
26: # (Navigate problems for statistical reports
1.28 matthew 27: #
28: #######################################################
29: #######################################################
30:
31: =pod
32:
33: =head1 NAME
34:
35: lonstudentassessment
36:
37: =head1 SYNOPSIS
38:
39: Presents assessment data about a student or a group of students.
40:
41: =head1 Subroutines
42:
43: =over 4
44:
45: =cut
46:
47: #######################################################
48: #######################################################
1.1 stredwic 49:
1.21 minaeibi 50: package Apache::lonstudentassessment;
1.1 stredwic 51:
52: use strict;
1.136 albertel 53: use Apache::lonstatistics();
54: use Apache::lonhtmlcommon();
1.77 matthew 55: use Apache::loncommon();
1.1 stredwic 56: use Apache::loncoursedata;
1.28 matthew 57: use Apache::lonnet; # for logging porpoises
1.75 matthew 58: use Apache::lonlocal;
1.136 albertel 59: use Apache::grades();
60: use Apache::lonmsgdisplay();
1.112 matthew 61: use Time::HiRes;
1.31 matthew 62: use Spreadsheet::WriteExcel;
1.76 matthew 63: use Spreadsheet::WriteExcel::Utility();
1.140 www 64: use lib '/home/httpd/lib/perl/';
65: use LONCAPA;
66:
1.31 matthew 67:
68: #######################################################
69: #######################################################
70: =pod
71:
72: =item Package Variables
73:
74: =over 4
75:
76: =item $Statistics Hash ref to store student data. Indexed by symb,
77: contains hashes with keys 'score' and 'max'.
78:
79: =cut
80:
81: #######################################################
82: #######################################################
1.1 stredwic 83:
1.30 matthew 84: my $Statistics;
85:
1.28 matthew 86: #######################################################
87: #######################################################
88:
89: =pod
90:
1.31 matthew 91: =item $show_links 'yes' or 'no' for linking to student performance data
92:
93: =item $output_mode 'html', 'excel', or 'csv' for output mode
94:
1.32 matthew 95: =item $show 'all', 'totals', or 'scores' determines how much data is output
1.31 matthew 96:
1.49 matthew 97: =item $single_student_mode evaluates to true if we are showing only one
98: student.
99:
1.31 matthew 100: =cut
101:
102: #######################################################
103: #######################################################
104: my $show_links;
105: my $output_mode;
1.87 matthew 106: my $chosen_output;
1.49 matthew 107: my $single_student_mode;
1.28 matthew 108:
1.31 matthew 109: #######################################################
110: #######################################################
111: # End of package variable declarations
1.28 matthew 112:
1.31 matthew 113: =pod
1.28 matthew 114:
1.31 matthew 115: =back
1.28 matthew 116:
1.31 matthew 117: =cut
1.28 matthew 118:
1.31 matthew 119: #######################################################
120: #######################################################
1.28 matthew 121:
1.31 matthew 122: =pod
1.28 matthew 123:
1.31 matthew 124: =item &BuildStudentAssessmentPage()
1.28 matthew 125:
1.31 matthew 126: Inputs:
1.4 stredwic 127:
1.31 matthew 128: =over 4
1.28 matthew 129:
130: =item $r Apache Request
131:
132: =item $c Apache Connection
133:
134: =back
135:
136: =cut
137:
138: #######################################################
139: #######################################################
1.1 stredwic 140: sub BuildStudentAssessmentPage {
1.30 matthew 141: my ($r,$c)=@_;
1.74 matthew 142: #
1.30 matthew 143: undef($Statistics);
1.66 matthew 144: undef($show_links);
145: undef($output_mode);
1.87 matthew 146: undef($chosen_output);
1.66 matthew 147: undef($single_student_mode);
1.74 matthew 148: #
149: my %Saveable_Parameters = ('Status' => 'scalar',
150: 'chartoutputmode' => 'scalar',
151: 'chartoutputdata' => 'scalar',
152: 'Section' => 'array',
1.139 raeburn 153: 'Groups' => 'array',
1.74 matthew 154: 'StudentData' => 'array',
155: 'Maps' => 'array');
156: &Apache::loncommon::store_course_settings('chart',\%Saveable_Parameters);
157: &Apache::loncommon::restore_course_settings('chart',\%Saveable_Parameters);
158: #
159: &Apache::lonstatistics::PrepareClasslist();
160: #
1.65 matthew 161: $single_student_mode = 0;
1.121 albertel 162: $single_student_mode = 1 if ($env{'form.SelectedStudent'});
1.100 matthew 163: &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},
164: ['selectstudent']);
1.121 albertel 165: if ($env{'form.selectstudent'}) {
1.59 matthew 166: &Apache::lonstatistics::DisplayClasslist($r);
167: return;
168: }
1.30 matthew 169: #
1.31 matthew 170: # Print out the HTML headers for the interface
171: # This also parses the output mode selector
1.54 matthew 172: # This step must *always* be done.
1.30 matthew 173: $r->print(&CreateInterface());
1.31 matthew 174: $r->print('<input type="hidden" name="notfirstrun" value="true" />');
1.49 matthew 175: $r->print('<input type="hidden" name="sort" value="'.
1.121 albertel 176: $env{'form.sort'}.'" />');
1.7 stredwic 177: $r->rflush();
1.58 matthew 178: #
1.121 albertel 179: if (! exists($env{'form.notfirstrun'}) && ! $single_student_mode) {
1.31 matthew 180: return;
181: }
1.119 matthew 182: $r->print('<h4>'.
183: &Apache::lonstatistics::section_and_enrollment_description().
184: '</h4>');
1.31 matthew 185: #
186: my $initialize = \&html_initialize;
187: my $output_student = \&html_outputstudent;
188: my $finish = \&html_finish;
189: #
190: if ($output_mode eq 'excel') {
191: $initialize = \&excel_initialize;
192: $output_student = \&excel_outputstudent;
193: $finish = \&excel_finish;
194: } elsif ($output_mode eq 'csv') {
195: $initialize = \&csv_initialize;
196: $output_student = \&csv_outputstudent;
197: $finish = \&csv_finish;
198: }
1.30 matthew 199: #
200: if($c->aborted()) { return ; }
1.31 matthew 201: #
1.49 matthew 202: # Determine which students we want to look at
203: my @Students;
204: if ($single_student_mode) {
205: @Students = (&Apache::lonstatistics::current_student());
206: $r->print(&next_and_previous_buttons());
207: $r->rflush();
208: } else {
209: @Students = @Apache::lonstatistics::Students;
210: }
1.56 matthew 211: #
212: # Perform generic initialization tasks
213: # Since we use lonnet::EXT to retrieve problem weights,
214: # to ensure current data we must clear the caches out.
215: # This makes sure that parameter changes at the student level
216: # are immediately reflected in the chart.
217: &Apache::lonnet::clear_EXT_cache_status();
1.69 matthew 218: #
219: # Clean out loncoursedata's package data, just to be safe.
220: &Apache::loncoursedata::clear_internal_caches();
1.49 matthew 221: #
1.31 matthew 222: # Call the initialize routine selected above
223: $initialize->($r);
1.49 matthew 224: foreach my $student (@Students) {
1.31 matthew 225: if($c->aborted()) {
226: $finish->($r);
227: return ;
1.1 stredwic 228: }
1.31 matthew 229: # Call the output_student routine selected above
230: $output_student->($r,$student);
231: }
232: # Call the "finish" routine selected above
233: $finish->($r);
234: #
235: return;
236: }
237:
238: #######################################################
239: #######################################################
1.49 matthew 240: sub next_and_previous_buttons {
241: my $Str = '';
242: $Str .= '<input type="hidden" name="SelectedStudent" value="'.
1.121 albertel 243: $env{'form.SelectedStudent'}.'" />';
1.49 matthew 244: #
245: # Build the previous student link
246: my $previous = &Apache::lonstatistics::previous_student();
247: my $previousbutton = '';
248: if (defined($previous)) {
249: my $sname = $previous->{'username'}.':'.$previous->{'domain'};
250: $previousbutton .= '<input type="button" value="'.
1.155 bisitz 251: &mt('Previous Student ([_1])',
252: $previous->{'username'}.':'.$previous->{'domain'}).
1.49 matthew 253: '" onclick="document.Statistics.SelectedStudent.value='.
254: "'".$sname."'".';'.
255: 'document.Statistics.submit();" />';
256: } else {
257: $previousbutton .= '<input type="button" value="'.
1.155 bisitz 258: &mt('Previous Student').'" disabled="disabled" />';
1.49 matthew 259: }
260: #
261: # Build the next student link
262: my $next = &Apache::lonstatistics::next_student();
263: my $nextbutton = '';
264: if (defined($next)) {
265: my $sname = $next->{'username'}.':'.$next->{'domain'};
266: $nextbutton .= '<input type="button" value="'.
1.155 bisitz 267: &mt('Next Student ([_1])',
268: $next->{'username'}.':'.$next->{'domain'}).
1.49 matthew 269: '" onclick="document.Statistics.SelectedStudent.value='.
270: "'".$sname."'".';'.
271: 'document.Statistics.submit();" />';
272: } else {
273: $nextbutton .= '<input type="button" value="'.
1.155 bisitz 274: &mt('Next Student').'" disabled="disabled" />';
1.49 matthew 275: }
276: #
277: # Build the 'all students' button
278: my $all = '';
1.155 bisitz 279: $all .= '<input type="button" value="'.&mt('All Students').'" '.
1.49 matthew 280: '" onclick="document.Statistics.SelectedStudent.value='.
281: "''".';'.'document.Statistics.submit();" />';
282: $Str .= $previousbutton.(' 'x5).$all.(' 'x5).$nextbutton;
283: return $Str;
284: }
285:
286: #######################################################
287: #######################################################
1.30 matthew 288:
1.31 matthew 289: sub get_student_fields_to_show {
290: my @to_show = @Apache::lonstatistics::SelectedStudentData;
291: foreach (@to_show) {
292: if ($_ eq 'all') {
293: @to_show = @Apache::lonstatistics::StudentDataOrder;
294: last;
295: }
296: }
297: return @to_show;
298: }
299:
1.28 matthew 300: #######################################################
301: #######################################################
302:
303: =pod
1.2 stredwic 304:
1.28 matthew 305: =item &CreateInterface()
1.21 minaeibi 306:
1.28 matthew 307: Called by &BuildStudentAssessmentPage to create the top part of the
308: page which displays the chart.
309:
1.30 matthew 310: Inputs: None
1.28 matthew 311:
312: Returns: A string containing the HTML for the headers and top table for
313: the chart page.
314:
315: =cut
316:
317: #######################################################
318: #######################################################
1.2 stredwic 319: sub CreateInterface {
1.4 stredwic 320: my $Str = '';
1.141 albertel 321: $Str .= &Apache::lonhtmlcommon::breadcrumbs('Chart','Chart_Description:Chart_Sections:Chart_Student_Data:Chart_Enrollment_Status:Chart_Sequences:Chart_Output_Formats:Chart_Output_Data');
1.30 matthew 322: # $Str .= &CreateLegend();
323: $Str .= '<table cellspacing="5">'."\n";
324: $Str .= '<tr>';
1.141 albertel 325: $Str .= '<td align="center"><b>'.&mt('Sections').'</b>'.
326: &Apache::loncommon::help_open_topic("Chart_Sections").
327: '</td>';
328: $Str .= '<td align="center"><b>'.&mt('Groups').'</b>'.
329: '</td>';
1.157 bisitz 330: $Str .= '<td align="center"><b>'.&mt('Student Data').'</b>'.
1.141 albertel 331: &Apache::loncommon::help_open_topic("Chart_Student_Data").
332: '</td>';
1.143 raeburn 333: $Str .= '<td align="center"><b>'.&mt('Access Status').'</b>'.
1.141 albertel 334: &Apache::loncommon::help_open_topic("Chart_Enrollment_Status").
335: '</td>';
336: $Str .= '<td align="center"><b>'.&mt('Sequences and Folders').'</b>'.
337: &Apache::loncommon::help_open_topic("Chart_Sequences").
338: '</td>';
1.75 matthew 339: $Str .= '<td align="center"><b>'.&mt('Output Format').'</b>'.
1.58 matthew 340: &Apache::loncommon::help_open_topic("Chart_Output_Formats").
341: '</td>';
1.75 matthew 342: $Str .= '<td align="center"><b>'.&mt('Output Data').'</b>'.
1.58 matthew 343: &Apache::loncommon::help_open_topic("Chart_Output_Data").
344: '</td>';
1.30 matthew 345: $Str .= '</tr>'."\n";
346: #
1.4 stredwic 347: $Str .= '<tr><td align="center">'."\n";
1.29 matthew 348: $Str .= &Apache::lonstatistics::SectionSelect('Section','multiple',5);
1.4 stredwic 349: $Str .= '</td><td align="center">';
1.139 raeburn 350: $Str .= &Apache::lonstatistics::GroupSelect('Group','multiple',5);
351: $Str .= '</td><td align="center">';
1.30 matthew 352: $Str .= &Apache::lonstatistics::StudentDataSelect('StudentData','multiple',
353: 5,undef);
1.46 matthew 354: $Str .= '</td><td>'."\n";
355: $Str .= &Apache::lonhtmlcommon::StatusOptions(undef,undef,5);
1.4 stredwic 356: $Str .= '</td><td>'."\n";
1.112 matthew 357: $Str .= &Apache::lonstatistics::map_select('Maps','multiple,all',5);
1.31 matthew 358: $Str .= '</td><td>'."\n";
359: $Str .= &CreateAndParseOutputSelector();
1.54 matthew 360: $Str .= '</td><td>'."\n";
361: $Str .= &CreateAndParseOutputDataSelector();
1.30 matthew 362: $Str .= '</td></tr>'."\n";
363: $Str .= '</table>'."\n";
1.156 bisitz 364: $Str .= '<p>'
365: .&mt('Status:').' '
366: .'<input type="text" name="stats_status" size="60" value="" readonly="readonly" />'
367: .'</p>';
1.75 matthew 368: $Str .= '<input type="submit" name="selectstudent" value="'.
369: &mt('Select One Student').'" />';
1.59 matthew 370: $Str .= ' 'x5;
1.75 matthew 371: $Str .= '<input type="submit" name="ClearCache" value="'.
372: &mt('Clear Caches').'" />';
1.156 bisitz 373: $Str .= '<p>'
374: .'<input type="submit" name="Generate Chart"'
375: .' value="'.&mt('Generate Chart').'" />'
376: .'</p>';
1.4 stredwic 377: return $Str;
1.1 stredwic 378: }
1.30 matthew 379:
380: #######################################################
381: #######################################################
382:
383: =pod
384:
1.31 matthew 385: =item &CreateAndParseOutputSelector()
1.30 matthew 386:
387: =cut
388:
389: #######################################################
390: #######################################################
1.32 matthew 391: my @OutputOptions =
392: ({ name => 'HTML, with links',
393: value => 'html, with links',
1.33 matthew 394: description => 'Output HTML with each symbol linked to the problem '.
1.35 matthew 395: 'which generated it.',
396: mode => 'html',
397: show_links => 'yes',
398: },
1.47 matthew 399: { name => 'HTML, with all links',
400: value => 'html, with all links',
401: description => 'Output HTML with each symbol linked to the problem '.
402: 'which generated it. '.
403: 'This includes links for unattempted problems.',
404: mode => 'html',
405: show_links => 'all',
406: },
1.32 matthew 407: { name => 'HTML, without links',
408: value => 'html, without links',
1.33 matthew 409: description => 'Output HTML. By not including links, the size of the'.
410: ' web page is greatly reduced. If your browser crashes on the '.
1.35 matthew 411: 'full display, try this.',
412: mode => 'html',
413: show_links => 'no',
414: },
1.54 matthew 415: { name => 'Excel',
416: value => 'excel',
417: description => 'Output an Excel file (compatable with Excel 95).',
1.35 matthew 418: mode => 'excel',
419: show_links => 'no',
1.54 matthew 420: },
421: { name => 'CSV',
422: value => 'csv',
1.96 www 423: description => 'Output a comma separated values file suitable for '.
1.57 matthew 424: 'import into a spreadsheet program. Using this method as opposed '.
425: 'to Excel output allows you to organize your data before importing'.
426: ' it into a spreadsheet program.',
1.35 matthew 427: mode => 'csv',
428: show_links => 'no',
429: },
1.32 matthew 430: );
431:
1.33 matthew 432: sub OutputDescriptions {
433: my $Str = '';
1.58 matthew 434: $Str .= "<h2>Output Formats</h2>\n";
1.33 matthew 435: $Str .= "<dl>\n";
436: foreach my $outputmode (@OutputOptions) {
437: $Str .=" <dt>".$outputmode->{'name'}."</dt>\n";
438: $Str .=" <dd>".$outputmode->{'description'}."</dd>\n";
439: }
440: $Str .= "</dl>\n";
441: return $Str;
442: }
443:
1.31 matthew 444: sub CreateAndParseOutputSelector {
445: my $Str = '';
1.44 matthew 446: my $elementname = 'chartoutputmode';
1.73 matthew 447: &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},
448: [$elementname]);
1.31 matthew 449: #
450: # Format for output options is 'mode, restrictions';
1.122 albertel 451: my $selected = (&Apache::loncommon::get_env_multiple('form.'.$elementname))[0];
452: $selected = 'html, without links' if (!$selected);
453:
1.31 matthew 454: #
455: # Set package variables describing output mode
456: $show_links = 'no';
457: $output_mode = 'html';
1.35 matthew 458: foreach my $option (@OutputOptions) {
459: next if ($option->{'value'} ne $selected);
460: $output_mode = $option->{'mode'};
461: $show_links = $option->{'show_links'};
1.31 matthew 462: }
1.35 matthew 463:
1.31 matthew 464: #
465: # Build the form element
466: $Str = qq/<select size="5" name="$elementname">/;
1.32 matthew 467: foreach my $option (@OutputOptions) {
468: $Str .= "\n".' <option value="'.$option->{'value'}.'"';
469: $Str .= " selected " if ($option->{'value'} eq $selected);
1.75 matthew 470: $Str .= ">".&mt($option->{'name'})."<\/option>";
1.31 matthew 471: }
472: $Str .= "\n</select>";
473: return $Str;
474: }
1.30 matthew 475:
1.54 matthew 476: ##
477: ## Data selector stuff
478: ##
479: my @OutputDataOptions =
1.57 matthew 480: (
1.72 matthew 481: { name => 'Scores Summary',
1.57 matthew 482: base => 'scores',
483: value => 'sum and total',
1.87 matthew 484: scores => 1,
485: tries => 0,
486: every_problem => 0,
487: sequence_sum => 1,
488: sequence_max => 1,
489: grand_total => 1,
1.101 matthew 490: grand_maximum => 1,
1.89 matthew 491: summary_table => 1,
1.90 matthew 492: maximum_row => 1,
1.129 bowersj2 493: ignore_weight => 0,
1.57 matthew 494: shortdesc => 'Total Score and Maximum Possible for each '.
495: 'Sequence or Folder',
496: longdesc => 'The score of each student as well as the '.
497: ' maximum possible on each Sequence or Folder.',
498: },
1.71 matthew 499: { name => 'Scores Per Problem',
1.57 matthew 500: base => 'scores',
1.71 matthew 501: value => 'scores',
1.87 matthew 502: scores => 1,
503: tries => 0,
504: correct => 0,
505: every_problem => 1,
506: sequence_sum => 1,
507: sequence_max => 1,
508: grand_total => 1,
1.101 matthew 509: grand_maximum => 1,
1.89 matthew 510: summary_table => 1,
1.90 matthew 511: maximum_row => 1,
1.129 bowersj2 512: ignore_weight => 0,
1.71 matthew 513: shortdesc => 'Score on each Problem Part',
514: longdesc =>'The students score on each problem part, computed as'.
515: 'the part weight * part awarded',
1.57 matthew 516: },
517: { name =>'Tries',
518: base =>'tries',
519: value => 'tries',
1.87 matthew 520: scores => 0,
521: tries => 1,
522: correct => 0,
523: every_problem => 1,
524: sequence_sum => 0,
525: sequence_max => 0,
526: grand_total => 0,
1.101 matthew 527: grand_maximum => 0,
1.90 matthew 528: summary_table => 0,
529: maximum_row => 0,
1.129 bowersj2 530: ignore_weight => 0,
1.57 matthew 531: shortdesc => 'Number of Tries before success on each Problem Part',
532: longdesc =>'The number of tries before success on each problem part.',
1.109 matthew 533: non_html_notes => 'negative values indicate an incorrect problem',
1.57 matthew 534: },
535: { name =>'Parts Correct',
536: base =>'tries',
537: value => 'parts correct total',
1.87 matthew 538: scores => 0,
539: tries => 0,
540: correct => 1,
541: every_problem => 1,
542: sequence_sum => 1,
543: sequence_max => 1,
544: grand_total => 1,
1.101 matthew 545: grand_maximum => 1,
1.89 matthew 546: summary_table => 1,
1.90 matthew 547: maximum_row => 0,
1.129 bowersj2 548: ignore_weight => 1,
1.157 bisitz 549: shortdesc => 'Number of Problem Parts completed successfully',
1.57 matthew 550: longdesc => 'The Number of Problem Parts completed successfully and '.
551: 'the maximum possible for each student',
552: },
553: );
554:
555: sub HTMLifyOutputDataDescriptions {
556: my $Str = '';
1.157 bisitz 557: $Str .= "<h2>'.&mt('Output Data').'</h2>\n";
1.57 matthew 558: $Str .= "<dl>\n";
559: foreach my $option (@OutputDataOptions) {
560: $Str .= ' <dt>'.$option->{'name'}.'</dt>';
561: $Str .= '<dd>'.$option->{'longdesc'}.'</dd>'."\n";
562: }
563: $Str .= "</dl>\n";
564: return $Str;
565: }
1.54 matthew 566:
567: sub CreateAndParseOutputDataSelector {
568: my $Str = '';
569: my $elementname = 'chartoutputdata';
570: #
1.122 albertel 571: my $selected = (&Apache::loncommon::get_env_multiple('form.'.$elementname))[0];
572: $selected = 'scores' if (!$selected);
573:
1.54 matthew 574: #
1.87 matthew 575: $chosen_output = $OutputDataOptions[0];
1.54 matthew 576: foreach my $option (@OutputDataOptions) {
577: if ($option->{'value'} eq $selected) {
1.87 matthew 578: $chosen_output = $option;
1.54 matthew 579: }
580: }
581: #
582: # Build the form element
583: $Str = qq/<select size="5" name="$elementname">/;
584: foreach my $option (@OutputDataOptions) {
585: $Str .= "\n".' <option value="'.$option->{'value'}.'"';
1.87 matthew 586: $Str .= " selected " if ($option->{'value'} eq $chosen_output->{'value'});
1.75 matthew 587: $Str .= ">".&mt($option->{'name'})."<\/option>";
1.54 matthew 588: }
589: $Str .= "\n</select>";
590: return $Str;
591:
592: }
593:
1.28 matthew 594: #######################################################
595: #######################################################
1.115 matthew 596: sub count_parts {
597: my ($navmap,$sequence) = @_;
598: my @resources = &get_resources($navmap,$sequence);
599: my $count = 0;
600: foreach my $res (@resources) {
601: $count += scalar(@{$res->parts});
602: }
603: return $count;
604: }
605:
606: sub get_resources {
607: my ($navmap,$sequence) = @_;
608: my @resources = $navmap->retrieveResources($sequence,
609: sub { shift->is_problem(); },
610: 0,0,0);
611: return @resources;
612: }
613:
614: #######################################################
615: #######################################################
1.1 stredwic 616:
1.28 matthew 617: =pod
618:
1.31 matthew 619: =head2 HTML output routines
1.28 matthew 620:
1.31 matthew 621: =item &html_initialize($r)
1.28 matthew 622:
1.31 matthew 623: Create labels for the columns of student data to show.
1.28 matthew 624:
1.31 matthew 625: =item &html_outputstudent($r,$student)
1.28 matthew 626:
1.31 matthew 627: Return a line of the chart for a student.
1.28 matthew 628:
1.31 matthew 629: =item &html_finish($r)
1.28 matthew 630:
631: =cut
632:
633: #######################################################
634: #######################################################
1.31 matthew 635: {
636: my $padding;
637: my $count;
638:
1.39 matthew 639: my $nodata_count; # The number of students for which there is no data
640: my %prog_state; # progress state used by loncommon PrgWin routines
1.102 matthew 641: my $total_sum_width;
1.39 matthew 642:
1.112 matthew 643: my %width; # Holds sequence width information
644: my @sequences;
645: my $navmap; # Have to keep this around since weakref is a bit zealous
646:
1.125 albertel 647: sub html_cleanup {
648: undef(%prog_state);
649: undef(%width);
650: #
651: undef($navmap);
652: undef(@sequences);
653: }
654:
1.31 matthew 655: sub html_initialize {
656: my ($r) = @_;
1.30 matthew 657: #
658: $padding = ' 'x3;
1.35 matthew 659: $count = 0;
1.39 matthew 660: $nodata_count = 0;
1.125 albertel 661: &html_cleanup();
1.115 matthew 662: ($navmap,@sequences) =
663: &Apache::lonstatistics::selected_sequences_with_assessments();
664: if (! ref($navmap)) {
665: # Unable to get data, so bail out
1.156 bisitz 666: $r->print('<p class="LC_error">'
667: .&mt('Unable to retrieve course information.')
668: .'</p>');
1.115 matthew 669: }
1.134 bowersj2 670:
671: # If we're showing links, show a checkbox to open in new
672: # windows.
673: if ($show_links ne 'no') {
1.146 bisitz 674: my $labeltext = &mt('Show links in new window:');
1.134 bowersj2 675: $r->print(<<NEW_WINDOW_CHECKBOX);
1.135 albertel 676: <script type="text/javascript">new_window = true;</script>
1.146 bisitz 677: <p><label>$labeltext
1.152 bisitz 678: <input type="checkbox" checked="checked" onclick="new_window=this.checked" />
1.135 albertel 679: </label></p>
1.134 bowersj2 680: NEW_WINDOW_CHECKBOX
681: }
682:
1.30 matthew 683: #
1.121 albertel 684: $r->print("<h3>".$env{'course.'.$env{'request.course.id'}.'.description'}.
1.156 bisitz 685: " ".&Apache::lonlocal::locallocaltime(time)."</h3>");
1.112 matthew 686: #
1.87 matthew 687: if ($chosen_output->{'base'} !~ /^final table/) {
1.146 bisitz 688: $r->print("<h3>".&mt($chosen_output->{'shortdesc'})."</h3>");
1.39 matthew 689: }
1.31 matthew 690: my $Str = "<pre>\n";
1.30 matthew 691: # First, the @StudentData fields need to be listed
1.31 matthew 692: my @to_show = &get_student_fields_to_show();
1.30 matthew 693: foreach my $field (@to_show) {
694: my $title=$Apache::lonstatistics::StudentData{$field}->{'title'};
695: my $base =$Apache::lonstatistics::StudentData{$field}->{'base_width'};
696: my $width=$Apache::lonstatistics::StudentData{$field}->{'width'};
697: $Str .= $title.' 'x($width-$base).$padding;
698: }
1.89 matthew 699: #
700: # Compute the column widths and output the sequence titles
1.102 matthew 701: my $total_count;
1.112 matthew 702: #
703: # Compute sequence widths
704: my $starttime = Time::HiRes::time;
705: foreach my $seq (@sequences) {
706: my $symb = $seq->symb;
707: my $title = $seq->compTitle;
708: $width{$symb}->{'width_sum'} = 0;
709: # Compute width of sum
1.89 matthew 710: if ($chosen_output->{'sequence_sum'}) {
1.99 matthew 711: if ($chosen_output->{'every_problem'}) {
712: # Use 1 digit for a space
1.112 matthew 713: $width{$symb}->{'width_sum'} += 1;
1.99 matthew 714: }
1.118 matthew 715: $total_count += &count_parts($navmap,$seq);
1.151 www 716: # Use 6 digits for the sum
717: $width{$symb}->{'width_sum'} += 6;
1.89 matthew 718: }
1.112 matthew 719: # Compute width of maximum
1.89 matthew 720: if ($chosen_output->{'sequence_max'}) {
1.112 matthew 721: if ($width{$symb}->{'width_sum'}>0) {
1.89 matthew 722: # One digit for the '/'
1.112 matthew 723: $width{$symb}->{'width_sum'} +=1;
1.89 matthew 724: }
1.151 www 725: # Use 6 digits for the total
726: $width{$symb}->{'width_sum'}+=6;
1.89 matthew 727: }
1.94 matthew 728: #
1.89 matthew 729: if ($chosen_output->{'every_problem'}) {
730: # one problem per digit
1.115 matthew 731: $width{$symb}->{'width_parts'}= &count_parts($navmap,$seq);
732: $width{$symb}->{'width_problem'} += $width{$symb}->{'width_parts'};
1.89 matthew 733: } else {
1.112 matthew 734: $width{$symb}->{'width_problem'} = 0;
1.89 matthew 735: }
1.112 matthew 736: $width{$symb}->{'width_total'} = $width{$symb}->{'width_problem'} +
737: $width{$symb}->{'width_sum'};
738: if ($width{$symb}->{'width_total'} < length(&HTML::Entities::decode($title))) {
739: $width{$symb}->{'width_total'} = length(&HTML::Entities::decode($title));
1.89 matthew 740: }
741: #
742: # Output the sequence titles
1.112 matthew 743: $Str .= $title.(' 'x($width{$symb}->{'width_total'}-
744: length($title)
745: )).$padding;
1.30 matthew 746: }
1.102 matthew 747: $total_sum_width = length($total_count)+1;
748: $Str .= " total</pre>\n";
1.31 matthew 749: $Str .= "<pre>";
750: $r->print($Str);
751: $r->rflush();
1.132 bowersj2 752:
753: $r->print(<<JS);
1.142 albertel 754: <script type="text/javascript">
1.132 bowersj2 755: // get the left offset of a given widget as an absolute position
756: function getLeftOffset (element) {
757: return collect(element, "offsetLeft");
758: }
759:
760: // get the top offset of a given widget as an absolute position
761: function getTopOffset (element) {
762: return collect(element, "offsetTop");
763: }
764:
765: function collect(element, att) {
766: var val = 0;
767: while(element) {
768: val += element[att];
769: element = element.offsetParent;
770: }
771: return val;
772: }
773:
774: var currentDiv;
775: var currentElement;
776: function popup_score(element, score) {
777: popdown_score();
778: var left = getLeftOffset(element);
779: var top = getTopOffset(element);
780: var div = document.createElement("div");
1.142 albertel 781: div.className = "LC_chrt_popup";
1.132 bowersj2 782: div.appendChild(document.createTextNode(score));
783: div.style.position = "absolute";
784: div.style.top = (top - 25) + "px";
785: div.style.left = (left - 10) + "px";
786: currentDiv = div;
1.133 bowersj2 787: document.body.insertBefore(div, document.body.childNodes[0]);
1.142 albertel 788: element.className = "LC_chrt_popup_up";
1.132 bowersj2 789: currentElement = element;
790: }
791:
792: function popdown_score() {
793: if (currentDiv) {
794: document.body.removeChild(currentDiv);
795: }
796: if (currentElement) {
1.142 albertel 797: currentElement.className = 'LC_chrt_popup_exists';
1.132 bowersj2 798: }
799: currentDiv = undefined;
800: }
801: </script>
802: JS
803:
1.123 albertel 804: #
805: # Let the user know what we are doing
806: my $studentcount = scalar(@Apache::lonstatistics::Students);
807: if ($env{'form.SelectedStudent'}) {
808: $studentcount = '1';
809: }
810: #
811: # Initialize progress window
812: %prog_state=&Apache::lonhtmlcommon::Create_PrgWin
813: ($r,'HTML Chart Status',
814: 'HTML Chart Progress', $studentcount,
815: 'inline',undef,'Statistics','stats_status');
816: #
817: &Apache::lonhtmlcommon::Update_PrgWin($r,\%prog_state,
818: 'Processing first student');
1.31 matthew 819: return;
1.30 matthew 820: }
821:
1.31 matthew 822: sub html_outputstudent {
823: my ($r,$student) = @_;
1.2 stredwic 824: my $Str = '';
1.112 matthew 825: return if (! defined($navmap));
1.35 matthew 826: #
1.87 matthew 827: if($count++ % 5 == 0 && $count > 0) {
1.158 ! bisitz 828: # $r->print("</pre><pre>");
! 829: $r->print('</pre>');
! 830: &Apache::lonhtmlcommon::Increment_PrgWin(
! 831: $r,\%prog_state,'last five students');
! 832: $r->rflush();
! 833: $r->print('<pre>');
1.35 matthew 834: }
1.30 matthew 835: # First, the @StudentData fields need to be listed
1.31 matthew 836: my @to_show = &get_student_fields_to_show();
1.30 matthew 837: foreach my $field (@to_show) {
838: my $title=$student->{$field};
1.103 matthew 839: # Deal with 'comments' - how I love special cases
840: if ($field eq 'comments') {
841: $title = '<a href="/adm/'.$student->{'domain'}.'/'.$student->{'username'}.'/'.'aboutme#coursecomment">'.&mt('Comments').'</a>';
842: }
1.31 matthew 843: my $base = length($title);
1.30 matthew 844: my $width=$Apache::lonstatistics::StudentData{$field}->{'width'};
845: $Str .= $title.' 'x($width-$base).$padding;
846: }
847: # Get ALL the students data
848: my %StudentsData;
849: my @tmp = &Apache::loncoursedata::get_current_state
850: ($student->{'username'},$student->{'domain'},undef,
1.121 albertel 851: $env{'request.course.id'});
1.144 albertel 852: if ((scalar @tmp > 0) && ($tmp[0] !~ /^error:(.*)/)) {
1.30 matthew 853: %StudentsData = @tmp;
1.144 albertel 854: } else {
855: my $error = $1;
856: if (scalar(@tmp) < 1) {
1.149 bisitz 857: $Str .= '<span class="LC_warning">'
858: .&mt('No Course Data')
859: .'</span>'."\n";
1.144 albertel 860: } else {
1.149 bisitz 861: $Str .= '<span class="LC_error">'
862: .&mt('Error getting student data ([_1])',$error)
863: .'</span>'."\n";
1.144 albertel 864: }
1.39 matthew 865: $nodata_count++;
1.31 matthew 866: $r->print($Str);
867: $r->rflush();
868: return;
1.30 matthew 869: }
870: #
871: # By sequence build up the data
872: my $studentstats;
1.31 matthew 873: my $PerformanceStr = '';
1.112 matthew 874: foreach my $seq (@sequences) {
1.118 matthew 875: my $symb = $seq->symb;
1.54 matthew 876: my ($performance,$performance_length,$score,$seq_max,$rawdata);
1.87 matthew 877: if ($chosen_output->{'tries'}) {
1.54 matthew 878: ($performance,$performance_length,$score,$seq_max,$rawdata) =
1.112 matthew 879: &student_tries_on_sequence($student,\%StudentsData,
880: $navmap,$seq,$show_links);
1.54 matthew 881: } else {
882: ($performance,$performance_length,$score,$seq_max,$rawdata) =
1.112 matthew 883: &student_performance_on_sequence($student,\%StudentsData,
1.129 bowersj2 884: $navmap,$seq,$show_links,
885: $chosen_output->{ignore_weight});
1.54 matthew 886: }
1.89 matthew 887: my $ratio='';
1.118 matthew 888: if ($chosen_output->{'every_problem'} &&
889: $chosen_output->{'sequence_sum'}) {
1.99 matthew 890: $ratio .= ' ';
891: }
1.97 matthew 892: if ($chosen_output->{'sequence_sum'} && $score ne ' ') {
1.151 www 893: my $score .= sprintf("%3.2f",$score);
894: $ratio .= (' 'x(6-length($score))).$score;
1.98 matthew 895: } elsif($chosen_output->{'sequence_sum'}) {
1.151 www 896: $ratio .= ' 'x6;
1.89 matthew 897: }
898: if ($chosen_output->{'sequence_max'}) {
899: if ($chosen_output->{'sequence_sum'}) {
900: $ratio .= '/';
901: }
1.151 www 902: my $sequence_total=sprintf("%3.2f",$seq_max);
903: $ratio .= $sequence_total.(' 'x(6-length($sequence_total)));
1.89 matthew 904: }
1.31 matthew 905: #
1.89 matthew 906: if (! $chosen_output->{'every_problem'}) {
907: $performance = '';
1.94 matthew 908: $performance_length=0;
1.30 matthew 909: }
1.118 matthew 910: $performance .= ' 'x($width{$symb}->{'width_total'} -
1.112 matthew 911: $performance_length -
1.118 matthew 912: $width{$symb}->{'width_sum'}).
1.89 matthew 913: $ratio;
1.31 matthew 914: #
915: $Str .= $performance.$padding;
916: #
1.118 matthew 917: $studentstats->{$symb}->{'score'}= $score;
918: $studentstats->{$symb}->{'max'} = $seq_max;
1.30 matthew 919: }
920: #
921: # Total it up and store the statistics info.
1.97 matthew 922: my ($score,$max);
1.30 matthew 923: while (my ($symb,$seq_stats) = each (%{$studentstats})) {
924: $Statistics->{$symb}->{'score'} += $seq_stats->{'score'};
1.54 matthew 925: if ($Statistics->{$symb}->{'max'} < $seq_stats->{'max'}) {
926: $Statistics->{$symb}->{'max'} = $seq_stats->{'max'};
927: }
1.97 matthew 928: if ($seq_stats->{'score'} ne ' ') {
929: $score += $seq_stats->{'score'};
930: $Statistics->{$symb}->{'num_students'}++;
931: }
1.30 matthew 932: $max += $seq_stats->{'max'};
933: }
1.97 matthew 934: if (! defined($score)) {
1.102 matthew 935: $score = ' ' x $total_sum_width;
1.105 matthew 936: } else {
1.151 www 937: $score = sprintf("%.2f",$score);
938: $score = (' 'x(6-length($score))).$score;
1.97 matthew 939: }
1.102 matthew 940: $Str .= ' '.' 'x($total_sum_width-length($score)).$score.' / '.$max;
1.30 matthew 941: $Str .= " \n";
1.39 matthew 942: #
1.31 matthew 943: $r->print($Str);
944: #
1.158 ! bisitz 945: # $r->rflush();
! 946: # &Apache::lonhtmlcommon::Increment_PrgWin($r,\%prog_state,'last student');
1.31 matthew 947: return;
1.30 matthew 948: }
1.2 stredwic 949:
1.31 matthew 950: sub html_finish {
951: my ($r) = @_;
1.112 matthew 952: return if (! defined($navmap));
1.39 matthew 953: #
954: # Check for suppressed output and close the progress window if so
1.87 matthew 955: $r->print("</pre>\n");
1.90 matthew 956: if ($chosen_output->{'summary_table'}) {
957: if ($single_student_mode) {
958: $r->print(&SingleStudentTotal());
959: } else {
960: $r->print(&StudentAverageTotal());
961: }
1.49 matthew 962: }
1.31 matthew 963: $r->rflush();
1.123 albertel 964: &Apache::lonhtmlcommon::Close_PrgWin($r,\%prog_state);
1.125 albertel 965: &html_cleanup();
1.31 matthew 966: return;
967: }
968:
1.39 matthew 969: sub StudentAverageTotal {
1.105 matthew 970: my $Str = '<h3>'.&mt('Summary Tables').'</h3>'.$/;
1.150 bisitz 971: $Str .= &Apache::loncommon::start_data_table();
972: $Str .= &Apache::loncommon::start_data_table_header_row().
1.105 matthew 973: '<th>'.&mt('Title').'</th>'.
974: '<th>'.&mt('Average').'</th>'.
975: '<th>'.&mt('Maximum').'</th>'.
1.150 bisitz 976: &Apache::loncommon::end_data_table_header_row().$/;
1.112 matthew 977: foreach my $seq (@sequences) {
978: my $symb = $seq->symb;
1.42 matthew 979: my $ave;
1.112 matthew 980: my $num_students = $Statistics->{$symb}->{'num_students'};
1.97 matthew 981: if ($num_students > 0) {
982: $ave = int(100*
1.112 matthew 983: ($Statistics->{$symb}->{'score'}/$num_students)
1.97 matthew 984: )/100;
1.42 matthew 985: } else {
986: $ave = 0;
987: }
1.112 matthew 988: my $max = $Statistics->{$symb}->{'max'};
1.82 matthew 989: $ave = sprintf("%.2f",$ave);
1.150 bisitz 990: $Str .= &Apache::loncommon::start_data_table_row().
991: '<td>'.$seq->compTitle.'</td>'.
1.82 matthew 992: '<td align="right">'.$ave.' </td>'.
1.150 bisitz 993: '<td align="right">'.$max.' '.'</td>'.
994: &Apache::loncommon::end_data_table_row()."\n";
1.39 matthew 995: }
1.150 bisitz 996: $Str .= &Apache::loncommon::end_data_table()."\n";
1.39 matthew 997: return $Str;
998: }
999:
1.49 matthew 1000: sub SingleStudentTotal {
1.115 matthew 1001: return if (! defined($navmap));
1.49 matthew 1002: my $student = &Apache::lonstatistics::current_student();
1.157 bisitz 1003: my $Str = '<h3>'.&mt('Summary table for [_1] ([_2])',
1.105 matthew 1004: $student->{'fullname'},
1.157 bisitz 1005: $student->{'username'}.':'.$student->{'domain'}).'</h3>';
1.105 matthew 1006: $Str .= $/;
1.150 bisitz 1007: $Str .= &Apache::loncommon::start_data_table()."\n";
1.49 matthew 1008: $Str .=
1.150 bisitz 1009: &Apache::loncommon::start_data_table_header_row().
1.105 matthew 1010: '<th>'.&mt('Sequence or Folder').'</th>';
1011: if ($chosen_output->{'base'} eq 'tries') {
1012: $Str .= '<th>'.&mt('Parts Correct').'</th>';
1013: } else {
1014: $Str .= '<th>'.&mt('Score').'</th>';
1015: }
1.150 bisitz 1016: $Str .= '<th>'.&mt('Maximum').'</th>'.
1017: &Apache::loncommon::end_data_table_header_row()."\n";
1.49 matthew 1018: my $total = 0;
1019: my $total_max = 0;
1.115 matthew 1020: foreach my $seq (@sequences) {
1.112 matthew 1021: my $value = $Statistics->{$seq->symb}->{'score'};
1022: my $max = $Statistics->{$seq->symb}->{'max'};
1.150 bisitz 1023: $Str .= &Apache::loncommon::start_data_table_row().
1024: '<td>'.&HTML::Entities::encode($seq->compTitle).'</td>'.
1.49 matthew 1025: '<td align="right">'.$value.'</td>'.
1.150 bisitz 1026: '<td align="right">'.$max.'</td>'.
1027: &Apache::loncommon::end_data_table_row()."\n";
1.49 matthew 1028: $total += $value;
1029: $total_max +=$max;
1030: }
1.150 bisitz 1031: $Str .= &Apache::loncommon::start_data_table_row().
1032: '<td><b>'.&mt('Total').'</b></td>'.
1.49 matthew 1033: '<td align="right">'.$total.'</td>'.
1.150 bisitz 1034: '<td align="right">'.$total_max.'</td>'.
1035: &Apache::loncommon::end_data_table_row()."\n";
1036: $Str .= &Apache::loncommon::end_data_table()."\n";
1.49 matthew 1037: return $Str;
1038: }
1039:
1.31 matthew 1040: }
1041:
1042: #######################################################
1043: #######################################################
1044:
1045: =pod
1046:
1047: =head2 EXCEL subroutines
1048:
1049: =item &excel_initialize($r)
1050:
1051: =item &excel_outputstudent($r,$student)
1052:
1053: =item &excel_finish($r)
1054:
1055: =cut
1056:
1057: #######################################################
1058: #######################################################
1059: {
1060:
1061: my $excel_sheet;
1.32 matthew 1062: my $excel_workbook;
1.117 matthew 1063: my $format;
1.32 matthew 1064:
1065: my $filename;
1066: my $rows_output;
1067: my $cols_output;
1068:
1.36 matthew 1069: my %prog_state; # progress window state
1.54 matthew 1070: my $request_aborted;
1.31 matthew 1071:
1.76 matthew 1072: my $total_formula;
1.101 matthew 1073: my $maximum_formula;
1.115 matthew 1074: my %formula_data;
1075:
1076: my $navmap;
1077: my @sequences;
1.76 matthew 1078:
1.125 albertel 1079: sub excel_cleanup {
1.31 matthew 1080: #
1.66 matthew 1081: undef ($excel_sheet);
1082: undef ($excel_workbook);
1083: undef ($filename);
1084: undef ($rows_output);
1085: undef ($cols_output);
1086: undef (%prog_state);
1087: undef ($request_aborted);
1.76 matthew 1088: undef ($total_formula);
1.101 matthew 1089: undef ($maximum_formula);
1.66 matthew 1090: #
1.115 matthew 1091: undef(%formula_data);
1092: #
1093: undef($navmap);
1094: undef(@sequences);
1.125 albertel 1095: }
1096:
1097: sub excel_initialize {
1098: my ($r) = @_;
1099:
1100: &excel_cleanup();
1.115 matthew 1101: ($navmap,@sequences) =
1102: &Apache::lonstatistics::selected_sequences_with_assessments();
1103: if (! ref($navmap)) {
1104: # Unable to get data, so bail out
1105: $r->print("<h3>".
1106: &mt('Unable to retrieve course information.').
1107: '</h3>');
1108: }
1109: #
1.54 matthew 1110: my $total_columns = scalar(&get_student_fields_to_show());
1.90 matthew 1111: my $num_students = scalar(@Apache::lonstatistics::Students);
1112: #
1.115 matthew 1113: foreach my $seq (@sequences) {
1.88 matthew 1114: if ($chosen_output->{'every_problem'}) {
1.115 matthew 1115: $total_columns+=&count_parts($navmap,$seq);
1.88 matthew 1116: }
1.87 matthew 1117: # Add 2 because we need a 'sequence_sum' and 'total' column for each
1.88 matthew 1118: $total_columns += 2;
1.54 matthew 1119: }
1.105 matthew 1120: my $too_many_cols_error_message =
1121: '<h2>'.&mt('Unable to Complete Request').'</h2>'.$/.
1122: '<p>'.&mt('LON-CAPA is unable to produce your Excel spreadsheet because your selections will result in more than 255 columns. Excel allows only 255 columns in a spreadsheet.').'</p>'.$/.
1123: '<p>'.&mt('You may consider reducing the number of <b>Sequences or Folders</b> you have selected.').'</p>'.$/.
1124: '<p>'.&mt('LON-CAPA can produce <b>CSV</b> files of this data or Excel files of the <b>Scores Summary</b> data.').'</p>'.$/;
1.87 matthew 1125: if ($chosen_output->{'base'} eq 'tries' && $total_columns > 255) {
1.105 matthew 1126: $r->print($too_many_cols_error_message);
1127: $request_aborted = 1;
1.54 matthew 1128: }
1.87 matthew 1129: if ($chosen_output->{'base'} eq 'scores' && $total_columns > 255) {
1.105 matthew 1130: $r->print($too_many_cols_error_message);
1131: $request_aborted = 1;
1.54 matthew 1132: }
1133: return if ($request_aborted);
1134: #
1.32 matthew 1135: #
1136: $excel_workbook = undef;
1137: $excel_sheet = undef;
1138: #
1139: $rows_output = 0;
1140: $cols_output = 0;
1141: #
1.90 matthew 1142: # Determine rows
1143: my $header_row = $rows_output++;
1144: my $description_row = $rows_output++;
1.109 matthew 1145: my $notes_row = $rows_output++;
1.90 matthew 1146: $rows_output++; # blank row
1147: my $summary_header_row;
1148: if ($chosen_output->{'summary_table'}) {
1149: $summary_header_row = $rows_output++;
1.115 matthew 1150: $rows_output+= scalar(@sequences);
1.90 matthew 1151: $rows_output++;
1152: }
1153: my $sequence_name_row = $rows_output++;
1154: my $resource_name_row = $rows_output++;
1155: my $maximum_data_row = $rows_output++;
1156: if (! $chosen_output->{'maximum_row'}) {
1157: $rows_output--;
1158: }
1159: my $first_data_row = $rows_output++;
1160: #
1.32 matthew 1161: # Create sheet
1.117 matthew 1162: ($excel_workbook,$filename,$format)=
1163: &Apache::loncommon::create_workbook($r);
1164: return if (! defined($excel_workbook));
1.91 matthew 1165: #
1.32 matthew 1166: # Add a worksheet
1.121 albertel 1167: my $sheetname = $env{'course.'.$env{'request.course.id'}.'.description'};
1.67 matthew 1168: $sheetname = &Apache::loncommon::clean_excel_name($sheetname);
1.33 matthew 1169: $excel_sheet = $excel_workbook->addworksheet($sheetname);
1.85 matthew 1170: #
1.34 matthew 1171: # Put the course description in the header
1.90 matthew 1172: $excel_sheet->write($header_row,$cols_output++,
1.121 albertel 1173: $env{'course.'.$env{'request.course.id'}.'.description'},
1.85 matthew 1174: $format->{'h1'});
1.34 matthew 1175: $cols_output += 3;
1176: #
1177: # Put a description of the sections listed
1178: my $sectionstring = '';
1.119 matthew 1179: my @Sections = &Apache::lonstatistics::get_selected_sections();
1.120 matthew 1180: $excel_sheet->write($header_row,$cols_output++,
1.124 matthew 1181: &Apache::lonstatistics::section_and_enrollment_description('plaintext'),
1.85 matthew 1182: $format->{'h3'});
1.34 matthew 1183: #
1184: # Put the date in there too
1.90 matthew 1185: $excel_sheet->write($header_row,$cols_output++,
1.157 bisitz 1186: &mt('Compiled on [_1]',&Apache::lonlocal::locallocaltime(time)),$format->{'h3'});
1.34 matthew 1187: #
1.54 matthew 1188: $cols_output = 0;
1.90 matthew 1189: $excel_sheet->write($description_row,$cols_output++,
1.157 bisitz 1190: &mt($chosen_output->{'shortdesc'}),
1.109 matthew 1191: $format->{'b'});
1192: #
1193: $cols_output = 0;
1194: $excel_sheet->write($notes_row,$cols_output++,
1195: $chosen_output->{'non_html_notes'},
1196: $format->{'i'});
1197:
1.90 matthew 1198: ##############################################
1199: # Output headings for the raw data
1200: ##############################################
1.86 matthew 1201: #
1.32 matthew 1202: # Add the student headers
1.34 matthew 1203: $cols_output = 0;
1.32 matthew 1204: foreach my $field (&get_student_fields_to_show()) {
1.86 matthew 1205: $excel_sheet->write($resource_name_row,$cols_output++,$field,
1.85 matthew 1206: $format->{'bold'});
1.32 matthew 1207: }
1208: #
1.54 matthew 1209: # Add the remaining column headers
1.76 matthew 1210: my $total_formula_string = '=0';
1.101 matthew 1211: my $maximum_formula_string = '=0';
1.115 matthew 1212: foreach my $seq (@sequences) {
1213: my $symb = $seq->symb;
1.86 matthew 1214: $excel_sheet->write($sequence_name_row,,
1.115 matthew 1215: $cols_output,$seq->compTitle,$format->{'bold'});
1.86 matthew 1216: # Determine starting cell
1.115 matthew 1217: $formula_data{$symb}->{'Excel:startcell'}=
1.86 matthew 1218: &Spreadsheet::WriteExcel::Utility::xl_rowcol_to_cell
1.90 matthew 1219: ($first_data_row,$cols_output);
1.115 matthew 1220: $formula_data{$symb}->{'Excel:startcol'}=$cols_output;
1.87 matthew 1221: my $count = 0;
1222: if ($chosen_output->{'every_problem'}) {
1.76 matthew 1223: # Put the names of the problems and parts into the sheet
1.115 matthew 1224: foreach my $res (&get_resources($navmap,$seq)) {
1225: if (scalar(@{$res->parts}) > 1) {
1226: foreach my $part (@{$res->parts}) {
1.86 matthew 1227: $excel_sheet->write($resource_name_row,
1.54 matthew 1228: $cols_output++,
1.115 matthew 1229: $res->compTitle.' part '.$res->part_display($part),
1.85 matthew 1230: $format->{'bold'});
1.106 matthew 1231: $count++;
1.54 matthew 1232: }
1233: } else {
1.86 matthew 1234: $excel_sheet->write($resource_name_row,
1.54 matthew 1235: $cols_output++,
1.115 matthew 1236: $res->compTitle,$format->{'bold'});
1.106 matthew 1237: $count++;
1.54 matthew 1238: }
1239: }
1.79 matthew 1240: }
1.87 matthew 1241: # Determine ending cell
1242: if ($count <= 1) {
1.115 matthew 1243: $formula_data{$symb}->{'Excel:endcell'} = $formula_data{$symb}->{'Excel:startcell'};
1244: $formula_data{$symb}->{'Excel:endcol'} = $formula_data{$symb}->{'Excel:startcol'};
1.87 matthew 1245: } else {
1.115 matthew 1246: $formula_data{$symb}->{'Excel:endcell'} =
1.87 matthew 1247: &Spreadsheet::WriteExcel::Utility::xl_rowcol_to_cell
1.90 matthew 1248: ($first_data_row,$cols_output-1);
1.115 matthew 1249: $formula_data{$symb}->{'Excel:endcol'} = $cols_output-1;
1.87 matthew 1250: }
1251: # Create the formula for summing up this sequence
1.115 matthew 1252: if (! exists($formula_data{$symb}->{'Excel:endcell'}) ||
1253: ! defined($formula_data{$symb}->{'Excel:endcell'})) {
1254: $formula_data{$symb}->{'Excel:endcell'} = $formula_data{$symb}->{'Excel:startcell'};
1255: }
1.128 bowersj2 1256:
1.127 bowersj2 1257: my $start = $formula_data{$symb}->{'Excel:startcell'};
1258: my $end = $formula_data{$symb}->{'Excel:endcell'};
1.115 matthew 1259: $formula_data{$symb}->{'Excel:sum'}= $excel_sheet->store_formula
1.127 bowersj2 1260: ("=IF(COUNT($start\:$end),SUM($start\:$end),\"\")");
1.79 matthew 1261: # Determine cell the score is held in
1.115 matthew 1262: $formula_data{$symb}->{'Excel:scorecell'} =
1.79 matthew 1263: &Spreadsheet::WriteExcel::Utility::xl_rowcol_to_cell
1.90 matthew 1264: ($first_data_row,$cols_output);
1.115 matthew 1265: $formula_data{$symb}->{'Excel:scorecol'}=$cols_output;
1.87 matthew 1266: if ($chosen_output->{'base'} eq 'parts correct total') {
1.86 matthew 1267: $excel_sheet->write($resource_name_row,$cols_output++,
1.157 bisitz 1268: &mt('parts correct'),
1.85 matthew 1269: $format->{'bold'});
1.87 matthew 1270: } elsif ($chosen_output->{'sequence_sum'}) {
1271: if ($chosen_output->{'correct'}) {
1272: # Only reporting the number correct, so do not call it score
1273: $excel_sheet->write($resource_name_row,$cols_output++,
1.157 bisitz 1274: &mt('sum'),
1.87 matthew 1275: $format->{'bold'});
1276: } else {
1277: $excel_sheet->write($resource_name_row,$cols_output++,
1.157 bisitz 1278: &mt('score'),
1.87 matthew 1279: $format->{'bold'});
1280: }
1.32 matthew 1281: }
1.79 matthew 1282: #
1283: $total_formula_string.='+'.
1284: &Spreadsheet::WriteExcel::Utility::xl_rowcol_to_cell
1.90 matthew 1285: ($first_data_row,$cols_output-1);
1.87 matthew 1286: if ($chosen_output->{'sequence_max'}) {
1.101 matthew 1287: $excel_sheet->write($resource_name_row,$cols_output,
1.157 bisitz 1288: &mt('maximum'),
1.87 matthew 1289: $format->{'bold'});
1.115 matthew 1290: $formula_data{$symb}->{'Excel:maxcell'} =
1.101 matthew 1291: &Spreadsheet::WriteExcel::Utility::xl_rowcol_to_cell
1292: ($first_data_row,$cols_output);
1.115 matthew 1293: $formula_data{$symb}->{'Excel:maxcol'}=$cols_output;
1.101 matthew 1294: $maximum_formula_string.='+'.
1295: &Spreadsheet::WriteExcel::Utility::xl_rowcol_to_cell
1296: ($first_data_row,$cols_output);
1297: $cols_output++;
1298:
1.87 matthew 1299: }
1300: }
1301: if ($chosen_output->{'grand_total'}) {
1.157 bisitz 1302: $excel_sheet->write($resource_name_row,$cols_output++,&mt('Total'),
1.85 matthew 1303: $format->{'bold'});
1.32 matthew 1304: }
1.101 matthew 1305: if ($chosen_output->{'grand_maximum'}) {
1.157 bisitz 1306: $excel_sheet->write($resource_name_row,$cols_output++,&mt('Max. Total'),
1.101 matthew 1307: $format->{'bold'});
1308: }
1.76 matthew 1309: $total_formula = $excel_sheet->store_formula($total_formula_string);
1.101 matthew 1310: $maximum_formula = $excel_sheet->store_formula($maximum_formula_string);
1.90 matthew 1311: ##############################################
1.87 matthew 1312: # Output a row for MAX, if appropriate
1.90 matthew 1313: ##############################################
1314: if ($chosen_output->{'maximum_row'}) {
1.87 matthew 1315: $cols_output = 0;
1316: foreach my $field (&get_student_fields_to_show()) {
1317: if ($field eq 'username' || $field eq 'fullname' ||
1318: $field eq 'id') {
1319: $excel_sheet->write($maximum_data_row,$cols_output++,'Maximum',
1320: $format->{'bold'});
1321: } else {
1322: $excel_sheet->write($maximum_data_row,$cols_output++,'');
1323: }
1.54 matthew 1324: }
1.87 matthew 1325: #
1326: # Add the maximums for each sequence or assessment
1327: my %total_cell_translation;
1.101 matthew 1328: my %maximum_cell_translation;
1.115 matthew 1329: foreach my $seq (@sequences) {
1330: my $symb = $seq->symb;
1331: $cols_output=$formula_data{$symb}->{'Excel:startcol'};
1332: $total_cell_translation{$formula_data{$symb}->{'Excel:scorecell'}}=
1.87 matthew 1333: &Spreadsheet::WriteExcel::Utility::xl_rowcol_to_cell
1.115 matthew 1334: ($maximum_data_row,$formula_data{$symb}->{'Excel:scorecol'});
1335: $maximum_cell_translation{$formula_data{$symb}->{'Excel:maxcell'}}=
1.101 matthew 1336: &Spreadsheet::WriteExcel::Utility::xl_rowcol_to_cell
1.115 matthew 1337: ($maximum_data_row,$formula_data{$symb}->{'Excel:maxcol'});
1.87 matthew 1338: my $weight;
1339: my $max = 0;
1.115 matthew 1340: foreach my $resource (&get_resources($navmap,$seq)) {
1341: foreach my $part (@{$resource->parts}){
1.87 matthew 1342: $weight = 1;
1343: if ($chosen_output->{'scores'}) {
1344: $weight = &Apache::lonnet::EXT
1.128 bowersj2 1345: ('resource.'.$part.'.weight',$resource->symb,
1.87 matthew 1346: undef,undef,undef);
1347: if (!defined($weight) || ($weight eq '')) {
1348: $weight=1;
1349: }
1350: }
1351: if ($chosen_output->{'scores'} &&
1352: $chosen_output->{'every_problem'}) {
1353: $excel_sheet->write($maximum_data_row,$cols_output++,
1354: $weight);
1.54 matthew 1355: }
1.87 matthew 1356: $max += $weight;
1.54 matthew 1357: }
1.87 matthew 1358: }
1359: #
1360: if ($chosen_output->{'sequence_sum'} &&
1361: $chosen_output->{'every_problem'}) {
1.110 albertel 1362: my %replaceCells=
1.115 matthew 1363: ('^'.$formula_data{$symb}->{'Excel:startcell'}.':'.
1364: $formula_data{$symb}->{'Excel:endcell'}.'$' =>
1365: &Spreadsheet::WriteExcel::Utility::xl_rowcol_to_cell($maximum_data_row,$formula_data{$symb}->{'Excel:startcol'}).':'.
1366: &Spreadsheet::WriteExcel::Utility::xl_rowcol_to_cell($maximum_data_row,$formula_data{$symb}->{'Excel:endcol'}));
1.87 matthew 1367: $excel_sheet->repeat_formula($maximum_data_row,$cols_output++,
1.115 matthew 1368: $formula_data{$symb}->{'Excel:sum'},undef,
1.127 bowersj2 1369: %replaceCells, %replaceCells);
1.110 albertel 1370:
1.87 matthew 1371: } elsif ($chosen_output->{'sequence_sum'}) {
1372: $excel_sheet->write($maximum_data_row,$cols_output++,$max);
1373: }
1374: if ($chosen_output->{'sequence_max'}) {
1375: $excel_sheet->write($maximum_data_row,$cols_output++,$max);
1.45 matthew 1376: }
1.87 matthew 1377: #
1.45 matthew 1378: }
1.87 matthew 1379: if ($chosen_output->{'grand_total'}) {
1.86 matthew 1380: $excel_sheet->repeat_formula($maximum_data_row,$cols_output++,
1.87 matthew 1381: $total_formula,undef,
1382: %total_cell_translation);
1.79 matthew 1383: }
1.101 matthew 1384: if ($chosen_output->{'grand_maximum'}) {
1385: $excel_sheet->repeat_formula($maximum_data_row,$cols_output++,
1386: $maximum_formula,undef,
1.107 matthew 1387: %maximum_cell_translation);
1.101 matthew 1388: }
1.90 matthew 1389: } # End of MAXIMUM row output if ($chosen_output->{'maximum_row'}) {
1.86 matthew 1390: $rows_output = $first_data_row;
1.90 matthew 1391: ##############################################
1392: # Output summary table, which actually is above the sequence name row.
1393: ##############################################
1394: if ($chosen_output->{'summary_table'}) {
1395: $cols_output = 0;
1396: $excel_sheet->write($summary_header_row,$cols_output++,
1.157 bisitz 1397: &mt('Summary Table'),$format->{'bold'});
1.90 matthew 1398: if ($chosen_output->{'maximum_row'}) {
1399: $excel_sheet->write($summary_header_row,$cols_output++,
1.157 bisitz 1400: &mt('Maximum'),$format->{'bold'});
1.90 matthew 1401: }
1402: $excel_sheet->write($summary_header_row,$cols_output++,
1.157 bisitz 1403: &mt('Average'),$format->{'bold'});
1.90 matthew 1404: $excel_sheet->write($summary_header_row,$cols_output++,
1.157 bisitz 1405: &mt('Median'),$format->{'bold'});
1.90 matthew 1406: $excel_sheet->write($summary_header_row,$cols_output++,
1.157 bisitz 1407: &mt('Std Dev'),$format->{'bold'});
1.90 matthew 1408: my $row = $summary_header_row+1;
1.115 matthew 1409: foreach my $seq (@sequences) {
1410: my $symb = $seq->symb;
1.90 matthew 1411: $cols_output = 0;
1412: $excel_sheet->write($row,$cols_output++,
1.115 matthew 1413: $seq->compTitle,
1.90 matthew 1414: $format->{'bold'});
1415: if ($chosen_output->{'maximum_row'}) {
1416: $excel_sheet->write
1417: ($row,$cols_output++,
1418: '='.
1419: &Spreadsheet::WriteExcel::Utility::xl_rowcol_to_cell
1.115 matthew 1420: ($maximum_data_row,$formula_data{$symb}->{'Excel:scorecol'})
1.90 matthew 1421: );
1422: }
1423: my $range =
1424: &Spreadsheet::WriteExcel::Utility::xl_rowcol_to_cell
1.115 matthew 1425: ($first_data_row,$formula_data{$symb}->{'Excel:scorecol'}).
1.90 matthew 1426: ':'.
1427: &Spreadsheet::WriteExcel::Utility::xl_rowcol_to_cell
1.115 matthew 1428: ($first_data_row+$num_students-1,$formula_data{$symb}->{'Excel:scorecol'});
1.90 matthew 1429: $excel_sheet->write($row,$cols_output++,
1430: '=AVERAGE('.$range.')');
1431: $excel_sheet->write($row,$cols_output++,
1432: '=MEDIAN('.$range.')');
1433: $excel_sheet->write($row,$cols_output++,
1434: '=STDEV('.$range.')');
1435: $row++;
1436: }
1437: }
1438: ##############################################
1439: # Take care of non-excel initialization
1440: ##############################################
1.32 matthew 1441: #
1442: # Let the user know what we are doing
1443: my $studentcount = scalar(@Apache::lonstatistics::Students);
1.121 albertel 1444: if ($env{'form.SelectedStudent'}) {
1.85 matthew 1445: $studentcount = '1';
1446: }
1.153 bisitz 1447: $r->print('<p>'
1448: .&mt('Compiling Excel spreadsheet for [quant,_1,student]...',$studentcount)
1449: ."</p>\n"
1450: );
1.32 matthew 1451: $r->rflush();
1.31 matthew 1452: #
1.36 matthew 1453: # Initialize progress window
1454: %prog_state=&Apache::lonhtmlcommon::Create_PrgWin
1455: ($r,'Excel File Compilation Status',
1.108 matthew 1456: 'Excel File Compilation Progress', $studentcount,
1457: 'inline',undef,'Statistics','stats_status');
1.36 matthew 1458: #
1.62 matthew 1459: &Apache::lonhtmlcommon::Update_PrgWin($r,\%prog_state,
1460: 'Processing first student');
1.31 matthew 1461: return;
1462: }
1463:
1464: sub excel_outputstudent {
1465: my ($r,$student) = @_;
1.115 matthew 1466: if ($request_aborted || ! defined($navmap) || ! defined($excel_sheet)) {
1467: return;
1468: }
1.32 matthew 1469: $cols_output=0;
1470: #
1471: # Write out student data
1472: my @to_show = &get_student_fields_to_show();
1473: foreach my $field (@to_show) {
1.103 matthew 1474: my $value = $student->{$field};
1475: if ($field eq 'comments') {
1.136 albertel 1476: $value = &Apache::lonmsgdisplay::retrieve_instructor_comments
1.103 matthew 1477: ($student->{'username'},$student->{'domain'});
1478: }
1479: $excel_sheet->write($rows_output,$cols_output++,$value);
1.32 matthew 1480: }
1481: #
1482: # Get student assessment data
1483: my %StudentsData;
1484: my @tmp = &Apache::loncoursedata::get_current_state($student->{'username'},
1485: $student->{'domain'},
1486: undef,
1.121 albertel 1487: $env{'request.course.id'});
1.32 matthew 1488: if ((scalar @tmp > 0) && ($tmp[0] !~ /^error:/)) {
1489: %StudentsData = @tmp;
1490: }
1491: #
1492: # Write out sequence scores and totals data
1.76 matthew 1493: my %total_cell_translation;
1.101 matthew 1494: my %maximum_cell_translation;
1.115 matthew 1495: foreach my $seq (@sequences) {
1496: my $symb = $seq->symb;
1497: $cols_output = $formula_data{$symb}->{'Excel:startcol'};
1.76 matthew 1498: # Keep track of cells to translate in total cell
1.115 matthew 1499: $total_cell_translation{$formula_data{$symb}->{'Excel:scorecell'}} =
1.76 matthew 1500: &Spreadsheet::WriteExcel::Utility::xl_rowcol_to_cell
1.115 matthew 1501: ($rows_output,$formula_data{$symb}->{'Excel:scorecol'});
1.107 matthew 1502: # and maximum cell
1.115 matthew 1503: $maximum_cell_translation{$formula_data{$symb}->{'Excel:maxcell'}} =
1.107 matthew 1504: &Spreadsheet::WriteExcel::Utility::xl_rowcol_to_cell
1.115 matthew 1505: ($rows_output,$formula_data{$symb}->{'Excel:maxcol'});
1.76 matthew 1506: #
1.54 matthew 1507: my ($performance,$performance_length,$score,$seq_max,$rawdata);
1.87 matthew 1508: if ($chosen_output->{'tries'} || $chosen_output->{'correct'}){
1.54 matthew 1509: ($performance,$performance_length,$score,$seq_max,$rawdata) =
1.115 matthew 1510: &student_tries_on_sequence($student,\%StudentsData,
1511: $navmap,$seq,'no');
1.54 matthew 1512: } else {
1513: ($performance,$performance_length,$score,$seq_max,$rawdata) =
1.115 matthew 1514: &student_performance_on_sequence($student,\%StudentsData,
1.129 bowersj2 1515: $navmap,$seq,'no',
1516: $chosen_output->{ignore_weight});
1.87 matthew 1517: }
1518: if ($chosen_output->{'every_problem'}) {
1519: if ($chosen_output->{'correct'}) {
1520: # only indiciate if each item is correct or not
1521: foreach my $value (@$rawdata) {
1.126 bowersj2 1522: # positive means correct, 0 or negative means
1523: # incorrect
1524: $value = $value > 0 ? 1 : 0;
1.87 matthew 1525: $excel_sheet->write($rows_output,$cols_output++,$value);
1526: }
1527: } else {
1528: foreach my $value (@$rawdata) {
1.97 matthew 1529: if ($score eq ' ' || !defined($value)) {
1530: $cols_output++;
1531: } else {
1532: $excel_sheet->write($rows_output,$cols_output++,
1533: $value);
1534: }
1.87 matthew 1535: }
1536: }
1.54 matthew 1537: }
1.87 matthew 1538: if ($chosen_output->{'sequence_sum'} &&
1539: $chosen_output->{'every_problem'}) {
1.76 matthew 1540: # Write a formula for the sum of this sequence
1.110 albertel 1541: my %replaceCells=
1.115 matthew 1542: ('^'.$formula_data{$symb}->{'Excel:startcell'}.':'.$formula_data{$symb}->{'Excel:endcell'}.'$'
1.110 albertel 1543: =>
1.115 matthew 1544: &Spreadsheet::WriteExcel::Utility::xl_rowcol_to_cell($rows_output,$formula_data{$symb}->{'Excel:startcol'}).':'.
1545: &Spreadsheet::WriteExcel::Utility::xl_rowcol_to_cell($rows_output,$formula_data{$symb}->{'Excel:endcol'})
1.110 albertel 1546: );
1547: # The undef is for the format
1548: $excel_sheet->repeat_formula($rows_output,$cols_output++,
1.115 matthew 1549: $formula_data{$symb}->{'Excel:sum'},undef,
1.127 bowersj2 1550: %replaceCells, %replaceCells);
1.87 matthew 1551: } elsif ($chosen_output->{'sequence_sum'}) {
1.97 matthew 1552: if ($score eq ' ') {
1553: $cols_output++;
1554: } else {
1555: $excel_sheet->write($rows_output,$cols_output++,$score);
1556: }
1.32 matthew 1557: }
1.87 matthew 1558: if ($chosen_output->{'sequence_max'}) {
1.32 matthew 1559: $excel_sheet->write($rows_output,$cols_output++,$seq_max);
1560: }
1561: }
1.76 matthew 1562: #
1.87 matthew 1563: if ($chosen_output->{'grand_total'}) {
1564: $excel_sheet->repeat_formula($rows_output,$cols_output++,
1565: $total_formula,undef,
1566: %total_cell_translation);
1567: }
1.101 matthew 1568: if ($chosen_output->{'grand_maximum'}) {
1569: $excel_sheet->repeat_formula($rows_output,$cols_output++,
1570: $maximum_formula,undef,
1.107 matthew 1571: %maximum_cell_translation);
1.101 matthew 1572: }
1.32 matthew 1573: #
1574: # Bookkeeping
1575: $rows_output++;
1576: $cols_output=0;
1577: #
1.36 matthew 1578: # Update the progress window
1579: &Apache::lonhtmlcommon::Increment_PrgWin($r,\%prog_state,'last student');
1.32 matthew 1580: return;
1.31 matthew 1581: }
1582:
1583: sub excel_finish {
1584: my ($r) = @_;
1.115 matthew 1585: if ($request_aborted || ! defined($navmap) || ! defined($excel_sheet)) {
1.125 albertel 1586: &excel_cleanup();
1.115 matthew 1587: return;
1588: }
1.32 matthew 1589: #
1590: # Write the excel file
1591: $excel_workbook->close();
1592: #
1.36 matthew 1593: # Close the progress window
1594: &Apache::lonhtmlcommon::Close_PrgWin($r,\%prog_state);
1595: #
1.32 matthew 1596: # Tell the user where to get their excel file
1.36 matthew 1597: $r->print('<br />'.
1.153 bisitz 1598: '<a href="'.$filename.'">'.&mt('Your Excel spreadsheet').'</a>'."\n");
1.32 matthew 1599: $r->rflush();
1.125 albertel 1600: &excel_cleanup();
1.32 matthew 1601: return;
1.31 matthew 1602: }
1603:
1604: }
1.30 matthew 1605: #######################################################
1606: #######################################################
1607:
1608: =pod
1609:
1.31 matthew 1610: =head2 CSV output routines
1611:
1612: =item &csv_initialize($r)
1613:
1614: =item &csv_outputstudent($r,$student)
1615:
1616: =item &csv_finish($r)
1.30 matthew 1617:
1618: =cut
1619:
1620: #######################################################
1621: #######################################################
1.31 matthew 1622: {
1623:
1.37 matthew 1624: my $outputfile;
1625: my $filename;
1.54 matthew 1626: my $request_aborted;
1.37 matthew 1627: my %prog_state; # progress window state
1.115 matthew 1628: my $navmap;
1629: my @sequences;
1.37 matthew 1630:
1.125 albertel 1631: sub csv_cleanup {
1.66 matthew 1632: undef($outputfile);
1633: undef($filename);
1634: undef($request_aborted);
1.37 matthew 1635: undef(%prog_state);
1636: #
1.115 matthew 1637: undef($navmap);
1638: undef(@sequences);
1.125 albertel 1639: }
1640:
1641: sub csv_initialize{
1642: my ($r) = @_;
1643:
1644: &csv_cleanup();
1.115 matthew 1645: ($navmap,@sequences) =
1646: &Apache::lonstatistics::selected_sequences_with_assessments();
1647: if (! ref($navmap)) {
1648: # Unable to get data, so bail out
1649: $r->print("<h3>".
1650: &mt('Unable to retrieve course information.').
1651: '</h3>');
1652: }
1653: #
1.54 matthew 1654: # Deal with unimplemented requests
1655: $request_aborted = undef;
1.87 matthew 1656: if ($chosen_output->{'base'} =~ /final table/) {
1.54 matthew 1657: $r->print(<<END);
1658: <h2>Unable to Complete Request</h2>
1659: <p>
1660: The <b>Summary Table (Scores)</b> option is not available for non-HTML output.
1661: </p>
1662: END
1663: $request_aborted = 1;
1664: }
1665: return if ($request_aborted);
1.87 matthew 1666: #
1667: # Initialize progress window
1668: my $studentcount = scalar(@Apache::lonstatistics::Students);
1669: %prog_state=&Apache::lonhtmlcommon::Create_PrgWin
1670: ($r,'CSV File Compilation Status',
1.108 matthew 1671: 'CSV File Compilation Progress', $studentcount,
1672: 'inline',undef,'Statistics','stats_status');
1.54 matthew 1673: #
1.37 matthew 1674: # Open a file
1.120 matthew 1675: ($outputfile,$filename) = &Apache::loncommon::create_text_file($r,'csv');
1676: if (! defined($outputfile)) { return ''; }
1.38 matthew 1677: #
1678: # Datestamp
1.121 albertel 1679: my $description = $env{'course.'.$env{'request.course.id'}.'.description'};
1.38 matthew 1680: print $outputfile '"'.&Apache::loncommon::csv_translate($description).'",'.
1681: '"'.&Apache::loncommon::csv_translate(scalar(localtime(time))).'"'.
1682: "\n";
1.120 matthew 1683: print $outputfile '"'.
1684: &Apache::loncommon::csv_translate
1685: (&Apache::lonstatistics::section_and_enrollment_description()).
1686: '"'."\n";
1.109 matthew 1687: foreach my $item ('shortdesc','non_html_notes') {
1688: next if (! exists($chosen_output->{$item}));
1689: print $outputfile
1690: '"'.&Apache::loncommon::csv_translate($chosen_output->{$item}).'"'.
1691: "\n";
1692: }
1.37 matthew 1693: #
1694: # Print out the headings
1.87 matthew 1695: my $sequence_row = '';
1696: my $resource_row = undef;
1.37 matthew 1697: foreach my $field (&get_student_fields_to_show()) {
1.87 matthew 1698: $sequence_row .='"",';
1699: $resource_row .= '"'.&Apache::loncommon::csv_translate($field).'",';
1.37 matthew 1700: }
1.115 matthew 1701: foreach my $seq (@sequences) {
1.87 matthew 1702: $sequence_row .= '"'.
1.115 matthew 1703: &Apache::loncommon::csv_translate($seq->compTitle).'",';
1.87 matthew 1704: my $count = 0;
1705: if ($chosen_output->{'every_problem'}) {
1.116 matthew 1706: foreach my $res (&get_resources($navmap,$seq)) {
1.115 matthew 1707: if (scalar(@{$res->parts}) < 1) {
1.87 matthew 1708: next;
1709: }
1.115 matthew 1710: foreach my $part (@{$res->parts}) {
1.87 matthew 1711: $resource_row .= '"'.
1.115 matthew 1712: &Apache::loncommon::csv_translate
1713: ($res->compTitle.', Part '.$res->part_display($part)).'",';
1.87 matthew 1714: $count++;
1.53 matthew 1715: }
1716: }
1.37 matthew 1717: }
1.87 matthew 1718: $sequence_row.='"",'x$count;
1719: if ($chosen_output->{'sequence_sum'}) {
1720: if($chosen_output->{'correct'}) {
1.157 bisitz 1721: $resource_row .= '"'.&mt('sum').'",';
1.87 matthew 1722: } else {
1.157 bisitz 1723: $resource_row .= '"'.&mt('score').'",';
1.87 matthew 1724: }
1725: }
1726: if ($chosen_output->{'sequence_max'}) {
1727: $sequence_row.= '"",';
1.157 bisitz 1728: $resource_row .= '"'.&mt('maximum possible').'",';
1.87 matthew 1729: }
1.37 matthew 1730: }
1.87 matthew 1731: if ($chosen_output->{'grand_total'}) {
1732: $sequence_row.= '"",';
1.157 bisitz 1733: $resource_row.= '"'.&mt('Total').'",';
1.87 matthew 1734: }
1.101 matthew 1735: if ($chosen_output->{'grand_maximum'}) {
1736: $sequence_row.= '"",';
1.157 bisitz 1737: $resource_row.= '"'.&mt('Maximum').'",';
1.101 matthew 1738: }
1.87 matthew 1739: chomp($sequence_row);
1740: chomp($resource_row);
1741: print $outputfile $sequence_row."\n";
1742: print $outputfile $resource_row."\n";
1.31 matthew 1743: return;
1744: }
1745:
1746: sub csv_outputstudent {
1747: my ($r,$student) = @_;
1.115 matthew 1748: if ($request_aborted || ! defined($navmap) || ! defined($outputfile)) {
1749: return;
1750: }
1.37 matthew 1751: my $Str = '';
1752: #
1753: # Output student fields
1754: my @to_show = &get_student_fields_to_show();
1755: foreach my $field (@to_show) {
1.103 matthew 1756: my $value = $student->{$field};
1757: if ($field eq 'comments') {
1.136 albertel 1758: $value = &Apache::lonmsgdisplay::retrieve_instructor_comments
1.103 matthew 1759: ($student->{'username'},$student->{'domain'});
1760: }
1761: $Str .= '"'.&Apache::loncommon::csv_translate($value).'",';
1.37 matthew 1762: }
1763: #
1764: # Get student assessment data
1765: my %StudentsData;
1766: my @tmp = &Apache::loncoursedata::get_current_state($student->{'username'},
1767: $student->{'domain'},
1768: undef,
1.121 albertel 1769: $env{'request.course.id'});
1.37 matthew 1770: if ((scalar @tmp > 0) && ($tmp[0] !~ /^error:/)) {
1771: %StudentsData = @tmp;
1772: }
1773: #
1774: # Output performance data
1.87 matthew 1775: my $total = 0;
1.101 matthew 1776: my $maximum = 0;
1.115 matthew 1777: foreach my $seq (@sequences) {
1.54 matthew 1778: my ($performance,$performance_length,$score,$seq_max,$rawdata);
1.87 matthew 1779: if ($chosen_output->{'tries'}){
1.54 matthew 1780: ($performance,$performance_length,$score,$seq_max,$rawdata) =
1.115 matthew 1781: &student_tries_on_sequence($student,\%StudentsData,
1782: $navmap,$seq,'no');
1.54 matthew 1783: } else {
1784: ($performance,$performance_length,$score,$seq_max,$rawdata) =
1.115 matthew 1785: &student_performance_on_sequence($student,\%StudentsData,
1.129 bowersj2 1786: $navmap,$seq,'no',
1787: $chosen_output->{ignore_weight});
1.54 matthew 1788: }
1.87 matthew 1789: if ($chosen_output->{'every_problem'}) {
1790: if ($chosen_output->{'correct'}) {
1791: $score = 0;
1792: # Deal with number of parts correct data
1793: $Str .= '"'.join('","',( map { if ($_>0) {
1794: $score += 1;
1795: 1;
1796: } else {
1797: 0;
1798: }
1799: } @$rawdata)).'",';
1800: } else {
1801: $Str .= '"'.join('","',(@$rawdata)).'",';
1802: }
1803: }
1804: if ($chosen_output->{'sequence_sum'}) {
1.37 matthew 1805: $Str .= '"'.$score.'",';
1.87 matthew 1806: }
1807: if ($chosen_output->{'sequence_max'}) {
1808: $Str .= '"'.$seq_max.'",';
1.37 matthew 1809: }
1.87 matthew 1810: $total+=$score;
1.101 matthew 1811: $maximum += $seq_max;
1.87 matthew 1812: }
1813: if ($chosen_output->{'grand_total'}) {
1814: $Str .= '"'.$total.'",';
1.101 matthew 1815: }
1816: if ($chosen_output->{'grand_maximum'}) {
1817: $Str .= '"'.$maximum.'",';
1.37 matthew 1818: }
1819: chop($Str);
1820: $Str .= "\n";
1821: print $outputfile $Str;
1822: #
1823: # Update the progress window
1824: &Apache::lonhtmlcommon::Increment_PrgWin($r,\%prog_state,'last student');
1825: return;
1.31 matthew 1826: }
1827:
1828: sub csv_finish {
1829: my ($r) = @_;
1.115 matthew 1830: if ($request_aborted || ! defined($navmap) || ! defined($outputfile)) {
1.125 albertel 1831: &csv_cleanup();
1.115 matthew 1832: return;
1833: }
1.37 matthew 1834: close($outputfile);
1835: #
1836: # Close the progress window
1837: &Apache::lonhtmlcommon::Close_PrgWin($r,\%prog_state);
1838: #
1839: # Tell the user where to get their csv file
1840: $r->print('<br />'.
1.147 bisitz 1841: '<a href="'.$filename.'">'.&mt('Your CSV file.').'</a>'."\n");
1.37 matthew 1842: $r->rflush();
1.125 albertel 1843: &csv_cleanup();
1.37 matthew 1844: return;
1845:
1.31 matthew 1846: }
1.2 stredwic 1847:
1848: }
1849:
1.132 bowersj2 1850: # This function will return an HTML string including a star, with
1851: # a mouseover popup showing the "real" value. An optional second
1852: # argument lets you show something other than a star.
1853: sub show_star {
1854: my $popup = shift;
1855: my $symbol = shift || '*';
1856: # Escape the popup for JS.
1857: $popup =~ s/([^-a-zA-Z0-9:;,._ ()|!\/?=&*])/'\\' . sprintf("%lo", ord($1))/ge;
1858:
1.142 albertel 1859: return "<span class=\"LC_chrt_popup_exists\" onmouseover='popup_score(this, \"$popup\");return false;' onmouseout='popdown_score();return false;'>$symbol</span>";
1.132 bowersj2 1860: }
1861:
1.28 matthew 1862: #######################################################
1863: #######################################################
1864:
1.2 stredwic 1865: =pod
1866:
1.54 matthew 1867: =item &StudentTriesOnSequence()
1.2 stredwic 1868:
1.30 matthew 1869: Inputs:
1.2 stredwic 1870:
1871: =over 4
1872:
1.30 matthew 1873: =item $student
1.28 matthew 1874:
1.30 matthew 1875: =item $studentdata Hash ref to all student data
1.2 stredwic 1876:
1.30 matthew 1877: =item $seq Hash ref, the sequence we are working on
1.2 stredwic 1878:
1.30 matthew 1879: =item $links if defined we will output links to each resource.
1.2 stredwic 1880:
1.28 matthew 1881: =back
1.2 stredwic 1882:
1883: =cut
1.1 stredwic 1884:
1.28 matthew 1885: #######################################################
1886: #######################################################
1.112 matthew 1887: sub student_tries_on_sequence {
1888: my ($student,$studentdata,$navmap,$seq,$links) = @_;
1.31 matthew 1889: $links = 'no' if (! defined($links));
1.1 stredwic 1890: my $Str = '';
1.30 matthew 1891: my ($sum,$max) = (0,0);
1.51 matthew 1892: my $performance_length = 0;
1.54 matthew 1893: my @TriesData = ();
1894: my $tries;
1.97 matthew 1895: my $hasdata = 0; # flag - true if the student has any data on the sequence
1.115 matthew 1896: foreach my $resource (&get_resources($navmap,$seq)) {
1.112 matthew 1897: my $resource_data = $studentdata->{$resource->symb};
1.30 matthew 1898: my $value = '';
1.112 matthew 1899: foreach my $partnum (@{$resource->parts()}) {
1.54 matthew 1900: $tries = undef;
1.30 matthew 1901: $max++;
1.51 matthew 1902: $performance_length++;
1.30 matthew 1903: my $symbol = ' '; # default to space
1904: #
1.78 matthew 1905: my $awarded = 0;
1906: if (exists($resource_data->{'resource.'.$partnum.'.awarded'})) {
1907: $awarded = $resource_data->{'resource.'.$partnum.'.awarded'};
1908: $awarded = 0 if (! $awarded);
1909: }
1910: #
1911: my $status = '';
1.30 matthew 1912: if (exists($resource_data->{'resource.'.$partnum.'.solved'})) {
1.78 matthew 1913: $status = $resource_data->{'resource.'.$partnum.'.solved'};
1914: }
1915: #
1916: my $tries = 0;
1917: if(exists($resource_data->{'resource.'.$partnum.'.tries'})) {
1918: $tries = $resource_data->{'resource.'.$partnum.'.tries'};
1.97 matthew 1919: $hasdata =1;
1.78 matthew 1920: }
1921: #
1922: if ($awarded > 0) {
1923: # The student has gotten the problem correct to some degree
1924: if ($status eq 'excused') {
1925: $symbol = 'x';
1926: $max--;
1.137 albertel 1927: } elsif ($status eq 'correct_by_override' && !$resource->is_task()) {
1.30 matthew 1928: $symbol = '+';
1929: $sum++;
1.78 matthew 1930: } elsif ($tries > 0) {
1.54 matthew 1931: if ($tries > 9) {
1.132 bowersj2 1932: $symbol = show_star($tries);
1.78 matthew 1933: } else {
1.54 matthew 1934: $symbol = $tries;
1.30 matthew 1935: }
1936: $sum++;
1937: } else {
1.78 matthew 1938: $symbol = '+';
1939: $sum++;
1.2 stredwic 1940: }
1.30 matthew 1941: } else {
1.78 matthew 1942: # The student has the problem incorrect or it is ungraded
1943: if ($status eq 'excused') {
1944: $symbol = 'x';
1945: $max--;
1946: } elsif ($status eq 'incorrect_by_override') {
1947: $symbol = '-';
1948: } elsif ($status eq 'ungraded_attempted') {
1.124 matthew 1949: $symbol = 'u';
1.78 matthew 1950: } elsif ($status eq 'incorrect_attempted' ||
1951: $tries > 0) {
1.30 matthew 1952: $symbol = '.';
1953: } else {
1.78 matthew 1954: # Problem is wrong and has not been attempted.
1955: $symbol=' ';
1.18 matthew 1956: }
1.2 stredwic 1957: }
1.54 matthew 1958: #
1.109 matthew 1959: if (! defined($tries)) {
1960: $tries = 0;
1961: }
1962: if ($status =~ /^(incorrect|ungraded)/) {
1963: # Bug 3390: show '-' for tries on incorrect problems
1964: # (csv & excel only)
1965: push(@TriesData,-$tries);
1966: } else {
1967: push (@TriesData,$tries);
1.54 matthew 1968: }
1.30 matthew 1969: #
1.47 matthew 1970: if ( ($links eq 'yes' && $symbol ne ' ') ||
1971: ($links eq 'all')) {
1.134 bowersj2 1972: my $link = '/adm/grades'.
1.148 raeburn 1973: '?symb='.&escape($resource->shown_symb).
1.30 matthew 1974: '&student='.$student->{'username'}.
1.64 albertel 1975: '&userdom='.$student->{'domain'}.
1.134 bowersj2 1976: '&command=submission';
1977: $symbol = &link($symbol, $link);
1.30 matthew 1978: }
1979: $value .= $symbol;
1.2 stredwic 1980: }
1.30 matthew 1981: $Str .= $value;
1.17 minaeibi 1982: }
1.112 matthew 1983: if ($seq->randompick()) {
1984: $max = $seq->randompick();
1.51 matthew 1985: }
1.97 matthew 1986: if (! $hasdata && $sum == 0) {
1987: $sum = ' ';
1988: }
1.54 matthew 1989: return ($Str,$performance_length,$sum,$max,\@TriesData);
1990: }
1991:
1.134 bowersj2 1992: =pod
1993:
1994: =item &link
1995:
1996: Inputs:
1997:
1998: =over 4
1999:
2000: =item $text
2001:
2002: =item $target
2003:
2004: =back
2005:
2006: Takes the text and creates a link to the $text that honors
2007: the value of 'new window' if clicked on, but uses a real
2008: 'href' so middle and right clicks still work.
2009:
2010: $target and $text are assumed to be already correctly escaped; i.e., it
2011: can be dumped out directly into the output stream as-is.
2012:
2013: =cut
2014:
2015: sub link {
2016: my ($text,$target) = @_;
2017: return
2018: "<a href='$target' onclick=\"t=this.href;if(new_window)"
2019: ."{window.open(t)}else{return void(window."
2020: ."location=t)};return false;\">$text</a>";
2021: }
2022:
1.54 matthew 2023: #######################################################
2024: #######################################################
2025:
2026: =pod
2027:
1.115 matthew 2028: =item &student_performance_on_sequence
1.54 matthew 2029:
2030: Inputs:
2031:
2032: =over 4
2033:
2034: =item $student
2035:
2036: =item $studentdata Hash ref to all student data
2037:
2038: =item $seq Hash ref, the sequence we are working on
2039:
2040: =item $links if defined we will output links to each resource.
2041:
2042: =back
2043:
2044: =cut
2045:
2046: #######################################################
2047: #######################################################
1.112 matthew 2048: sub student_performance_on_sequence {
1.129 bowersj2 2049: my ($student,$studentdata,$navmap,$seq,$links,$awarded_only) = @_;
1.54 matthew 2050: $links = 'no' if (! defined($links));
2051: my $Str = ''; # final result string
2052: my ($score,$max) = (0,0);
2053: my $performance_length = 0;
2054: my $symbol;
2055: my @ScoreData = ();
2056: my $partscore;
1.97 matthew 2057: my $hasdata = 0; # flag, 0 if there were no submissions on the sequence
1.115 matthew 2058: foreach my $resource (&get_resources($navmap,$seq)) {
1.112 matthew 2059: my $symb = $resource->symb;
2060: my $resource_data = $studentdata->{$symb};
2061: foreach my $part (@{$resource->parts()}) {
1.54 matthew 2062: $partscore = undef;
1.129 bowersj2 2063: my $weight;
2064: if (!$awarded_only){
2065: $weight = &Apache::lonnet::EXT('resource.'.$part.'.weight',
2066: $symb,
2067: $student->{'domain'},
2068: $student->{'username'},
2069: $student->{'section'});
2070: }
1.54 matthew 2071: if (!defined($weight) || ($weight eq '')) {
2072: $weight=1;
2073: }
2074: #
2075: $max += $weight; # see the 'excused' branch below...
2076: $performance_length++; # one character per part
2077: $symbol = ' '; # default to space
2078: #
1.97 matthew 2079: my $awarded;
1.54 matthew 2080: if (exists($resource_data->{'resource.'.$part.'.awarded'})) {
2081: $awarded = $resource_data->{'resource.'.$part.'.awarded'};
1.67 matthew 2082: $awarded = 0 if (! $awarded);
1.97 matthew 2083: $hasdata = 1;
1.54 matthew 2084: }
2085: #
1.131 albertel 2086: $partscore = &Apache::grades::compute_points($weight,$awarded);
1.97 matthew 2087: if (! defined($awarded)) {
2088: $partscore = undef;
2089: }
1.54 matthew 2090: $score += $partscore;
1.63 matthew 2091: $symbol = $partscore;
1.70 matthew 2092: if (abs($symbol - sprintf("%.0f",$symbol)) < 0.001) {
2093: $symbol = sprintf("%.0f",$symbol);
2094: }
1.54 matthew 2095: if (length($symbol) > 1) {
1.132 bowersj2 2096: $symbol = show_star($symbol);
1.54 matthew 2097: }
1.124 matthew 2098: if (exists($resource_data->{'resource.'.$part.'.solved'}) &&
2099: $resource_data->{'resource.'.$part.'.solved'} ne '') {
1.54 matthew 2100: my $status = $resource_data->{'resource.'.$part.'.solved'};
2101: if ($status eq 'excused') {
2102: $symbol = 'x';
2103: $max -= $weight; # Do not count 'excused' problems.
1.124 matthew 2104: } elsif ($status eq 'ungraded_attempted') {
2105: $symbol = 'u';
1.54 matthew 2106: }
1.97 matthew 2107: $hasdata = 1;
1.124 matthew 2108: } elsif ($resource_data->{'resource.'.$part.'.award'} eq 'DRAFT') {
2109: $symbol = 'd';
2110: $hasdata = 1;
1.111 matthew 2111: } elsif (!exists($resource_data->{'resource.'.$part.'.awarded'})){
1.54 matthew 2112: # Unsolved. Did they try?
2113: if (exists($resource_data->{'resource.'.$part.'.tries'})){
2114: $symbol = '.';
1.97 matthew 2115: $hasdata = 1;
1.54 matthew 2116: } else {
2117: $symbol = ' ';
2118: }
2119: }
2120: #
1.60 matthew 2121: if (! defined($partscore)) {
2122: $partscore = $symbol;
2123: }
2124: push (@ScoreData,$partscore);
2125: #
1.54 matthew 2126: if ( ($links eq 'yes' && $symbol ne ' ') || ($links eq 'all')) {
1.134 bowersj2 2127: my $link = '/adm/grades' .
1.148 raeburn 2128: '?symb='.&escape($resource->shown_symb).
1.54 matthew 2129: '&student='.$student->{'username'}.
1.64 albertel 2130: '&userdom='.$student->{'domain'}.
1.134 bowersj2 2131: '&command=submission';
2132: $symbol = &link($symbol, $link);
1.54 matthew 2133: }
1.60 matthew 2134: $Str .= $symbol;
1.54 matthew 2135: }
1.97 matthew 2136: }
2137: if (! $hasdata && $score == 0) {
2138: $score = ' ';
1.54 matthew 2139: }
2140: return ($Str,$performance_length,$score,$max,\@ScoreData);
1.1 stredwic 2141: }
1.23 minaeibi 2142:
1.28 matthew 2143: #######################################################
2144: #######################################################
1.23 minaeibi 2145:
1.2 stredwic 2146: =pod
2147:
2148: =item &CreateLegend()
2149:
2150: This function returns a formatted string containing the legend for the
2151: chart. The legend describes the symbols used to represent grades for
2152: problems.
2153:
2154: =cut
2155:
1.28 matthew 2156: #######################################################
2157: #######################################################
1.2 stredwic 2158: sub CreateLegend {
2159: my $Str = "<p><pre>".
1.124 matthew 2160: " digit score or number of tries to get correct ".
1.12 minaeibi 2161: " * correct by student in more than 9 tries\n".
1.20 minaeibi 2162: " + correct by hand grading or override\n".
1.12 minaeibi 2163: " - incorrect by override\n".
2164: " . incorrect attempted\n".
1.124 matthew 2165: " u ungraded attempted\n".
2166: " d draft answer saved but not submitted\n".
1.13 minaeibi 2167: " not attempted (blank field)\n".
1.12 minaeibi 2168: " x excused".
1.17 minaeibi 2169: "</pre><p>";
1.2 stredwic 2170: return $Str;
2171: }
2172:
1.28 matthew 2173: #######################################################
2174: #######################################################
2175:
1.30 matthew 2176: =pod
1.2 stredwic 2177:
2178: =back
2179:
2180: =cut
2181:
1.28 matthew 2182: #######################################################
2183: #######################################################
1.2 stredwic 2184:
1.28 matthew 2185: 1;
1.2 stredwic 2186:
1.1 stredwic 2187: __END__
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>