Annotation of loncom/interface/statistics/lonstudentassessment.pm, revision 1.72

1.1       stredwic    1: # The LearningOnline Network with CAPA
                      2: #
1.72    ! matthew     3: # $Id: lonstudentassessment.pm,v 1.71 2003/10/21 21:23:53 matthew 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.28      matthew    53: use Apache::lonstatistics;
1.1       stredwic   54: use Apache::lonhtmlcommon;
                     55: use Apache::loncoursedata;
1.28      matthew    56: use Apache::lonnet; # for logging porpoises
1.31      matthew    57: use Spreadsheet::WriteExcel;
                     58: 
                     59: #######################################################
                     60: #######################################################
                     61: =pod
                     62: 
                     63: =item Package Variables
                     64: 
                     65: =over 4
                     66: 
                     67: =item $Statistics Hash ref to store student data.  Indexed by symb,
                     68:       contains hashes with keys 'score' and 'max'.
                     69: 
                     70: =cut
                     71: 
                     72: #######################################################
                     73: #######################################################
1.1       stredwic   74: 
1.30      matthew    75: my $Statistics;
                     76: 
1.28      matthew    77: #######################################################
                     78: #######################################################
                     79: 
                     80: =pod
                     81: 
1.31      matthew    82: =item $show_links 'yes' or 'no' for linking to student performance data
                     83: 
                     84: =item $output_mode 'html', 'excel', or 'csv' for output mode
                     85: 
1.32      matthew    86: =item $show 'all', 'totals', or 'scores' determines how much data is output
1.31      matthew    87: 
1.54      matthew    88: =item $data  determines what performance data is shown
                     89: 
                     90: =item $datadescription A short description of the output data selected.
                     91: 
                     92: =item $base 'tries' or 'scores' determines the base of the performance shown
                     93: 
1.49      matthew    94: =item $single_student_mode evaluates to true if we are showing only one
                     95: student.
                     96: 
1.31      matthew    97: =cut
                     98: 
                     99: #######################################################
                    100: #######################################################
                    101: my $show_links;
                    102: my $output_mode;
1.54      matthew   103: my $data;
                    104: my $base;
                    105: my $datadescription;
1.49      matthew   106: my $single_student_mode;
1.28      matthew   107: 
1.31      matthew   108: #######################################################
                    109: #######################################################
                    110: # End of package variable declarations
1.28      matthew   111: 
1.31      matthew   112: =pod
1.28      matthew   113: 
1.31      matthew   114: =back
1.28      matthew   115: 
1.31      matthew   116: =cut
1.28      matthew   117: 
1.31      matthew   118: #######################################################
                    119: #######################################################
1.28      matthew   120: 
1.31      matthew   121: =pod
1.28      matthew   122: 
1.31      matthew   123: =item &BuildStudentAssessmentPage()
1.28      matthew   124: 
1.31      matthew   125: Inputs: 
1.4       stredwic  126: 
1.31      matthew   127: =over 4
1.28      matthew   128: 
                    129: =item $r Apache Request
                    130: 
                    131: =item $c Apache Connection 
                    132: 
                    133: =back
                    134: 
                    135: =cut
                    136: 
                    137: #######################################################
                    138: #######################################################
1.1       stredwic  139: sub BuildStudentAssessmentPage {
1.30      matthew   140:     my ($r,$c)=@_;
1.65      matthew   141: 
1.30      matthew   142:     undef($Statistics);
1.66      matthew   143:     undef($show_links);
                    144:     undef($output_mode);
                    145:     undef($data);
                    146:     undef($base);
                    147:     undef($datadescription);
                    148:     undef($single_student_mode);
1.65      matthew   149: 
                    150:     $single_student_mode = 0;
1.49      matthew   151:     $single_student_mode = 1 if ($ENV{'form.SelectedStudent'});
1.59      matthew   152:     if ($ENV{'form.selectstudent'}) {
                    153:         &Apache::lonstatistics::DisplayClasslist($r);
                    154:         return;
                    155:     }
1.30      matthew   156:     #
1.31      matthew   157:     # Print out the HTML headers for the interface
                    158:     #    This also parses the output mode selector
1.54      matthew   159:     #    This step must *always* be done.
1.30      matthew   160:     $r->print(&CreateInterface());
1.31      matthew   161:     $r->print('<input type="hidden" name="notfirstrun" value="true" />');
1.49      matthew   162:     $r->print('<input type="hidden" name="sort" value="'.
                    163:               $ENV{'form.sort'}.'" />');
1.7       stredwic  164:     $r->rflush();
1.58      matthew   165:     #
1.49      matthew   166:     if (! exists($ENV{'form.notfirstrun'}) && ! $single_student_mode) {
1.31      matthew   167:         return;
                    168:     }
                    169:     #
                    170:     my $initialize     = \&html_initialize;
                    171:     my $output_student = \&html_outputstudent;
                    172:     my $finish         = \&html_finish;
                    173:     #
                    174:     if ($output_mode eq 'excel') {
                    175:         $initialize     = \&excel_initialize;
                    176:         $output_student = \&excel_outputstudent;
                    177:         $finish         = \&excel_finish;
                    178:     } elsif ($output_mode eq 'csv') {
                    179:         $initialize     = \&csv_initialize;
                    180:         $output_student = \&csv_outputstudent;
                    181:         $finish         = \&csv_finish;
                    182:     }
1.30      matthew   183:     #
                    184:     if($c->aborted()) {  return ; }
1.31      matthew   185:     #
1.49      matthew   186:     # Determine which students we want to look at
                    187:     my @Students;
                    188:     if ($single_student_mode) {
                    189:         @Students = (&Apache::lonstatistics::current_student());
                    190:         $r->print(&next_and_previous_buttons());
                    191:         $r->rflush();
                    192:     } else {
                    193:         @Students = @Apache::lonstatistics::Students;
                    194:     }
1.56      matthew   195:     #
                    196:     # Perform generic initialization tasks
                    197:     #       Since we use lonnet::EXT to retrieve problem weights,
                    198:     #       to ensure current data we must clear the caches out.
                    199:     #       This makes sure that parameter changes at the student level
                    200:     #       are immediately reflected in the chart.
                    201:     &Apache::lonnet::clear_EXT_cache_status();
1.69      matthew   202:     #
                    203:     # Clean out loncoursedata's package data, just to be safe.
                    204:     &Apache::loncoursedata::clear_internal_caches();
1.49      matthew   205:     #
1.31      matthew   206:     # Call the initialize routine selected above
                    207:     $initialize->($r);
1.49      matthew   208:     foreach my $student (@Students) {
1.31      matthew   209:         if($c->aborted()) { 
                    210:             $finish->($r);
                    211:             return ; 
1.1       stredwic  212:         }
1.31      matthew   213:         # Call the output_student routine selected above
                    214:         $output_student->($r,$student);
                    215:     }
                    216:     # Call the "finish" routine selected above
                    217:     $finish->($r);
                    218:     #
                    219:     return;
                    220: }
                    221: 
                    222: #######################################################
                    223: #######################################################
1.49      matthew   224: sub next_and_previous_buttons {
                    225:     my $Str = '';
                    226:     $Str .= '<input type="hidden" name="SelectedStudent" value="'.
                    227:         $ENV{'form.SelectedStudent'}.'" />';
                    228:     #
                    229:     # Build the previous student link
                    230:     my $previous = &Apache::lonstatistics::previous_student();
                    231:     my $previousbutton = '';
                    232:     if (defined($previous)) {
                    233:         my $sname = $previous->{'username'}.':'.$previous->{'domain'};
                    234:         $previousbutton .= '<input type="button" value="'.
                    235:             'Previous Student ('.
                    236:             $previous->{'username'}.'@'.$previous->{'domain'}.')'.
                    237:             '" onclick="document.Statistics.SelectedStudent.value='.
                    238:             "'".$sname."'".';'.
                    239:             'document.Statistics.submit();" />';
                    240:     } else {
                    241:         $previousbutton .= '<input type="button" value="'.
                    242:             'Previous student (none)'.'" />';
                    243:     }
                    244:     #
                    245:     # Build the next student link
                    246:     my $next = &Apache::lonstatistics::next_student();
                    247:     my $nextbutton = '';
                    248:     if (defined($next)) {
                    249:         my $sname = $next->{'username'}.':'.$next->{'domain'};
                    250:         $nextbutton .= '<input type="button" value="'.
                    251:             'Next Student ('.
                    252:             $next->{'username'}.'@'.$next->{'domain'}.')'.
                    253:             '" onclick="document.Statistics.SelectedStudent.value='.
                    254:             "'".$sname."'".';'.
                    255:             'document.Statistics.submit();" />';
                    256:     } else {
                    257:         $nextbutton .= '<input type="button" value="'.
                    258:             'Next student (none)'.'" />';
                    259:     }
                    260:     #
                    261:     # Build the 'all students' button
                    262:     my $all = '';
                    263:     $all .= '<input type="button" value="All Students" '.
                    264:             '" onclick="document.Statistics.SelectedStudent.value='.
                    265:             "''".';'.'document.Statistics.submit();" />';
                    266:     $Str .= $previousbutton.('&nbsp;'x5).$all.('&nbsp;'x5).$nextbutton;
                    267:     return $Str;
                    268: }
                    269: 
                    270: #######################################################
                    271: #######################################################
1.30      matthew   272: 
1.31      matthew   273: sub get_student_fields_to_show {
                    274:     my @to_show = @Apache::lonstatistics::SelectedStudentData;
                    275:     foreach (@to_show) {
                    276:         if ($_ eq 'all') {
                    277:             @to_show = @Apache::lonstatistics::StudentDataOrder;
                    278:             last;
                    279:         }
                    280:     }
                    281:     return @to_show;
                    282: }
                    283: 
1.28      matthew   284: #######################################################
                    285: #######################################################
                    286: 
                    287: =pod
1.2       stredwic  288: 
1.28      matthew   289: =item &CreateInterface()
1.21      minaeibi  290: 
1.28      matthew   291: Called by &BuildStudentAssessmentPage to create the top part of the
                    292: page which displays the chart.
                    293: 
1.30      matthew   294: Inputs: None
1.28      matthew   295: 
                    296: Returns:  A string containing the HTML for the headers and top table for 
                    297: the chart page.
                    298: 
                    299: =cut
                    300: 
                    301: #######################################################
                    302: #######################################################
1.2       stredwic  303: sub CreateInterface {
1.4       stredwic  304:     my $Str = '';
1.30      matthew   305: #    $Str .= &CreateLegend();
                    306:     $Str .= '<table cellspacing="5">'."\n";
                    307:     $Str .= '<tr>';
                    308:     $Str .= '<td align="center"><b>Sections</b></td>';
                    309:     $Str .= '<td align="center"><b>Student Data</b></td>';
1.46      matthew   310:     $Str .= '<td align="center"><b>Enrollment Status</b></td>';
1.41      matthew   311:     $Str .= '<td align="center"><b>Sequences and Folders</b></td>';
1.58      matthew   312:     $Str .= '<td align="center"><b>Output Format</b>'.
                    313:         &Apache::loncommon::help_open_topic("Chart_Output_Formats").
                    314:         '</td>';
                    315:     $Str .= '<td align="center"><b>Output Data</b>'.
                    316:         &Apache::loncommon::help_open_topic("Chart_Output_Data").
                    317:         '</td>';
1.30      matthew   318:     $Str .= '</tr>'."\n";
                    319:     #
1.4       stredwic  320:     $Str .= '<tr><td align="center">'."\n";
1.29      matthew   321:     $Str .= &Apache::lonstatistics::SectionSelect('Section','multiple',5);
1.4       stredwic  322:     $Str .= '</td><td align="center">';
1.30      matthew   323:     my $only_seq_with_assessments = sub { 
                    324:         my $s=shift;
                    325:         if ($s->{'num_assess'} < 1) { 
                    326:             return 0;
                    327:         } else { 
                    328:             return 1;
                    329:         }
                    330:     };
                    331:     $Str .= &Apache::lonstatistics::StudentDataSelect('StudentData','multiple',
                    332:                                                       5,undef);
1.46      matthew   333:     $Str .= '</td><td>'."\n";
                    334:     $Str .= &Apache::lonhtmlcommon::StatusOptions(undef,undef,5);
1.4       stredwic  335:     $Str .= '</td><td>'."\n";
1.30      matthew   336:     $Str .= &Apache::lonstatistics::MapSelect('Maps','multiple,all',5,
                    337:                                               $only_seq_with_assessments);
1.31      matthew   338:     $Str .= '</td><td>'."\n";
                    339:     $Str .= &CreateAndParseOutputSelector();
1.54      matthew   340:     $Str .= '</td><td>'."\n";
                    341:     $Str .= &CreateAndParseOutputDataSelector();
1.30      matthew   342:     $Str .= '</td></tr>'."\n";
                    343:     $Str .= '</table>'."\n";
1.55      matthew   344:     $Str .= '<input type="submit" value="Generate Chart" />';
1.59      matthew   345:     $Str .= '&nbsp;'x5;
                    346:     $Str .= '<input type="submit" name="selectstudent" '.
                    347:                                   'value="Select One Student" />';
                    348:     $Str .= '&nbsp;'x5;
                    349:     $Str .= '<input type="submit" name="ClearCache" value="Clear Caches" />';
1.61      www       350:     $Str .= '&nbsp;'x5;
                    351:     $Str .= '<br />';
1.4       stredwic  352:     return $Str;
1.1       stredwic  353: }
1.30      matthew   354: 
                    355: #######################################################
                    356: #######################################################
                    357: 
                    358: =pod
                    359: 
1.31      matthew   360: =item &CreateAndParseOutputSelector()
1.30      matthew   361: 
                    362: =cut
                    363: 
                    364: #######################################################
                    365: #######################################################
1.32      matthew   366: my @OutputOptions = 
                    367:     ({ name  => 'HTML, with links',
                    368:        value => 'html, with links',
1.33      matthew   369:        description => 'Output HTML with each symbol linked to the problem '.
1.35      matthew   370: 	   'which generated it.',
                    371:        mode => 'html',
                    372:        show_links => 'yes',
                    373:        },
1.47      matthew   374:      { name  => 'HTML, with all links',
                    375:        value => 'html, with all links',
                    376:        description => 'Output HTML with each symbol linked to the problem '.
                    377: 	   'which generated it.  '.
                    378:            'This includes links for unattempted problems.',
                    379:        mode => 'html',
                    380:        show_links => 'all',
                    381:        },
1.32      matthew   382:      { name  => 'HTML, without links',
                    383:        value => 'html, without links',
1.33      matthew   384:        description => 'Output HTML.  By not including links, the size of the'.
                    385: 	   ' web page is greatly reduced.  If your browser crashes on the '.
1.35      matthew   386: 	   'full display, try this.',
                    387:        mode => 'html',
                    388:        show_links => 'no',
                    389:            },
1.54      matthew   390:      { name  => 'Excel',
                    391:        value => 'excel',
                    392:        description => 'Output an Excel file (compatable with Excel 95).',
1.35      matthew   393:        mode => 'excel',
                    394:        show_links => 'no',
1.54      matthew   395:    },
                    396:      { name  => 'CSV',
                    397:        value => 'csv',
                    398:        description => 'Output a comma seperated values file suitable for '.
1.57      matthew   399:            'import into a spreadsheet program.  Using this method as opposed '.
                    400:            'to Excel output allows you to organize your data before importing'.
                    401:            ' it into a spreadsheet program.',
1.35      matthew   402:        mode => 'csv',
                    403:        show_links => 'no',
                    404:            },
1.32      matthew   405:      );
                    406: 
1.33      matthew   407: sub OutputDescriptions {
                    408:     my $Str = '';
1.58      matthew   409:     $Str .= "<h2>Output Formats</h2>\n";
1.33      matthew   410:     $Str .= "<dl>\n";
                    411:     foreach my $outputmode (@OutputOptions) {
                    412: 	$Str .="    <dt>".$outputmode->{'name'}."</dt>\n";
                    413: 	$Str .="        <dd>".$outputmode->{'description'}."</dd>\n";
                    414:     }
                    415:     $Str .= "</dl>\n";
                    416:     return $Str;
                    417: }
                    418: 
1.31      matthew   419: sub CreateAndParseOutputSelector {
                    420:     my $Str = '';
1.44      matthew   421:     my $elementname = 'chartoutputmode';
1.31      matthew   422:     #
                    423:     # Format for output options is 'mode, restrictions';
1.50      matthew   424:     my $selected = 'html, without links';
1.31      matthew   425:     if (exists($ENV{'form.'.$elementname})) {
                    426:         if (ref($ENV{'form.'.$elementname} eq 'ARRAY')) {
                    427:             $selected = $ENV{'form.'.$elementname}->[0];
                    428:         } else {
                    429:             $selected = $ENV{'form.'.$elementname};
                    430:         }
                    431:     }
                    432:     #
                    433:     # Set package variables describing output mode
                    434:     $show_links  = 'no';
                    435:     $output_mode = 'html';
1.35      matthew   436:     foreach my $option (@OutputOptions) {
                    437:         next if ($option->{'value'} ne $selected);
                    438:         $output_mode = $option->{'mode'};
                    439:         $show_links  = $option->{'show_links'};
1.31      matthew   440:     }
1.35      matthew   441: 
1.31      matthew   442:     #
                    443:     # Build the form element
                    444:     $Str = qq/<select size="5" name="$elementname">/;
1.32      matthew   445:     foreach my $option (@OutputOptions) {
                    446:         $Str .= "\n".'    <option value="'.$option->{'value'}.'"';
                    447:         $Str .= " selected " if ($option->{'value'} eq $selected);
                    448:         $Str .= ">".$option->{'name'}."<\/option>";
1.31      matthew   449:     }
                    450:     $Str .= "\n</select>";
                    451:     return $Str;
                    452: }
1.30      matthew   453: 
1.54      matthew   454: ##
                    455: ## Data selector stuff
                    456: ##
                    457: my @OutputDataOptions =
1.57      matthew   458:     (
1.72    ! matthew   459:      { name  => 'Scores Summary',
1.57      matthew   460:        base  => 'scores',
                    461:        value => 'sum and total',
                    462:        shortdesc => 'Total Score and Maximum Possible for each '.
                    463:            'Sequence or Folder',
                    464:        longdesc => 'The score of each student as well as the '.
                    465:            ' maximum possible on each Sequence or Folder.',
                    466:        },
1.71      matthew   467:      { name  => 'Scores Per Problem',
1.57      matthew   468:        base  => 'scores',
1.71      matthew   469:        value => 'scores',
                    470:        shortdesc => 'Score on each Problem Part',
                    471:        longdesc =>'The students score on each problem part, computed as'.
                    472:            'the part weight * part awarded',
1.57      matthew   473:        },
1.71      matthew   474: #     { name  => 'Scores Sum',
                    475: #       base  => 'scores',
                    476: #       value => 'sum only',
                    477: #       shortdesc => 'Sum of Scores on each Problem Part',
                    478: #       longdesc =>'The total of the scores of the student on each problem'.
                    479: #           ' part in the sequences or folders selected.',
                    480: #       },
                    481: #     { name  => 'Scores Summary Table Only',
                    482: #       base  => 'scores',
                    483: #       value => 'final table scores',
                    484: #       shortdesc => 'Summary of Scores',
                    485: #       longdesc  => 'The average score on each sequence or folder for the '.
                    486: #           'selected students.',
                    487: #       },
1.57      matthew   488:      { name  =>'Tries',
                    489:        base  =>'tries',
                    490:        value => 'tries',
                    491:        shortdesc => 'Number of Tries before success on each Problem Part',
                    492:        longdesc =>'The number of tries before success on each problem part.',
                    493:        },
                    494:      { name  =>'Parts Correct',
                    495:        base  =>'tries',
                    496:        value => 'parts correct total',
                    497:        shortdesc => 'Number of Problem Parts completed successfully.',
                    498:        longdesc => 'The Number of Problem Parts completed successfully and '.
                    499:            'the maximum possible for each student',
                    500:        },
1.71      matthew   501: #     { name  =>'Parts Correct',
                    502: #       base  =>'tries',
                    503: #       value => 'parts correct',
                    504: #       shortdesc => 'Number of Problem Parts completed successfully.',
                    505: #       longdesc => 'The Number of Problem Parts completed successfully'.
                    506: #           ' on each sequence or folder.',
                    507: #       },
                    508: #     { name  => 'Parts Summary Table Only',
                    509: #       base  => 'tries',
                    510: #       value => 'final table parts',
                    511: #       shortdesc => 'Summary of Parts Correct',
                    512: #       longdesc  => 'A summary table of the average number of problem parts '.
                    513: #           'students were able to get correct on each sequence.',
                    514: #       },
1.57      matthew   515:      );
                    516: 
                    517: sub HTMLifyOutputDataDescriptions {
                    518:     my $Str = '';
1.58      matthew   519:     $Str .= "<h2>Output Data</h2>\n";
1.57      matthew   520:     $Str .= "<dl>\n";
                    521:     foreach my $option (@OutputDataOptions) {
                    522:         $Str .= '    <dt>'.$option->{'name'}.'</dt>';
                    523:         $Str .= '<dd>'.$option->{'longdesc'}.'</dd>'."\n";
                    524:     }
                    525:     $Str .= "</dl>\n";
                    526:     return $Str;
                    527: }
1.54      matthew   528: 
                    529: sub CreateAndParseOutputDataSelector {
                    530:     my $Str = '';
                    531:     my $elementname = 'chartoutputdata';
                    532:     #
                    533:     my $selected = 'scores';
                    534:     if (exists($ENV{'form.'.$elementname})) {
                    535:         if (ref($ENV{'form.'.$elementname} eq 'ARRAY')) {
                    536:             $selected = $ENV{'form.'.$elementname}->[0];
                    537:         } else {
                    538:             $selected = $ENV{'form.'.$elementname};
                    539:         }
                    540:     }
                    541:     #
                    542:     $data = 'scores';
                    543:     foreach my $option (@OutputDataOptions) {
                    544:         if ($option->{'value'} eq $selected) {
                    545:             $data = $option->{'value'};
                    546:             $base = $option->{'base'};
                    547:             $datadescription = $option->{'shortdesc'};
                    548:         }
                    549:     }
                    550:     #
                    551:     # Build the form element
                    552:     $Str = qq/<select size="5" name="$elementname">/;
                    553:     foreach my $option (@OutputDataOptions) {
                    554:         $Str .= "\n".'    <option value="'.$option->{'value'}.'"';
                    555:         $Str .= " selected " if ($option->{'value'} eq $data);
                    556:         $Str .= ">".$option->{'name'}."<\/option>";
                    557:     }
                    558:     $Str .= "\n</select>";
                    559:     return $Str;
                    560: 
                    561: }
                    562: 
1.28      matthew   563: #######################################################
                    564: #######################################################
1.1       stredwic  565: 
1.28      matthew   566: =pod
                    567: 
1.31      matthew   568: =head2 HTML output routines
1.28      matthew   569: 
1.31      matthew   570: =item &html_initialize($r)
1.28      matthew   571: 
1.31      matthew   572: Create labels for the columns of student data to show.
1.28      matthew   573: 
1.31      matthew   574: =item &html_outputstudent($r,$student)
1.28      matthew   575: 
1.31      matthew   576: Return a line of the chart for a student.
1.28      matthew   577: 
1.31      matthew   578: =item &html_finish($r)
1.28      matthew   579: 
                    580: =cut
                    581: 
                    582: #######################################################
                    583: #######################################################
1.31      matthew   584: {
                    585:     my $padding;
                    586:     my $count;
                    587: 
1.39      matthew   588:     my $nodata_count; # The number of students for which there is no data
                    589:     my %prog_state;   # progress state used by loncommon PrgWin routines
                    590: 
1.31      matthew   591: sub html_initialize {
                    592:     my ($r) = @_;
1.30      matthew   593:     #
                    594:     $padding = ' 'x3;
1.35      matthew   595:     $count = 0;
1.39      matthew   596:     $nodata_count = 0;
1.66      matthew   597:     undef(%prog_state);
1.30      matthew   598:     #
1.38      matthew   599:     $r->print("<h3>".$ENV{'course.'.$ENV{'request.course.id'}.'.description'}.
                    600:               "&nbsp;&nbsp;".localtime(time)."</h3>");
1.39      matthew   601: 
1.55      matthew   602:     if ($data !~ /^final table/) {
                    603:         $r->print("<h3>".$datadescription."</h3>");        
                    604:     }
1.39      matthew   605:     #
                    606:     # Set up progress window for 'final table' display only
1.54      matthew   607:     if ($data =~ /^final table/) {
1.39      matthew   608:         my $studentcount = scalar(@Apache::lonstatistics::Students); 
                    609:         %prog_state=&Apache::lonhtmlcommon::Create_PrgWin
                    610:             ($r,'Summary Table Status',
                    611:              'Summary Table Compilation Progress', $studentcount);
                    612:     }
1.31      matthew   613:     my $Str = "<pre>\n";
1.30      matthew   614:     # First, the @StudentData fields need to be listed
1.31      matthew   615:     my @to_show = &get_student_fields_to_show();
1.30      matthew   616:     foreach my $field (@to_show) {
                    617:         my $title=$Apache::lonstatistics::StudentData{$field}->{'title'};
                    618:         my $base =$Apache::lonstatistics::StudentData{$field}->{'base_width'};
                    619:         my $width=$Apache::lonstatistics::StudentData{$field}->{'width'};
                    620:         $Str .= $title.' 'x($width-$base).$padding;
                    621:     }
                    622:     # Now the selected sequences need to be listed
1.40      matthew   623:     foreach my $sequence (&Apache::lonstatistics::Sequences_with_Assess()){
1.31      matthew   624:         my $title = $sequence->{'title'};
                    625:         my $base  = $sequence->{'base_width'};
                    626:         my $width = $sequence->{'width'};
                    627:         $Str .= $title.' 'x($width-$base).$padding;
1.30      matthew   628:     }
1.54      matthew   629:     $Str .= "total</pre>\n";
1.31      matthew   630:     $Str .= "<pre>";
1.39      matthew   631:     #
                    632:     # Check for suppression of output
1.54      matthew   633:     if ($data =~ /^final table/) {
1.39      matthew   634:         $Str = '';
                    635:     }
1.31      matthew   636:     $r->print($Str);
                    637:     $r->rflush();
                    638:     return;
1.30      matthew   639: }
                    640: 
1.31      matthew   641: sub html_outputstudent {
                    642:     my ($r,$student) = @_;
1.2       stredwic  643:     my $Str = '';
1.35      matthew   644:     #
1.55      matthew   645:     if($count++ % 5 == 0 && $count > 0 && $data !~ /^final table/) {
1.35      matthew   646:         $r->print("</pre><pre>");
                    647:     }
1.30      matthew   648:     # First, the @StudentData fields need to be listed
1.31      matthew   649:     my @to_show = &get_student_fields_to_show();
1.30      matthew   650:     foreach my $field (@to_show) {
                    651:         my $title=$student->{$field};
1.31      matthew   652:         my $base = length($title);
1.30      matthew   653:         my $width=$Apache::lonstatistics::StudentData{$field}->{'width'};
                    654:         $Str .= $title.' 'x($width-$base).$padding;
                    655:     }
                    656:     # Get ALL the students data
                    657:     my %StudentsData;
                    658:     my @tmp = &Apache::loncoursedata::get_current_state
                    659:         ($student->{'username'},$student->{'domain'},undef,
                    660:          $ENV{'request.course.id'});
                    661:     if ((scalar @tmp > 0) && ($tmp[0] !~ /^error:/)) {
                    662:         %StudentsData = @tmp;
                    663:     }
                    664:     if (scalar(@tmp) < 1) {
1.39      matthew   665:         $nodata_count++;
1.54      matthew   666:         return if ($data =~ /^final table/);
1.30      matthew   667:         $Str .= '<font color="blue">No Course Data</font>'."\n";
1.31      matthew   668:         $r->print($Str);
                    669:         $r->rflush();
                    670:         return;
1.30      matthew   671:     }
                    672:     #
                    673:     # By sequence build up the data
                    674:     my $studentstats;
1.31      matthew   675:     my $PerformanceStr = '';
1.40      matthew   676:     foreach my $seq (&Apache::lonstatistics::Sequences_with_Assess()) {
1.54      matthew   677:         my ($performance,$performance_length,$score,$seq_max,$rawdata);
                    678:         if ($base eq 'tries') {
                    679:             ($performance,$performance_length,$score,$seq_max,$rawdata) =
                    680:                 &StudentTriesOnSequence($student,\%StudentsData,
                    681:                                         $seq,$show_links);
                    682:         } else {
                    683:             ($performance,$performance_length,$score,$seq_max,$rawdata) =
                    684:                 &StudentPerformanceOnSequence($student,\%StudentsData,
                    685:                                               $seq,$show_links);
                    686:         }
                    687:         my $ratio = sprintf("%3d",$score).'/'.sprintf("%3d",$seq_max);
1.31      matthew   688:         #
1.54      matthew   689:         if ($data eq 'sum and total' || $data eq 'parts correct total') {
                    690:             $performance  = $ratio;
                    691:             $performance .= ' 'x($seq->{'width'}-length($ratio));
                    692:         } elsif ($data eq 'sum only' || $data eq 'parts correct') {
                    693:             $performance  = $score;
                    694:             $performance .= ' 'x($seq->{'width'}-length($score));
1.31      matthew   695:         } else {
                    696:             # Pad with extra spaces
1.51      matthew   697:             $performance .= ' 'x($seq->{'width'}-$performance_length-
1.31      matthew   698:                                  length($ratio)
                    699:                                  ).$ratio;
1.30      matthew   700:         }
1.31      matthew   701:         #
                    702:         $Str .= $performance.$padding;
                    703:         #
                    704:         $studentstats->{$seq->{'symb'}}->{'score'}= $score;
                    705:         $studentstats->{$seq->{'symb'}}->{'max'}  = $seq_max;
1.30      matthew   706:     }
                    707:     #
                    708:     # Total it up and store the statistics info.
                    709:     my ($score,$max) = (0,0);
                    710:     while (my ($symb,$seq_stats) = each (%{$studentstats})) {
                    711:         $Statistics->{$symb}->{'score'} += $seq_stats->{'score'};
1.54      matthew   712:         if ($Statistics->{$symb}->{'max'} < $seq_stats->{'max'}) {
                    713:             $Statistics->{$symb}->{'max'} = $seq_stats->{'max'};
                    714:         }
1.30      matthew   715:         $score += $seq_stats->{'score'};
                    716:         $max   += $seq_stats->{'max'};
                    717:     }
1.31      matthew   718:     $Str .= ' '.' 'x(length($max)-length($score)).$score.'/'.$max;
1.30      matthew   719:     $Str .= " \n";
1.39      matthew   720:     #
                    721:     # Check for suppressed output and update the progress window if so...
1.54      matthew   722:     if ($data =~ /^final table/) {
1.39      matthew   723:         $Str = '';
                    724:         &Apache::lonhtmlcommon::Increment_PrgWin($r,\%prog_state,
                    725:                                                  'last student');
                    726:     }
                    727:     #
1.31      matthew   728:     $r->print($Str);
                    729:     #
                    730:     $r->rflush();
                    731:     return;
1.30      matthew   732: }    
1.2       stredwic  733: 
1.31      matthew   734: sub html_finish {
                    735:     my ($r) = @_;
1.39      matthew   736:     #
                    737:     # Check for suppressed output and close the progress window if so
1.54      matthew   738:     if ($data =~ /^final table/) {
1.39      matthew   739:         &Apache::lonhtmlcommon::Close_PrgWin($r,\%prog_state);
                    740:     } else {
                    741:         $r->print("</pre>\n"); 
                    742:     }
1.49      matthew   743:     if ($single_student_mode) {
                    744:         $r->print(&SingleStudentTotal());
                    745:     } else {
                    746:         $r->print(&StudentAverageTotal());
                    747:     }
1.31      matthew   748:     $r->rflush();
                    749:     return;
                    750: }
                    751: 
1.39      matthew   752: sub StudentAverageTotal {
                    753:     my $Str = "<h3>Summary Tables</h3>\n";
                    754:     my $num_students = scalar(@Apache::lonstatistics::Students);
                    755:     my $total_ave = 0;
                    756:     my $total_max = 0;
                    757:     $Str .= '<table border=2 cellspacing="1">'."\n";
                    758:     $Str .= "<tr><th>Title</th><th>Average</th><th>Maximum</th></tr>\n";
1.40      matthew   759:     foreach my $seq (&Apache::lonstatistics::Sequences_with_Assess()) {
1.42      matthew   760:         my $ave;
                    761:         if ($num_students > $nodata_count) {
                    762:             $ave = int(100*($Statistics->{$seq->{'symb'}}->{'score'}/
                    763:                             ($num_students-$nodata_count)))/100;
                    764:         } else {
                    765:             $ave = 0;
                    766:         }
1.39      matthew   767:         $total_ave += $ave;
1.54      matthew   768:         my $max = $Statistics->{$seq->{'symb'}}->{'max'};
1.39      matthew   769:         $total_max += $max;
                    770:         if ($ave == 0) {
                    771:             $ave = "0.00";
                    772:         }
                    773:         $ave .= '&nbsp;';
                    774:         $max .= '&nbsp;&nbsp;&nbsp;';
                    775:         $Str .= '<tr><td>'.$seq->{'title'}.'</td>'.
                    776:             '<td align="right">'.$ave.'</td>'.
                    777:                 '<td align="right">'.$max.'</td></tr>'."\n";
                    778:     }
                    779:     $total_ave = int(100*$total_ave)/100; # only two digit
                    780:     $Str .= "</table>\n";
                    781:     $Str .= '<table border=2 cellspacing="1">'."\n";
                    782:     $Str .= '<tr><th>Number of Students</th><th>Average</th>'.
                    783:         "<th>Maximum</th></tr>\n";
                    784:     $Str .= '<tr><td>'.($num_students-$nodata_count).'</td>'.
                    785:         '<td>'.$total_ave.'</td><td>'.$total_max.'</td>';
                    786:     $Str .= "</table>\n";
                    787:     return $Str;
                    788: }
                    789: 
1.49      matthew   790: sub SingleStudentTotal {
                    791:     my $student = &Apache::lonstatistics::current_student();
1.52      matthew   792:     my $Str = "<h3>Summary table for ".$student->{'fullname'}." ".
                    793:         $student->{'username'}.'@'.$student->{'domain'}."</h3>\n";
1.49      matthew   794:     $Str .= '<table border=2 cellspacing="1">'."\n";
                    795:     $Str .= 
                    796:         "<tr><th>Sequence or Folder</th><th>Score</th><th>Maximum</th></tr>\n";
                    797:     my $total = 0;
                    798:     my $total_max = 0;
                    799:     foreach my $seq (&Apache::lonstatistics::Sequences_with_Assess()) {
                    800:         my $value = $Statistics->{$seq->{'symb'}}->{'score'};
                    801:         my $max = $Statistics->{$seq->{'symb'}}->{'max'};
                    802:         $Str .= '<tr><td>'.$seq->{'title'}.'</td>'.
                    803:             '<td align="right">'.$value.'</td>'.
                    804:                 '<td align="right">'.$max.'</td></tr>'."\n";
                    805:         $total += $value;
                    806:         $total_max +=$max;
                    807:     }
                    808:     $Str .= '<tr><td><b>Total</b></td>'.
                    809:         '<td align="right">'.$total.'</td>'.
                    810:         '<td align="right">'.$total_max."</td></tr>\n";
                    811:     $Str .= "</table>\n";
                    812:     return $Str;
                    813: }
                    814: 
1.31      matthew   815: }
                    816: 
                    817: #######################################################
                    818: #######################################################
                    819: 
                    820: =pod
                    821: 
                    822: =head2 EXCEL subroutines
                    823: 
                    824: =item &excel_initialize($r)
                    825: 
                    826: =item &excel_outputstudent($r,$student)
                    827: 
                    828: =item &excel_finish($r)
                    829: 
                    830: =cut
                    831: 
                    832: #######################################################
                    833: #######################################################
                    834: {
                    835: 
                    836: my $excel_sheet;
1.32      matthew   837: my $excel_workbook;
                    838: 
                    839: my $filename;
                    840: my $rows_output;
                    841: my $cols_output;
                    842: 
1.36      matthew   843: my %prog_state; # progress window state
1.54      matthew   844: my $request_aborted;
1.31      matthew   845: 
                    846: sub excel_initialize {
                    847:     my ($r) = @_;
                    848:     #
1.66      matthew   849:     undef ($excel_sheet);
                    850:     undef ($excel_workbook);
                    851:     undef ($filename);
                    852:     undef ($rows_output);
                    853:     undef ($cols_output);
                    854:     undef (%prog_state);
                    855:     undef ($request_aborted);
                    856:     #
1.54      matthew   857:     my $total_columns = scalar(&get_student_fields_to_show());
                    858:     foreach my $seq (&Apache::lonstatistics::Sequences_with_Assess()) {
                    859:         # Add 2 because we need a 'sum' and 'total' column for each
                    860:         $total_columns += $seq->{'num_assess_parts'}+2;
                    861:     }
                    862:     if ($data eq 'tries' && $total_columns > 255) {
                    863:         $r->print(<<END);
                    864: <h2>Unable to Complete Request</h2>
                    865: <p>
                    866: LON-CAPA is unable to produce your Excel spreadsheet because your selections
                    867: will result in more than 255 columns.  Excel allows only 255 columns in a
                    868: spreadsheet.
                    869: </p><p>
                    870: You may consider reducing the number of <b>Sequences or Folders</b> you
                    871: have selected.  
                    872: </p><p>
                    873: LON-CAPA can produce <b>CSV</b> files of this data or Excel files of the
                    874: summary data (<b>Parts Correct</b> or <b>Parts Correct & Totals</b>).
                    875: </p>
                    876: END
                    877:        $request_aborted = 1;
                    878:     }
                    879:     if ($data eq 'scores' && $total_columns > 255) {
                    880:         $r->print(<<END);
                    881: <h2>Unable to Complete Request</h2>
                    882: <p>
                    883: LON-CAPA is unable to produce your Excel spreadsheet because your selections
                    884: will result in more than 255 columns.  Excel allows only 255 columns in a
                    885: spreadsheet.
                    886: </p><p>
                    887: You may consider reducing the number of <b>Sequences or Folders</b> you
                    888: have selected.  
                    889: </p><p>
                    890: LON-CAPA can produce <b>CSV</b> files of this data or Excel files of the
                    891: summary data (<b>Scores Sum</b> or <b>Scores Sum & Totals</b>).
                    892: </p>
                    893: END
                    894:        $request_aborted = 1;
                    895:     }
                    896:     if ($data =~ /^final table/) {
                    897:         $r->print(<<END);
                    898: <h2>Unable to Complete Request</h2>
                    899: <p>
                    900: The <b>Summary Table (Scores)</b> option is not available for non-HTML output.
                    901: </p>
                    902: END
                    903:        $request_aborted = 1;
                    904:     }
                    905:     return if ($request_aborted);
                    906:     #
1.32      matthew   907:     $filename = '/prtspool/'.
1.31      matthew   908:         $ENV{'user.name'}.'_'.$ENV{'user.domain'}.'_'.
                    909:             time.'_'.rand(1000000000).'.xls';
1.32      matthew   910:     #
                    911:     $excel_workbook = undef;
                    912:     $excel_sheet = undef;
                    913:     #
                    914:     $rows_output = 0;
                    915:     $cols_output = 0;
                    916:     #
                    917:     # Create sheet
                    918:     $excel_workbook = Spreadsheet::WriteExcel->new('/home/httpd'.$filename);
                    919:     #
                    920:     # Check for errors
                    921:     if (! defined($excel_workbook)) {
1.31      matthew   922:         $r->log_error("Error creating excel spreadsheet $filename: $!");
                    923:         $r->print("Problems creating new Excel file.  ".
                    924:                   "This error has been logged.  ".
                    925:                   "Please alert your LON-CAPA administrator");
1.32      matthew   926:         return ;
1.31      matthew   927:     }
                    928:     #
                    929:     # The excel spreadsheet stores temporary data in files, then put them
                    930:     # together.  If needed we should be able to disable this (memory only).
                    931:     # The temporary directory must be specified before calling 'addworksheet'.
                    932:     # File::Temp is used to determine the temporary directory.
1.32      matthew   933:     $excel_workbook->set_tempdir($Apache::lonnet::tmpdir);
                    934:     #
                    935:     # Add a worksheet
1.33      matthew   936:     my $sheetname = $ENV{'course.'.$ENV{'request.course.id'}.'.description'};
1.67      matthew   937:     $sheetname = &Apache::loncommon::clean_excel_name($sheetname);
1.33      matthew   938:     $excel_sheet = $excel_workbook->addworksheet($sheetname);
1.32      matthew   939:     #
1.34      matthew   940:     # Put the course description in the header
                    941:     $excel_sheet->write($rows_output,$cols_output++,
                    942:                    $ENV{'course.'.$ENV{'request.course.id'}.'.description'});
                    943:     $cols_output += 3;
                    944:     #
                    945:     # Put a description of the sections listed
                    946:     my $sectionstring = '';
                    947:     my @Sections = @Apache::lonstatistics::SelectedSections;
                    948:     if (scalar(@Sections) > 1) {
                    949:         if (scalar(@Sections) > 2) {
                    950:             my $last = pop(@Sections);
                    951:             $sectionstring = "Sections ".join(', ',@Sections).', and '.$last;
                    952:         } else {
                    953:             $sectionstring = "Sections ".join(' and ',@Sections);
                    954:         }
                    955:     } else {
                    956:         if ($Sections[0] eq 'all') {
                    957:             $sectionstring = "All sections";
                    958:         } else {
                    959:             $sectionstring = "Section ".$Sections[0];
                    960:         }
                    961:     }
                    962:     $excel_sheet->write($rows_output,$cols_output++,$sectionstring);
                    963:     $cols_output += scalar(@Sections);
                    964:     #
                    965:     # Put the date in there too
1.54      matthew   966:     $excel_sheet->write($rows_output++,$cols_output++,
1.34      matthew   967:                         'Compiled on '.localtime(time));
                    968:     #
1.54      matthew   969:     $cols_output = 0;
                    970:     $excel_sheet->write($rows_output++,$cols_output++,$datadescription);
                    971:     #
                    972:     if ($data eq 'tries' || $data eq 'scores') {
                    973:         $rows_output++;
                    974:     }
1.34      matthew   975:     #
1.32      matthew   976:     # Add the student headers
1.34      matthew   977:     $cols_output = 0;
1.32      matthew   978:     foreach my $field (&get_student_fields_to_show()) {
1.34      matthew   979:         $excel_sheet->write($rows_output,$cols_output++,$field);
1.32      matthew   980:     }
1.54      matthew   981:     my $row_offset = 0;
                    982:     if ($data eq 'tries' || $data eq 'scores') {
                    983:         $row_offset = -1;
                    984:     }
1.32      matthew   985:     #
1.54      matthew   986:     # Add the remaining column headers
1.40      matthew   987:     foreach my $seq (&Apache::lonstatistics::Sequences_with_Assess()) {
1.54      matthew   988:         $excel_sheet->write($rows_output+$row_offset,
                    989:                             $cols_output,$seq->{'title'});
                    990:         if ($data eq 'tries' || $data eq 'scores') {
                    991:             foreach my $res (@{$seq->{'contents'}}) {
                    992:                 next if ($res->{'type'} ne 'assessment');
                    993:                 if (scalar(@{$res->{'parts'}}) > 1) {
                    994:                     foreach my $part (@{$res->{'parts'}}) {
                    995:                         $excel_sheet->write($rows_output,
                    996:                                             $cols_output++,
                    997:                                             $res->{'title'}.' part '.$part);
                    998:                     }
                    999:                 } else {
                   1000:                     $excel_sheet->write($rows_output,
                   1001:                                         $cols_output++,
                   1002:                                         $res->{'title'});
                   1003:                 }
                   1004:             }
                   1005:             $excel_sheet->write($rows_output,$cols_output++,'score');
                   1006:             $excel_sheet->write($rows_output,$cols_output++,'maximum');
                   1007:         } elsif ($data eq 'sum and total' || $data eq 'parts correct total') {
1.34      matthew  1008:             $excel_sheet->write($rows_output+1,$cols_output,'score');
                   1009:             $excel_sheet->write($rows_output+1,$cols_output+1,'maximum');
1.32      matthew  1010:             $cols_output += 2;
                   1011:         } else {
                   1012:             $cols_output++;
                   1013:         }
                   1014:     }
                   1015:     #
                   1016:     # Bookkeeping
1.54      matthew  1017:     if ($data eq 'sum and total' || $data eq 'parts correct total') {
1.34      matthew  1018:         $rows_output += 2;
1.32      matthew  1019:     } else {
1.34      matthew  1020:         $rows_output += 1;
1.45      matthew  1021:     }
                   1022:     #
                   1023:     # Output a row for MAX
1.54      matthew  1024:     $cols_output = 0;
                   1025:     foreach my $field (&get_student_fields_to_show()) {
                   1026:         if ($field eq 'username' || $field eq 'fullname' || 
                   1027:             $field eq 'id') {
                   1028:             $excel_sheet->write($rows_output,$cols_output++,'Maximum');
                   1029:         } else {
                   1030:             $excel_sheet->write($rows_output,$cols_output++,'');
                   1031:         }
                   1032:     }
                   1033:     #
                   1034:     # Add the maximums for each sequence or assessment
                   1035:     foreach my $seq (&Apache::lonstatistics::Sequences_with_Assess()) {
                   1036:         my $weight;
                   1037:         my $max = 0;
                   1038:         foreach my $resource (@{$seq->{'contents'}}) {
                   1039:             next if ($resource->{'type'} ne 'assessment');
                   1040:             foreach my $part (@{$resource->{'parts'}}) {
                   1041:                 $weight = 1;
                   1042:                 if ($base eq 'scores') {
                   1043:                     $weight = &Apache::lonnet::EXT
                   1044:                         ('resource.'.$part.'.weight',$resource->{'symb'},
                   1045:                          undef,undef,undef);
                   1046:                     if (!defined($weight) || ($weight eq '')) { 
                   1047:                         $weight=1;
                   1048:                     }
                   1049:                 }
                   1050:                 if ($data eq 'scores') {
                   1051:                     $excel_sheet->write($rows_output,$cols_output++,$weight);
                   1052:                 } elsif ($data eq 'tries') {
                   1053:                     $excel_sheet->write($rows_output,$cols_output++,'');
                   1054:                 }
                   1055:                 $max += $weight;
1.45      matthew  1056:             }
1.54      matthew  1057:         } 
                   1058:         if (! ($data eq 'sum only' || $data eq 'parts correct')) {
                   1059:             $excel_sheet->write($rows_output,$cols_output++,'');
1.45      matthew  1060:         }
1.54      matthew  1061:         $excel_sheet->write($rows_output,$cols_output++,$max);
1.32      matthew  1062:     }
1.54      matthew  1063:     $rows_output++;
1.32      matthew  1064:     #
                   1065:     # Let the user know what we are doing
                   1066:     my $studentcount = scalar(@Apache::lonstatistics::Students); 
                   1067:     $r->print("<h1>Compiling Excel spreadsheet for ".
                   1068:               $studentcount.' student');
                   1069:     $r->print('s') if ($studentcount > 1);
                   1070:     $r->print("</h1>\n");
                   1071:     $r->rflush();
1.31      matthew  1072:     #
1.36      matthew  1073:     # Initialize progress window
                   1074:     %prog_state=&Apache::lonhtmlcommon::Create_PrgWin
                   1075:         ($r,'Excel File Compilation Status',
                   1076:          'Excel File Compilation Progress', $studentcount);
                   1077:     #
1.62      matthew  1078:     &Apache::lonhtmlcommon::Update_PrgWin($r,\%prog_state,
                   1079:                                           'Processing first student');
1.31      matthew  1080:     return;
                   1081: }
                   1082: 
                   1083: sub excel_outputstudent {
                   1084:     my ($r,$student) = @_;
1.54      matthew  1085:     return if ($request_aborted);
1.32      matthew  1086:     return if (! defined($excel_sheet));
                   1087:     $cols_output=0;
                   1088:     #
                   1089:     # Write out student data
                   1090:     my @to_show = &get_student_fields_to_show();
                   1091:     foreach my $field (@to_show) {
                   1092:         $excel_sheet->write($rows_output,$cols_output++,$student->{$field});
                   1093:     }
                   1094:     #
                   1095:     # Get student assessment data
                   1096:     my %StudentsData;
                   1097:     my @tmp = &Apache::loncoursedata::get_current_state($student->{'username'},
                   1098:                                                         $student->{'domain'},
                   1099:                                                         undef,
                   1100:                                                    $ENV{'request.course.id'});
                   1101:     if ((scalar @tmp > 0) && ($tmp[0] !~ /^error:/)) {
                   1102:         %StudentsData = @tmp;
                   1103:     }
                   1104:     #
                   1105:     # Write out sequence scores and totals data
1.40      matthew  1106:     foreach my $seq (&Apache::lonstatistics::Sequences_with_Assess()) {
1.54      matthew  1107:         my ($performance,$performance_length,$score,$seq_max,$rawdata);
                   1108:         if ($base eq 'tries') {
                   1109:             ($performance,$performance_length,$score,$seq_max,$rawdata) =
                   1110:                 &StudentTriesOnSequence($student,\%StudentsData,
                   1111:                                         $seq,'no');
                   1112:         } else {
                   1113:             ($performance,$performance_length,$score,$seq_max,$rawdata) =
                   1114:                 &StudentPerformanceOnSequence($student,\%StudentsData,
                   1115:                                               $seq,'no');
                   1116:         }
                   1117:         if ($data eq 'tries' || $data eq 'scores') {
                   1118:             foreach my $value (@$rawdata) {
                   1119:                 $excel_sheet->write($rows_output,$cols_output++,$value);
                   1120:             }
                   1121:             $excel_sheet->write($rows_output,$cols_output++,$score);
                   1122:             $excel_sheet->write($rows_output,$cols_output++,$seq_max);
                   1123:         } elsif ($data eq 'sum and total' || $data eq 'sum only' || 
                   1124:             $data eq 'parts correct' || $data eq 'parts correct total') {
1.32      matthew  1125:             $excel_sheet->write($rows_output,$cols_output++,$score);
                   1126:         }
1.54      matthew  1127:         if ($data eq 'sum and total' || $data eq 'parts correct total') {
1.32      matthew  1128:             $excel_sheet->write($rows_output,$cols_output++,$seq_max);
                   1129:         }
                   1130:     }
                   1131:     #
                   1132:     # Bookkeeping
                   1133:     $rows_output++; 
                   1134:     $cols_output=0;
                   1135:     #
1.36      matthew  1136:     # Update the progress window
                   1137:     &Apache::lonhtmlcommon::Increment_PrgWin($r,\%prog_state,'last student');
1.32      matthew  1138:     return;
1.31      matthew  1139: }
                   1140: 
                   1141: sub excel_finish {
                   1142:     my ($r) = @_;
1.54      matthew  1143:     return if ($request_aborted);
1.32      matthew  1144:     return if (! defined($excel_sheet));
                   1145:     #
                   1146:     # Write the excel file
                   1147:     $excel_workbook->close();
                   1148:     my $c = $r->connection();
                   1149:     #
                   1150:     return if($c->aborted());
                   1151:     #
1.36      matthew  1152:     # Close the progress window
                   1153:     &Apache::lonhtmlcommon::Close_PrgWin($r,\%prog_state);
                   1154:     #
1.32      matthew  1155:     # Tell the user where to get their excel file
1.36      matthew  1156:     $r->print('<br />'.
1.32      matthew  1157:               '<a href="'.$filename.'">Your Excel spreadsheet.</a>'."\n");
                   1158:     $r->rflush();
                   1159:     return;
1.31      matthew  1160: }
                   1161: 
                   1162: }
1.30      matthew  1163: #######################################################
                   1164: #######################################################
                   1165: 
                   1166: =pod
                   1167: 
1.31      matthew  1168: =head2 CSV output routines
                   1169: 
                   1170: =item &csv_initialize($r)
                   1171: 
                   1172: =item &csv_outputstudent($r,$student)
                   1173: 
                   1174: =item &csv_finish($r)
1.30      matthew  1175: 
                   1176: =cut
                   1177: 
                   1178: #######################################################
                   1179: #######################################################
1.31      matthew  1180: {
                   1181: 
1.37      matthew  1182: my $outputfile;
                   1183: my $filename;
1.54      matthew  1184: my $request_aborted;
1.37      matthew  1185: my %prog_state; # progress window state
                   1186: 
1.31      matthew  1187: sub csv_initialize{
                   1188:     my ($r) = @_;
1.37      matthew  1189:     # 
                   1190:     # Clean up
1.66      matthew  1191:     undef($outputfile);
                   1192:     undef($filename);
                   1193:     undef($request_aborted);
1.37      matthew  1194:     undef(%prog_state);
                   1195:     #
1.54      matthew  1196:     # Deal with unimplemented requests
                   1197:     $request_aborted = undef;
                   1198:     if ($data =~ /final table/) {
                   1199:         $r->print(<<END);
                   1200: <h2>Unable to Complete Request</h2>
                   1201: <p>
                   1202: The <b>Summary Table (Scores)</b> option is not available for non-HTML output.
                   1203: </p>
                   1204: END
                   1205:        $request_aborted = 1;
                   1206:     }
                   1207:     return if ($request_aborted);
                   1208: 
                   1209:     #
1.37      matthew  1210:     # Open a file
                   1211:     $filename = '/prtspool/'.
                   1212:         $ENV{'user.name'}.'_'.$ENV{'user.domain'}.'_'.
                   1213:             time.'_'.rand(1000000000).'.csv';
                   1214:     unless ($outputfile = Apache::File->new('>/home/httpd'.$filename)) {
                   1215:         $r->log_error("Couldn't open $filename for output $!");
                   1216:         $r->print("Problems occured in writing the csv file.  ".
                   1217:                   "This error has been logged.  ".
                   1218:                   "Please alert your LON-CAPA administrator.");
                   1219:         $outputfile = undef;
                   1220:     }
1.38      matthew  1221:     #
                   1222:     # Datestamp
                   1223:     my $description = $ENV{'course.'.$ENV{'request.course.id'}.'.description'};
                   1224:     print $outputfile '"'.&Apache::loncommon::csv_translate($description).'",'.
                   1225:         '"'.&Apache::loncommon::csv_translate(scalar(localtime(time))).'"'.
                   1226:             "\n";
1.37      matthew  1227:     #
                   1228:     # Print out the headings
                   1229:     my $Str = '';
                   1230:     my $Str2 = undef;
                   1231:     foreach my $field (&get_student_fields_to_show()) {
1.54      matthew  1232:         if ($data eq 'sum only') {
1.37      matthew  1233:             $Str .= '"'.&Apache::loncommon::csv_translate($field).'",';
1.54      matthew  1234:         } elsif ($data eq 'sum and total' || $data eq 'parts correct total') {
1.37      matthew  1235:             $Str .= '"",'; # first row empty on the student fields
                   1236:             $Str2 .= '"'.&Apache::loncommon::csv_translate($field).'",';
1.54      matthew  1237:         } elsif ($data eq 'scores' || $data eq 'tries' || 
                   1238:                  $data eq 'parts correct') {
1.53      matthew  1239:             $Str  .= '"",';
                   1240:             $Str2 .= '"'.&Apache::loncommon::csv_translate($field).'",';
1.37      matthew  1241:         }
                   1242:     }
1.40      matthew  1243:     foreach my $seq (&Apache::lonstatistics::Sequences_with_Assess()) {
1.54      matthew  1244:         if ($data eq 'sum only' || $data eq 'parts correct') {
1.37      matthew  1245:             $Str .= '"'.&Apache::loncommon::csv_translate($seq->{'title'}).
                   1246:                 '",';
1.54      matthew  1247:         } elsif ($data eq 'sum and total' || $data eq 'parts correct total') {
1.37      matthew  1248:             $Str  .= '"'.&Apache::loncommon::csv_translate($seq->{'title'}).
                   1249:                 '","",';
                   1250:             $Str2 .= '"score","total possible",';
1.54      matthew  1251:         } elsif ($data eq 'scores' || $data eq 'tries') {
1.37      matthew  1252:             $Str  .= '"'.&Apache::loncommon::csv_translate($seq->{'title'}).
                   1253:                 '",';
1.53      matthew  1254:             $Str .= '"",'x($seq->{'num_assess_parts'}-1+2);
                   1255:             foreach my $res (@{$seq->{'contents'}}) {
1.54      matthew  1256:                 next if ($res->{'type'} ne 'assessment');
1.53      matthew  1257:                 foreach my $part (@{$res->{'parts'}}) {
                   1258:                     $Str2 .= '"'.&Apache::loncommon::csv_translate($res->{'title'}.', Part '.$part).'",';
                   1259:                 }
                   1260:             }
                   1261:             $Str2 .= '"score","total possible",';
1.37      matthew  1262:         }
                   1263:     }
                   1264:     chop($Str);
                   1265:     $Str .= "\n";
                   1266:     print $outputfile $Str;
                   1267:     if (defined($Str2)) {
                   1268:         chop($Str2);
                   1269:         $Str2 .= "\n";
                   1270:         print $outputfile $Str2;
                   1271:     }
                   1272:     #
                   1273:     # Initialize progress window
                   1274:     my $studentcount = scalar(@Apache::lonstatistics::Students);
                   1275:     %prog_state=&Apache::lonhtmlcommon::Create_PrgWin
                   1276:         ($r,'CSV File Compilation Status',
                   1277:          'CSV File Compilation Progress', $studentcount);
1.31      matthew  1278:     return;
                   1279: }
                   1280: 
                   1281: sub csv_outputstudent {
                   1282:     my ($r,$student) = @_;
1.54      matthew  1283:     return if ($request_aborted);
1.37      matthew  1284:     return if (! defined($outputfile));
                   1285:     my $Str = '';
                   1286:     #
                   1287:     # Output student fields
                   1288:     my @to_show = &get_student_fields_to_show();
                   1289:     foreach my $field (@to_show) {
                   1290:         $Str .= '"'.&Apache::loncommon::csv_translate($student->{$field}).'",';
                   1291:     }
                   1292:     #
                   1293:     # Get student assessment data
                   1294:     my %StudentsData;
                   1295:     my @tmp = &Apache::loncoursedata::get_current_state($student->{'username'},
                   1296:                                                         $student->{'domain'},
                   1297:                                                         undef,
                   1298:                                                    $ENV{'request.course.id'});
                   1299:     if ((scalar @tmp > 0) && ($tmp[0] !~ /^error:/)) {
                   1300:         %StudentsData = @tmp;
                   1301:     }
                   1302:     #
                   1303:     # Output performance data
1.40      matthew  1304:     foreach my $seq (&Apache::lonstatistics::Sequences_with_Assess()) {
1.54      matthew  1305:         my ($performance,$performance_length,$score,$seq_max,$rawdata);
                   1306:         if ($base eq 'tries') {
                   1307:             ($performance,$performance_length,$score,$seq_max,$rawdata) =
                   1308:                 &StudentTriesOnSequence($student,\%StudentsData,
                   1309:                                         $seq,'no');
                   1310:         } else {
                   1311:             ($performance,$performance_length,$score,$seq_max,$rawdata) =
                   1312:                 &StudentPerformanceOnSequence($student,\%StudentsData,
                   1313:                                               $seq,'no');
                   1314:         }
                   1315:         if ($data eq 'sum only' || $data eq 'parts correct') {
1.37      matthew  1316:             $Str .= '"'.$score.'",';
1.54      matthew  1317:         } elsif ($data eq 'sum and total' || $data eq 'parts correct total') {
1.37      matthew  1318:             $Str  .= '"'.$score.'","'.$seq_max.'",';
1.54      matthew  1319:         } elsif ($data eq 'scores' || $data eq 'tries') {
                   1320:             $Str .= '"'.join('","',(@$rawdata,$score,$seq_max)).'",';
1.37      matthew  1321:         }
                   1322:     }
                   1323:     chop($Str);
                   1324:     $Str .= "\n";
                   1325:     print $outputfile $Str;
                   1326:     #
                   1327:     # Update the progress window
                   1328:     &Apache::lonhtmlcommon::Increment_PrgWin($r,\%prog_state,'last student');
                   1329:     return;
1.31      matthew  1330: }
                   1331: 
                   1332: sub csv_finish {
                   1333:     my ($r) = @_;
1.54      matthew  1334:     return if ($request_aborted);
1.37      matthew  1335:     return if (! defined($outputfile));
                   1336:     close($outputfile);
                   1337:     #
                   1338:     my $c = $r->connection();
                   1339:     return if ($c->aborted());
                   1340:     #
                   1341:     # Close the progress window
                   1342:     &Apache::lonhtmlcommon::Close_PrgWin($r,\%prog_state);
                   1343:     #
                   1344:     # Tell the user where to get their csv file
                   1345:     $r->print('<br />'.
                   1346:               '<a href="'.$filename.'">Your csv file.</a>'."\n");
                   1347:     $r->rflush();
                   1348:     return;
                   1349:     
1.31      matthew  1350: }
1.2       stredwic 1351: 
                   1352: }
                   1353: 
1.28      matthew  1354: #######################################################
                   1355: #######################################################
                   1356: 
1.2       stredwic 1357: =pod
                   1358: 
1.54      matthew  1359: =item &StudentTriesOnSequence()
1.2       stredwic 1360: 
1.30      matthew  1361: Inputs:
1.2       stredwic 1362: 
                   1363: =over 4
                   1364: 
1.30      matthew  1365: =item $student
1.28      matthew  1366: 
1.30      matthew  1367: =item $studentdata Hash ref to all student data
1.2       stredwic 1368: 
1.30      matthew  1369: =item $seq Hash ref, the sequence we are working on
1.2       stredwic 1370: 
1.30      matthew  1371: =item $links if defined we will output links to each resource.
1.2       stredwic 1372: 
1.28      matthew  1373: =back
1.2       stredwic 1374: 
                   1375: =cut
1.1       stredwic 1376: 
1.28      matthew  1377: #######################################################
                   1378: #######################################################
1.54      matthew  1379: sub StudentTriesOnSequence {
1.32      matthew  1380:     my ($student,$studentdata,$seq,$links) = @_;
1.31      matthew  1381:     $links = 'no' if (! defined($links));
1.1       stredwic 1382:     my $Str = '';
1.30      matthew  1383:     my ($sum,$max) = (0,0);
1.51      matthew  1384:     my $performance_length = 0;
1.54      matthew  1385:     my @TriesData = ();
                   1386:     my $tries;
1.30      matthew  1387:     foreach my $resource (@{$seq->{'contents'}}) {
                   1388:         next if ($resource->{'type'} ne 'assessment');
                   1389:         my $resource_data = $studentdata->{$resource->{'symb'}};
                   1390:         my $value = '';
                   1391:         foreach my $partnum (@{$resource->{'parts'}}) {
1.54      matthew  1392:             $tries = undef;
1.30      matthew  1393:             $max++;
1.51      matthew  1394:             $performance_length++;
1.30      matthew  1395:             my $symbol = ' '; # default to space
                   1396:             #
                   1397:             if (exists($resource_data->{'resource.'.$partnum.'.solved'})) {
                   1398:                 my $status = $resource_data->{'resource.'.$partnum.'.solved'};
                   1399:                 if ($status eq 'correct_by_override') {
                   1400:                     $symbol = '+';
                   1401:                     $sum++;
                   1402:                 } elsif ($status eq 'incorrect_by_override') {
                   1403:                     $symbol = '-';
                   1404:                 } elsif ($status eq 'ungraded_attempted') {
                   1405:                     $symbol = '#';
                   1406:                 } elsif ($status eq 'incorrect_attempted')  {
                   1407:                     $symbol = '.';
                   1408:                 } elsif ($status eq 'excused') {
                   1409:                     $symbol = 'x';
                   1410:                     $max--;
1.68      matthew  1411:                 } elsif (($status eq 'correct_by_scantron' ||
                   1412:                           $status eq 'correct_by_student') &&
1.30      matthew  1413:                     exists($resource_data->{'resource.'.$partnum.'.tries'})){
1.54      matthew  1414:                     $tries = $resource_data->{'resource.'.$partnum.'.tries'};
                   1415:                     if ($tries > 9) {
1.30      matthew  1416:                         $symbol = '*';
1.54      matthew  1417:                     } elsif ($tries > 0) {
                   1418:                         $symbol = $tries;
1.30      matthew  1419:                     } else {
                   1420:                         $symbol = ' ';
                   1421:                     }
                   1422:                     $sum++;
1.43      matthew  1423:                 } elsif (exists($resource_data->{'resource.'.
                   1424:                                                      $partnum.'.tries'})){
                   1425:                     $symbol = '.';
1.30      matthew  1426:                 } else {
                   1427:                     $symbol = ' ';
1.2       stredwic 1428:                 }
1.30      matthew  1429:             } else {
                   1430:                 # Unsolved.  Did they try?
                   1431:                 if (exists($resource_data->{'resource.'.$partnum.'.tries'})){
                   1432:                     $symbol = '.';
                   1433:                 } else {
                   1434:                     $symbol = ' ';
1.18      matthew  1435:                 }
1.2       stredwic 1436:             }
1.54      matthew  1437:             #
                   1438:             if (! defined($tries)) {
                   1439:                 $tries = $symbol;
                   1440:             }
                   1441:             push (@TriesData,$tries);
1.30      matthew  1442:             #
1.47      matthew  1443:             if ( ($links eq 'yes' && $symbol ne ' ') ||
                   1444:                  ($links eq 'all')) {
1.49      matthew  1445:                 if (length($symbol) > 1) {
                   1446:                     &Apache::lonnet::logthis('length of symbol "'.$symbol.'" > 1');
                   1447:                 }
1.30      matthew  1448:                 $symbol = '<a href="/adm/grades'.
                   1449:                     '?symb='.&Apache::lonnet::escape($resource->{'symb'}).
                   1450:                         '&student='.$student->{'username'}.
1.64      albertel 1451:                             '&userdom='.$student->{'domain'}.
1.30      matthew  1452:                                 '&command=submission">'.$symbol.'</a>';
                   1453:             }
                   1454:             $value .= $symbol;
1.2       stredwic 1455:         }
1.30      matthew  1456:         $Str .= $value;
1.17      minaeibi 1457:     }
1.51      matthew  1458:     if ($seq->{'randompick'}) {
                   1459:         $max = $seq->{'randompick'};
                   1460:     }
1.54      matthew  1461:     return ($Str,$performance_length,$sum,$max,\@TriesData);
                   1462: }
                   1463: 
                   1464: #######################################################
                   1465: #######################################################
                   1466: 
                   1467: =pod
                   1468: 
                   1469: =item &StudentPerformanceOnSequence()
                   1470: 
                   1471: Inputs:
                   1472: 
                   1473: =over 4
                   1474: 
                   1475: =item $student
                   1476: 
                   1477: =item $studentdata Hash ref to all student data
                   1478: 
                   1479: =item $seq Hash ref, the sequence we are working on
                   1480: 
                   1481: =item $links if defined we will output links to each resource.
                   1482: 
                   1483: =back
                   1484: 
                   1485: =cut
                   1486: 
                   1487: #######################################################
                   1488: #######################################################
                   1489: sub StudentPerformanceOnSequence {
                   1490:     my ($student,$studentdata,$seq,$links) = @_;
                   1491:     $links = 'no' if (! defined($links));
                   1492:     my $Str = ''; # final result string
                   1493:     my ($score,$max) = (0,0);
                   1494:     my $performance_length = 0;
                   1495:     my $symbol;
                   1496:     my @ScoreData = ();
                   1497:     my $partscore;
                   1498:     foreach my $resource (@{$seq->{'contents'}}) {
                   1499:         next if ($resource->{'type'} ne 'assessment');
                   1500:         my $resource_data = $studentdata->{$resource->{'symb'}};
                   1501:         foreach my $part (@{$resource->{'parts'}}) {
                   1502:             $partscore = undef;
                   1503:             my $weight = &Apache::lonnet::EXT('resource.'.$part.'.weight',
                   1504:                                               $resource->{'symb'},
                   1505:                                               $student->{'domain'},
                   1506:                                               $student->{'username'},
                   1507:                                               $student->{'section'});
                   1508:             if (!defined($weight) || ($weight eq '')) { 
                   1509:                 $weight=1;
                   1510:             }
                   1511:             #
                   1512:             $max += $weight; # see the 'excused' branch below...
                   1513:             $performance_length++; # one character per part
                   1514:             $symbol = ' '; # default to space
                   1515:             #
                   1516:             my $awarded = 0;
                   1517:             if (exists($resource_data->{'resource.'.$part.'.awarded'})) {
                   1518:                 $awarded = $resource_data->{'resource.'.$part.'.awarded'};
1.67      matthew  1519:                 $awarded = 0 if (! $awarded);
1.54      matthew  1520:             }
                   1521:             #
                   1522:             $partscore = $weight*$awarded;
                   1523:             $score += $partscore;
1.63      matthew  1524:             $symbol = $partscore; 
1.70      matthew  1525:             if (abs($symbol - sprintf("%.0f",$symbol)) < 0.001) {
                   1526:                 $symbol = sprintf("%.0f",$symbol);
                   1527:             }
1.54      matthew  1528:             if (length($symbol) > 1) {
                   1529:                 $symbol = '*';
                   1530:             }
                   1531:             if (exists($resource_data->{'resource.'.$part.'.solved'})) {
                   1532:                 my $status = $resource_data->{'resource.'.$part.'.solved'};
                   1533:                 if ($status eq 'excused') {
                   1534:                     $symbol = 'x';
                   1535:                     $max -= $weight; # Do not count 'excused' problems.
                   1536:                 }
                   1537:             } else {
                   1538:                 # Unsolved.  Did they try?
                   1539:                 if (exists($resource_data->{'resource.'.$part.'.tries'})){
                   1540:                     $symbol = '.';
                   1541:                 } else {
                   1542:                     $symbol = ' ';
                   1543:                 }
                   1544:             }
                   1545:             #
1.60      matthew  1546:             if (! defined($partscore)) {
                   1547:                 $partscore = $symbol;
                   1548:             }
                   1549:             push (@ScoreData,$partscore);
                   1550:             #
1.54      matthew  1551:             if ( ($links eq 'yes' && $symbol ne ' ') || ($links eq 'all')) {
                   1552:                 $symbol = '<a href="/adm/grades'.
                   1553:                     '?symb='.&Apache::lonnet::escape($resource->{'symb'}).
                   1554:                     '&student='.$student->{'username'}.
1.64      albertel 1555:                     '&userdom='.$student->{'domain'}.
1.54      matthew  1556:                     '&command=submission">'.$symbol.'</a>';
                   1557:             }
1.60      matthew  1558:             $Str .= $symbol;
1.54      matthew  1559:         }
                   1560:     }
                   1561:     return ($Str,$performance_length,$score,$max,\@ScoreData);
1.1       stredwic 1562: }
1.23      minaeibi 1563: 
1.28      matthew  1564: #######################################################
                   1565: #######################################################
1.23      minaeibi 1566: 
1.2       stredwic 1567: =pod
                   1568: 
                   1569: =item &CreateLegend()
                   1570: 
                   1571: This function returns a formatted string containing the legend for the
                   1572: chart.  The legend describes the symbols used to represent grades for
                   1573: problems.
                   1574: 
                   1575: =cut
                   1576: 
1.28      matthew  1577: #######################################################
                   1578: #######################################################
1.2       stredwic 1579: sub CreateLegend {
                   1580:     my $Str = "<p><pre>".
1.13      minaeibi 1581:               "   1  correct by student in 1 try\n".
                   1582:               "   7  correct by student in 7 tries\n".
1.12      minaeibi 1583:               "   *  correct by student in more than 9 tries\n".
1.20      minaeibi 1584: 	      "   +  correct by hand grading or override\n".
1.12      minaeibi 1585:               "   -  incorrect by override\n".
                   1586: 	      "   .  incorrect attempted\n".
                   1587: 	      "   #  ungraded attempted\n".
1.13      minaeibi 1588:               "      not attempted (blank field)\n".
1.12      minaeibi 1589: 	      "   x  excused".
1.17      minaeibi 1590:               "</pre><p>";
1.2       stredwic 1591:     return $Str;
                   1592: }
                   1593: 
1.28      matthew  1594: #######################################################
                   1595: #######################################################
                   1596: 
1.30      matthew  1597: =pod 
1.2       stredwic 1598: 
                   1599: =back
                   1600: 
                   1601: =cut
                   1602: 
1.28      matthew  1603: #######################################################
                   1604: #######################################################
1.2       stredwic 1605: 
1.28      matthew  1606: 1;
1.2       stredwic 1607: 
1.1       stredwic 1608: __END__

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>