version 1.173, 2004/02/09 22:16:32
|
version 1.185, 2004/03/31 05:23:59
|
Line 511 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 526 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 550 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 1283 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 1692 KEYWORDS
|
Line 1704 KEYWORDS
|
($ENV{'form.command'} eq 'processGroup' && $counter == $total)) { |
($ENV{'form.command'} eq 'processGroup' && $counter == $total)) { |
$toGrade.='</form>'.&show_grading_menu_form($symb,$url) |
$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 3452 sub scantron_selectphase {
|
Line 3466 sub scantron_selectphase {
|
$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> |
<td> |
<!-- FIXME this is lazy, a single parse of the set should let me know what this is --> |
<!-- FIXME this is lazy, a single parse of the set should let me know what this is --> |
Last line to expect an answer on: |
Last line to expect an answer on: </td><td> |
<input type="text" name="scantron_maxbubble" /> |
<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 3500 SCANTRONFORM
|
Line 3508 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 3826 sub scantron_getfile {
|
Line 3857 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 3858 sub scantron_putfile {
|
Line 3889 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 3975 sub scantron_get_correction {
|
Line 4006 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 eq 'doublebubble') { |
} elsif ($error eq 'doublebubble') { |
Line 4173 sub scantron_upload_scantron_data {
|
Line 4204 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,1)); |
my $default_form_data=&defaultFormData(&get_symb_and_url($r,1)); |
Line 4190 sub scantron_upload_scantron_data {
|
Line 4222 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 4204 UPLOAD
|
Line 4238 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 4229 sub scantron_upload_scantron_data_save {
|
Line 4273 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('<br /><form action="/adm/grades" method="post">'."\n". |
my $result=&Apache::lonnet::finishuserfileupload($ENV{'form.courseid'},$ENV{'form.domainid'},$home,'upfile',$fname); |
'<input type="hidden" name="command" value="scantronupload" />'."\n". |
if ($result =~ m|^/uploaded/|) { |
'<input type="submit" name="submit" value="Do Another Upload" />'."\n". |
$r->print("<font color='green'>Success:</font> Successfully uploaded ".(length($ENV{'form.upfile'})-1)." bytes of data into location <tt>".$result."</tt>"); |
'</form>'."\n"); |
} 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 4389 GRADINGMENUJS
|
Line 4441 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"; |
} |
} |