version 1.168, 2003/12/05 19:40:56
|
version 1.180, 2004/03/12 18:03:38
|
Line 49 use Apache::loncoursedata;
|
Line 49 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 Apache::lonlocal; |
#use String::Similarity; |
use String::Similarity; |
|
|
my %oldessays=(); |
my %oldessays=(); |
my %perm=(); |
my %perm=(); |
Line 89 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 521 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 545 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 738 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 1275 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 1679 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 3443 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 3491 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 3817 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 3849 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 3966 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 4151 SCANTRONFORM
|
Line 4191 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 4167 sub scantron_upload_scantron_data {
|
Line 4207 sub scantron_upload_scantron_data {
|
'domainid'); |
'domainid'); |
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 4223 sub scantron_upload_scantron_data_save {
|
Line 4263 sub scantron_upload_scantron_data_save {
|
$r->print(&Apache::lonnet::finishuserfileupload($ENV{'form.courseid'}, |
$r->print(&Apache::lonnet::finishuserfileupload($ENV{'form.courseid'}, |
$ENV{'form.domainid'}, |
$ENV{'form.domainid'}, |
$home,'upfile',$fname)); |
$home,'upfile',$fname)); |
$r->print(&show_grading_menu_form(&get_symb_and_url($r))); |
my ($symb,$url)=&get_symb_and_url($r); |
|
if ($symb) { |
|
$r->print(&show_grading_menu_form(&get_symb_and_url($r))); |
|
} else { |
|
$r->print('<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"); |
|
} |
return ''; |
return ''; |
} |
} |
|
|