version 1.166, 2003/12/04 23:23:16
|
version 1.191, 2004/04/29 04:47:47
|
Line 48 use Apache::lonhomework;
|
Line 48 use Apache::lonhomework;
|
use Apache::loncoursedata; |
use Apache::loncoursedata; |
use Apache::lonmsg qw(:user_normal_msg); |
use Apache::lonmsg qw(:user_normal_msg); |
use Apache::Constants qw(:common); |
use Apache::Constants qw(:common); |
|
use Apache::lonlocal; |
use String::Similarity; |
use String::Similarity; |
|
|
my %oldessays=(); |
my %oldessays=(); |
Line 88 sub getpartlist {
|
Line 89 sub getpartlist {
|
|
|
# --- Get the symbolic name of a problem and the url |
# --- Get the symbolic name of a problem and the url |
sub get_symb_and_url { |
sub get_symb_and_url { |
my ($request) = @_; |
my ($request,$silent) = @_; |
(my $url=$ENV{'form.url'}) =~ s-^http://($ENV{'SERVER_NAME'}|$ENV{'HTTP_HOST'})--; |
(my $url=$ENV{'form.url'}) =~ s-^http://($ENV{'SERVER_NAME'}|$ENV{'HTTP_HOST'})--; |
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 '') { |
|
if (!$silent) { |
|
$request->print("Unable to handle ambiguous references:$url:."); |
|
return (); |
|
} |
|
} |
return ($symb,$url); |
return ($symb,$url); |
} |
} |
|
|
Line 168 sub showResourceInfo {
|
Line 174 sub showResourceInfo {
|
my $col=3; |
my $col=3; |
if ($checkboxes) { $col=4; } |
if ($checkboxes) { $col=4; } |
my $result ='<table border="0">'. |
my $result ='<table border="0">'. |
'<tr><td colspan="'.$col.'"><font size="+1"><b>Current Resource: </b>'. |
'<tr><td colspan="'.$col.'"><font size="+1"><b>'.&mt('Current Resource').': </b>'. |
$probTitle.'</font></td></tr>'."\n"; |
$probTitle.'</font></td></tr>'."\n"; |
my ($partlist,$handgrade,$responseType) = &response_type($url); |
my ($partlist,$handgrade,$responseType) = &response_type($url); |
my %resptype = (); |
my %resptype = (); |
Line 505 sub verifyreceipt {
|
Line 511 sub verifyreceipt {
|
my $request = shift; |
my $request = shift; |
|
|
my $courseid = $ENV{'request.course.id'}; |
my $courseid = $ENV{'request.course.id'}; |
my $receipt = unpack("%32C*",$Apache::lonnet::perlvar{'lonHostID'}).'-'. |
my $receipt = &Apache::lonnet::recprefix($courseid).'-'. |
$ENV{'form.receipt'}; |
$ENV{'form.receipt'}; |
$receipt =~ s/[^\-\d]//g; |
$receipt =~ s/[^\-\d]//g; |
my $url = $ENV{'form.url'}; |
my $url = $ENV{'form.url'}; |
Line 520 sub verifyreceipt {
|
Line 526 sub verifyreceipt {
|
|
|
my ($string,$contents,$matches) = ('','',0); |
my ($string,$contents,$matches) = ('','',0); |
my (undef,undef,$fullname) = &getclasslist('all','0'); |
my (undef,undef,$fullname) = &getclasslist('all','0'); |
|
|
|
my $receiptparts=0; |
|
if ($ENV{"course.$courseid.receiptalg"} eq 'receipt2') { $receiptparts=1; } |
|
my $parts=['0']; |
|
if ($receiptparts) { ($parts)=&response_type($url,$symb); } |
foreach (sort {lc($$fullname{$a}) cmp lc($$fullname{$b}) } keys %$fullname) { |
foreach (sort {lc($$fullname{$a}) cmp lc($$fullname{$b}) } keys %$fullname) { |
my ($uname,$udom)=split(/\:/); |
my ($uname,$udom)=split(/\:/); |
if ($receipt eq |
foreach my $part (@$parts) { |
&Apache::lonnet::ireceipt($uname,$udom,$courseid,$symb)) { |
if ($receipt eq &Apache::lonnet::ireceipt($uname,$udom,$courseid,$symb,$part)) { |
$contents.='<tr bgcolor="#ffffe6"><td> '."\n". |
$contents.='<tr bgcolor="#ffffe6"><td> '."\n". |
'<a href="javascript:viewOneStudent(\''.$uname.'\',\''.$udom. |
'<a href="javascript:viewOneStudent(\''.$uname.'\',\''.$udom. |
'\')"; TARGET=_self>'.$$fullname{$_}.'</a> </td>'."\n". |
'\')"; TARGET=_self>'.$$fullname{$_}.'</a> </td>'."\n". |
'<td> '.$uname.' </td>'. |
'<td> '.$uname.' </td>'. |
'<td> '.$udom.' </td></tr>'."\n"; |
'<td> '.$udom.' </td>'; |
|
if ($receiptparts) { |
$matches++; |
$contents.='<td> '.$part.' </td>'; |
|
} |
|
$contents.='</tr>'."\n"; |
|
|
|
$matches++; |
|
} |
} |
} |
} |
} |
if ($matches == 0) { |
if ($matches == 0) { |
Line 544 sub verifyreceipt {
|
Line 559 sub verifyreceipt {
|
'<table border="0"><tr bgcolor="#e6ffff">'."\n". |
'<table border="0"><tr bgcolor="#e6ffff">'."\n". |
'<td><b> Fullname </b></td>'."\n". |
'<td><b> Fullname </b></td>'."\n". |
'<td><b> Username </b></td>'."\n". |
'<td><b> Username </b></td>'."\n". |
'<td><b> Domain </b></td></tr>'."\n". |
'<td><b> Domain </b></td>'; |
$contents. |
if ($receiptparts) { |
|
$string.='<td> Problem Part </td>'; |
|
} |
|
$string.='</tr>'."\n".$contents. |
'</table></td></tr></table>'."\n"; |
'</table></td></tr></table>'."\n"; |
} |
} |
return $string.&show_grading_menu_form($symb,$url); |
return $string.&show_grading_menu_form($symb,$url); |
Line 737 LISTJAVASCRIPT
|
Line 755 LISTJAVASCRIPT
|
if ($num_students eq 0) { |
if ($num_students eq 0) { |
$gradeTable='<br /> <font color="red">There are no students currently enrolled.</font>'; |
$gradeTable='<br /> <font color="red">There are no students currently enrolled.</font>'; |
} else { |
} else { |
|
my $submissions='submissions'; |
|
if ($submitonly eq 'incorrect') { $submissions = 'incorrect submissions'; } |
|
if ($submitonly eq 'graded' ) { $submissions = 'ungraded submissions'; } |
$gradeTable='<br /> <font color="red">'. |
$gradeTable='<br /> <font color="red">'. |
'No submissions found for this resource for any students. ('.$num_students. |
'No '.$submissions.' found for this resource for any students. ('.$num_students. |
' checked for submissions)</font><br />'; |
' students checked for '.$submissions.')</font><br />'; |
} |
} |
} elsif ($ctr == 1) { |
} elsif ($ctr == 1) { |
$gradeTable =~ s/type=checkbox/type=checkbox checked/; |
$gradeTable =~ s/type=checkbox/type=checkbox checked/; |
Line 1274 sub gradeBox {
|
Line 1295 sub gradeBox {
|
my $ctr = 0; |
my $ctr = 0; |
$result.='<table border="0"><tr>'."\n"; # display radio buttons in a nice table 10 across |
$result.='<table border="0"><tr>'."\n"; # display radio buttons in a nice table 10 across |
while ($ctr<=$wgt) { |
while ($ctr<=$wgt) { |
$result.= '<td><input type="radio" name="RADVAL'.$counter.'_'.$partid.'" '. |
$result.= '<td><nobr><input type="radio" name="RADVAL'.$counter.'_'.$partid.'" '. |
'onclick="javascript:writeBox(this.form,\''.$counter.'_'.$partid.'\','. |
'onclick="javascript:writeBox(this.form,\''.$counter.'_'.$partid.'\','. |
$ctr.')" value="'.$ctr.'" '. |
$ctr.')" value="'.$ctr.'" '. |
($score eq $ctr ? 'checked':'').' /> '.$ctr."</td>\n"; |
($score eq $ctr ? 'checked':'').' /> '.$ctr."</nobr></td>\n"; |
$result.=(($ctr+1)%10 == 0 ? '</tr><tr>' : ''); |
$result.=(($ctr+1)%10 == 0 ? '</tr><tr>' : ''); |
$ctr++; |
$ctr++; |
} |
} |
Line 1678 KEYWORDS
|
Line 1699 KEYWORDS
|
my $toGrade.='<input type="button" value="Grade Student" '. |
my $toGrade.='<input type="button" value="Grade Student" '. |
'onClick="javascript:checksubmit(this.form,\'Grade Student\',\'' |
'onClick="javascript:checksubmit(this.form,\'Grade Student\',\'' |
.$counter.'\');" TARGET=_self> '."\n" if (&canmodify($usec)); |
.$counter.'\');" TARGET=_self> '."\n" if (&canmodify($usec)); |
$toGrade.='</td></tr></table></td></tr></table></form>'."\n"; |
$toGrade.='</td></tr></table></td></tr></table>'."\n"; |
$toGrade.=&show_grading_menu_form($symb,$url) |
if (($ENV{'form.command'} eq 'submission') || |
if (($ENV{'form.command'} eq 'submission') || |
($ENV{'form.command'} eq 'processGroup' && $counter == $total)) { |
($ENV{'form.command'} eq 'processGroup' && $counter == $total)); |
$toGrade.='</form>'.&show_grading_menu_form($symb,$url) |
$request = print($toGrade); |
} |
|
$request->print($toGrade); |
return; |
return; |
|
} else { |
|
$request->print('</td></tr></table></td></tr></table>'."\n"); |
} |
} |
|
|
# essay grading message center |
# essay grading message center |
Line 2247 sub viewgrades {
|
Line 2271 sub viewgrades {
|
&viewgrades_js($request); |
&viewgrades_js($request); |
|
|
my ($symb,$url) = ($ENV{'form.symb'},$ENV{'form.url'}); |
my ($symb,$url) = ($ENV{'form.symb'},$ENV{'form.url'}); |
my $result='<h3><font color="#339933">Manual Grading</font></h3>'; |
#need to make sure we have the correct data for later EXT calls, |
|
#thus invalidate the cache |
|
&Apache::lonnet::devalidatecourseresdata( |
|
$ENV{'course.'.$ENV{'request.course.id'}.'.num'}, |
|
$ENV{'course.'.$ENV{'request.course.id'}.'.domain'}); |
|
&Apache::lonnet::clear_EXT_cache_status(); |
|
|
|
my $result='<h3><font color="#339933">'.&mt('Manual Grading').'</font></h3>'; |
$result.='<font size=+1><b>Current Resource: </b>'.$ENV{'form.probTitle'}.'</font>'."\n"; |
$result.='<font size=+1><b>Current Resource: </b>'.$ENV{'form.probTitle'}.'</font>'."\n"; |
|
|
#view individual student submission form - called using Javascript viewOneStudent |
#view individual student submission form - called using Javascript viewOneStudent |
Line 3031 sub displayPage {
|
Line 3061 sub displayPage {
|
my ($classlist,undef,$fullname) = &getclasslist($getsec,'1'); |
my ($classlist,undef,$fullname) = &getclasslist($getsec,'1'); |
my ($uname,$udom) = split(/:/,$ENV{'form.student'}); |
my ($uname,$udom) = split(/:/,$ENV{'form.student'}); |
my $usec=$classlist->{$ENV{'form.student'}}[5]; |
my $usec=$classlist->{$ENV{'form.student'}}[5]; |
|
|
|
#need to make sure we have the correct data for later EXT calls, |
|
#thus invalidate the cache |
|
&Apache::lonnet::devalidatecourseresdata( |
|
$ENV{'course.'.$ENV{'request.course.id'}.'.num'}, |
|
$ENV{'course.'.$ENV{'request.course.id'}.'.domain'}); |
|
&Apache::lonnet::clear_EXT_cache_status(); |
|
|
if (!&canview($usec)) { |
if (!&canview($usec)) { |
$request->print('<font color="red">Unable to view requested student.('.$ENV{'form.student'}.')</font>'); |
$request->print('<font color="red">Unable to view requested student.('.$ENV{'form.student'}.')</font>'); |
$request->print(&show_grading_menu_form($symb,$url)); |
$request->print(&show_grading_menu_form($symb,$url)); |
Line 3202 sub displaySubByDates {
|
Line 3240 sub displaySubByDates {
|
} |
} |
if (exists $$record{"$version:resource.$partid.regrader"}) { |
if (exists $$record{"$version:resource.$partid.regrader"}) { |
$displaySub[2].=$$record{"$version:resource.$partid.regrader"}. |
$displaySub[2].=$$record{"$version:resource.$partid.regrader"}. |
' (<b>Part:</b> '.$partid.')'; |
' (<b>'.&mt('Part').':</b> '.$partid.')'; |
} |
} |
} |
} |
# needed because old essay regrader has not parts info |
# needed because old essay regrader has not parts info |
Line 3384 sub scantron_uploads {
|
Line 3422 sub scantron_uploads {
|
my $cname=$ENV{'course.'.$ENV{'request.course.id'}.'.num'}; |
my $cname=$ENV{'course.'.$ENV{'request.course.id'}.'.num'}; |
my @files=&Apache::lonnet::dirlist('userfiles',$cdom,$cname, |
my @files=&Apache::lonnet::dirlist('userfiles',$cdom,$cname, |
&Apache::loncommon::propath($cdom,$cname)); |
&Apache::loncommon::propath($cdom,$cname)); |
|
$result.="<option></option>"; |
foreach my $filename (@files) { |
foreach my $filename (@files) { |
($filename)=split(/&/,$filename); |
($filename)=split(/&/,$filename); |
if ($filename!~/^scantron_orig_/) { next ; } |
if ($filename!~/^scantron_orig_/) { next ; } |
Line 3397 sub scantron_uploads {
|
Line 3436 sub scantron_uploads {
|
sub scantron_scantab { |
sub scantron_scantab { |
my $fh=Apache::File->new($Apache::lonnet::perlvar{'lonTabDir'}.'/scantronformat.tab'); |
my $fh=Apache::File->new($Apache::lonnet::perlvar{'lonTabDir'}.'/scantronformat.tab'); |
my $result='<select name="scantron_format">'."\n"; |
my $result='<select name="scantron_format">'."\n"; |
|
$result.='<option></option>'."\n"; |
foreach my $line (<$fh>) { |
foreach my $line (<$fh>) { |
my ($name,$descrip)=split(/:/,$line); |
my ($name,$descrip)=split(/:/,$line); |
if ($name =~ /^\#/) { next; } |
if ($name =~ /^\#/) { next; } |
Line 3407 sub scantron_scantab {
|
Line 3447 sub scantron_scantab {
|
return $result; |
return $result; |
} |
} |
|
|
|
sub scantron_CODElist { |
|
my $cdom = $ENV{'course.'.$ENV{'request.course.id'}.'.domain'}; |
|
my $cnum = $ENV{'course.'.$ENV{'request.course.id'}.'.num'}; |
|
my @names=&Apache::lonnet::getkeys('CODEs',$cdom,$cnum); |
|
my $namechoice='<option></option>'; |
|
foreach my $name (@names) { |
|
if ($name =~ /^error: 2 /) { next; } |
|
$namechoice.='<option value="'.$name.'">'.$name.'</option>'; |
|
} |
|
$namechoice='<select name="scantron_CODElist">'.$namechoice.'</select>'; |
|
return $namechoice; |
|
} |
|
|
|
sub scantron_CODEunique { |
|
my $result='<nobr> |
|
<input type="radio" name="scantron_CODEunique" |
|
value="Yes" checked="on" /> Yes |
|
</nobr> |
|
<nobr> |
|
<input type="radio" name="scantron_CODEunique" |
|
value="No" /> No |
|
</nobr>'; |
|
return $result; |
|
} |
|
|
sub scantron_selectphase { |
sub scantron_selectphase { |
my ($r) = @_; |
my ($r) = @_; |
my ($symb,$url)=&get_symb_and_url($r); |
my ($symb,$url)=&get_symb_and_url($r); |
Line 3416 sub scantron_selectphase {
|
Line 3481 sub scantron_selectphase {
|
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(); |
my $format_selector=&scantron_scantab(); |
my $format_selector=&scantron_scantab(); |
|
my $CODE_selector=&scantron_CODElist(); |
|
my $CODE_unique=&scantron_CODEunique(); |
my $result; |
my $result; |
#FIXME allow instructor to be able to download the scantron file |
#FIXME allow instructor to be able to download the scantron file |
# and to upload it, |
# and to upload it, |
Line 3423 sub scantron_selectphase {
|
Line 3490 sub scantron_selectphase {
|
<table width="100%" border="0"> |
<table width="100%" border="0"> |
<tr> |
<tr> |
<td bgcolor="#777777"> |
<td bgcolor="#777777"> |
<form method="post" enctype="multipart/form-data" action="/adm/grades" name="scantro_process"> |
<form method="post" enctype="multipart/form-data" action="/adm/grades" name="scantron_process"> |
<input type="hidden" name="command" value="scantron_validate" /> |
<input type="hidden" name="command" value="scantron_validate" /> |
$default_form_data |
$default_form_data |
<table width="100%" border="0"> |
<table width="100%" border="0"> |
<tr bgcolor="#e6ffff"> |
<tr bgcolor="#e6ffff"> |
<td> |
<td colspan="2"> |
<b>Specify file location and which Folder/Sequence to grade</b> |
<b>Specify file and which Folder/Sequence to grade</b> |
</td> |
</td> |
</tr> |
</tr> |
<tr bgcolor="#ffffe6"> |
<tr bgcolor="#ffffe6"> |
<td> |
<td> Sequence to grade: </td><td> $sequence_selector </td> |
Sequence to grade: $sequence_selector |
|
</td> |
|
</tr> |
</tr> |
<tr bgcolor="#ffffe6"> |
<tr bgcolor="#ffffe6"> |
<td> |
<td> Filename of scoring office file: </td><td> $file_selector </td> |
Filename of scoring office file: $file_selector |
|
</td> |
|
</tr> |
</tr> |
<tr bgcolor="#ffffe6"> |
<tr bgcolor="#ffffe6"> |
<td> |
<td> Format of data file: </td><td> $format_selector </td> |
Format of data file: $format_selector |
|
</td> |
|
</tr> |
</tr> |
<tr bgcolor="#ffffe6"> |
<tr bgcolor="#ffffe6"> |
|
<td> Saved CODEs to validate against: </td><td> $CODE_selector</td> |
|
</tr> |
|
<tr bgcolor="#ffffe6"> |
|
<td> Each CODE is only to be used once:</td><td> $CODE_unique </td> |
|
</tr> |
|
<tr bgcolor="#ffffe6"> |
|
<td> Options: </td> |
<td> |
<td> |
<!-- FIXME this is lazy, a single parse of the set should let me know what this is --> |
<input type="checkbox" name="scantron_options_redo" value="redo_skipped"/> Redo skipped records <br /> |
Last line to expect an answer on: |
<input type="checkbox" name="scantron_options_ignore" value="ignore_corrections"/> Ignore Original Corrections |
<input type="text" name="scantron_maxbubble" /> |
|
</td> |
</td> |
</tr> |
</tr> |
<tr bgcolor="#ffffe6"> |
<tr bgcolor="#ffffe6"> |
<td> |
<td colspan="2"> |
<input type="submit" value="Validate Scantron Records" /> |
<input type="submit" value="Validate Scantron Records" /> |
</td> |
</td> |
</tr> |
</tr> |
Line 3476 SCANTRONFORM
|
Line 3543 SCANTRONFORM
|
<table width="100%" border="0"> |
<table width="100%" border="0"> |
<tr bgcolor="#e6ffff"> |
<tr bgcolor="#e6ffff"> |
<td> |
<td> |
Specify a Scantron data file to upload. |
<b>Specify a Scantron data file to upload.</b> |
</td> |
</td> |
</tr> |
</tr> |
<tr bgcolor="#ffffe6"> |
<tr bgcolor="#ffffe6"> |
<td> |
<td> |
SCANTRONFORM |
SCANTRONFORM |
&scantron_upload_scantron_data($r); |
my $default_form_data=&defaultFormData(&get_symb_and_url($r,1)); |
|
my $cdom= $ENV{'course.'.$ENV{'request.course.id'}.'.domain'}; |
|
my $cnum= $ENV{'course.'.$ENV{'request.course.id'}.'.num'}; |
|
$r->print(<<UPLOAD); |
|
<script type="text/javascript" language="javascript"> |
|
function checkUpload(formname) { |
|
if (formname.upfile.value == "") { |
|
alert("Please use the browse button to select a file from your local directory."); |
|
return false; |
|
} |
|
formname.submit(); |
|
} |
|
</script> |
|
|
|
<form enctype='multipart/form-data' action='/adm/grades' name='rules' method='post'> |
|
$default_form_data |
|
<input name='courseid' type='hidden' value='$cnum' /> |
|
<input name='domainid' type='hidden' value='$cdom' /> |
|
<input name='command' value='scantronupload_save' type='hidden' /> |
|
File to upload:<input type="file" name="upfile" size="50" /> |
|
<br /> |
|
<input type="button" onClick="javascript:checkUpload(this.form);" value="Upload Scantron Data" /> |
|
</form> |
|
UPLOAD |
|
|
$r->print(<<SCANTRONFORM); |
$r->print(<<SCANTRONFORM); |
</td> |
</td> |
Line 3492 SCANTRONFORM
|
Line 3582 SCANTRONFORM
|
</tr> |
</tr> |
SCANTRONFORM |
SCANTRONFORM |
} |
} |
|
$r->print(<<SCANTRONFORM); |
|
<tr> |
|
<td bgcolor="#777777"> |
|
<form action='/adm/grades' name='scantron_download'> |
|
<input type="hidden" name="command" value="scantron_download" /> |
|
<table width="100%" border="0"> |
|
<tr bgcolor="#e6ffff"> |
|
<td colspan="2"> |
|
<b>Download a scoring office file</b> |
|
</td> |
|
</tr> |
|
<tr bgcolor="#ffffe6"> |
|
<td> Filename of scoring office file: </td><td> $file_selector </td> |
|
</tr> |
|
<tr bgcolor="#ffffe6"> |
|
<td> |
|
Records to download |
|
</td> |
|
<td> |
|
<input type="radio" name="scantron_options" value="download_skipped"/> Skipped Records <br /> |
|
<input type="radio" name="scantron_options" value="download_corrected"/> Corrected Records <br /> |
|
<input checked="on" type="radio" name="scantron_options" value="dowload_orig"/> Original Records |
|
</td> |
|
</tr> |
|
<tr bgcolor="#ffffe6"> |
|
<td colspan="2"> |
|
<input type="submit" value="Validate Scantron Records" /> |
|
</td> |
|
</tr> |
|
</table> |
|
</form> |
|
</td> |
|
</tr> |
|
SCANTRONFORM |
|
|
$r->print(<<SCANTRONFORM); |
$r->print(<<SCANTRONFORM); |
</table> |
</table> |
Line 3548 sub scantron_fixup_scanline {
|
Line 3672 sub scantron_fixup_scanline {
|
my ($scantron_config,$scan_data,$line,$whichline,$field,$args)=@_; |
my ($scantron_config,$scan_data,$line,$whichline,$field,$args)=@_; |
if ($field eq 'ID') { |
if ($field eq 'ID') { |
if (length($args->{'newid'}) > $$scantron_config{'IDlength'}) { |
if (length($args->{'newid'}) > $$scantron_config{'IDlength'}) { |
return ($line,1,'New value to large'); |
return ($line,1,'New value too large'); |
} |
} |
if (length($args->{'newid'}) < $$scantron_config{'IDlength'}) { |
if (length($args->{'newid'}) < $$scantron_config{'IDlength'}) { |
$args->{'newid'}=sprintf('%-'.$$scantron_config{'IDlength'}.'s', |
$args->{'newid'}=sprintf('%-'.$$scantron_config{'IDlength'}.'s', |
Line 3560 sub scantron_fixup_scanline {
|
Line 3684 sub scantron_fixup_scanline {
|
&scan_data($scan_data,"$whichline.user", |
&scan_data($scan_data,"$whichline.user", |
$args->{'username'}.':'.$args->{'domain'}); |
$args->{'username'}.':'.$args->{'domain'}); |
} |
} |
|
} elsif ($field eq 'CODE') { |
|
if ($args->{'CODE'} eq 'use_unfound') { |
|
&scan_data($scan_data,"$whichline.useCODE",'1'); |
|
} else { |
|
if (length($args->{'CODE'}) > $$scantron_config{'CODElength'}) { |
|
return ($line,1,'New CODE value too large'); |
|
} |
|
if (length($args->{'CODE'}) < $$scantron_config{'CODElength'}) { |
|
$args->{'CODE'}=sprintf('%-'.$$scantron_config{'CODElength'}.'s',$args->{'CODE'}); |
|
} |
|
substr($line,$$scantron_config{'CODEstart'}-1, |
|
$$scantron_config{'CODElength'})=$args->{'CODE'}; |
|
# if ($args->{'CODE'}=~/^\s*$/) { |
|
# &scan_data($scan_data,"$whichline.CODE",$args->{'CODE'}); |
|
# } |
|
} |
} elsif ($field eq 'answer') { |
} elsif ($field eq 'answer') { |
my $length=$scantron_config->{'Qlength'}; |
my $length=$scantron_config->{'Qlength'}; |
my $off=$scantron_config->{'Qoff'}; |
my $off=$scantron_config->{'Qoff'}; |
Line 3590 sub scan_data {
|
Line 3730 sub scan_data {
|
} |
} |
|
|
sub scantron_parse_scanline { |
sub scantron_parse_scanline { |
my ($line,$whichline,$scantron_config,$scan_data)=@_; |
my ($line,$whichline,$scantron_config,$scan_data,$justCODE)=@_; |
my %record; |
my %record; |
my $questions=substr($line,$$scantron_config{'Qstart'}-1); |
my $questions=substr($line,$$scantron_config{'Qstart'}-1); |
my $data=substr($line,0,$$scantron_config{'Qstart'}-1); |
my $data=substr($line,0,$$scantron_config{'Qstart'}-1); |
if ($$scantron_config{'CODElocation'} ne 0) { |
if ($$scantron_config{'CODElocation'} ne 0) { |
if ($$scantron_config{'CODElocation'} < 0) { |
if ($$scantron_config{'CODElocation'} < 0) { |
$record{'scantron.CODE'}=substr($data,$$scantron_config{'CODEstart'}-1, |
$record{'scantron.CODE'}=substr($data, |
|
$$scantron_config{'CODEstart'}-1, |
$$scantron_config{'CODElength'}); |
$$scantron_config{'CODElength'}); |
|
if (&scan_data($scan_data,"$whichline.useCODE")) { |
|
$record{'scantron.useCODE'}=1; |
|
} |
} else { |
} else { |
#FIXME interpret first N questions |
#FIXME interpret first N questions |
} |
} |
} |
} |
|
if ($justCODE) { return \%record; } |
$record{'scantron.ID'}=substr($data,$$scantron_config{'IDstart'}-1, |
$record{'scantron.ID'}=substr($data,$$scantron_config{'IDstart'}-1, |
$$scantron_config{'IDlength'}); |
$$scantron_config{'IDlength'}); |
$record{'scantron.PaperID'}= |
$record{'scantron.PaperID'}= |
Line 3693 sub scantron_process_corrections {
|
Line 3838 sub scantron_process_corrections {
|
'ID',{'newid'=>$newid, |
'ID',{'newid'=>$newid, |
'username'=>$ENV{'form.scantron_username'}, |
'username'=>$ENV{'form.scantron_username'}, |
'domain'=>$ENV{'form.scantron_domain'}}); |
'domain'=>$ENV{'form.scantron_domain'}}); |
|
} elsif ($ENV{'form.scantron_corrections'} =~ /^(duplicate|incorrect)CODE$/) { |
|
my $resolution=$ENV{'form.scantron_CODE_resolution'}; |
|
my $newCODE; |
|
if ($resolution eq 'use_unfound') { |
|
$newCODE='use_unfound'; |
|
} elsif ($resolution eq 'use_found') { |
|
$newCODE=$ENV{'form.scantron_CODE_selectedvalue'}; |
|
} elsif ($resolution eq 'use_typed') { |
|
$newCODE=$ENV{'form.scantron_CODE_newvalue'}; |
|
} |
|
($line,$err,$errmsg)= |
|
&scantron_fixup_scanline(\%scantron_config,$scan_data,$line,$which, |
|
'CODE',{'CODE'=>$newCODE}); |
} elsif ($ENV{'form.scantron_corrections'} =~ /^(missing|double)bubble$/) { |
} elsif ($ENV{'form.scantron_corrections'} =~ /^(missing|double)bubble$/) { |
foreach my $question (split(',',$ENV{'form.scantron_questions'})) { |
foreach my $question (split(',',$ENV{'form.scantron_questions'})) { |
($line,$err,$errmsg)= |
($line,$err,$errmsg)= |
Line 3721 sub scantron_validate_file {
|
Line 3879 sub scantron_validate_file {
|
if ($ENV{'form.scantron_corrections'}) { |
if ($ENV{'form.scantron_corrections'}) { |
&scantron_process_corrections($r); |
&scantron_process_corrections($r); |
} |
} |
|
$r->print("<p>Gathering neccessary info.</p>");$r->rflush(); |
|
my $max_bubble=&scantron_get_maxbubble($r); |
#get the student pick code ready |
#get the student pick code ready |
$r->print(&Apache::loncommon::studentbrowser_javascript()); |
$r->print(&Apache::loncommon::studentbrowser_javascript()); |
my $result= <<SCANTRONFORM; |
my $result= <<SCANTRONFORM; |
Line 3728 sub scantron_validate_file {
|
Line 3888 sub scantron_validate_file {
|
<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="$ENV{'form.scantron_maxbubble'}" /> |
<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_CODEunique" value="$ENV{'form.scantron_CODEunique'}" /> |
|
<input type="hidden" name="scantron_options_redo" value="$ENV{'form.scantron_optiond_redo'}" /> |
|
<input type="hidden" name="scantron_options_ignore" value="$ENV{'form.scantron_optiond_ignore'}" /> |
$default_form_data |
$default_form_data |
SCANTRONFORM |
SCANTRONFORM |
$r->print($result); |
$r->print($result); |
Line 3802 sub scantron_getfile {
|
Line 3966 sub scantron_getfile {
|
} else { |
} else { |
$scanlines{'skipped'}=[(split("\n",$lines,-1))]; |
$scanlines{'skipped'}=[(split("\n",$lines,-1))]; |
} |
} |
my @tmp=&Apache::lonnet::dump('scantrondata',$cdom,$cname); |
my @tmp=&Apache::lonnet::dump('nohist_scantrondata',$cdom,$cname); |
if ($tmp[0] =~ /^(error:|no_such_host)/) { @tmp=(); } |
if ($tmp[0] =~ /^(error:|no_such_host)/) { @tmp=(); } |
my %scan_data = @tmp; |
my %scan_data = @tmp; |
return (\%scanlines,\%scan_data); |
return (\%scanlines,\%scan_data); |
Line 3834 sub scantron_putfile {
|
Line 3998 sub scantron_putfile {
|
&lonnet_putfile(join("\n",@{$scanlines->{'skipped'}}), |
&lonnet_putfile(join("\n",@{$scanlines->{'skipped'}}), |
$prefix.'skipped_'. |
$prefix.'skipped_'. |
$ENV{'form.scantron_selectfile'}); |
$ENV{'form.scantron_selectfile'}); |
&Apache::lonnet::put('scantrondata',$scan_data,$cdom,$cname); |
&Apache::lonnet::put('nohist_scantrondata',$scan_data,$cdom,$cname); |
} |
} |
|
|
sub scantron_get_line { |
sub scantron_get_line { |
Line 3886 sub scantron_validate_ID {
|
Line 4050 sub scantron_validate_ID {
|
$line,'duplicateID',$username); |
$line,'duplicateID',$username); |
return(1); |
return(1); |
} |
} |
#FIXME store away line we prviously saw the ID on to use above |
#FIXME store away line we previously saw the ID on to use above |
$found{'ids'}{$found}++; |
$found{'ids'}{$found}++; |
$found{'usernames'}{$username}++; |
$found{'usernames'}{$username}++; |
} else { |
} else { |
Line 3933 sub scantron_get_correction {
|
Line 4097 sub scantron_get_correction {
|
$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$/) { |
if ($error eq 'unknownID') { |
if ($error eq 'incorrectID') { |
$r->print("The encoded ID is not in the classlist</p>\n"); |
$r->print("The encoded ID is not in the classlist</p>\n"); |
} 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"); |
Line 3951 sub scantron_get_correction {
|
Line 4115 sub scantron_get_correction {
|
'scantron_username','scantron_domain')); |
'scantron_username','scantron_domain')); |
$r->print(": <input type='text' name='scantron_username' value='' />"); |
$r->print(": <input type='text' name='scantron_username' value='' />"); |
$r->print("\n@". |
$r->print("\n@". |
&Apache::loncommon::select_dom_form(undef,'scantron_domain')); |
&Apache::loncommon::select_dom_form($ENV{'request.role.domain'},'scantron_domain')); |
|
|
$r->print('</li>'); |
$r->print('</li>'); |
|
} elsif ($error =~ /CODE$/) { |
|
if ($error eq 'incorrectCODE') { |
|
$r->print("</p><p>The encoded CODE is not in the list of possible CODEs</p>\n"); |
|
} elsif ($error eq 'duplicateCODE') { |
|
$r->print("</p><p>The encoded CODE has also been used by a previous paper $arg, and CODEs were supposed to be unique</p>\n"); |
|
} |
|
$r->print("<p>The CODE on the form is <tt>". |
|
$$scan_record{'scantron.CODE'}."</tt><br />\n"); |
|
$r->print("<p>The ID on the form is <tt>". |
|
$$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("\n<br /> "); |
|
$r->print("<input type='radio' name='scantron_CODE_resolution' value='use_unfound' checked='on' /> Use the CODE <b><tt>".$$scan_record{'scantron.CODE'}."</tt></b> that is was on the paper, ignoring the error."); |
|
$r->print("\n<br />"); |
|
$r->print(<<ENDSCRIPT); |
|
<script type="text/javascript"> |
|
function change_radio(field) { |
|
var slct=document.scantronupload.scantron_CODE_resolution; |
|
var i; |
|
for (i=0;i<slct.length;i++) { |
|
if (slct[i].value==field) { slct[i].checked=true; } |
|
} |
|
} |
|
</script> |
|
ENDSCRIPT |
|
my $href="/adm/pickcode?". |
|
"form=".&Apache::lonnet::escape("scantronupload"). |
|
"&scantron_format=".&Apache::lonnet::escape($ENV{'form.scantron_format'}). |
|
"&scantron_CODElist=".&Apache::lonnet::escape($ENV{'form.scantron_CODElist'}). |
|
"&curCODE=".&Apache::lonnet::escape($$scan_record{'scantron.CODE'}). |
|
"&scantron_selectfile=".&Apache::lonnet::escape($ENV{'form.scantron_selectfile'}); |
|
$r->print("<input type='radio' name='scantron_CODE_resolution' value='use_found' /> <a target='_blank' href='$href'>Select</a> a CODE from the list of all CODEs and use it. Selected CODE is <input readonly='true' type='text' size='8' name='scantron_CODE_selectedvalue' onfocus=\"javascript:change_radio('use_found')\" onchange=\"javascript:change_radio('use_found')\" />"); |
|
$r->print("\n<br />"); |
|
$r->print("<input type='radio' name='scantron_CODE_resolution' value='use_typed' /> Use <input type='text' size='8' name='scantron_CODE_newvalue' onfocus=\"javascript:change_radio('use_typed')\" onkeypress=\"javascript:change_radio('use_typed')\" /> as the CODE."); |
|
$r->print("\n<br /><br />"); |
} elsif ($error eq 'doublebubble') { |
} elsif ($error eq 'doublebubble') { |
#FIXME Need to print out who this is along with the paper info |
#FIXME Need to print out who this is along with the paper info |
$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"); |
Line 4005 sub scantron_bubble_selector {
|
Line 4207 sub scantron_bubble_selector {
|
sub scantron_validate_CODE { |
sub scantron_validate_CODE { |
my ($r,$currentphase) = @_; |
my ($r,$currentphase) = @_; |
#FIXME doesn't do anything yet |
#FIXME doesn't do anything yet |
|
my %scantron_config=&get_scantron_config($ENV{'form.scantron_format'}); |
|
if ($scantron_config{'CODElocation'} && |
|
$scantron_config{'CODEstart'} && |
|
$scantron_config{'CODElength'}) { |
|
if (!defined($ENV{'form.scantron_CODElist'})) { |
|
&FIXME_blow_up() |
|
} |
|
} else { |
|
return (0,$currentphase+1); |
|
} |
|
|
|
my %usedCODEs; |
|
|
|
my $old_name=$ENV{'form.scantron_CODElist'}; |
|
my $cdom =$ENV{'course.'.$ENV{'request.course.id'}.'.domain'}; |
|
my $cnum =$ENV{'course.'.$ENV{'request.course.id'}.'.num'}; |
|
my %result=&Apache::lonnet::get('CODEs',[$old_name],$cdom,$cnum); |
|
my %allcodes=map {(&Apache::lonprintout::num_to_letters($_),1)} split(',',$result{$old_name}); |
|
|
|
my ($scanlines,$scan_data)=&scantron_getfile(); |
|
for (my $i=0;$i<=$scanlines->{'count'};$i++) { |
|
my $line=&scantron_get_line($scanlines,$i); |
|
if ($line=~/^[\s\cz]*$/) { next; } |
|
my $scan_record=&scantron_parse_scanline($line,$i,\%scantron_config, |
|
$scan_data); |
|
my $CODE=$$scan_record{'scantron.CODE'}; |
|
my $error=0; |
|
if (!exists($allcodes{$CODE}) && !$$scan_record{'scantron.useCODE'}) { |
|
&scantron_get_correction($r,$i,$scan_record, |
|
\%scantron_config, |
|
$line,'incorrectCODE',$CODE); |
|
return(1); |
|
} |
|
if (exists($usedCODEs{$CODE}) && $ENV{'form.scantron_CODEunique'}) { |
|
&scantron_get_correction($r,$i,$scan_record, |
|
\%scantron_config, |
|
$line,'duplicateCODE',$CODE); |
|
return(1); |
|
} |
|
$usedCODEs{$CODE}++; |
|
} |
return (0,$currentphase+1); |
return (0,$currentphase+1); |
} |
} |
|
|
Line 4031 sub scantron_validate_doublebubble {
|
Line 4274 sub scantron_validate_doublebubble {
|
return (0,$currentphase+1); |
return (0,$currentphase+1); |
} |
} |
|
|
|
sub scantron_get_maxbubble { |
|
my ($r)=@_; |
|
if (defined($ENV{'form.scantron_maxbubble'}) && |
|
$ENV{'form.scantron_maxbubble'}) { |
|
return $ENV{'form.scantron_maxbubble'}; |
|
} |
|
my $navmap=Apache::lonnavmaps::navmap->new(); |
|
my (undef,undef,$sequence)= |
|
&Apache::lonnet::decode_symb($ENV{'form.selectpage'}); |
|
my $map=$navmap->getResourceByUrl($sequence); |
|
my @resources=$navmap->retrieveResources($map,\&scantron_filter,1,0); |
|
&Apache::lonnet::delenv('form.counter'); |
|
foreach my $resource (@resources) { |
|
my $result=&Apache::lonnet::ssi($resource->src()); |
|
} |
|
&Apache::lonnet::delenv('scantron\.'); |
|
my $envfile=$ENV{'user.environment'}; |
|
$envfile=~/\/([^\/]+)\.id$/; |
|
$envfile=$1; |
|
&Apache::lonnet::transfer_profile_to_env($r->dir_config('lonIDsDir'), |
|
$envfile); |
|
$ENV{'form.scantron_maxbubble'}=$ENV{'form.counter'}-1; |
|
return $ENV{'form.scantron_maxbubble'}; |
|
} |
|
|
sub scantron_validate_missingbubbles { |
sub scantron_validate_missingbubbles { |
my ($r,$currentphase) = @_; |
my ($r,$currentphase) = @_; |
#get student info |
#get student info |
Line 4040 sub scantron_validate_missingbubbles {
|
Line 4308 sub scantron_validate_missingbubbles {
|
#get scantron line setup |
#get scantron line setup |
my %scantron_config=&get_scantron_config($ENV{'form.scantron_format'}); |
my %scantron_config=&get_scantron_config($ENV{'form.scantron_format'}); |
my ($scanlines,$scan_data)=&scantron_getfile(); |
my ($scanlines,$scan_data)=&scantron_getfile(); |
my $max_bubble=$ENV{'form.scantron_maxbubble'}; |
my $max_bubble=&scantron_get_maxbubble(); |
if (!$max_bubble) { $max_bubble=2**31; } |
if (!$max_bubble) { $max_bubble=2**31; } |
for (my $i=0;$i<=$scanlines->{'count'};$i++) { |
for (my $i=0;$i<=$scanlines->{'count'};$i++) { |
my $line=&scantron_get_line($scanlines,$i); |
my $line=&scantron_get_line($scanlines,$i); |
Line 4136 SCANTRONFORM
|
Line 4404 SCANTRONFORM
|
'last student'); |
'last student'); |
} |
} |
&Apache::lonhtmlcommon::Close_PrgWin($r,\%prog_state); |
&Apache::lonhtmlcommon::Close_PrgWin($r,\%prog_state); |
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(); |
$navmap->untieHashes(); |
$r->print("<p>Done</p>"); |
$r->print("</form><p>Done</p>"); |
$r->print(&show_grading_menu_form($symb,$url)); |
$r->print(&show_grading_menu_form($symb,$url)); |
return ''; |
return ''; |
} |
} |
Line 4149 sub scantron_upload_scantron_data {
|
Line 4417 sub scantron_upload_scantron_data {
|
my ($r)=@_; |
my ($r)=@_; |
$r->print(&Apache::loncommon::coursebrowser_javascript($ENV{'request.role.domain'})); |
$r->print(&Apache::loncommon::coursebrowser_javascript($ENV{'request.role.domain'})); |
my $select_link=&Apache::loncommon::selectcourse_link('rules','courseid', |
my $select_link=&Apache::loncommon::selectcourse_link('rules','courseid', |
'domainid'); |
'domainid', |
|
'coursename'); |
my $domsel=&Apache::loncommon::select_dom_form($ENV{'request.role.domain'}, |
my $domsel=&Apache::loncommon::select_dom_form($ENV{'request.role.domain'}, |
'domainid'); |
'domainid'); |
my $default_form_data=&defaultFormData(&get_symb_and_url($r)); |
my $default_form_data=&defaultFormData(&get_symb_and_url($r,1)); |
$r->print(<<UPLOAD); |
$r->print(<<UPLOAD); |
<script type="text/javascript" language="javascript"> |
<script type="text/javascript" language="javascript"> |
function checkUpload(formname) { |
function checkUpload(formname) { |
Line 4166 sub scantron_upload_scantron_data {
|
Line 4435 sub scantron_upload_scantron_data {
|
|
|
<form enctype='multipart/form-data' action='/adm/grades' name='rules' method='post'> |
<form enctype='multipart/form-data' action='/adm/grades' name='rules' method='post'> |
$default_form_data |
$default_form_data |
Course: <input name='courseid' type='text' /> |
<table> |
Domain: $domsel $select_link |
<tr><td>$select_link </td></tr> |
<br /> |
<tr><td>Course ID: </td><td><input name='courseid' type='text' /> </td></tr> |
|
<tr><td>Course Name: </td><td><input name='coursename' type='text' /></td></tr> |
|
<tr><td>Domain: </td><td>$domsel </td></tr> |
|
<tr><td>File to upload:</td><td><input type="file" name="upfile" size="50" /></td></tr> |
|
</table> |
<input name='command' value='scantronupload_save' type='hidden' /> |
<input name='command' value='scantronupload_save' type='hidden' /> |
File to upload:<input type="file" name="upfile" size="50" /> |
|
<br /> |
|
<input type="button" onClick="javascript:checkUpload(this.form);" value="Upload Scantron Data" /> |
<input type="button" onClick="javascript:checkUpload(this.form);" value="Upload Scantron Data" /> |
</form> |
</form> |
UPLOAD |
UPLOAD |
Line 4180 UPLOAD
|
Line 4451 UPLOAD
|
|
|
sub scantron_upload_scantron_data_save { |
sub scantron_upload_scantron_data_save { |
my($r)=@_; |
my($r)=@_; |
|
my ($symb,$url)=&get_symb_and_url($r,1); |
|
my $doanotherupload= |
|
'<br /><form action="/adm/grades" method="post">'."\n". |
|
'<input type="hidden" name="command" value="scantronupload" />'."\n". |
|
'<input type="submit" name="submit" value="Do Another Upload" />'."\n". |
|
'</form>'."\n"; |
if (!&Apache::lonnet::allowed('usc',$ENV{'form.domainid'}) && |
if (!&Apache::lonnet::allowed('usc',$ENV{'form.domainid'}) && |
!&Apache::lonnet::allowed('usc', |
!&Apache::lonnet::allowed('usc', |
$ENV{'form.domainid'}.'_'.$ENV{'form.courseid'})) { |
$ENV{'form.domainid'}.'_'.$ENV{'form.courseid'})) { |
$r->print("You are not allowed to upload Scantron data to the requested course.<br />"); |
$r->print("You are not allowed to upload Scantron data to the requested course.<br />"); |
$r->print(&show_grading_menu_form(&get_symb_and_url($r))); |
if ($symb) { |
|
$r->print(&show_grading_menu_form($symb,$url)); |
|
} else { |
|
$r->print($doanotherupload); |
|
} |
return ''; |
return ''; |
} |
} |
$r->print("Doing upload to ".$ENV{'form.courseid'}." <br />"); |
$r->print("Doing upload to ".$ENV{'form.courseid'}." <br />"); |
Line 4205 sub scantron_upload_scantron_data_save {
|
Line 4486 sub scantron_upload_scantron_data_save {
|
# 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'; } |
$fname='scantron_orig_'.$fname; |
$fname='scantron_orig_'.$fname; |
$r->print(&Apache::lonnet::finishuserfileupload($ENV{'form.courseid'}, |
if (length($ENV{'form.upfile'}) < 2) { |
$ENV{'form.domainid'}, |
$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."); |
$home,'upfile',$fname)); |
} else { |
$r->print(&show_grading_menu_form(&get_symb_and_url($r))); |
my $result=&Apache::lonnet::finishuserfileupload($ENV{'form.courseid'},$ENV{'form.domainid'},$home,'upfile',$fname); |
|
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>"); |
|
} 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>"); |
|
} |
|
} |
|
if ($symb) { |
|
$r->print(&show_grading_menu_form($symb,$url)); |
|
} else { |
|
$r->print($doanotherupload); |
|
} |
return ''; |
return ''; |
} |
} |
|
|
Line 4315 GRADINGMENUJS
|
Line 4607 GRADINGMENUJS
|
|
|
$result.='<table width="100%" border=0>'; |
$result.='<table width="100%" border=0>'; |
$result.='<tr bgcolor="#ffffe6" valign="top"><td>'."\n". |
$result.='<tr bgcolor="#ffffe6" valign="top"><td>'."\n". |
' Select Section: <select name="section">'."\n"; |
' '.&mt('Select Section').': <select name="section">'."\n"; |
if (ref($sections)) { |
if (ref($sections)) { |
foreach (sort (@$sections)) { |
foreach (sort (@$sections)) { |
$result.='<option value="'.$_.'" '. |
$result.='<option value="'.$_.'" '. |
Line 4324 GRADINGMENUJS
|
Line 4616 GRADINGMENUJS
|
} |
} |
$result.= '<option value="all" '.($saveSec eq 'all' ? 'selected="on"' : ''). '>all</select> '; |
$result.= '<option value="all" '.($saveSec eq 'all' ? 'selected="on"' : ''). '>all</select> '; |
|
|
$result.='Student Status:</b>'.&Apache::lonhtmlcommon::StatusOptions($saveStatus,undef,1,undef); |
$result.=&mt('Student Status').':</b>'.&Apache::lonhtmlcommon::StatusOptions($saveStatus,undef,1,undef); |
|
|
if (ref($sections) && (grep /no/,@$sections)) { |
if (ref($sections) && (grep /no/,@$sections)) { |
$result.=' (Section "no" implies the students were not assigned a section.)<br />'; |
$result.=' (Section "no" implies the students were not assigned a section.)<br />'; |
Line 4333 GRADINGMENUJS
|
Line 4625 GRADINGMENUJS
|
|
|
$result.='<tr bgcolor="#ffffe6"valign="top"><td>'. |
$result.='<tr bgcolor="#ffffe6"valign="top"><td>'. |
'<input type="radio" name="radioChoice" value="submission" '. |
'<input type="radio" name="radioChoice" value="submission" '. |
($saveCmd eq 'submission' ? 'checked' : '').'> '.'<b>Current Resource:</b> For one or more students '. |
($saveCmd eq 'submission' ? 'checked' : '').'> '.'<b>'.&mt('Current Resource').':</b> '.&mt('For one or more students'). |
'<select name="submitonly">'. |
' <select name="submitonly">'. |
'<option value="yes" '. |
'<option value="yes" '. |
($saveSub eq 'yes' ? 'selected="on"' : '').'>with submissions</option>'. |
($saveSub eq 'yes' ? 'selected="on"' : '').'>with submissions</option>'. |
'<option value="graded" '. |
'<option value="graded" '. |
Line 4362 GRADINGMENUJS
|
Line 4654 GRADINGMENUJS
|
|
|
$result.='<table width="100%" border=0>'; |
$result.='<table width="100%" border=0>'; |
$result.='<tr bgcolor="#ffffe6"><td>'. |
$result.='<tr bgcolor="#ffffe6"><td>'. |
'<input type="button" onClick="javascript:checkChoice(this.form,\'3\',\'csvform\');" value="Upload" />'. |
'<input type="button" onClick="javascript:checkChoice(this.form,\'3\',\'csvform\');" value="'.&mt('Upload').'" />'. |
' scores from file </td></tr>'."\n"; |
' '.&mt('scores from file').' </td></tr>'."\n"; |
|
|
$result.='<tr bgcolor="#ffffe6"valign="top"><td colspan="2">'. |
$result.='<tr bgcolor="#ffffe6"valign="top"><td colspan="2">'. |
'<input type="button" onClick="javascript:checkChoice(this.form,\'4\',\'scantron_selectphase\');'. |
'<input type="button" onClick="javascript:checkChoice(this.form,\'4\',\'scantron_selectphase\');'. |
'" value="Grade" /> scantron forms</td></tr>'."\n"; |
'" value="'.&mt('Grade').'" /> scantron forms</td></tr>'."\n"; |
|
|
if ((&Apache::lonnet::allowed('mgr',$ENV{'request.course.id'})) && ($symb)) { |
if ((&Apache::lonnet::allowed('mgr',$ENV{'request.course.id'})) && ($symb)) { |
$result.='<tr bgcolor="#ffffe6"valign="top"><td>'. |
$result.='<tr bgcolor="#ffffe6"valign="top"><td>'. |
'<input type="button" onClick="javascript:checkChoice(this.form,\'5\',\'verify\');" value="Verify" />'. |
'<input type="button" onClick="javascript:checkChoice(this.form,\'5\',\'verify\');" value="'.&mt('Verify').'" />'. |
' submission Receipt no: '.unpack("%32C*",$Apache::lonnet::perlvar{'lonHostID'}). |
' '.&mt('receipt').': '. |
|
&Apache::lonnet::recprefix($ENV{'request.course.id'}). |
'-<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"; |
} |
} |