#!/usr/bin/perl ## $Id$ use lib '/ww/webwork/development/'; # mainWeBWorKDirectory; use Global; use CGI qw(:standard); use Auth; use strict; # begin Timing code use Benchmark; my $beginTime = new Benchmark; # end Timing code # local($cgi) = new CGI_Lite(); # local(%inputs) = $cgi->parse_form_data(); &CGI::ReadParse; my %inputs=%main::in; &Global::getCourseEnvironment($inputs{'course'}); my $scriptDirectory = $Global::scriptDirectory; my $databaseDirectory = $Global::databaseDirectory; my $htmlURL = $Global::htmlURL; my $cgiURL = getWebworkCgiURL; require "${scriptDirectory}$Global::DBglue_pl"; require "${scriptDirectory}HTMLglue.pl"; require "${scriptDirectory}$Global::FILE_pl"; # log access &Global::log_info('', query_string); my $keyFile = &Global::getCourseKeyFile($inputs{'course'}); &verify_key($inputs{'user'}, $inputs{'key'}, "$keyFile", $inputs{'course'}); my $permissionsFile = &Global::getCoursePermissionsFile($inputs{'course'}); my $permissions = &get_permissions($inputs{'user'}, $permissionsFile); if (($permissions != $Global::instructor_permissions) and ($permissions != $Global::TA_permissions) ) { print "permissions = $permissions instructor_permissions = $Global::instructor_permissions\n"; print &html_NO_PERMISSION; exit(0); } ############################################################################### #unless ($inputs{'pCL'}) { # # print &htmlTOP("Classlist: Set Selection for course $inputs{'course'}"); # print <Welcome to the View Classlist Page #On this page, you may choose a problem set whose classlist you would like to view. #


#Choose a problem set: #EOF # # print "
\n"; # my %setNumberHash=&getAllProbSetNumbersHash( # $inputs {'user'}); # &printProbSetsJR("setNo",\%setNumberHash); # # print "\n"; # print &sessionKeyInputs(\%inputs); # print "
"; # print &htmlBOTTOM("classlist.pl", \%inputs); # # begin Timing code # my $endTime = new Benchmark; # &Global::logTimingInfo($beginTime,$endTime,"classlist.pl",$inputs{'course'},$inputs{'user'}); # # end Timing code # exit; #} ############################################################################### print &htmlTOP("Roster for the course $inputs{'course'}, set number $inputs{'setNo'}"); print < [Up]

Roster and scores for $inputs{'course'}, set $inputs{'setNo'}

Click on student's name to see the student's version of the problem set. A period (.) indicates a problem has not been attempted, a "C" indicates a problem has been answered 100% correctly, and a number from 0 to 99 indicates the percentage of partial credit earned. The number on the second line gives the number of incorrect attempts.
END_OF_HTML # Dump the contents of the DBM files: my ($setNum,$psvn,$percentRight,@keyList); $setNum=$inputs{'setNo'}; my $sortOrder =$inputs{'sortOrder'}; if ($sortOrder eq 'byCourse') { @keyList = &getAllProbSetKeysForSetSortedByName($setNum); } elsif ($sortOrder eq 'byRecitation') { @keyList = &getAllProbSetKeysForSetSortedByRecitationThenByName($setNum); } else { @keyList = &getAllProbSetKeysForSetSortedBySectionThenByName($setNum); } my ($key,$id,$lname,$fname,$login_name,@problems,$string,$twoString,@tempSort, $total,$totalRight,$status,$longStatus,$valid_status, $attempted,$probValue,$num,$classSection,$classRecitation,$incorrect,$i); print < Name psvn Score Out
of EOF ##get number of problems &attachProbSetRecord($keyList[0]); @problems = &getAllProblemsForProbSetRecord($key); my $noOfProbs = @problems; $string = ' Problems
'; $twoString = ''; for ($i=1; $i <= $noOfProbs;$i++) { $twoString .= &threeSpaceFill($i); } $string .= "
$twoString
"; print "$string"; print <section recitation login_name studentId EOF foreach $key (@keyList) { &attachProbSetRecord($key)|| print "no Record $key\n"; $id = &getStudentID($key); $lname = &getStudentLastName($key); $fname = &getStudentFirstName($key); $login_name = &getStudentLogin($key); $classSection = &getClassSection($key); $classRecitation = &getClassRecitation($key); # replace empty strings by a non breaking space $classSection = ' ' unless ($classSection =~ /\S/); $classRecitation = ' ' unless ($classRecitation =~ /\S/); # $psvn = $key; @problems = &getAllProblemsForProbSetRecord($key); $string = ''; $twoString =''; @tempSort = sort( { $a <=> $b } @problems); $total=0; $totalRight = 0; disable diagnostics; ## surpress warning caused by ($problemStatus == 0 and $problemStatus ne '0') foreach $num (@tempSort) { $valid_status = 0; $status = &getProblemStatus($num,$key); $attempted = getProblemAttempted($num,$key); if (!$attempted){ $longStatus = '. '; } elsif ($status >= 0 and $status <=1 ) { $valid_status = 1; $longStatus = int(100*$status+.5); if ($longStatus == 100) { $longStatus = 'C '; } else { $longStatus = &threeSpaceFill($longStatus); } } else { $longStatus = 'X '; } $incorrect = getProblemNumOfIncorrectAns($num,$key); $incorrect = min($incorrect,99); $string .= $longStatus; $twoString .= &threeSpaceFill($incorrect); $probValue = &getProblemValue($num,$key); $total += $probValue; $totalRight += round_score($status*$probValue) if $valid_status; } # save original from 3 lines down # $lname print < $lname $fname $key $totalRight $total
$string
$twoString
$classSection $classRecitation $login_name $id EOF } print "
"; print &htmlBOTTOM("classlist.pl", \%inputs, 'classlistHelp.html'); exit(0); ## subroutines sub threeSpaceFill { my $num = shift @_; if ($num < 10) {return "$num".' ';} elsif ($num < 100) {return "$num".' ';} else {return "$num";} }