version 1.207, 2004/08/06 22:06:14
|
version 1.242, 2005/02/07 17:07:58
|
Line 25
|
Line 25
|
# |
# |
# http://www.lon-capa.org/ |
# http://www.lon-capa.org/ |
# |
# |
# 2/9,2/13 Guy Albertelli |
|
# 6/8 Gerd Kortemeyer |
|
# 7/26 H.K. Ng |
|
# 8/20 Gerd Kortemeyer |
|
# Year 2002 |
|
# June-August H.K. Ng |
|
# Year 2003 |
|
# February, March H.K. Ng |
|
# July, H. K. Ng |
|
# |
|
|
|
package Apache::grades; |
package Apache::grades; |
use strict; |
use strict; |
Line 101 sub get_symb_and_url {
|
Line 91 sub get_symb_and_url {
|
return ($symb,$url); |
return ($symb,$url); |
} |
} |
|
|
# --- Retrieve the fullname for a user. Return lastname, first middle --- |
|
# --- Generation is attached next to the lastname if it exists. --- |
|
sub get_fullname { |
|
my ($uname,$udom) = @_; |
|
my %name=&Apache::lonnet::get('environment', ['lastname','generation', |
|
'firstname','middlename'], |
|
$udom,$uname); |
|
my $fullname; |
|
my ($tmp) = keys(%name); |
|
if ($tmp !~ /^(con_lost|error|no_such_host)/i) { |
|
$fullname = &Apache::loncoursedata::ProcessFullName |
|
(@name{qw/lastname generation firstname middlename/}); |
|
} else { |
|
&Apache::lonnet::logthis('grades.pm: no name data for '.$uname. |
|
'@'.$udom.':'.$tmp); |
|
} |
|
return $fullname; |
|
} |
|
|
|
#--- Format fullname, username:domain if different for display |
#--- Format fullname, username:domain if different for display |
#--- Use anywhere where the student names are listed |
#--- Use anywhere where the student names are listed |
sub nameUserString { |
sub nameUserString { |
Line 174 sub get_display_part {
|
Line 145 sub get_display_part {
|
if ($symb eq '') { $symb=&Apache::lonnet::symbread($url) } |
if ($symb eq '') { $symb=&Apache::lonnet::symbread($url) } |
} |
} |
my $display=&Apache::lonnet::EXT('resource.'.$partID.'.display',$symb); |
my $display=&Apache::lonnet::EXT('resource.'.$partID.'.display',$symb); |
&Apache::lonnet::logthis("\nsymb $symb\n url $url\npartID $partID\ndisplay $display \n"); |
|
if (defined($display) and $display ne '') { |
if (defined($display) and $display ne '') { |
$display.= " (<font color=\"#999900\">id $partID</font>)"; |
$display.= " (<font color=\"#999900\">id $partID</font>)"; |
} else { |
} else { |
Line 1002 sub sub_page_kw_js {
|
Line 972 sub sub_page_kw_js {
|
my $request = shift; |
my $request = shift; |
my $iconpath = $request->dir_config('lonIconsURL'); |
my $iconpath = $request->dir_config('lonIconsURL'); |
&commonJSfunctions($request); |
&commonJSfunctions($request); |
|
my $docopen=&Apache::lonhtmlcommon::javascript_docopen(); |
|
$docopen=~s/^document\.//; |
$request->print(<<SUBJAVASCRIPT); |
$request->print(<<SUBJAVASCRIPT); |
<script type="text/javascript" language="javascript"> |
<script type="text/javascript" language="javascript"> |
|
|
Line 1114 sub sub_page_kw_js {
|
Line 1086 sub sub_page_kw_js {
|
pWin = window.open('', 'MessageCenter', 'resizable=yes,toolbar=no,location=no,scrollbars='+scrollbar+',screenx='+xpos+',screeny='+ypos+',width=600,height='+height); |
pWin = window.open('', 'MessageCenter', 'resizable=yes,toolbar=no,location=no,scrollbars='+scrollbar+',screenx='+xpos+',screeny='+ypos+',width=600,height='+height); |
pWin.focus(); |
pWin.focus(); |
pDoc = pWin.document; |
pDoc = pWin.document; |
pDoc.open('text/html','replace'); |
pDoc.$docopen; |
pDoc.write("<html><head>"); |
pDoc.write("<html><head>"); |
pDoc.write("<title>Message Central</title>"); |
pDoc.write("<title>Message Central</title>"); |
|
|
Line 1245 sub sub_page_kw_js {
|
Line 1217 sub sub_page_kw_js {
|
hwdWin = window.open('', 'KeywordHighlightCentral', 'resizeable=yes,toolbar=no,location=no,scrollbars=no,width=400,height=300,screenx='+xpos+',screeny='+ypos); |
hwdWin = window.open('', 'KeywordHighlightCentral', 'resizeable=yes,toolbar=no,location=no,scrollbars=no,width=400,height=300,screenx='+xpos+',screeny='+ypos); |
hwdWin.focus(); |
hwdWin.focus(); |
var hDoc = hwdWin.document; |
var hDoc = hwdWin.document; |
hDoc.open('text/html','replace'); |
hDoc.$docopen; |
hDoc.write("<html><head>"); |
hDoc.write("<html><head>"); |
hDoc.write("<title>Highlight Central</title>"); |
hDoc.write("<title>Highlight Central</title>"); |
|
|
Line 1414 sub submission {
|
Line 1386 sub submission {
|
my ($uname,$udom) = ($ENV{'form.student'},$ENV{'form.userdom'}); |
my ($uname,$udom) = ($ENV{'form.student'},$ENV{'form.userdom'}); |
$udom = ($udom eq '' ? $ENV{'user.domain'} : $udom); #has form.userdom changed for a student? |
$udom = ($udom eq '' ? $ENV{'user.domain'} : $udom); #has form.userdom changed for a student? |
my $usec = &Apache::lonnet::getsection($udom,$uname,$ENV{'request.course.id'}); |
my $usec = &Apache::lonnet::getsection($udom,$uname,$ENV{'request.course.id'}); |
$ENV{'form.fullname'} = &get_fullname ($uname,$udom) if $ENV{'form.fullname'} eq ''; |
$ENV{'form.fullname'} = &Apache::loncommon::plainname($uname,$udom,'lastname') if $ENV{'form.fullname'} eq ''; |
|
|
my $symb=($ENV{'form.symb'} ne '' ? $ENV{'form.symb'} : (&Apache::lonnet::symbread($url))); |
my $symb=($ENV{'form.symb'} ne '' ? $ENV{'form.symb'} : (&Apache::lonnet::symbread($url))); |
if ($symb eq '') { $request->print("Unable to handle ambiguous references:$url:."); return ''; } |
if ($symb eq '') { $request->print("Unable to handle ambiguous references:$url:."); return ''; } |
|
|
if (!&canview($usec)) { |
if (!&canview($usec)) { |
$request->print('<font color="red">Unable to view requested student.('. |
$request->print('<font color="red">Unable to view requested student.('. |
$uname.$udom.$usec.$ENV{'request.course.id'}.')</font>'); |
$uname.'@'.$udom.' in section '.$usec.' in course id '. |
|
$ENV{'request.course.id'}.')</font>'); |
$request->print(&show_grading_menu_form($symb,$url)); |
$request->print(&show_grading_menu_form($symb,$url)); |
return; |
return; |
} |
} |
Line 1698 KEYWORDS
|
Line 1671 KEYWORDS
|
$lastsubonly.='<tr><td bgcolor="#ffffe6"><b>Part:</b> '. |
$lastsubonly.='<tr><td bgcolor="#ffffe6"><b>Part:</b> '. |
$display_part.' <font color="#999999">( ID '.$respid. |
$display_part.' <font color="#999999">( ID '.$respid. |
' )</font> '; |
' )</font> '; |
|
my @files; |
|
if ($record{"resource.$partid.$respid.portfiles"}) { |
|
my $file_url = '/uploaded/'.$udom.'/'.$uname.'/portfolio'; |
|
foreach my $file (split(',',$record{"resource.$partid.$respid.portfiles"})) { |
|
push(@files,$file_url.$file); |
|
|
|
&Apache::lonnet::logthis("found a portfolio file".$record{"resource.$partid.$respid.portfiles"}); |
|
&Apache::lonnet::logthis("uploaded URL file".$record{"resource.$partid.$respid.uploadedurl"}); |
|
} |
|
} |
if ($record{"resource.$partid.$respid.uploadedurl"}) { |
if ($record{"resource.$partid.$respid.uploadedurl"}) { |
&Apache::lonnet::allowuploaded('/adm/grades', |
push(@files,$record{"resource.$partid.$respid.uploadedurl"}); |
$record{"resource.$partid.$respid.uploadedurl"}); |
} |
$lastsubonly.='<a href="'.$record{"resource.$partid.$respid.uploadedurl"}.'" target="lonGRDs"><img src="/adm/lonIcons/unknown.gif" border=0"> File uploaded by student</a> <font color="red" size="1">Like all files provided by users, this file may contain virusses</font><br />'; |
if (@files) { |
|
$lastsubonly.='<br /><font color="red" size="1">Like all files provided by users, this file may contain virusses</font><br />'; |
|
foreach my $file (@files) { |
|
&Apache::lonnet::allowuploaded('/adm/grades',$file); |
|
$lastsubonly.='<br /><a href="'.$file.'" target="lonGRDs"><img src="'.&Apache::loncommon::icon($file).'" border=0"> '.$file.'</a>'; |
|
} |
|
$lastsubonly.='<br />'; |
} |
} |
$lastsubonly.='<b>Submitted Answer: </b>'. |
$lastsubonly.='<b>Submitted Answer: </b>'. |
&cleanRecord($subval,$responsetype,$symb,$partid, |
&cleanRecord($subval,$responsetype,$symb,$partid, |
Line 2415 sub viewgrades {
|
Line 2404 sub viewgrades {
|
my (undef,undef,$fullname) = &getclasslist($ENV{'form.section'},'1'); |
my (undef,undef,$fullname) = &getclasslist($ENV{'form.section'},'1'); |
my $ctr = 0; |
my $ctr = 0; |
foreach (sort {lc($$fullname{$a}) cmp lc($$fullname{$b}) } keys %$fullname) { |
foreach (sort {lc($$fullname{$a}) cmp lc($$fullname{$b}) } keys %$fullname) { |
my $uname = $_; |
|
$uname=~s/:/_/; |
|
$result.='<input type="hidden" name="ctr'.$ctr.'" value="'.$uname.'" />'."\n"; |
|
$ctr++; |
$ctr++; |
$result.=&viewstudentgrade($url,$symb,$ENV{'request.course.id'}, |
$result.=&viewstudentgrade($url,$symb,$ENV{'request.course.id'}, |
$_,$$fullname{$_},\@parts,\%weight,$ctr); |
$_,$$fullname{$_},\@parts,\%weight,$ctr); |
Line 2441 sub viewstudentgrade {
|
Line 2427 sub viewstudentgrade {
|
my ($uname,$udom) = split(/:/,$student); |
my ($uname,$udom) = split(/:/,$student); |
$student=~s/:/_/; |
$student=~s/:/_/; |
my %record=&Apache::lonnet::restore($symb,$courseid,$udom,$uname); |
my %record=&Apache::lonnet::restore($symb,$courseid,$udom,$uname); |
my $result='<tr bgcolor="#ffffdd"><td align="right">'.$ctr.' </td><td> '. |
my $result='<tr bgcolor="#ffffdd"><td align="right">'. |
|
'<input type="hidden" name="ctr'.($ctr-1).'" value="'.$student.'" />'. |
|
"\n".$ctr.' </td><td> '. |
'<a href="javascript:viewOneStudent(\''.$uname.'\',\''.$udom. |
'<a href="javascript:viewOneStudent(\''.$uname.'\',\''.$udom. |
'\')"; TARGET=_self>'.$fullname.'</a> '. |
'\')"; TARGET=_self>'.$fullname.'</a> '. |
'<font color="#999999">('.$uname.($ENV{'user.domain'} eq $udom ? '' : ':'.$udom).')</font></td>'."\n"; |
'<font color="#999999">('.$uname.($ENV{'user.domain'} eq $udom ? '' : ':'.$udom).')</font></td>'."\n"; |
foreach my $apart (@$parts) { |
foreach my $apart (@$parts) { |
my ($part,$type) = &split_part_type($apart); |
my ($part,$type) = &split_part_type($apart); |
my $score=$record{"resource.$part.$type"}; |
my $score=$record{"resource.$part.$type"}; |
|
$result.='<td align="middle">'; |
if ($type eq 'awarded') { |
if ($type eq 'awarded') { |
my $pts = $score eq '' ? '' : $score*$$weight{$part}; |
my $pts = $score eq '' ? '' : $score*$$weight{$part}; |
$result.='<input type="hidden" name="'. |
$result.='<input type="hidden" name="'. |
'GD_'.$student.'_'.$part.'_awarded_s" value="'.$pts.'" />'."\n"; |
'GD_'.$student.'_'.$part.'_awarded_s" value="'.$pts.'" />'."\n"; |
$result.='<td align="middle"><input type="text" name="'. |
$result.='<input type="text" name="'. |
'GD_'.$student.'_'.$part.'_awarded" '. |
'GD_'.$student.'_'.$part.'_awarded" '. |
'onChange="javascript:changeSelect(\''.$part.'\',\''.$student. |
'onChange="javascript:changeSelect(\''.$part.'\',\''.$student. |
'\')" value="'.$pts.'" size="4" /></td>'."\n"; |
'\')" value="'.$pts.'" size="4" /></td>'."\n"; |
Line 2461 sub viewstudentgrade {
|
Line 2450 sub viewstudentgrade {
|
$status = 'nothing' if ($status eq ''); |
$status = 'nothing' if ($status eq ''); |
$result.='<input type="hidden" name="'.'GD_'.$student.'_'. |
$result.='<input type="hidden" name="'.'GD_'.$student.'_'. |
$part.'_solved_s" value="'.$status.'" />'."\n"; |
$part.'_solved_s" value="'.$status.'" />'."\n"; |
$result.='<td align="middle"> <select name="'. |
$result.=' <select name="'. |
'GD_'.$student.'_'.$part.'_solved" '. |
'GD_'.$student.'_'.$part.'_solved" '. |
'onChange="javascript:changeOneScore(\''.$part.'\',\''.$student.'\')" >'."\n"; |
'onChange="javascript:changeOneScore(\''.$part.'\',\''.$student.'\')" >'."\n"; |
$result.= (($status eq 'excused') ? '<option> </option><option selected="on">excused</option>' |
$result.= (($status eq 'excused') ? '<option> </option><option selected="on">excused</option>' |
Line 2472 sub viewstudentgrade {
|
Line 2461 sub viewstudentgrade {
|
$result.='<input type="hidden" name="'. |
$result.='<input type="hidden" name="'. |
'GD_'.$student.'_'.$part.'_'.$type.'_s" value="'.$score.'" />'. |
'GD_'.$student.'_'.$part.'_'.$type.'_s" value="'.$score.'" />'. |
"\n"; |
"\n"; |
$result.='<td align="middle"><input type="text" name="'. |
$result.='<input type="text" name="'. |
'GD_'.$student.'_'.$part.'_'.$type.'" '. |
'GD_'.$student.'_'.$part.'_'.$type.'" '. |
'value="'.$score.'" size="4" /></td>'."\n"; |
'value="'.$score.'" size="4" /></td>'."\n"; |
} |
} |
Line 3071 sub getSymbMap {
|
Line 3060 sub getSymbMap {
|
my $minder = 0; |
my $minder = 0; |
|
|
# Gather every sequence that has problems. |
# Gather every sequence that has problems. |
my @sequences = $navmap->retrieveResources(undef, sub { shift->is_map(); }, 1); |
my @sequences = $navmap->retrieveResources(undef, sub { shift->is_map(); }, |
|
1,0,1); |
for my $sequence ($navmap->getById('0.0'), @sequences) { |
for my $sequence ($navmap->getById('0.0'), @sequences) { |
if ($navmap->hasResource($sequence, sub { shift->is_problem(); }, 0) ) { |
if ($navmap->hasResource($sequence, sub { shift->is_problem(); }, 0) ) { |
my $title = $minder.'.'.$sequence->compTitle(); |
my $title = $minder.'.'.$sequence->compTitle(); |
Line 3080 sub getSymbMap {
|
Line 3070 sub getSymbMap {
|
$minder++; |
$minder++; |
} |
} |
} |
} |
|
|
$navmap->untieHashes(); |
|
return \@titles,\%symbx; |
return \@titles,\%symbx; |
} |
} |
|
|
Line 3152 sub displayPage {
|
Line 3140 sub displayPage {
|
if($curRes == $iterator->BEGIN_MAP) { $depth++; } |
if($curRes == $iterator->BEGIN_MAP) { $depth++; } |
if($curRes == $iterator->END_MAP) { $depth--; } |
if($curRes == $iterator->END_MAP) { $depth--; } |
|
|
if (ref($curRes) && $curRes->is_problem()) { |
if (ref($curRes) && $curRes->is_problem() && !$curRes->randomout) { |
my $parts = $curRes->parts(); |
my $parts = $curRes->parts(); |
my $title = $curRes->compTitle(); |
my $title = $curRes->compTitle(); |
my $symbx = $curRes->symb(); |
my $symbx = $curRes->symb(); |
Line 3214 sub displayPage {
|
Line 3202 sub displayPage {
|
$curRes = $iterator->next(); |
$curRes = $iterator->next(); |
} |
} |
|
|
$navmap->untieHashes(); |
|
|
|
$studentTable.='</td></tr></table></td></tr></table>'."\n". |
$studentTable.='</td></tr></table></td></tr></table>'."\n". |
'<input type="button" value="Save" '. |
'<input type="button" value="Save" '. |
'onClick="javascript:checkSubmitPage(this.form,'.$question.');" TARGET=_self />'. |
'onClick="javascript:checkSubmitPage(this.form,'.$question.');" TARGET=_self />'. |
Line 3228 sub displayPage {
|
Line 3214 sub displayPage {
|
|
|
sub displaySubByDates { |
sub displaySubByDates { |
my ($symb,$record,$parts,$responseType,$checkIcon,$uname,$udom) = @_; |
my ($symb,$record,$parts,$responseType,$checkIcon,$uname,$udom) = @_; |
|
my $isCODE=0; |
|
if (exists($record->{'resource.CODE'})) { $isCODE=1; } |
my $studentTable='<table border="0" width="100%"><tr><td bgcolor="#777777">'. |
my $studentTable='<table border="0" width="100%"><tr><td bgcolor="#777777">'. |
'<table border="0" width="100%"><tr bgcolor="#e6ffff">'. |
'<table border="0" width="100%"><tr bgcolor="#e6ffff">'. |
'<td><b>Date/Time</b></td>'. |
'<td><b>Date/Time</b></td>'. |
|
($isCODE?'<td><b>CODE</b></td>':''). |
'<td><b>Submission</b></td>'. |
'<td><b>Submission</b></td>'. |
'<td><b>Status </b></td></tr>'; |
'<td><b>Status </b></td></tr>'; |
my ($version); |
my ($version); |
Line 3243 sub displaySubByDates {
|
Line 3232 sub displaySubByDates {
|
for ($version=1;$version<=$$record{'version'};$version++) { |
for ($version=1;$version<=$$record{'version'};$version++) { |
my $timestamp = scalar(localtime($$record{$version.':timestamp'})); |
my $timestamp = scalar(localtime($$record{$version.':timestamp'})); |
$studentTable.='<tr bgcolor="#ffffff" valign="top"><td>'.$timestamp.'</td>'; |
$studentTable.='<tr bgcolor="#ffffff" valign="top"><td>'.$timestamp.'</td>'; |
|
if ($isCODE) { |
|
$studentTable.='<td>'.$record->{$version.':resource.CODE'}.'</td>'; |
|
} |
my @versionKeys = split(/\:/,$$record{$version.':keys'}); |
my @versionKeys = split(/\:/,$$record{$version.':keys'}); |
my @displaySub = (); |
my @displaySub = (); |
foreach my $partid (@{$parts}) { |
foreach my $partid (@{$parts}) { |
Line 3411 sub updateGradeByPage {
|
Line 3403 sub updateGradeByPage {
|
$curRes = $iterator->next(); |
$curRes = $iterator->next(); |
} |
} |
|
|
$navmap->untieHashes(); |
|
|
|
$studentTable.='</td></tr></table></td></tr></table>'; |
$studentTable.='</td></tr></table></td></tr></table>'; |
$studentTable.=&show_grading_menu_form($ENV{'form.symb'},$ENV{'form.url'}); |
$studentTable.=&show_grading_menu_form($ENV{'form.symb'},$ENV{'form.url'}); |
my $grademsg=($changeflag == 0 ? 'No score was changed or updated.' : |
my $grademsg=($changeflag == 0 ? 'No score was changed or updated.' : |
Line 3473 sub scantron_filenames {
|
Line 3463 sub scantron_filenames {
|
} |
} |
|
|
sub scantron_uploads { |
sub scantron_uploads { |
|
my ($file2grade) = @_; |
my $result= '<select name="scantron_selectfile">'; |
my $result= '<select name="scantron_selectfile">'; |
$result.="<option></option>"; |
$result.="<option></option>"; |
foreach my $filename (sort(&scantron_filenames())) { |
foreach my $filename (sort(&scantron_filenames())) { |
$result.="<option>$filename</option>\n"; |
$result.="<option".($filename eq $file2grade ? ' selected="on"':'').">$filename</option>\n"; |
} |
} |
$result.="</select>"; |
$result.="</select>"; |
return $result; |
return $result; |
Line 3501 sub scantron_CODElist {
|
Line 3492 sub scantron_CODElist {
|
my $cnum = $ENV{'course.'.$ENV{'request.course.id'}.'.num'}; |
my $cnum = $ENV{'course.'.$ENV{'request.course.id'}.'.num'}; |
my @names=&Apache::lonnet::getkeys('CODEs',$cdom,$cnum); |
my @names=&Apache::lonnet::getkeys('CODEs',$cdom,$cnum); |
my $namechoice='<option></option>'; |
my $namechoice='<option></option>'; |
foreach my $name (sort(@names)) { |
foreach my $name (sort {uc($a) cmp uc($b)} @names) { |
if ($name =~ /^error: 2 /) { next; } |
if ($name =~ /^error: 2 /) { next; } |
$namechoice.='<option value="'.$name.'">'.$name.'</option>'; |
$namechoice.='<option value="'.$name.'">'.$name.'</option>'; |
} |
} |
Line 3522 sub scantron_CODEunique {
|
Line 3513 sub scantron_CODEunique {
|
} |
} |
|
|
sub scantron_selectphase { |
sub scantron_selectphase { |
my ($r) = @_; |
my ($r,$file2grade) = @_; |
my ($symb,$url)=&get_symb_and_url($r); |
my ($symb,$url)=&get_symb_and_url($r); |
if (!$symb) {return '';} |
if (!$symb) {return '';} |
my $sequence_selector=&getSequenceDropDown($r,$symb); |
my $sequence_selector=&getSequenceDropDown($r,$symb); |
my $default_form_data=&defaultFormData($symb,$url); |
my $default_form_data=&defaultFormData($symb,$url); |
my $grading_menu_button=&show_grading_menu_form($symb,$url); |
my $grading_menu_button=&show_grading_menu_form($symb,$url); |
my $file_selector=&scantron_uploads(); |
my $file_selector=&scantron_uploads($file2grade); |
my $format_selector=&scantron_scantab(); |
my $format_selector=&scantron_scantab(); |
my $CODE_selector=&scantron_CODElist(); |
my $CODE_selector=&scantron_CODElist(); |
my $CODE_unique=&scantron_CODEunique(); |
my $CODE_unique=&scantron_CODEunique(); |
Line 3538 sub scantron_selectphase {
|
Line 3529 sub scantron_selectphase {
|
$result.= <<SCANTRONFORM; |
$result.= <<SCANTRONFORM; |
<table width="100%" border="0"> |
<table width="100%" border="0"> |
<tr> |
<tr> |
|
<form method="post" enctype="multipart/form-data" action="/adm/grades" name="scantron_process"> |
<td bgcolor="#777777"> |
<td bgcolor="#777777"> |
<form method="post" enctype="multipart/form-data" action="/adm/grades" name="scantron_process"> |
|
<input type="hidden" name="command" value="scantron_warning" /> |
<input type="hidden" name="command" value="scantron_warning" /> |
$default_form_data |
$default_form_data |
<table width="100%" border="0"> |
<table width="100%" border="0"> |
Line 3576 sub scantron_selectphase {
|
Line 3567 sub scantron_selectphase {
|
</td> |
</td> |
</tr> |
</tr> |
</table> |
</table> |
</form> |
</td> |
</td> |
</form> |
</tr> |
</tr> |
SCANTRONFORM |
SCANTRONFORM |
|
|
Line 3633 SCANTRONFORM
|
Line 3624 SCANTRONFORM
|
} |
} |
$r->print(<<SCANTRONFORM); |
$r->print(<<SCANTRONFORM); |
<tr> |
<tr> |
<td bgcolor="#777777"> |
<form action='/adm/grades' name='scantron_download'> |
<form action='/adm/grades' name='scantron_download'> |
<td bgcolor="#777777"> |
<input type="hidden" name="command" value="scantron_download" /> |
<input type="hidden" name="command" value="scantron_download" /> |
<table width="100%" border="0"> |
<table width="100%" border="0"> |
<tr bgcolor="#e6ffff"> |
<tr bgcolor="#e6ffff"> |
Line 3651 SCANTRONFORM
|
Line 3642 SCANTRONFORM
|
</td> |
</td> |
</tr> |
</tr> |
</table> |
</table> |
</form> |
</td> |
</td> |
</form> |
</tr> |
</tr> |
SCANTRONFORM |
SCANTRONFORM |
|
|
$r->print(<<SCANTRONFORM); |
$r->print(<<SCANTRONFORM); |
</table> |
</table> |
</form> |
|
$grading_menu_button |
$grading_menu_button |
SCANTRONFORM |
SCANTRONFORM |
|
|
Line 3807 sub scantron_parse_scanline {
|
Line 3797 sub scantron_parse_scanline {
|
my $currentquest=substr($questions,0,$$scantron_config{'Qlength'}); |
my $currentquest=substr($questions,0,$$scantron_config{'Qlength'}); |
substr($questions,0,$$scantron_config{'Qlength'})=''; |
substr($questions,0,$$scantron_config{'Qlength'})=''; |
if (length($currentquest) < $$scantron_config{'Qlength'}) { next; } |
if (length($currentquest) < $$scantron_config{'Qlength'}) { next; } |
my @array=split($$scantron_config{'Qon'},$currentquest,-1); |
if ($$scantron_config{'Qon'} eq 'letter') { |
if (length($array[0]) eq $$scantron_config{'Qlength'}) { |
if (!$currentquest || $currentquest eq $$scantron_config{'Qoff'} || |
$record{"scantron.$questnum.answer"}=''; |
$currentquest !~ /^[A-Z]$/) { |
if (!&scan_data($scan_data,"$whichline.no_bubble.$questnum")) { |
$record{"scantron.$questnum.answer"}=''; |
push(@{$record{"scantron.missingerror"}},$questnum); |
if (!&scan_data($scan_data,"$whichline.no_bubble.$questnum")) { |
} |
push(@{$record{"scantron.missingerror"}},$questnum); |
|
} |
|
} else { |
|
$record{"scantron.$questnum.answer"}=$currentquest; |
|
} |
|
} elsif ($$scantron_config{'Qon'} eq 'number') { |
|
if (!$currentquest || $currentquest eq $$scantron_config{'Qoff'} || |
|
$currentquest !~ /^\d$/) { |
|
$record{"scantron.$questnum.answer"}=''; |
|
if (!&scan_data($scan_data,"$whichline.no_bubble.$questnum")) { |
|
push(@{$record{"scantron.missingerror"}},$questnum); |
|
} |
|
} else { |
|
$record{"scantron.$questnum.answer"}= |
|
$alphabet[$currentquest-1]; |
|
} |
} else { |
} else { |
$record{"scantron.$questnum.answer"}=$alphabet[length($array[0])]; |
my @array=split($$scantron_config{'Qon'},$currentquest,-1); |
|
if (length($array[0]) eq $$scantron_config{'Qlength'}) { |
|
$record{"scantron.$questnum.answer"}=''; |
|
if (!&scan_data($scan_data,"$whichline.no_bubble.$questnum")) { |
|
push(@{$record{"scantron.missingerror"}},$questnum); |
|
} |
|
} else { |
|
$record{"scantron.$questnum.answer"}= |
|
$alphabet[length($array[0])]; |
|
} |
|
if (scalar(@array) gt 2) { |
|
push(@{$record{'scantron.doubleerror'}},$questnum); |
|
my @ans=@array; |
|
my $i=length($ans[0]);shift(@ans); |
|
while ($#ans) { |
|
$i+=length($ans[0])+1; |
|
$record{"scantron.$questnum.answer"}.=$alphabet[$i]; |
|
shift(@ans); |
|
} |
|
} |
} |
} |
if (scalar(@array) gt 2) { |
|
push(@{$record{'scantron.doubleerror'}},$questnum); |
|
my @ans=@array; |
|
my $i=length($ans[0]);shift(@ans); |
|
while ($#ans) { |
|
$i+=length($ans[0])+1; |
|
$record{"scantron.$questnum.answer"}.=$alphabet[$i]; |
|
shift(@ans); |
|
} |
|
} |
|
} |
} |
$record{'scantron.maxquest'}=$questnum; |
$record{'scantron.maxquest'}=$questnum; |
return \%record; |
return \%record; |
Line 3855 sub scantron_find_student {
|
Line 3869 sub scantron_find_student {
|
|
|
sub scantron_filter { |
sub scantron_filter { |
my ($curres)=@_; |
my ($curres)=@_; |
if (ref($curres) && $curres->is_problem() && !$curres->randomout) { |
# randomout is dysfunctional at best for this purpose |
|
if (ref($curres) && $curres->is_problem()) { #&& !$curres->randomout) { |
return 1; |
return 1; |
} |
} |
return 0; |
return 0; |
Line 3989 sub scantron_do_warning {
|
Line 4004 sub scantron_do_warning {
|
if (!$symb) {return '';} |
if (!$symb) {return '';} |
my $default_form_data=&defaultFormData($symb,$url); |
my $default_form_data=&defaultFormData($symb,$url); |
$r->print(&scantron_form_start().$default_form_data); |
$r->print(&scantron_form_start().$default_form_data); |
my $warning=&scantron_warning_screen('Validate Records'); |
if ( $ENV{'form.selectpage'} eq '' || |
$r->print(<<STUFF); |
$ENV{'form.scantron_selectfile'} eq '' || |
|
$ENV{'form.scantron_format'} eq '' ) { |
|
$r->print("<p>You have forgetten to specify some information. Please go Back and try again.</p>"); |
|
if ( $ENV{'form.selectpage'} eq '') { |
|
$r->print('<p><font color="red">You have not selected a Sequence to grade</font></p>'); |
|
} |
|
if ( $ENV{'form.scantron_selectfile'} eq '') { |
|
$r->print('<p><font color="red">You have not selected a file that contains the student\'s response data.</font></p>'); |
|
} |
|
if ( $ENV{'form.scantron_format'} eq '') { |
|
$r->print('<p><font color="red">You have not selected a the format of the student\'s response data.</font></p>'); |
|
} |
|
} else { |
|
my $warning=&scantron_warning_screen('Validate Records'); |
|
$r->print(<<STUFF); |
$warning |
$warning |
<input type="submit" name="submit" value="Validate Records" /> |
<input type="submit" name="submit" value="Validate Records" /> |
<input type="hidden" name="command" value="scantron_validate" /> |
<input type="hidden" name="command" value="scantron_validate" /> |
</form> |
|
STUFF |
STUFF |
$r->print("<br />".&show_grading_menu_form($symb,$url)."</body></html>"); |
} |
|
$r->print("</form><br />".&show_grading_menu_form($symb,$url)."</body></html>"); |
return ''; |
return ''; |
} |
} |
|
|
Line 4007 sub scantron_form_start {
|
Line 4036 sub scantron_form_start {
|
<input type="hidden" name="selectpage" value="$ENV{'form.selectpage'}" /> |
<input type="hidden" name="selectpage" value="$ENV{'form.selectpage'}" /> |
<input type="hidden" name="scantron_format" value="$ENV{'form.scantron_format'}" /> |
<input type="hidden" name="scantron_format" value="$ENV{'form.scantron_format'}" /> |
<input type="hidden" name="scantron_selectfile" value="$ENV{'form.scantron_selectfile'}" /> |
<input type="hidden" name="scantron_selectfile" value="$ENV{'form.scantron_selectfile'}" /> |
<input type="hidden" name="scantron_maxbubble" value="$max_bubble'" /> |
<input type="hidden" name="scantron_maxbubble" value="$max_bubble" /> |
<input type="hidden" name="scantron_CODElist" value="$ENV{'form.scantron_CODElist'}" /> |
<input type="hidden" name="scantron_CODElist" value="$ENV{'form.scantron_CODElist'}" /> |
<input type="hidden" name="scantron_CODEunique" value="$ENV{'form.scantron_CODEunique'}" /> |
<input type="hidden" name="scantron_CODEunique" value="$ENV{'form.scantron_CODEunique'}" /> |
<input type="hidden" name="scantron_options_redo" value="$ENV{'form.scantron_options_redo'}" /> |
<input type="hidden" name="scantron_options_redo" value="$ENV{'form.scantron_options_redo'}" /> |
Line 4297 sub scantron_get_correction {
|
Line 4326 sub scantron_get_correction {
|
$r->print(" in scanline $i <pre>". |
$r->print(" in scanline $i <pre>". |
$line."</pre> \n"); |
$line."</pre> \n"); |
} |
} |
|
my $message="<p>The ID on the form is <tt>". |
|
$$scan_record{'scantron.ID'}."</tt><br />\n". |
|
"The name on the paper is ". |
|
$$scan_record{'scantron.LastName'}.",". |
|
$$scan_record{'scantron.FirstName'}."</p>"; |
|
|
$r->print('<input type="hidden" name="scantron_corrections" value="'.$error.'" />'."\n"); |
$r->print('<input type="hidden" name="scantron_corrections" value="'.$error.'" />'."\n"); |
$r->print('<input type="hidden" name="scantron_line" value="'.$i.'" />'."\n"); |
$r->print('<input type="hidden" name="scantron_line" value="'.$i.'" />'."\n"); |
if ($error =~ /ID$/) { |
if ($error =~ /ID$/) { |
Line 4305 sub scantron_get_correction {
|
Line 4340 sub scantron_get_correction {
|
} elsif ($error eq 'duplicateID') { |
} elsif ($error eq 'duplicateID') { |
$r->print("The encoded ID has also been used by a previous paper $arg</p>\n"); |
$r->print("The encoded ID has also been used by a previous paper $arg</p>\n"); |
} |
} |
$r->print("<p>The ID on the form is <tt>". |
$r->print($message); |
$$scan_record{'scantron.ID'}."</tt><br />\n"); |
|
$r->print("The name on the paper is ". |
|
$$scan_record{'scantron.LastName'}.",". |
|
$$scan_record{'scantron.FirstName'}."</p>"); |
|
$r->print("<p>How should I handle this? <br /> \n"); |
$r->print("<p>How should I handle this? <br /> \n"); |
$r->print("\n<ul><li> "); |
$r->print("\n<ul><li> "); |
#FIXME it would be nice if this sent back the user ID and |
#FIXME it would be nice if this sent back the user ID and |
Line 4327 sub scantron_get_correction {
|
Line 4358 sub scantron_get_correction {
|
} elsif ($error eq 'duplicateCODE') { |
} elsif ($error eq 'duplicateCODE') { |
$r->print("</p><p>The encoded CODE has also been used by a previous paper ".join(', ',@{$arg}).", and CODEs are supposed to be unique</p>\n"); |
$r->print("</p><p>The encoded CODE has also been used by a previous paper ".join(', ',@{$arg}).", and CODEs are supposed to be unique</p>\n"); |
} |
} |
$r->print("<p>The CODE on the form is <tt>". |
$r->print("<p>The CODE on the form is <tt>'". |
$$scan_record{'scantron.CODE'}."</tt><br />\n"); |
$$scan_record{'scantron.CODE'}."'</tt><br />\n"); |
$r->print("<p>The ID on the form is <tt>". |
$r->print($message); |
$$scan_record{'scantron.ID'}."</tt><br />\n"); |
|
$r->print("The name on the paper is ". |
|
$$scan_record{'scantron.LastName'}.",". |
|
$$scan_record{'scantron.FirstName'}."</p>"); |
|
$r->print("<p>How should I handle this? <br /> \n"); |
$r->print("<p>How should I handle this? <br /> \n"); |
$r->print("\n<br /> "); |
$r->print("\n<br /> "); |
my $i=0; |
my $i=0; |
Line 4376 ENDSCRIPT
|
Line 4403 ENDSCRIPT
|
$r->print("<p>There have been multiple bubbles scanned for a some question(s)</p>\n"); |
$r->print("<p>There have been multiple bubbles scanned for a some question(s)</p>\n"); |
$r->print('<input type="hidden" name="scantron_questions" value="'. |
$r->print('<input type="hidden" name="scantron_questions" value="'. |
join(',',@{$arg}).'" />'); |
join(',',@{$arg}).'" />'); |
|
$r->print($message); |
$r->print("<p>Please indicate which bubble should be used for grading</p>"); |
$r->print("<p>Please indicate which bubble should be used for grading</p>"); |
foreach my $question (@{$arg}) { |
foreach my $question (@{$arg}) { |
my $selected=$$scan_record{"scantron.$question.answer"}; |
my $selected=$$scan_record{"scantron.$question.answer"}; |
Line 4383 ENDSCRIPT
|
Line 4411 ENDSCRIPT
|
} |
} |
} elsif ($error eq 'missingbubble') { |
} elsif ($error eq 'missingbubble') { |
$r->print("<p>There have been <b>no</b> bubbles scanned for some question(s)</p>\n"); |
$r->print("<p>There have been <b>no</b> bubbles scanned for some question(s)</p>\n"); |
|
$r->print($message); |
$r->print("<p>Please indicate which bubble should be used for grading</p>"); |
$r->print("<p>Please indicate which bubble should be used for grading</p>"); |
$r->print("Some questions have no scanned bubbles\n"); |
$r->print("Some questions have no scanned bubbles\n"); |
$r->print('<input type="hidden" name="scantron_questions" value="'. |
$r->print('<input type="hidden" name="scantron_questions" value="'. |
Line 4474 sub scantron_validate_CODE {
|
Line 4503 sub scantron_validate_CODE {
|
$scan_data); |
$scan_data); |
my $CODE=$$scan_record{'scantron.CODE'}; |
my $CODE=$$scan_record{'scantron.CODE'}; |
my $error=0; |
my $error=0; |
if (!exists($allcodes{$CODE}) && !$$scan_record{'scantron.useCODE'}) { |
if (!&Apache::lonnet::validCODE($CODE)) { |
|
&scantron_get_correction($r,$i,$scan_record, |
|
\%scantron_config, |
|
$line,'incorrectCODE',\%allcodes); |
|
return(1,$currentphase); |
|
} |
|
if (%allcodes && !exists($allcodes{$CODE}) |
|
&& !$$scan_record{'scantron.useCODE'}) { |
&scantron_get_correction($r,$i,$scan_record, |
&scantron_get_correction($r,$i,$scan_record, |
\%scantron_config, |
\%scantron_config, |
$line,'incorrectCODE',\%allcodes); |
$line,'incorrectCODE',\%allcodes); |
return(1,$currentphase); |
return(1,$currentphase); |
} |
} |
if (exists($usedCODEs{$CODE}) && $ENV{'form.scantron_CODEunique'} |
if (exists($usedCODEs{$CODE}) |
|
&& $ENV{'form.scantron_CODEunique'} eq 'yes' |
&& !$$scan_record{'scantron.CODE_ignore_dup'}) { |
&& !$$scan_record{'scantron.CODE_ignore_dup'}) { |
&scantron_get_correction($r,$i,$scan_record, |
&scantron_get_correction($r,$i,$scan_record, |
\%scantron_config, |
\%scantron_config, |
Line 4528 sub scantron_get_maxbubble {
|
Line 4565 sub scantron_get_maxbubble {
|
my @resources=$navmap->retrieveResources($map,\&scantron_filter,1,0); |
my @resources=$navmap->retrieveResources($map,\&scantron_filter,1,0); |
&Apache::lonnet::delenv('form.counter'); |
&Apache::lonnet::delenv('form.counter'); |
foreach my $resource (@resources) { |
foreach my $resource (@resources) { |
my $result=&Apache::lonnet::ssi($resource->src()); |
my $result=&Apache::lonnet::ssi($resource->src().'?symb='.&Apache::lonnet::escape($resource->symb())); |
} |
} |
&Apache::lonnet::delenv('scantron\.'); |
&Apache::lonnet::delenv('scantron\.'); |
my $envfile=$ENV{'user.environment'}; |
my $envfile=$ENV{'user.environment'}; |
Line 4645 SCANTRONFORM
|
Line 4682 SCANTRONFORM
|
if (exists($scan_record->{'scantron.CODE'}) && |
if (exists($scan_record->{'scantron.CODE'}) && |
$scan_record->{'scantron.CODE'}) { |
$scan_record->{'scantron.CODE'}) { |
$form{'CODE'}=$scan_record->{'scantron.CODE'}; |
$form{'CODE'}=$scan_record->{'scantron.CODE'}; |
|
} else { |
|
$form{'CODE'}=''; |
} |
} |
my $result=&Apache::lonnet::ssi($resource->src(),%form); |
my $result=&Apache::lonnet::ssi($resource->src(),%form); |
|
if ($result ne '') { |
|
&Apache::lonnet::logthis("scantron grading error -> $result"); |
|
&Apache::lonnet::logthis("scantron grading error info name $uname domain $udom course $ENV{'request.course.id'} url ".$resource->src()); |
|
} |
|
if (&Apache::loncommon::connection_aborted($r)) { last; } |
} |
} |
$completedstudents{$uname}={'line'=>$line}; |
$completedstudents{$uname}={'line'=>$line}; |
|
if (&Apache::loncommon::connection_aborted($r)) { last; } |
} continue { |
} continue { |
&Apache::lonnet::delenv('form.counter'); |
&Apache::lonnet::delenv('form.counter'); |
&Apache::lonnet::delenv('scantron\.'); |
&Apache::lonnet::delenv('scantron\.'); |
Line 4658 SCANTRONFORM
|
Line 4702 SCANTRONFORM
|
# my $lasttime = &Time::HiRes::time()-$start; |
# my $lasttime = &Time::HiRes::time()-$start; |
# $r->print("<p>took $lasttime</p>"); |
# $r->print("<p>took $lasttime</p>"); |
|
|
$navmap->untieHashes(); |
|
$r->print("</form>"); |
$r->print("</form>"); |
$r->print(&show_grading_menu_form($symb,$url)); |
$r->print(&show_grading_menu_form($symb,$url)); |
return ''; |
return ''; |
Line 4719 sub scantron_upload_scantron_data_save {
|
Line 4762 sub scantron_upload_scantron_data_save {
|
} |
} |
return ''; |
return ''; |
} |
} |
$r->print("Doing upload to ".$ENV{'form.courseid'}." <br />"); |
my %coursedata=&Apache::lonnet::coursedescription($ENV{'form.domainid'}.'_'.$ENV{'form.courseid'}); |
|
$r->print("Doing upload to ".$coursedata{'description'}." <br />"); |
my $home=&Apache::lonnet::homeserver($ENV{'form.courseid'}, |
my $home=&Apache::lonnet::homeserver($ENV{'form.courseid'}, |
$ENV{'form.domainid'}); |
$ENV{'form.domainid'}); |
my $fname=$ENV{'form.upfile.filename'}; |
my $fname=$ENV{'form.upfile.filename'}; |
Line 4736 sub scantron_upload_scantron_data_save {
|
Line 4780 sub scantron_upload_scantron_data_save {
|
$fname=~s/[^\w\.\-]//g; |
$fname=~s/[^\w\.\-]//g; |
# See if there is anything left |
# See if there is anything left |
unless ($fname) { return 'error: no uploaded file'; } |
unless ($fname) { return 'error: no uploaded file'; } |
|
my $uploadedfile=$fname; |
$fname='scantron_orig_'.$fname; |
$fname='scantron_orig_'.$fname; |
if (length($ENV{'form.upfile'}) < 2) { |
if (length($ENV{'form.upfile'}) < 2) { |
$r->print("<font color='red'>Error:</font> The file you attempted to upload, <tt>".&HTML::Entities::encode($ENV{'form.upfile.filename'},'<>&"')."</tt>, contained no information. Please check that you entered the correct filename."); |
$r->print("<font color='red'>Error:</font> The file you attempted to upload, <tt>".&HTML::Entities::encode($ENV{'form.upfile.filename'},'<>&"')."</tt>, contained no information. Please check that you entered the correct filename."); |
Line 4744 sub scantron_upload_scantron_data_save {
|
Line 4789 sub scantron_upload_scantron_data_save {
|
if ($result =~ m|^/uploaded/|) { |
if ($result =~ m|^/uploaded/|) { |
$r->print("<font color='green'>Success:</font> Successfully uploaded ".(length($ENV{'form.upfile'})-1)." bytes of data into location <tt>".$result."</tt>"); |
$r->print("<font color='green'>Success:</font> Successfully uploaded ".(length($ENV{'form.upfile'})-1)." bytes of data into location <tt>".$result."</tt>"); |
} else { |
} else { |
$r->print("<font color='red'>Error:</font> An error (".$result.") occured when attempting to upload the file, <tt>".&HTML::Entities::encode($ENV{'form.upfile.filename'},'<>&"')."</tt>"); |
$r->print("<font color='red'>Error:</font> An error (".$result.") occurred when attempting to upload the file, <tt>".&HTML::Entities::encode($ENV{'form.upfile.filename'},'<>&"')."</tt>"); |
} |
} |
} |
} |
if ($symb) { |
if ($symb) { |
$r->print(&show_grading_menu_form($symb,$url)); |
$r->print(&scantron_selectphase($r,$uploadedfile)); |
} else { |
} else { |
$r->print($doanotherupload); |
$r->print($doanotherupload); |
} |
} |
Line 4804 DOWNLOAD
|
Line 4849 DOWNLOAD
|
# |
# |
#------------------------------------------------------------------- |
#------------------------------------------------------------------- |
|
|
|
|
#-------------------------- Menu interface ------------------------- |
#-------------------------- Menu interface ------------------------- |
# |
# |
#--- Show a Grading Menu button - Calls the next routine --- |
#--- Show a Grading Menu button - Calls the next routine --- |
Line 4857 sub gradingmenu {
|
Line 4901 sub gradingmenu {
|
if (!checkReceiptNo(formname,'notOK')) { return false;} |
if (!checkReceiptNo(formname,'notOK')) { return false;} |
formname.submit(); |
formname.submit(); |
} |
} |
|
if (val < 7) formname.submit(); |
} |
} |
|
|
function checkReceiptNo(formname,nospace) { |
function checkReceiptNo(formname,nospace) { |
Line 4909 GRADINGMENUJS
|
Line 4954 GRADINGMENUJS
|
($saveSec eq $_ ? 'selected="on"':'').'>'.$_.'</option>'."\n"; |
($saveSec eq $_ ? 'selected="on"':'').'>'.$_.'</option>'."\n"; |
} |
} |
} |
} |
$result.= '<option value="all" '.($saveSec eq 'all' ? 'selected="on"' : ''). '>all</select> '; |
$result.= '<option value="all" '.($saveSec eq 'all' ? 'selected="on"' : ''). '>all</option></select> '; |
|
|
$result.=&mt('Student Status').':</b>'.&Apache::lonhtmlcommon::StatusOptions($saveStatus,undef,1,undef); |
$result.=&mt('Student Status').':</b>'.&Apache::lonhtmlcommon::StatusOptions($saveStatus,undef,1,undef); |
|
|
Line 4961 GRADINGMENUJS
|
Line 5006 GRADINGMENUJS
|
'-<input type="text" name="receipt" size="4" onChange="javascript:checkReceiptNo(this.form,\'OK\')">'. |
'-<input type="text" name="receipt" size="4" onChange="javascript:checkReceiptNo(this.form,\'OK\')">'. |
'</td></tr>'."\n"; |
'</td></tr>'."\n"; |
} |
} |
|
$result.='<tr bgcolor="#ffffe6"valign="top"><td colspan="2">'. |
|
'<input type="button" onClick="javascript:this.form.action=\'/adm/helper/resettimes.helper\';this.form.submit();'. |
|
'" value="'.&mt('Manage').'" /> access times.</td></tr>'."\n"; |
|
|
$result.='</form></td></tr></table>'."\n". |
$result.='</form></td></tr></table>'."\n". |
'</td></tr></table>'."\n". |
'</td></tr></table>'."\n". |
Line 5112 sub send_header {
|
Line 5160 sub send_header {
|
|
|
sub send_footer { |
sub send_footer { |
my ($request)= @_; |
my ($request)= @_; |
$request->print('</body>'); |
$request->print('</body></html>'); |
$request->print(&Apache::lontexconvert::footer()); |
|
} |
} |
|
|
1; |
1; |