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

1.1       stredwic    1: # The LearningOnline Network with CAPA
                      2: #
1.73    ! matthew     3: # $Id: lonstudentassessment.pm,v 1.72 2003/10/22 15:38:11 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.73    ! matthew   422:     &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},
        !           423:                                             [$elementname]);
1.31      matthew   424:     #
                    425:     # Format for output options is 'mode, restrictions';
1.50      matthew   426:     my $selected = 'html, without links';
1.31      matthew   427:     if (exists($ENV{'form.'.$elementname})) {
                    428:         if (ref($ENV{'form.'.$elementname} eq 'ARRAY')) {
                    429:             $selected = $ENV{'form.'.$elementname}->[0];
                    430:         } else {
                    431:             $selected = $ENV{'form.'.$elementname};
                    432:         }
                    433:     }
                    434:     #
                    435:     # Set package variables describing output mode
                    436:     $show_links  = 'no';
                    437:     $output_mode = 'html';
1.35      matthew   438:     foreach my $option (@OutputOptions) {
                    439:         next if ($option->{'value'} ne $selected);
                    440:         $output_mode = $option->{'mode'};
                    441:         $show_links  = $option->{'show_links'};
1.31      matthew   442:     }
1.35      matthew   443: 
1.31      matthew   444:     #
                    445:     # Build the form element
                    446:     $Str = qq/<select size="5" name="$elementname">/;
1.32      matthew   447:     foreach my $option (@OutputOptions) {
                    448:         $Str .= "\n".'    <option value="'.$option->{'value'}.'"';
                    449:         $Str .= " selected " if ($option->{'value'} eq $selected);
                    450:         $Str .= ">".$option->{'name'}."<\/option>";
1.31      matthew   451:     }
                    452:     $Str .= "\n</select>";
                    453:     return $Str;
                    454: }
1.30      matthew   455: 
1.54      matthew   456: ##
                    457: ## Data selector stuff
                    458: ##
                    459: my @OutputDataOptions =
1.57      matthew   460:     (
1.72      matthew   461:      { name  => 'Scores Summary',
1.57      matthew   462:        base  => 'scores',
                    463:        value => 'sum and total',
                    464:        shortdesc => 'Total Score and Maximum Possible for each '.
                    465:            'Sequence or Folder',
                    466:        longdesc => 'The score of each student as well as the '.
                    467:            ' maximum possible on each Sequence or Folder.',
                    468:        },
1.71      matthew   469:      { name  => 'Scores Per Problem',
1.57      matthew   470:        base  => 'scores',
1.71      matthew   471:        value => 'scores',
                    472:        shortdesc => 'Score on each Problem Part',
                    473:        longdesc =>'The students score on each problem part, computed as'.
                    474:            'the part weight * part awarded',
1.57      matthew   475:        },
1.71      matthew   476: #     { name  => 'Scores Sum',
                    477: #       base  => 'scores',
                    478: #       value => 'sum only',
                    479: #       shortdesc => 'Sum of Scores on each Problem Part',
                    480: #       longdesc =>'The total of the scores of the student on each problem'.
                    481: #           ' part in the sequences or folders selected.',
                    482: #       },
                    483: #     { name  => 'Scores Summary Table Only',
                    484: #       base  => 'scores',
                    485: #       value => 'final table scores',
                    486: #       shortdesc => 'Summary of Scores',
                    487: #       longdesc  => 'The average score on each sequence or folder for the '.
                    488: #           'selected students.',
                    489: #       },
1.57      matthew   490:      { name  =>'Tries',
                    491:        base  =>'tries',
                    492:        value => 'tries',
                    493:        shortdesc => 'Number of Tries before success on each Problem Part',
                    494:        longdesc =>'The number of tries before success on each problem part.',
                    495:        },
                    496:      { name  =>'Parts Correct',
                    497:        base  =>'tries',
                    498:        value => 'parts correct total',
                    499:        shortdesc => 'Number of Problem Parts completed successfully.',
                    500:        longdesc => 'The Number of Problem Parts completed successfully and '.
                    501:            'the maximum possible for each student',
                    502:        },
1.71      matthew   503: #     { name  =>'Parts Correct',
                    504: #       base  =>'tries',
                    505: #       value => 'parts correct',
                    506: #       shortdesc => 'Number of Problem Parts completed successfully.',
                    507: #       longdesc => 'The Number of Problem Parts completed successfully'.
                    508: #           ' on each sequence or folder.',
                    509: #       },
                    510: #     { name  => 'Parts Summary Table Only',
                    511: #       base  => 'tries',
                    512: #       value => 'final table parts',
                    513: #       shortdesc => 'Summary of Parts Correct',
                    514: #       longdesc  => 'A summary table of the average number of problem parts '.
                    515: #           'students were able to get correct on each sequence.',
                    516: #       },
1.57      matthew   517:      );
                    518: 
                    519: sub HTMLifyOutputDataDescriptions {
                    520:     my $Str = '';
1.58      matthew   521:     $Str .= "<h2>Output Data</h2>\n";
1.57      matthew   522:     $Str .= "<dl>\n";
                    523:     foreach my $option (@OutputDataOptions) {
                    524:         $Str .= '    <dt>'.$option->{'name'}.'</dt>';
                    525:         $Str .= '<dd>'.$option->{'longdesc'}.'</dd>'."\n";
                    526:     }
                    527:     $Str .= "</dl>\n";
                    528:     return $Str;
                    529: }
1.54      matthew   530: 
                    531: sub CreateAndParseOutputDataSelector {
                    532:     my $Str = '';
                    533:     my $elementname = 'chartoutputdata';
                    534:     #
                    535:     my $selected = 'scores';
                    536:     if (exists($ENV{'form.'.$elementname})) {
                    537:         if (ref($ENV{'form.'.$elementname} eq 'ARRAY')) {
                    538:             $selected = $ENV{'form.'.$elementname}->[0];
                    539:         } else {
                    540:             $selected = $ENV{'form.'.$elementname};
                    541:         }
                    542:     }
                    543:     #
                    544:     $data = 'scores';
                    545:     foreach my $option (@OutputDataOptions) {
                    546:         if ($option->{'value'} eq $selected) {
                    547:             $data = $option->{'value'};
                    548:             $base = $option->{'base'};
                    549:             $datadescription = $option->{'shortdesc'};
                    550:         }
                    551:     }
                    552:     #
                    553:     # Build the form element
                    554:     $Str = qq/<select size="5" name="$elementname">/;
                    555:     foreach my $option (@OutputDataOptions) {
                    556:         $Str .= "\n".'    <option value="'.$option->{'value'}.'"';
                    557:         $Str .= " selected " if ($option->{'value'} eq $data);
                    558:         $Str .= ">".$option->{'name'}."<\/option>";
                    559:     }
                    560:     $Str .= "\n</select>";
                    561:     return $Str;
                    562: 
                    563: }
                    564: 
1.28      matthew   565: #######################################################
                    566: #######################################################
1.1       stredwic  567: 
1.28      matthew   568: =pod
                    569: 
1.31      matthew   570: =head2 HTML output routines
1.28      matthew   571: 
1.31      matthew   572: =item &html_initialize($r)
1.28      matthew   573: 
1.31      matthew   574: Create labels for the columns of student data to show.
1.28      matthew   575: 
1.31      matthew   576: =item &html_outputstudent($r,$student)
1.28      matthew   577: 
1.31      matthew   578: Return a line of the chart for a student.
1.28      matthew   579: 
1.31      matthew   580: =item &html_finish($r)
1.28      matthew   581: 
                    582: =cut
                    583: 
                    584: #######################################################
                    585: #######################################################
1.31      matthew   586: {
                    587:     my $padding;
                    588:     my $count;
                    589: 
1.39      matthew   590:     my $nodata_count; # The number of students for which there is no data
                    591:     my %prog_state;   # progress state used by loncommon PrgWin routines
                    592: 
1.31      matthew   593: sub html_initialize {
                    594:     my ($r) = @_;
1.30      matthew   595:     #
                    596:     $padding = ' 'x3;
1.35      matthew   597:     $count = 0;
1.39      matthew   598:     $nodata_count = 0;
1.66      matthew   599:     undef(%prog_state);
1.30      matthew   600:     #
1.38      matthew   601:     $r->print("<h3>".$ENV{'course.'.$ENV{'request.course.id'}.'.description'}.
                    602:               "&nbsp;&nbsp;".localtime(time)."</h3>");
1.39      matthew   603: 
1.55      matthew   604:     if ($data !~ /^final table/) {
                    605:         $r->print("<h3>".$datadescription."</h3>");        
                    606:     }
1.39      matthew   607:     #
                    608:     # Set up progress window for 'final table' display only
1.54      matthew   609:     if ($data =~ /^final table/) {
1.39      matthew   610:         my $studentcount = scalar(@Apache::lonstatistics::Students); 
                    611:         %prog_state=&Apache::lonhtmlcommon::Create_PrgWin
                    612:             ($r,'Summary Table Status',
                    613:              'Summary Table Compilation Progress', $studentcount);
                    614:     }
1.31      matthew   615:     my $Str = "<pre>\n";
1.30      matthew   616:     # First, the @StudentData fields need to be listed
1.31      matthew   617:     my @to_show = &get_student_fields_to_show();
1.30      matthew   618:     foreach my $field (@to_show) {
                    619:         my $title=$Apache::lonstatistics::StudentData{$field}->{'title'};
                    620:         my $base =$Apache::lonstatistics::StudentData{$field}->{'base_width'};
                    621:         my $width=$Apache::lonstatistics::StudentData{$field}->{'width'};
                    622:         $Str .= $title.' 'x($width-$base).$padding;
                    623:     }
                    624:     # Now the selected sequences need to be listed
1.40      matthew   625:     foreach my $sequence (&Apache::lonstatistics::Sequences_with_Assess()){
1.31      matthew   626:         my $title = $sequence->{'title'};
                    627:         my $base  = $sequence->{'base_width'};
                    628:         my $width = $sequence->{'width'};
                    629:         $Str .= $title.' 'x($width-$base).$padding;
1.30      matthew   630:     }
1.54      matthew   631:     $Str .= "total</pre>\n";
1.31      matthew   632:     $Str .= "<pre>";
1.39      matthew   633:     #
                    634:     # Check for suppression of output
1.54      matthew   635:     if ($data =~ /^final table/) {
1.39      matthew   636:         $Str = '';
                    637:     }
1.31      matthew   638:     $r->print($Str);
                    639:     $r->rflush();
                    640:     return;
1.30      matthew   641: }
                    642: 
1.31      matthew   643: sub html_outputstudent {
                    644:     my ($r,$student) = @_;
1.2       stredwic  645:     my $Str = '';
1.35      matthew   646:     #
1.55      matthew   647:     if($count++ % 5 == 0 && $count > 0 && $data !~ /^final table/) {
1.35      matthew   648:         $r->print("</pre><pre>");
                    649:     }
1.30      matthew   650:     # First, the @StudentData fields need to be listed
1.31      matthew   651:     my @to_show = &get_student_fields_to_show();
1.30      matthew   652:     foreach my $field (@to_show) {
                    653:         my $title=$student->{$field};
1.31      matthew   654:         my $base = length($title);
1.30      matthew   655:         my $width=$Apache::lonstatistics::StudentData{$field}->{'width'};
                    656:         $Str .= $title.' 'x($width-$base).$padding;
                    657:     }
                    658:     # Get ALL the students data
                    659:     my %StudentsData;
                    660:     my @tmp = &Apache::loncoursedata::get_current_state
                    661:         ($student->{'username'},$student->{'domain'},undef,
                    662:          $ENV{'request.course.id'});
                    663:     if ((scalar @tmp > 0) && ($tmp[0] !~ /^error:/)) {
                    664:         %StudentsData = @tmp;
                    665:     }
                    666:     if (scalar(@tmp) < 1) {
1.39      matthew   667:         $nodata_count++;
1.54      matthew   668:         return if ($data =~ /^final table/);
1.30      matthew   669:         $Str .= '<font color="blue">No Course Data</font>'."\n";
1.31      matthew   670:         $r->print($Str);
                    671:         $r->rflush();
                    672:         return;
1.30      matthew   673:     }
                    674:     #
                    675:     # By sequence build up the data
                    676:     my $studentstats;
1.31      matthew   677:     my $PerformanceStr = '';
1.40      matthew   678:     foreach my $seq (&Apache::lonstatistics::Sequences_with_Assess()) {
1.54      matthew   679:         my ($performance,$performance_length,$score,$seq_max,$rawdata);
                    680:         if ($base eq 'tries') {
                    681:             ($performance,$performance_length,$score,$seq_max,$rawdata) =
                    682:                 &StudentTriesOnSequence($student,\%StudentsData,
                    683:                                         $seq,$show_links);
                    684:         } else {
                    685:             ($performance,$performance_length,$score,$seq_max,$rawdata) =
                    686:                 &StudentPerformanceOnSequence($student,\%StudentsData,
                    687:                                               $seq,$show_links);
                    688:         }
                    689:         my $ratio = sprintf("%3d",$score).'/'.sprintf("%3d",$seq_max);
1.31      matthew   690:         #
1.54      matthew   691:         if ($data eq 'sum and total' || $data eq 'parts correct total') {
                    692:             $performance  = $ratio;
                    693:             $performance .= ' 'x($seq->{'width'}-length($ratio));
                    694:         } elsif ($data eq 'sum only' || $data eq 'parts correct') {
                    695:             $performance  = $score;
                    696:             $performance .= ' 'x($seq->{'width'}-length($score));
1.31      matthew   697:         } else {
                    698:             # Pad with extra spaces
1.51      matthew   699:             $performance .= ' 'x($seq->{'width'}-$performance_length-
1.31      matthew   700:                                  length($ratio)
                    701:                                  ).$ratio;
1.30      matthew   702:         }
1.31      matthew   703:         #
                    704:         $Str .= $performance.$padding;
                    705:         #
                    706:         $studentstats->{$seq->{'symb'}}->{'score'}= $score;
                    707:         $studentstats->{$seq->{'symb'}}->{'max'}  = $seq_max;
1.30      matthew   708:     }
                    709:     #
                    710:     # Total it up and store the statistics info.
                    711:     my ($score,$max) = (0,0);
                    712:     while (my ($symb,$seq_stats) = each (%{$studentstats})) {
                    713:         $Statistics->{$symb}->{'score'} += $seq_stats->{'score'};
1.54      matthew   714:         if ($Statistics->{$symb}->{'max'} < $seq_stats->{'max'}) {
                    715:             $Statistics->{$symb}->{'max'} = $seq_stats->{'max'};
                    716:         }
1.30      matthew   717:         $score += $seq_stats->{'score'};
                    718:         $max   += $seq_stats->{'max'};
                    719:     }
1.31      matthew   720:     $Str .= ' '.' 'x(length($max)-length($score)).$score.'/'.$max;
1.30      matthew   721:     $Str .= " \n";
1.39      matthew   722:     #
                    723:     # Check for suppressed output and update the progress window if so...
1.54      matthew   724:     if ($data =~ /^final table/) {
1.39      matthew   725:         $Str = '';
                    726:         &Apache::lonhtmlcommon::Increment_PrgWin($r,\%prog_state,
                    727:                                                  'last student');
                    728:     }
                    729:     #
1.31      matthew   730:     $r->print($Str);
                    731:     #
                    732:     $r->rflush();
                    733:     return;
1.30      matthew   734: }    
1.2       stredwic  735: 
1.31      matthew   736: sub html_finish {
                    737:     my ($r) = @_;
1.39      matthew   738:     #
                    739:     # Check for suppressed output and close the progress window if so
1.54      matthew   740:     if ($data =~ /^final table/) {
1.39      matthew   741:         &Apache::lonhtmlcommon::Close_PrgWin($r,\%prog_state);
                    742:     } else {
                    743:         $r->print("</pre>\n"); 
                    744:     }
1.49      matthew   745:     if ($single_student_mode) {
                    746:         $r->print(&SingleStudentTotal());
                    747:     } else {
                    748:         $r->print(&StudentAverageTotal());
                    749:     }
1.31      matthew   750:     $r->rflush();
                    751:     return;
                    752: }
                    753: 
1.39      matthew   754: sub StudentAverageTotal {
                    755:     my $Str = "<h3>Summary Tables</h3>\n";
                    756:     my $num_students = scalar(@Apache::lonstatistics::Students);
                    757:     my $total_ave = 0;
                    758:     my $total_max = 0;
                    759:     $Str .= '<table border=2 cellspacing="1">'."\n";
                    760:     $Str .= "<tr><th>Title</th><th>Average</th><th>Maximum</th></tr>\n";
1.40      matthew   761:     foreach my $seq (&Apache::lonstatistics::Sequences_with_Assess()) {
1.42      matthew   762:         my $ave;
                    763:         if ($num_students > $nodata_count) {
                    764:             $ave = int(100*($Statistics->{$seq->{'symb'}}->{'score'}/
                    765:                             ($num_students-$nodata_count)))/100;
                    766:         } else {
                    767:             $ave = 0;
                    768:         }
1.39      matthew   769:         $total_ave += $ave;
1.54      matthew   770:         my $max = $Statistics->{$seq->{'symb'}}->{'max'};
1.39      matthew   771:         $total_max += $max;
                    772:         if ($ave == 0) {
                    773:             $ave = "0.00";
                    774:         }
                    775:         $ave .= '&nbsp;';
                    776:         $max .= '&nbsp;&nbsp;&nbsp;';
                    777:         $Str .= '<tr><td>'.$seq->{'title'}.'</td>'.
                    778:             '<td align="right">'.$ave.'</td>'.
                    779:                 '<td align="right">'.$max.'</td></tr>'."\n";
                    780:     }
                    781:     $total_ave = int(100*$total_ave)/100; # only two digit
                    782:     $Str .= "</table>\n";
                    783:     $Str .= '<table border=2 cellspacing="1">'."\n";
                    784:     $Str .= '<tr><th>Number of Students</th><th>Average</th>'.
                    785:         "<th>Maximum</th></tr>\n";
                    786:     $Str .= '<tr><td>'.($num_students-$nodata_count).'</td>'.
                    787:         '<td>'.$total_ave.'</td><td>'.$total_max.'</td>';
                    788:     $Str .= "</table>\n";
                    789:     return $Str;
                    790: }
                    791: 
1.49      matthew   792: sub SingleStudentTotal {
                    793:     my $student = &Apache::lonstatistics::current_student();
1.52      matthew   794:     my $Str = "<h3>Summary table for ".$student->{'fullname'}." ".
                    795:         $student->{'username'}.'@'.$student->{'domain'}."</h3>\n";
1.49      matthew   796:     $Str .= '<table border=2 cellspacing="1">'."\n";
                    797:     $Str .= 
                    798:         "<tr><th>Sequence or Folder</th><th>Score</th><th>Maximum</th></tr>\n";
                    799:     my $total = 0;
                    800:     my $total_max = 0;
                    801:     foreach my $seq (&Apache::lonstatistics::Sequences_with_Assess()) {
                    802:         my $value = $Statistics->{$seq->{'symb'}}->{'score'};
                    803:         my $max = $Statistics->{$seq->{'symb'}}->{'max'};
                    804:         $Str .= '<tr><td>'.$seq->{'title'}.'</td>'.
                    805:             '<td align="right">'.$value.'</td>'.
                    806:                 '<td align="right">'.$max.'</td></tr>'."\n";
                    807:         $total += $value;
                    808:         $total_max +=$max;
                    809:     }
                    810:     $Str .= '<tr><td><b>Total</b></td>'.
                    811:         '<td align="right">'.$total.'</td>'.
                    812:         '<td align="right">'.$total_max."</td></tr>\n";
                    813:     $Str .= "</table>\n";
                    814:     return $Str;
                    815: }
                    816: 
1.31      matthew   817: }
                    818: 
                    819: #######################################################
                    820: #######################################################
                    821: 
                    822: =pod
                    823: 
                    824: =head2 EXCEL subroutines
                    825: 
                    826: =item &excel_initialize($r)
                    827: 
                    828: =item &excel_outputstudent($r,$student)
                    829: 
                    830: =item &excel_finish($r)
                    831: 
                    832: =cut
                    833: 
                    834: #######################################################
                    835: #######################################################
                    836: {
                    837: 
                    838: my $excel_sheet;
1.32      matthew   839: my $excel_workbook;
                    840: 
                    841: my $filename;
                    842: my $rows_output;
                    843: my $cols_output;
                    844: 
1.36      matthew   845: my %prog_state; # progress window state
1.54      matthew   846: my $request_aborted;
1.31      matthew   847: 
                    848: sub excel_initialize {
                    849:     my ($r) = @_;
                    850:     #
1.66      matthew   851:     undef ($excel_sheet);
                    852:     undef ($excel_workbook);
                    853:     undef ($filename);
                    854:     undef ($rows_output);
                    855:     undef ($cols_output);
                    856:     undef (%prog_state);
                    857:     undef ($request_aborted);
                    858:     #
1.54      matthew   859:     my $total_columns = scalar(&get_student_fields_to_show());
                    860:     foreach my $seq (&Apache::lonstatistics::Sequences_with_Assess()) {
                    861:         # Add 2 because we need a 'sum' and 'total' column for each
                    862:         $total_columns += $seq->{'num_assess_parts'}+2;
                    863:     }
                    864:     if ($data eq 'tries' && $total_columns > 255) {
                    865:         $r->print(<<END);
                    866: <h2>Unable to Complete Request</h2>
                    867: <p>
                    868: LON-CAPA is unable to produce your Excel spreadsheet because your selections
                    869: will result in more than 255 columns.  Excel allows only 255 columns in a
                    870: spreadsheet.
                    871: </p><p>
                    872: You may consider reducing the number of <b>Sequences or Folders</b> you
                    873: have selected.  
                    874: </p><p>
                    875: LON-CAPA can produce <b>CSV</b> files of this data or Excel files of the
                    876: summary data (<b>Parts Correct</b> or <b>Parts Correct & Totals</b>).
                    877: </p>
                    878: END
                    879:        $request_aborted = 1;
                    880:     }
                    881:     if ($data eq 'scores' && $total_columns > 255) {
                    882:         $r->print(<<END);
                    883: <h2>Unable to Complete Request</h2>
                    884: <p>
                    885: LON-CAPA is unable to produce your Excel spreadsheet because your selections
                    886: will result in more than 255 columns.  Excel allows only 255 columns in a
                    887: spreadsheet.
                    888: </p><p>
                    889: You may consider reducing the number of <b>Sequences or Folders</b> you
                    890: have selected.  
                    891: </p><p>
                    892: LON-CAPA can produce <b>CSV</b> files of this data or Excel files of the
                    893: summary data (<b>Scores Sum</b> or <b>Scores Sum & Totals</b>).
                    894: </p>
                    895: END
                    896:        $request_aborted = 1;
                    897:     }
                    898:     if ($data =~ /^final table/) {
                    899:         $r->print(<<END);
                    900: <h2>Unable to Complete Request</h2>
                    901: <p>
                    902: The <b>Summary Table (Scores)</b> option is not available for non-HTML output.
                    903: </p>
                    904: END
                    905:        $request_aborted = 1;
                    906:     }
                    907:     return if ($request_aborted);
                    908:     #
1.32      matthew   909:     $filename = '/prtspool/'.
1.31      matthew   910:         $ENV{'user.name'}.'_'.$ENV{'user.domain'}.'_'.
                    911:             time.'_'.rand(1000000000).'.xls';
1.32      matthew   912:     #
                    913:     $excel_workbook = undef;
                    914:     $excel_sheet = undef;
                    915:     #
                    916:     $rows_output = 0;
                    917:     $cols_output = 0;
                    918:     #
                    919:     # Create sheet
                    920:     $excel_workbook = Spreadsheet::WriteExcel->new('/home/httpd'.$filename);
                    921:     #
                    922:     # Check for errors
                    923:     if (! defined($excel_workbook)) {
1.31      matthew   924:         $r->log_error("Error creating excel spreadsheet $filename: $!");
                    925:         $r->print("Problems creating new Excel file.  ".
                    926:                   "This error has been logged.  ".
                    927:                   "Please alert your LON-CAPA administrator");
1.32      matthew   928:         return ;
1.31      matthew   929:     }
                    930:     #
                    931:     # The excel spreadsheet stores temporary data in files, then put them
                    932:     # together.  If needed we should be able to disable this (memory only).
                    933:     # The temporary directory must be specified before calling 'addworksheet'.
                    934:     # File::Temp is used to determine the temporary directory.
1.32      matthew   935:     $excel_workbook->set_tempdir($Apache::lonnet::tmpdir);
                    936:     #
                    937:     # Add a worksheet
1.33      matthew   938:     my $sheetname = $ENV{'course.'.$ENV{'request.course.id'}.'.description'};
1.67      matthew   939:     $sheetname = &Apache::loncommon::clean_excel_name($sheetname);
1.33      matthew   940:     $excel_sheet = $excel_workbook->addworksheet($sheetname);
1.32      matthew   941:     #
1.34      matthew   942:     # Put the course description in the header
                    943:     $excel_sheet->write($rows_output,$cols_output++,
                    944:                    $ENV{'course.'.$ENV{'request.course.id'}.'.description'});
                    945:     $cols_output += 3;
                    946:     #
                    947:     # Put a description of the sections listed
                    948:     my $sectionstring = '';
                    949:     my @Sections = @Apache::lonstatistics::SelectedSections;
                    950:     if (scalar(@Sections) > 1) {
                    951:         if (scalar(@Sections) > 2) {
                    952:             my $last = pop(@Sections);
                    953:             $sectionstring = "Sections ".join(', ',@Sections).', and '.$last;
                    954:         } else {
                    955:             $sectionstring = "Sections ".join(' and ',@Sections);
                    956:         }
                    957:     } else {
                    958:         if ($Sections[0] eq 'all') {
                    959:             $sectionstring = "All sections";
                    960:         } else {
                    961:             $sectionstring = "Section ".$Sections[0];
                    962:         }
                    963:     }
                    964:     $excel_sheet->write($rows_output,$cols_output++,$sectionstring);
                    965:     $cols_output += scalar(@Sections);
                    966:     #
                    967:     # Put the date in there too
1.54      matthew   968:     $excel_sheet->write($rows_output++,$cols_output++,
1.34      matthew   969:                         'Compiled on '.localtime(time));
                    970:     #
1.54      matthew   971:     $cols_output = 0;
                    972:     $excel_sheet->write($rows_output++,$cols_output++,$datadescription);
                    973:     #
                    974:     if ($data eq 'tries' || $data eq 'scores') {
                    975:         $rows_output++;
                    976:     }
1.34      matthew   977:     #
1.32      matthew   978:     # Add the student headers
1.34      matthew   979:     $cols_output = 0;
1.32      matthew   980:     foreach my $field (&get_student_fields_to_show()) {
1.34      matthew   981:         $excel_sheet->write($rows_output,$cols_output++,$field);
1.32      matthew   982:     }
1.54      matthew   983:     my $row_offset = 0;
                    984:     if ($data eq 'tries' || $data eq 'scores') {
                    985:         $row_offset = -1;
                    986:     }
1.32      matthew   987:     #
1.54      matthew   988:     # Add the remaining column headers
1.40      matthew   989:     foreach my $seq (&Apache::lonstatistics::Sequences_with_Assess()) {
1.54      matthew   990:         $excel_sheet->write($rows_output+$row_offset,
                    991:                             $cols_output,$seq->{'title'});
                    992:         if ($data eq 'tries' || $data eq 'scores') {
                    993:             foreach my $res (@{$seq->{'contents'}}) {
                    994:                 next if ($res->{'type'} ne 'assessment');
                    995:                 if (scalar(@{$res->{'parts'}}) > 1) {
                    996:                     foreach my $part (@{$res->{'parts'}}) {
                    997:                         $excel_sheet->write($rows_output,
                    998:                                             $cols_output++,
                    999:                                             $res->{'title'}.' part '.$part);
                   1000:                     }
                   1001:                 } else {
                   1002:                     $excel_sheet->write($rows_output,
                   1003:                                         $cols_output++,
                   1004:                                         $res->{'title'});
                   1005:                 }
                   1006:             }
                   1007:             $excel_sheet->write($rows_output,$cols_output++,'score');
                   1008:             $excel_sheet->write($rows_output,$cols_output++,'maximum');
                   1009:         } elsif ($data eq 'sum and total' || $data eq 'parts correct total') {
1.34      matthew  1010:             $excel_sheet->write($rows_output+1,$cols_output,'score');
                   1011:             $excel_sheet->write($rows_output+1,$cols_output+1,'maximum');
1.32      matthew  1012:             $cols_output += 2;
                   1013:         } else {
                   1014:             $cols_output++;
                   1015:         }
                   1016:     }
                   1017:     #
                   1018:     # Bookkeeping
1.54      matthew  1019:     if ($data eq 'sum and total' || $data eq 'parts correct total') {
1.34      matthew  1020:         $rows_output += 2;
1.32      matthew  1021:     } else {
1.34      matthew  1022:         $rows_output += 1;
1.45      matthew  1023:     }
                   1024:     #
                   1025:     # Output a row for MAX
1.54      matthew  1026:     $cols_output = 0;
                   1027:     foreach my $field (&get_student_fields_to_show()) {
                   1028:         if ($field eq 'username' || $field eq 'fullname' || 
                   1029:             $field eq 'id') {
                   1030:             $excel_sheet->write($rows_output,$cols_output++,'Maximum');
                   1031:         } else {
                   1032:             $excel_sheet->write($rows_output,$cols_output++,'');
                   1033:         }
                   1034:     }
                   1035:     #
                   1036:     # Add the maximums for each sequence or assessment
                   1037:     foreach my $seq (&Apache::lonstatistics::Sequences_with_Assess()) {
                   1038:         my $weight;
                   1039:         my $max = 0;
                   1040:         foreach my $resource (@{$seq->{'contents'}}) {
                   1041:             next if ($resource->{'type'} ne 'assessment');
                   1042:             foreach my $part (@{$resource->{'parts'}}) {
                   1043:                 $weight = 1;
                   1044:                 if ($base eq 'scores') {
                   1045:                     $weight = &Apache::lonnet::EXT
                   1046:                         ('resource.'.$part.'.weight',$resource->{'symb'},
                   1047:                          undef,undef,undef);
                   1048:                     if (!defined($weight) || ($weight eq '')) { 
                   1049:                         $weight=1;
                   1050:                     }
                   1051:                 }
                   1052:                 if ($data eq 'scores') {
                   1053:                     $excel_sheet->write($rows_output,$cols_output++,$weight);
                   1054:                 } elsif ($data eq 'tries') {
                   1055:                     $excel_sheet->write($rows_output,$cols_output++,'');
                   1056:                 }
                   1057:                 $max += $weight;
1.45      matthew  1058:             }
1.54      matthew  1059:         } 
                   1060:         if (! ($data eq 'sum only' || $data eq 'parts correct')) {
                   1061:             $excel_sheet->write($rows_output,$cols_output++,'');
1.45      matthew  1062:         }
1.54      matthew  1063:         $excel_sheet->write($rows_output,$cols_output++,$max);
1.32      matthew  1064:     }
1.54      matthew  1065:     $rows_output++;
1.32      matthew  1066:     #
                   1067:     # Let the user know what we are doing
                   1068:     my $studentcount = scalar(@Apache::lonstatistics::Students); 
                   1069:     $r->print("<h1>Compiling Excel spreadsheet for ".
                   1070:               $studentcount.' student');
                   1071:     $r->print('s') if ($studentcount > 1);
                   1072:     $r->print("</h1>\n");
                   1073:     $r->rflush();
1.31      matthew  1074:     #
1.36      matthew  1075:     # Initialize progress window
                   1076:     %prog_state=&Apache::lonhtmlcommon::Create_PrgWin
                   1077:         ($r,'Excel File Compilation Status',
                   1078:          'Excel File Compilation Progress', $studentcount);
                   1079:     #
1.62      matthew  1080:     &Apache::lonhtmlcommon::Update_PrgWin($r,\%prog_state,
                   1081:                                           'Processing first student');
1.31      matthew  1082:     return;
                   1083: }
                   1084: 
                   1085: sub excel_outputstudent {
                   1086:     my ($r,$student) = @_;
1.54      matthew  1087:     return if ($request_aborted);
1.32      matthew  1088:     return if (! defined($excel_sheet));
                   1089:     $cols_output=0;
                   1090:     #
                   1091:     # Write out student data
                   1092:     my @to_show = &get_student_fields_to_show();
                   1093:     foreach my $field (@to_show) {
                   1094:         $excel_sheet->write($rows_output,$cols_output++,$student->{$field});
                   1095:     }
                   1096:     #
                   1097:     # Get student assessment data
                   1098:     my %StudentsData;
                   1099:     my @tmp = &Apache::loncoursedata::get_current_state($student->{'username'},
                   1100:                                                         $student->{'domain'},
                   1101:                                                         undef,
                   1102:                                                    $ENV{'request.course.id'});
                   1103:     if ((scalar @tmp > 0) && ($tmp[0] !~ /^error:/)) {
                   1104:         %StudentsData = @tmp;
                   1105:     }
                   1106:     #
                   1107:     # Write out sequence scores and totals data
1.40      matthew  1108:     foreach my $seq (&Apache::lonstatistics::Sequences_with_Assess()) {
1.54      matthew  1109:         my ($performance,$performance_length,$score,$seq_max,$rawdata);
                   1110:         if ($base eq 'tries') {
                   1111:             ($performance,$performance_length,$score,$seq_max,$rawdata) =
                   1112:                 &StudentTriesOnSequence($student,\%StudentsData,
                   1113:                                         $seq,'no');
                   1114:         } else {
                   1115:             ($performance,$performance_length,$score,$seq_max,$rawdata) =
                   1116:                 &StudentPerformanceOnSequence($student,\%StudentsData,
                   1117:                                               $seq,'no');
                   1118:         }
                   1119:         if ($data eq 'tries' || $data eq 'scores') {
                   1120:             foreach my $value (@$rawdata) {
                   1121:                 $excel_sheet->write($rows_output,$cols_output++,$value);
                   1122:             }
                   1123:             $excel_sheet->write($rows_output,$cols_output++,$score);
                   1124:             $excel_sheet->write($rows_output,$cols_output++,$seq_max);
                   1125:         } elsif ($data eq 'sum and total' || $data eq 'sum only' || 
                   1126:             $data eq 'parts correct' || $data eq 'parts correct total') {
1.32      matthew  1127:             $excel_sheet->write($rows_output,$cols_output++,$score);
                   1128:         }
1.54      matthew  1129:         if ($data eq 'sum and total' || $data eq 'parts correct total') {
1.32      matthew  1130:             $excel_sheet->write($rows_output,$cols_output++,$seq_max);
                   1131:         }
                   1132:     }
                   1133:     #
                   1134:     # Bookkeeping
                   1135:     $rows_output++; 
                   1136:     $cols_output=0;
                   1137:     #
1.36      matthew  1138:     # Update the progress window
                   1139:     &Apache::lonhtmlcommon::Increment_PrgWin($r,\%prog_state,'last student');
1.32      matthew  1140:     return;
1.31      matthew  1141: }
                   1142: 
                   1143: sub excel_finish {
                   1144:     my ($r) = @_;
1.54      matthew  1145:     return if ($request_aborted);
1.32      matthew  1146:     return if (! defined($excel_sheet));
                   1147:     #
                   1148:     # Write the excel file
                   1149:     $excel_workbook->close();
                   1150:     my $c = $r->connection();
                   1151:     #
                   1152:     return if($c->aborted());
                   1153:     #
1.36      matthew  1154:     # Close the progress window
                   1155:     &Apache::lonhtmlcommon::Close_PrgWin($r,\%prog_state);
                   1156:     #
1.32      matthew  1157:     # Tell the user where to get their excel file
1.36      matthew  1158:     $r->print('<br />'.
1.32      matthew  1159:               '<a href="'.$filename.'">Your Excel spreadsheet.</a>'."\n");
                   1160:     $r->rflush();
                   1161:     return;
1.31      matthew  1162: }
                   1163: 
                   1164: }
1.30      matthew  1165: #######################################################
                   1166: #######################################################
                   1167: 
                   1168: =pod
                   1169: 
1.31      matthew  1170: =head2 CSV output routines
                   1171: 
                   1172: =item &csv_initialize($r)
                   1173: 
                   1174: =item &csv_outputstudent($r,$student)
                   1175: 
                   1176: =item &csv_finish($r)
1.30      matthew  1177: 
                   1178: =cut
                   1179: 
                   1180: #######################################################
                   1181: #######################################################
1.31      matthew  1182: {
                   1183: 
1.37      matthew  1184: my $outputfile;
                   1185: my $filename;
1.54      matthew  1186: my $request_aborted;
1.37      matthew  1187: my %prog_state; # progress window state
                   1188: 
1.31      matthew  1189: sub csv_initialize{
                   1190:     my ($r) = @_;
1.37      matthew  1191:     # 
                   1192:     # Clean up
1.66      matthew  1193:     undef($outputfile);
                   1194:     undef($filename);
                   1195:     undef($request_aborted);
1.37      matthew  1196:     undef(%prog_state);
                   1197:     #
1.54      matthew  1198:     # Deal with unimplemented requests
                   1199:     $request_aborted = undef;
                   1200:     if ($data =~ /final table/) {
                   1201:         $r->print(<<END);
                   1202: <h2>Unable to Complete Request</h2>
                   1203: <p>
                   1204: The <b>Summary Table (Scores)</b> option is not available for non-HTML output.
                   1205: </p>
                   1206: END
                   1207:        $request_aborted = 1;
                   1208:     }
                   1209:     return if ($request_aborted);
                   1210: 
                   1211:     #
1.37      matthew  1212:     # Open a file
                   1213:     $filename = '/prtspool/'.
                   1214:         $ENV{'user.name'}.'_'.$ENV{'user.domain'}.'_'.
                   1215:             time.'_'.rand(1000000000).'.csv';
                   1216:     unless ($outputfile = Apache::File->new('>/home/httpd'.$filename)) {
                   1217:         $r->log_error("Couldn't open $filename for output $!");
                   1218:         $r->print("Problems occured in writing the csv file.  ".
                   1219:                   "This error has been logged.  ".
                   1220:                   "Please alert your LON-CAPA administrator.");
                   1221:         $outputfile = undef;
                   1222:     }
1.38      matthew  1223:     #
                   1224:     # Datestamp
                   1225:     my $description = $ENV{'course.'.$ENV{'request.course.id'}.'.description'};
                   1226:     print $outputfile '"'.&Apache::loncommon::csv_translate($description).'",'.
                   1227:         '"'.&Apache::loncommon::csv_translate(scalar(localtime(time))).'"'.
                   1228:             "\n";
1.37      matthew  1229:     #
                   1230:     # Print out the headings
                   1231:     my $Str = '';
                   1232:     my $Str2 = undef;
                   1233:     foreach my $field (&get_student_fields_to_show()) {
1.54      matthew  1234:         if ($data eq 'sum only') {
1.37      matthew  1235:             $Str .= '"'.&Apache::loncommon::csv_translate($field).'",';
1.54      matthew  1236:         } elsif ($data eq 'sum and total' || $data eq 'parts correct total') {
1.37      matthew  1237:             $Str .= '"",'; # first row empty on the student fields
                   1238:             $Str2 .= '"'.&Apache::loncommon::csv_translate($field).'",';
1.54      matthew  1239:         } elsif ($data eq 'scores' || $data eq 'tries' || 
                   1240:                  $data eq 'parts correct') {
1.53      matthew  1241:             $Str  .= '"",';
                   1242:             $Str2 .= '"'.&Apache::loncommon::csv_translate($field).'",';
1.37      matthew  1243:         }
                   1244:     }
1.40      matthew  1245:     foreach my $seq (&Apache::lonstatistics::Sequences_with_Assess()) {
1.54      matthew  1246:         if ($data eq 'sum only' || $data eq 'parts correct') {
1.37      matthew  1247:             $Str .= '"'.&Apache::loncommon::csv_translate($seq->{'title'}).
                   1248:                 '",';
1.54      matthew  1249:         } elsif ($data eq 'sum and total' || $data eq 'parts correct total') {
1.37      matthew  1250:             $Str  .= '"'.&Apache::loncommon::csv_translate($seq->{'title'}).
                   1251:                 '","",';
                   1252:             $Str2 .= '"score","total possible",';
1.54      matthew  1253:         } elsif ($data eq 'scores' || $data eq 'tries') {
1.37      matthew  1254:             $Str  .= '"'.&Apache::loncommon::csv_translate($seq->{'title'}).
                   1255:                 '",';
1.53      matthew  1256:             $Str .= '"",'x($seq->{'num_assess_parts'}-1+2);
                   1257:             foreach my $res (@{$seq->{'contents'}}) {
1.54      matthew  1258:                 next if ($res->{'type'} ne 'assessment');
1.53      matthew  1259:                 foreach my $part (@{$res->{'parts'}}) {
                   1260:                     $Str2 .= '"'.&Apache::loncommon::csv_translate($res->{'title'}.', Part '.$part).'",';
                   1261:                 }
                   1262:             }
                   1263:             $Str2 .= '"score","total possible",';
1.37      matthew  1264:         }
                   1265:     }
                   1266:     chop($Str);
                   1267:     $Str .= "\n";
                   1268:     print $outputfile $Str;
                   1269:     if (defined($Str2)) {
                   1270:         chop($Str2);
                   1271:         $Str2 .= "\n";
                   1272:         print $outputfile $Str2;
                   1273:     }
                   1274:     #
                   1275:     # Initialize progress window
                   1276:     my $studentcount = scalar(@Apache::lonstatistics::Students);
                   1277:     %prog_state=&Apache::lonhtmlcommon::Create_PrgWin
                   1278:         ($r,'CSV File Compilation Status',
                   1279:          'CSV File Compilation Progress', $studentcount);
1.31      matthew  1280:     return;
                   1281: }
                   1282: 
                   1283: sub csv_outputstudent {
                   1284:     my ($r,$student) = @_;
1.54      matthew  1285:     return if ($request_aborted);
1.37      matthew  1286:     return if (! defined($outputfile));
                   1287:     my $Str = '';
                   1288:     #
                   1289:     # Output student fields
                   1290:     my @to_show = &get_student_fields_to_show();
                   1291:     foreach my $field (@to_show) {
                   1292:         $Str .= '"'.&Apache::loncommon::csv_translate($student->{$field}).'",';
                   1293:     }
                   1294:     #
                   1295:     # Get student assessment data
                   1296:     my %StudentsData;
                   1297:     my @tmp = &Apache::loncoursedata::get_current_state($student->{'username'},
                   1298:                                                         $student->{'domain'},
                   1299:                                                         undef,
                   1300:                                                    $ENV{'request.course.id'});
                   1301:     if ((scalar @tmp > 0) && ($tmp[0] !~ /^error:/)) {
                   1302:         %StudentsData = @tmp;
                   1303:     }
                   1304:     #
                   1305:     # Output performance data
1.40      matthew  1306:     foreach my $seq (&Apache::lonstatistics::Sequences_with_Assess()) {
1.54      matthew  1307:         my ($performance,$performance_length,$score,$seq_max,$rawdata);
                   1308:         if ($base eq 'tries') {
                   1309:             ($performance,$performance_length,$score,$seq_max,$rawdata) =
                   1310:                 &StudentTriesOnSequence($student,\%StudentsData,
                   1311:                                         $seq,'no');
                   1312:         } else {
                   1313:             ($performance,$performance_length,$score,$seq_max,$rawdata) =
                   1314:                 &StudentPerformanceOnSequence($student,\%StudentsData,
                   1315:                                               $seq,'no');
                   1316:         }
                   1317:         if ($data eq 'sum only' || $data eq 'parts correct') {
1.37      matthew  1318:             $Str .= '"'.$score.'",';
1.54      matthew  1319:         } elsif ($data eq 'sum and total' || $data eq 'parts correct total') {
1.37      matthew  1320:             $Str  .= '"'.$score.'","'.$seq_max.'",';
1.54      matthew  1321:         } elsif ($data eq 'scores' || $data eq 'tries') {
                   1322:             $Str .= '"'.join('","',(@$rawdata,$score,$seq_max)).'",';
1.37      matthew  1323:         }
                   1324:     }
                   1325:     chop($Str);
                   1326:     $Str .= "\n";
                   1327:     print $outputfile $Str;
                   1328:     #
                   1329:     # Update the progress window
                   1330:     &Apache::lonhtmlcommon::Increment_PrgWin($r,\%prog_state,'last student');
                   1331:     return;
1.31      matthew  1332: }
                   1333: 
                   1334: sub csv_finish {
                   1335:     my ($r) = @_;
1.54      matthew  1336:     return if ($request_aborted);
1.37      matthew  1337:     return if (! defined($outputfile));
                   1338:     close($outputfile);
                   1339:     #
                   1340:     my $c = $r->connection();
                   1341:     return if ($c->aborted());
                   1342:     #
                   1343:     # Close the progress window
                   1344:     &Apache::lonhtmlcommon::Close_PrgWin($r,\%prog_state);
                   1345:     #
                   1346:     # Tell the user where to get their csv file
                   1347:     $r->print('<br />'.
                   1348:               '<a href="'.$filename.'">Your csv file.</a>'."\n");
                   1349:     $r->rflush();
                   1350:     return;
                   1351:     
1.31      matthew  1352: }
1.2       stredwic 1353: 
                   1354: }
                   1355: 
1.28      matthew  1356: #######################################################
                   1357: #######################################################
                   1358: 
1.2       stredwic 1359: =pod
                   1360: 
1.54      matthew  1361: =item &StudentTriesOnSequence()
1.2       stredwic 1362: 
1.30      matthew  1363: Inputs:
1.2       stredwic 1364: 
                   1365: =over 4
                   1366: 
1.30      matthew  1367: =item $student
1.28      matthew  1368: 
1.30      matthew  1369: =item $studentdata Hash ref to all student data
1.2       stredwic 1370: 
1.30      matthew  1371: =item $seq Hash ref, the sequence we are working on
1.2       stredwic 1372: 
1.30      matthew  1373: =item $links if defined we will output links to each resource.
1.2       stredwic 1374: 
1.28      matthew  1375: =back
1.2       stredwic 1376: 
                   1377: =cut
1.1       stredwic 1378: 
1.28      matthew  1379: #######################################################
                   1380: #######################################################
1.54      matthew  1381: sub StudentTriesOnSequence {
1.32      matthew  1382:     my ($student,$studentdata,$seq,$links) = @_;
1.31      matthew  1383:     $links = 'no' if (! defined($links));
1.1       stredwic 1384:     my $Str = '';
1.30      matthew  1385:     my ($sum,$max) = (0,0);
1.51      matthew  1386:     my $performance_length = 0;
1.54      matthew  1387:     my @TriesData = ();
                   1388:     my $tries;
1.30      matthew  1389:     foreach my $resource (@{$seq->{'contents'}}) {
                   1390:         next if ($resource->{'type'} ne 'assessment');
                   1391:         my $resource_data = $studentdata->{$resource->{'symb'}};
                   1392:         my $value = '';
                   1393:         foreach my $partnum (@{$resource->{'parts'}}) {
1.54      matthew  1394:             $tries = undef;
1.30      matthew  1395:             $max++;
1.51      matthew  1396:             $performance_length++;
1.30      matthew  1397:             my $symbol = ' '; # default to space
                   1398:             #
                   1399:             if (exists($resource_data->{'resource.'.$partnum.'.solved'})) {
                   1400:                 my $status = $resource_data->{'resource.'.$partnum.'.solved'};
                   1401:                 if ($status eq 'correct_by_override') {
                   1402:                     $symbol = '+';
                   1403:                     $sum++;
                   1404:                 } elsif ($status eq 'incorrect_by_override') {
                   1405:                     $symbol = '-';
                   1406:                 } elsif ($status eq 'ungraded_attempted') {
                   1407:                     $symbol = '#';
                   1408:                 } elsif ($status eq 'incorrect_attempted')  {
                   1409:                     $symbol = '.';
                   1410:                 } elsif ($status eq 'excused') {
                   1411:                     $symbol = 'x';
                   1412:                     $max--;
1.68      matthew  1413:                 } elsif (($status eq 'correct_by_scantron' ||
                   1414:                           $status eq 'correct_by_student') &&
1.30      matthew  1415:                     exists($resource_data->{'resource.'.$partnum.'.tries'})){
1.54      matthew  1416:                     $tries = $resource_data->{'resource.'.$partnum.'.tries'};
                   1417:                     if ($tries > 9) {
1.30      matthew  1418:                         $symbol = '*';
1.54      matthew  1419:                     } elsif ($tries > 0) {
                   1420:                         $symbol = $tries;
1.30      matthew  1421:                     } else {
                   1422:                         $symbol = ' ';
                   1423:                     }
                   1424:                     $sum++;
1.43      matthew  1425:                 } elsif (exists($resource_data->{'resource.'.
                   1426:                                                      $partnum.'.tries'})){
                   1427:                     $symbol = '.';
1.30      matthew  1428:                 } else {
                   1429:                     $symbol = ' ';
1.2       stredwic 1430:                 }
1.30      matthew  1431:             } else {
                   1432:                 # Unsolved.  Did they try?
                   1433:                 if (exists($resource_data->{'resource.'.$partnum.'.tries'})){
                   1434:                     $symbol = '.';
                   1435:                 } else {
                   1436:                     $symbol = ' ';
1.18      matthew  1437:                 }
1.2       stredwic 1438:             }
1.54      matthew  1439:             #
                   1440:             if (! defined($tries)) {
                   1441:                 $tries = $symbol;
                   1442:             }
                   1443:             push (@TriesData,$tries);
1.30      matthew  1444:             #
1.47      matthew  1445:             if ( ($links eq 'yes' && $symbol ne ' ') ||
                   1446:                  ($links eq 'all')) {
1.49      matthew  1447:                 if (length($symbol) > 1) {
                   1448:                     &Apache::lonnet::logthis('length of symbol "'.$symbol.'" > 1');
                   1449:                 }
1.30      matthew  1450:                 $symbol = '<a href="/adm/grades'.
                   1451:                     '?symb='.&Apache::lonnet::escape($resource->{'symb'}).
                   1452:                         '&student='.$student->{'username'}.
1.64      albertel 1453:                             '&userdom='.$student->{'domain'}.
1.30      matthew  1454:                                 '&command=submission">'.$symbol.'</a>';
                   1455:             }
                   1456:             $value .= $symbol;
1.2       stredwic 1457:         }
1.30      matthew  1458:         $Str .= $value;
1.17      minaeibi 1459:     }
1.51      matthew  1460:     if ($seq->{'randompick'}) {
                   1461:         $max = $seq->{'randompick'};
                   1462:     }
1.54      matthew  1463:     return ($Str,$performance_length,$sum,$max,\@TriesData);
                   1464: }
                   1465: 
                   1466: #######################################################
                   1467: #######################################################
                   1468: 
                   1469: =pod
                   1470: 
                   1471: =item &StudentPerformanceOnSequence()
                   1472: 
                   1473: Inputs:
                   1474: 
                   1475: =over 4
                   1476: 
                   1477: =item $student
                   1478: 
                   1479: =item $studentdata Hash ref to all student data
                   1480: 
                   1481: =item $seq Hash ref, the sequence we are working on
                   1482: 
                   1483: =item $links if defined we will output links to each resource.
                   1484: 
                   1485: =back
                   1486: 
                   1487: =cut
                   1488: 
                   1489: #######################################################
                   1490: #######################################################
                   1491: sub StudentPerformanceOnSequence {
                   1492:     my ($student,$studentdata,$seq,$links) = @_;
                   1493:     $links = 'no' if (! defined($links));
                   1494:     my $Str = ''; # final result string
                   1495:     my ($score,$max) = (0,0);
                   1496:     my $performance_length = 0;
                   1497:     my $symbol;
                   1498:     my @ScoreData = ();
                   1499:     my $partscore;
                   1500:     foreach my $resource (@{$seq->{'contents'}}) {
                   1501:         next if ($resource->{'type'} ne 'assessment');
                   1502:         my $resource_data = $studentdata->{$resource->{'symb'}};
                   1503:         foreach my $part (@{$resource->{'parts'}}) {
                   1504:             $partscore = undef;
                   1505:             my $weight = &Apache::lonnet::EXT('resource.'.$part.'.weight',
                   1506:                                               $resource->{'symb'},
                   1507:                                               $student->{'domain'},
                   1508:                                               $student->{'username'},
                   1509:                                               $student->{'section'});
                   1510:             if (!defined($weight) || ($weight eq '')) { 
                   1511:                 $weight=1;
                   1512:             }
                   1513:             #
                   1514:             $max += $weight; # see the 'excused' branch below...
                   1515:             $performance_length++; # one character per part
                   1516:             $symbol = ' '; # default to space
                   1517:             #
                   1518:             my $awarded = 0;
                   1519:             if (exists($resource_data->{'resource.'.$part.'.awarded'})) {
                   1520:                 $awarded = $resource_data->{'resource.'.$part.'.awarded'};
1.67      matthew  1521:                 $awarded = 0 if (! $awarded);
1.54      matthew  1522:             }
                   1523:             #
                   1524:             $partscore = $weight*$awarded;
                   1525:             $score += $partscore;
1.63      matthew  1526:             $symbol = $partscore; 
1.70      matthew  1527:             if (abs($symbol - sprintf("%.0f",$symbol)) < 0.001) {
                   1528:                 $symbol = sprintf("%.0f",$symbol);
                   1529:             }
1.54      matthew  1530:             if (length($symbol) > 1) {
                   1531:                 $symbol = '*';
                   1532:             }
                   1533:             if (exists($resource_data->{'resource.'.$part.'.solved'})) {
                   1534:                 my $status = $resource_data->{'resource.'.$part.'.solved'};
                   1535:                 if ($status eq 'excused') {
                   1536:                     $symbol = 'x';
                   1537:                     $max -= $weight; # Do not count 'excused' problems.
                   1538:                 }
                   1539:             } else {
                   1540:                 # Unsolved.  Did they try?
                   1541:                 if (exists($resource_data->{'resource.'.$part.'.tries'})){
                   1542:                     $symbol = '.';
                   1543:                 } else {
                   1544:                     $symbol = ' ';
                   1545:                 }
                   1546:             }
                   1547:             #
1.60      matthew  1548:             if (! defined($partscore)) {
                   1549:                 $partscore = $symbol;
                   1550:             }
                   1551:             push (@ScoreData,$partscore);
                   1552:             #
1.54      matthew  1553:             if ( ($links eq 'yes' && $symbol ne ' ') || ($links eq 'all')) {
                   1554:                 $symbol = '<a href="/adm/grades'.
                   1555:                     '?symb='.&Apache::lonnet::escape($resource->{'symb'}).
                   1556:                     '&student='.$student->{'username'}.
1.64      albertel 1557:                     '&userdom='.$student->{'domain'}.
1.54      matthew  1558:                     '&command=submission">'.$symbol.'</a>';
                   1559:             }
1.60      matthew  1560:             $Str .= $symbol;
1.54      matthew  1561:         }
                   1562:     }
                   1563:     return ($Str,$performance_length,$score,$max,\@ScoreData);
1.1       stredwic 1564: }
1.23      minaeibi 1565: 
1.28      matthew  1566: #######################################################
                   1567: #######################################################
1.23      minaeibi 1568: 
1.2       stredwic 1569: =pod
                   1570: 
                   1571: =item &CreateLegend()
                   1572: 
                   1573: This function returns a formatted string containing the legend for the
                   1574: chart.  The legend describes the symbols used to represent grades for
                   1575: problems.
                   1576: 
                   1577: =cut
                   1578: 
1.28      matthew  1579: #######################################################
                   1580: #######################################################
1.2       stredwic 1581: sub CreateLegend {
                   1582:     my $Str = "<p><pre>".
1.13      minaeibi 1583:               "   1  correct by student in 1 try\n".
                   1584:               "   7  correct by student in 7 tries\n".
1.12      minaeibi 1585:               "   *  correct by student in more than 9 tries\n".
1.20      minaeibi 1586: 	      "   +  correct by hand grading or override\n".
1.12      minaeibi 1587:               "   -  incorrect by override\n".
                   1588: 	      "   .  incorrect attempted\n".
                   1589: 	      "   #  ungraded attempted\n".
1.13      minaeibi 1590:               "      not attempted (blank field)\n".
1.12      minaeibi 1591: 	      "   x  excused".
1.17      minaeibi 1592:               "</pre><p>";
1.2       stredwic 1593:     return $Str;
                   1594: }
                   1595: 
1.28      matthew  1596: #######################################################
                   1597: #######################################################
                   1598: 
1.30      matthew  1599: =pod 
1.2       stredwic 1600: 
                   1601: =back
                   1602: 
                   1603: =cut
                   1604: 
1.28      matthew  1605: #######################################################
                   1606: #######################################################
1.2       stredwic 1607: 
1.28      matthew  1608: 1;
1.2       stredwic 1609: 
1.1       stredwic 1610: __END__

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