version 1.375, 2006/09/14 21:47:22
|
version 1.393, 2007/03/14 23:39:39
|
Line 39 use Apache::loncoursedata;
|
Line 39 use Apache::loncoursedata;
|
use Apache::lonmsg(); |
use Apache::lonmsg(); |
use Apache::Constants qw(:common); |
use Apache::Constants qw(:common); |
use Apache::lonlocal; |
use Apache::lonlocal; |
|
use Apache::lonenc; |
use String::Similarity; |
use String::Similarity; |
use lib '/home/httpd/lib/perl'; |
use lib '/home/httpd/lib/perl'; |
use LONCAPA; |
use LONCAPA; |
Line 112 sub nameUserString {
|
Line 113 sub nameUserString {
|
#--- Indicate if a response type is coded handgraded or not. --- |
#--- Indicate if a response type is coded handgraded or not. --- |
sub response_type { |
sub response_type { |
my ($symb) = shift; |
my ($symb) = shift; |
my (undef,undef,$url) = &Apache::lonnet::decode_symb($symb); |
|
my $allkeys = &Apache::lonnet::metadata($url,'keys'); |
my $navmap = Apache::lonnavmaps::navmap->new(); |
my %vPart; |
my $res = $navmap->getBySymb($symb); |
foreach my $partid (&Apache::loncommon::get_env_multiple('form.vPart')) { |
my $partlist = $res->parts(); |
$vPart{$partid}=1; |
my %vPart = |
} |
map { $_ => 1 } (&Apache::loncommon::get_env_multiple('form.vPart')); |
my %seen = (); |
my (%response_types,%handgrade); |
my (@partlist,%handgrade,%responseType); |
foreach my $part (@{ $partlist }) { |
foreach (split(/,/,&Apache::lonnet::metadata($url,'packages'))) { |
next if (%vPart && !exists($vPart{$part})); |
if (/^\w+response_.*/ || /^Task_/) { |
|
my ($responsetype,$part) = split(/_/,$_,2); |
my @types = $res->responseType($part); |
my ($partid,$respid) = split(/_/,$part,2); |
my @ids = $res->responseIds($part); |
if ($responsetype eq 'Task') { $respid='0'; } |
for (my $i=0; $i < scalar(@ids); $i++) { |
if (&Apache::loncommon::check_if_partid_hidden($partid,$symb)) { |
$response_types{$part}{$ids[$i]} = $types[$i]; |
next; |
$handgrade{$part.'_'.$ids[$i]} = |
} |
&Apache::lonnet::EXT('resource.'.$part.'_'.$ids[$i]. |
if (%vPart && !exists($vPart{$partid})) { |
'.handgrade',$symb); |
next; |
|
} |
|
$responsetype =~ s/response$//; # make it compatible w/ navmaps - should move to that!! |
|
my ($value) = &Apache::lonnet::EXT('resource.'.$part.'.handgrade',$symb); |
|
$handgrade{$part} = ($value eq 'yes' ? 'yes' : 'no'); |
|
if (!exists($responseType{$partid})) { $responseType{$partid}={}; } |
|
$responseType{$partid}->{$respid}=$responsetype; |
|
next if ($seen{$partid} > 0); |
|
$seen{$partid}++; |
|
push @partlist,$partid; |
|
} |
} |
} |
} |
return (\@partlist,\%handgrade,\%responseType); |
return ($partlist,\%handgrade,\%response_types); |
} |
} |
|
|
sub flatten_responseType { |
sub flatten_responseType { |
Line 602 sub verifyreceipt {
|
Line 593 sub verifyreceipt {
|
my $receipt = &Apache::lonnet::recprefix($courseid).'-'. |
my $receipt = &Apache::lonnet::recprefix($courseid).'-'. |
$env{'form.receipt'}; |
$env{'form.receipt'}; |
$receipt =~ s/[^\-\d]//g; |
$receipt =~ s/[^\-\d]//g; |
my $symb = &Apache::lonnet::symbread(); |
my ($symb) = &get_symb($request); |
|
|
my $title.='<h3><font color="#339933">Verifying Submission Receipt '. |
my $title.='<h3><font color="#339933">Verifying Submission Receipt '. |
$receipt.'</h3></font>'."\n". |
$receipt.'</h3></font>'."\n". |
Line 612 sub verifyreceipt {
|
Line 603 sub verifyreceipt {
|
my (undef,undef,$fullname) = &getclasslist('all','0'); |
my (undef,undef,$fullname) = &getclasslist('all','0'); |
|
|
my $receiptparts=0; |
my $receiptparts=0; |
if ($env{"course.$courseid.receiptalg"} eq 'receipt2') { $receiptparts=1; } |
if ($env{"course.$courseid.receiptalg"} eq 'receipt2' || |
|
$env{"course.$courseid.receiptalg"} eq 'receipt3') { $receiptparts=1; } |
my $parts=['0']; |
my $parts=['0']; |
if ($receiptparts) { ($parts)=&response_type($symb); } |
if ($receiptparts) { ($parts)=&response_type($symb); } |
foreach (sort |
foreach (sort |
Line 1483 sub get_increment {
|
Line 1475 sub get_increment {
|
#--- displays the grading box, used in essay type problem and grading by page/sequence |
#--- displays the grading box, used in essay type problem and grading by page/sequence |
sub gradeBox { |
sub gradeBox { |
my ($request,$symb,$uname,$udom,$counter,$partid,$record) = @_; |
my ($request,$symb,$uname,$udom,$counter,$partid,$record) = @_; |
my $checkIcon = '<img src="'.$request->dir_config('lonIconsURL'). |
my $checkIcon = '<img alt="'.&mt('Check Mark'). |
|
'" src="'.$request->dir_config('lonIconsURL'). |
'/check.gif" height="16" border="0" />'; |
'/check.gif" height="16" border="0" />'; |
my $wgt = &Apache::lonnet::EXT('resource.'.$partid.'.weight',$symb,$udom,$uname); |
my $wgt = &Apache::lonnet::EXT('resource.'.$partid.'.weight',$symb,$udom,$uname); |
my $wgtmsg = ($wgt > 0 ? '(problem weight)' : |
my $wgtmsg = ($wgt > 0 ? '(problem weight)' : |
Line 1506 sub gradeBox {
|
Line 1499 sub gradeBox {
|
my $increment = &get_increment(); |
my $increment = &get_increment(); |
$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 ($thisweight<=$wgt) { |
while ($thisweight<=$wgt) { |
$result.= '<td><nobr><label><input type="radio" name="RADVAL'.$counter.'_'.$partid.'" '. |
$result.= '<td><span style="white-space: nowrap;"><label><input type="radio" name="RADVAL'.$counter.'_'.$partid.'" '. |
'onclick="javascript:writeBox(this.form,\''.$counter.'_'.$partid.'\','. |
'onclick="javascript:writeBox(this.form,\''.$counter.'_'.$partid.'\','. |
$thisweight.')" value="'.$thisweight.'" '. |
$thisweight.')" value="'.$thisweight.'" '. |
($score eq $thisweight ? 'checked':'').' /> '.$thisweight."</label></nobr></td>\n"; |
($score eq $thisweight ? 'checked':'').' /> '.$thisweight."</label></span></td>\n"; |
$result.=(($ctr+1)%10 == 0 ? '</tr><tr>' : ''); |
$result.=(($ctr+1)%10 == 0 ? '</tr><tr>' : ''); |
$thisweight += $increment; |
$thisweight += $increment; |
$ctr++; |
$ctr++; |
Line 1526 sub gradeBox {
|
Line 1519 sub gradeBox {
|
$result.='<select name="GD_SEL'.$counter.'_'.$partid.'" '. |
$result.='<select name="GD_SEL'.$counter.'_'.$partid.'" '. |
'onChange="javascript:clearRadBox(this.form,\''.$counter.'_'.$partid.'\')" >'."\n"; |
'onChange="javascript:clearRadBox(this.form,\''.$counter.'_'.$partid.'\')" >'."\n"; |
if ($$record{'resource.'.$partid.'.solved'} eq 'excused') { |
if ($$record{'resource.'.$partid.'.solved'} eq 'excused') { |
$result.='<option> </option>'. |
$result.='<option></option>'. |
'<option selected="on">excused</option>'; |
'<option selected="on">excused</option>'; |
} else { |
} else { |
$result.='<option selected="on"> </option>'. |
$result.='<option selected="on"></option>'. |
'<option>excused</option>'; |
'<option>excused</option>'; |
} |
} |
$result.='<option>reset status</option></select>'."\n"; |
$result.='<option>reset status</option></select>'."\n"; |
$result.="  \n"; |
$result.=" \n"; |
$result.='<input type="hidden" name="stores'.$counter.'_'.$partid.'" value="" />'."\n". |
$result.='<input type="hidden" name="stores'.$counter.'_'.$partid.'" value="" />'."\n". |
'<input type="hidden" name="oldpts'.$counter.'_'.$partid.'" value="'.$score.'" />'."\n". |
'<input type="hidden" name="oldpts'.$counter.'_'.$partid.'" value="'.$score.'" />'."\n". |
'<input type="hidden" name="solved'.$counter.'_'.$partid.'" value="'. |
'<input type="hidden" name="solved'.$counter.'_'.$partid.'" value="'. |
Line 1583 sub handback_box {
|
Line 1576 sub handback_box {
|
} |
} |
|
|
sub show_problem { |
sub show_problem { |
my ($request,$symb,$uname,$udom,$removeform,$viewon,$mode) = @_; |
my ($request,$symb,$uname,$udom,$removeform,$viewon,$mode,$form) = @_; |
my $rendered; |
my $rendered; |
|
my %form = ((ref($form) eq 'HASH')? %{$form} : ()); |
&Apache::lonxml::remember_problem_counter(); |
&Apache::lonxml::remember_problem_counter(); |
if ($mode eq 'both' or $mode eq 'text') { |
if ($mode eq 'both' or $mode eq 'text') { |
$rendered=&Apache::loncommon::get_student_view($symb,$uname,$udom, |
$rendered=&Apache::loncommon::get_student_view($symb,$uname,$udom, |
$env{'request.course.id'}); |
$env{'request.course.id'}, |
|
undef,\%form); |
} |
} |
if ($removeform) { |
if ($removeform) { |
$rendered=~s|<form(.*?)>||g; |
$rendered=~s|<form(.*?)>||g; |
Line 1598 sub show_problem {
|
Line 1593 sub show_problem {
|
my $companswer; |
my $companswer; |
if ($mode eq 'both' or $mode eq 'answer') { |
if ($mode eq 'both' or $mode eq 'answer') { |
&Apache::lonxml::restore_problem_counter(); |
&Apache::lonxml::restore_problem_counter(); |
$companswer=&Apache::loncommon::get_student_answers($symb,$uname,$udom, |
$companswer= |
$env{'request.course.id'}); |
&Apache::loncommon::get_student_answers($symb,$uname,$udom, |
|
$env{'request.course.id'}, |
|
%form); |
} |
} |
if ($removeform) { |
if ($removeform) { |
$companswer=~s|<form(.*?)>||g; |
$companswer=~s|<form(.*?)>||g; |
Line 1654 sub submission {
|
Line 1651 sub submission {
|
if (!$env{'form.vProb'}) { $env{'form.vProb'} = 'yes'; } |
if (!$env{'form.vProb'}) { $env{'form.vProb'} = 'yes'; } |
if (!$env{'form.vAns'}) { $env{'form.vAns'} = 'yes'; } |
if (!$env{'form.vAns'}) { $env{'form.vAns'} = 'yes'; } |
my $last = ($env{'form.lastSub'} eq 'last' ? 'last' : ''); |
my $last = ($env{'form.lastSub'} eq 'last' ? 'last' : ''); |
my $checkIcon = '<img src="'.$request->dir_config('lonIconsURL'). |
my $checkIcon = '<img alt="'.&mt('Check Mark'). |
|
'" src="'.$request->dir_config('lonIconsURL'). |
'/check.gif" height="16" border="0" />'; |
'/check.gif" height="16" border="0" />'; |
|
|
# header info |
# header info |
Line 1766 KEYWORDS
|
Line 1764 KEYWORDS
|
# Load the other essays for similarity check |
# Load the other essays for similarity check |
# |
# |
my (undef,undef,$essayurl) = &Apache::lonnet::decode_symb($symb); |
my (undef,undef,$essayurl) = &Apache::lonnet::decode_symb($symb); |
my ($adom,$aname,$apath)=($essayurl=~/^(\w+)\/(\w+)\/(.*)$/); |
my ($adom,$aname,$apath)=($essayurl=~/^($LONCAPA::domain_re)\/($LONCAPA::username_re)\/(.*)$/); |
$apath=&escape($apath); |
$apath=&escape($apath); |
$apath=~s/\W/\_/gs; |
$apath=~s/\W/\_/gs; |
%oldessays=&Apache::lonnet::dump('nohist_essay_'.$apath,$adom,$aname); |
%oldessays=&Apache::lonnet::dump('nohist_essay_'.$apath,$adom,$aname); |
Line 1874 KEYWORDS
|
Line 1872 KEYWORDS
|
my %seenparts; |
my %seenparts; |
my @part_response_id = &flatten_responseType($responseType); |
my @part_response_id = &flatten_responseType($responseType); |
foreach my $part (@part_response_id) { |
foreach my $part (@part_response_id) { |
|
next if ($env{'form.lastSub'} eq 'hdgrade' |
|
&& $$handgrade{$$part[0].'_'.$$part[1]} ne 'yes'); |
|
|
my ($partid,$respid) = @{ $part }; |
my ($partid,$respid) = @{ $part }; |
my $display_part=&get_display_part($partid,$symb); |
my $display_part=&get_display_part($partid,$symb); |
if ($env{"form.$uname:$udom:$partid:submitted_by"}) { |
if ($env{"form.$uname:$udom:$partid:submitted_by"}) { |
Line 1918 KEYWORDS
|
Line 1919 KEYWORDS
|
my $order=&get_order($partid,$respid,$symb,$uname,$udom); |
my $order=&get_order($partid,$respid,$symb,$uname,$udom); |
if ($env{'form.lastSub'} eq 'lastonly' || |
if ($env{'form.lastSub'} eq 'lastonly' || |
($env{'form.lastSub'} eq 'hdgrade' && |
($env{'form.lastSub'} eq 'hdgrade' && |
$$handgrade{$part} eq 'yes')) { |
$$handgrade{$$part[0].'_'.$$part[1]} eq 'yes')) { |
my $display_part=&get_display_part($partid,$symb); |
my $display_part=&get_display_part($partid,$symb); |
$lastsubonly.='<tr><td bgcolor="#ffffe6"><b>Part:</b> '. |
$lastsubonly.='<tr><td bgcolor="#ffffe6">Debug -'.'<b>Part:</b> '. |
$display_part.' <font color="#999999">( ID '.$respid. |
$display_part.' <font color="#999999">( hhhh ID '.$respid. |
' )</font> '; |
' )</font> '; |
my $files=&get_submitted_files($udom,$uname,$partid,$respid,\%record); |
my $files=&get_submitted_files($udom,$uname,$partid,$respid,\%record); |
if (@$files) { |
if (@$files) { |
Line 2014 KEYWORDS
|
Line 2015 KEYWORDS
|
my $part_resp = join('_',@{ $part_response_id }); |
my $part_resp = join('_',@{ $part_response_id }); |
next if ($seen{$partid} > 0); |
next if ($seen{$partid} > 0); |
$seen{$partid}++; |
$seen{$partid}++; |
next if ($$handgrade{$part_resp} =~ /:no$/ && $env{'form.lastSub'} =~ /^(hdgrade)$/); |
next if ($$handgrade{$part_resp} ne 'yes' |
|
&& $env{'form.lastSub'} eq 'hdgrade'); |
push @partlist,$partid; |
push @partlist,$partid; |
push @gradePartRespid,$partid.'.'.$respid; |
push @gradePartRespid,$partid.'.'.$respid; |
$request->print(&gradeBox($request,$symb,$uname,$udom,$counter,$partid,\%record)); |
$request->print(&gradeBox($request,$symb,$uname,$udom,$counter,$partid,\%record)); |
Line 2124 sub processHandGrade {
|
Line 2126 sub processHandGrade {
|
} |
} |
my $includemsg = $env{'form.includemsg'.$ctr}; |
my $includemsg = $env{'form.includemsg'.$ctr}; |
my ($subject,$message,$msgstatus) = ('','',''); |
my ($subject,$message,$msgstatus) = ('','',''); |
|
my $restitle = &Apache::lonnet::gettitle($symb); |
|
my $encrypturl=&Apache::lonnet::EXT('resource.0.encrypturl', |
|
$symb,$udom,$uname); |
|
my ($feedurl,$baseurl,$showsymb,$messagetail); |
|
$feedurl = &Apache::lonnet::clutter($url); |
|
if ($encrypturl =~ /^yes$/i) { |
|
$baseurl = &Apache::lonenc::encrypted($feedurl,1); |
|
$showsymb = &Apache::lonenc::encrypted($symb,1); |
|
} else { |
|
$baseurl = $feedurl; |
|
$showsymb = $symb; |
|
} |
if ($includemsg =~ /savemsg|newmsg\Q$ctr\E/) { |
if ($includemsg =~ /savemsg|newmsg\Q$ctr\E/) { |
$subject = $env{'form.msgsub'} if ($includemsg =~ /msgsub/); |
$subject = $env{'form.msgsub'} if ($includemsg =~ /msgsub/); |
unless ($subject=~/\w/) { $subject=&mt('Grading Feedback'); } |
unless ($subject=~/\w/) { $subject=&mt('Grading Feedback'); } |
$subject.=' ['.&Apache::lonnet::declutter($url).']'; |
$subject.=' ['.$restitle.']'; |
my (@msgnum) = split(/,/,$includemsg); |
my (@msgnum) = split(/,/,$includemsg); |
foreach (@msgnum) { |
foreach (@msgnum) { |
$message.=$env{'form.'.$_} if ($_ =~ /savemsg|newmsg/ && $_ ne ''); |
$message.=$env{'form.'.$_} if ($_ =~ /savemsg|newmsg/ && $_ ne ''); |
Line 2135 sub processHandGrade {
|
Line 2149 sub processHandGrade {
|
$message =&Apache::lonfeedback::clear_out_html($message); |
$message =&Apache::lonfeedback::clear_out_html($message); |
if ($env{'form.withgrades'.$ctr}) { |
if ($env{'form.withgrades'.$ctr}) { |
$message.="\n\nPoint".($pts > 1 ? 's':'').' awarded = '.$pts.' out of '.$wgt; |
$message.="\n\nPoint".($pts > 1 ? 's':'').' awarded = '.$pts.' out of '.$wgt; |
$message.=" for <a href=\"". |
$messagetail = " for <a href=\"". |
&Apache::lonnet::clutter($url). |
$baseurl."?symb=$showsymb\">$env{'form.probTitle'}</a>"; |
"?symb=$symb\">$env{'form.probTitle'}</a>"; |
} |
} |
$msgstatus = |
$msgstatus = &Apache::lonmsg::user_normal_msg($uname,$udom, |
&Apache::lonmsg::user_normal_msg($uname,$udom,$subject, |
$subject, |
$message.$messagetail, |
$message); |
undef,$baseurl,undef, |
$request->print('<br />'.&mt('Sending message to [_1]@[_2]',$uname,$udom).': '. |
undef,undef,$showsymb, |
|
$restitle); |
|
$request->print('<br />'.&mt('Sending message to [_1]:[_2]',$uname,$udom).': '. |
$msgstatus); |
$msgstatus); |
} |
} |
if ($env{'form.collaborator'.$ctr}) { |
if ($env{'form.collaborator'.$ctr}) { |
Line 2158 sub processHandGrade {
|
Line 2174 sub processHandGrade {
|
next; |
next; |
} else { |
} else { |
if ($message ne '') { |
if ($message ne '') { |
$msgstatus = &Apache::lonmsg::user_normal_msg($collaborator,$udom,$subject,$message); |
$encrypturl= |
|
&Apache::lonnet::EXT('resource.0.encrypturl', |
|
$symb,$udom,$collaborator); |
|
if ($encrypturl =~ /^yes$/i) { |
|
$baseurl = &Apache::lonenc::encrypted($feedurl,1); |
|
$showsymb = &Apache::lonenc::encrypted($symb,1); |
|
} else { |
|
$baseurl = $feedurl; |
|
$showsymb = $symb; |
|
} |
|
if ($env{'form.withgrades'.$ctr}) { |
|
$messagetail = " for <a href=\"". |
|
$baseurl."?symb=$showsymb\">$env{'form.probTitle'}</a>"; |
|
|
|
} |
|
$msgstatus = |
|
&Apache::lonmsg::user_normal_msg($collaborator,$udom,$subject,$message.$messagetail,undef,$baseurl,undef,undef,undef,$showsymb,$restitle); |
} |
} |
} |
} |
} |
} |
Line 2434 sub saveHandGrade {
|
Line 2466 sub saveHandGrade {
|
} |
} |
&Apache::lonnet::cstore(\%newrecord,$symb, |
&Apache::lonnet::cstore(\%newrecord,$symb, |
$env{'request.course.id'},$domain,$stuname); |
$env{'request.course.id'},$domain,$stuname); |
my @ungraded_parts; |
&check_and_remove_from_queue(\@parts,\%record,\%newrecord,$symb, |
foreach my $part (@parts) { |
$cdom,$cnum,$domain,$stuname); |
if ( !defined($record{'resource.'.$part.'.awarded'}) |
|
&& !defined($newrecord{'resource.'.$part.'.awarded'}) ) { |
|
push(@ungraded_parts, $part); |
|
} |
|
} |
|
if ( !@ungraded_parts ) { |
|
&Apache::bridgetask::remove_from_queue('gradingqueue',$symb,$cdom, |
|
$cnum,$domain,$stuname); |
|
} |
|
} |
} |
if ($aggregateflag) { |
if ($aggregateflag) { |
&Apache::lonnet::cinc('nohist_resourcetracker',\%aggregate, |
&Apache::lonnet::cinc('nohist_resourcetracker',\%aggregate, |
Line 2453 sub saveHandGrade {
|
Line 2476 sub saveHandGrade {
|
return ('',$pts,$wgt); |
return ('',$pts,$wgt); |
} |
} |
|
|
|
sub check_and_remove_from_queue { |
|
my ($parts,$record,$newrecord,$symb,$cdom,$cnum,$domain,$stuname) = @_; |
|
my @ungraded_parts; |
|
foreach my $part (@{$parts}) { |
|
if ( $record->{ 'resource.'.$part.'.awarded'} eq '' |
|
&& $record->{ 'resource.'.$part.'.solved' } ne 'excused' |
|
&& $newrecord->{'resource.'.$part.'.awarded'} eq '' |
|
&& $newrecord->{'resource.'.$part.'.solved' } ne 'excused' |
|
) { |
|
push(@ungraded_parts, $part); |
|
} |
|
} |
|
if ( !@ungraded_parts ) { |
|
&Apache::bridgetask::remove_from_queue('gradingqueue',$symb,$cdom, |
|
$cnum,$domain,$stuname); |
|
} |
|
} |
|
|
sub handback_files { |
sub handback_files { |
my ($request,$symb,$stuname,$domain,$newflg,$new_part,$newrecord) = @_; |
my ($request,$symb,$stuname,$domain,$newflg,$new_part,$newrecord) = @_; |
my $portfolio_root = &propath($domain,$stuname).'/userfiles/portfolio'; |
my $portfolio_root = &propath($domain,$stuname).'/userfiles/portfolio'; |
Line 2505 sub handback_files {
|
Line 2546 sub handback_files {
|
$message .= ' The returned file(s) are named: '. $file_msg; |
$message .= ' The returned file(s) are named: '. $file_msg; |
$message .= " and can be found in your portfolio space."; |
$message .= " and can be found in your portfolio space."; |
my $url = (&Apache::lonnet::decode_symb($symb))[2]; |
my $url = (&Apache::lonnet::decode_symb($symb))[2]; |
$url = &Apache::lonnet::declutter($url); |
my $feedurl = &Apache::lonnet::clutter($url); |
my $msgstatus = &Apache::lonmsg::user_normal_msg($stuname,$domain, |
my $encrypturl=&Apache::lonnet::EXT('resource.0.encrypturl', |
$subject.' (File Returned) ['.$url.']',$message); |
$symb,$domain,$stuname); |
|
my ($baseurl,$showsymb); |
|
if ($encrypturl =~ /^yes$/i) { |
|
$baseurl = &Apache::lonenc::encrypted($feedurl,1); |
|
$showsymb = &Apache::lonenc::encrypted($symb,1); |
|
} else { |
|
$baseurl = $feedurl; |
|
$showsymb = $symb; |
|
} |
|
my $restitle = &Apache::lonnet::gettitle($symb); |
|
my $msgstatus = |
|
&Apache::lonmsg::user_normal_msg($stuname,$domain,$subject. |
|
' (File Returned) ['.$restitle.']',$message,undef, |
|
$baseurl,undef,undef,undef,$showsymb,$restitle); |
} |
} |
} |
} |
return; |
return; |
Line 2940 sub viewgrades {
|
Line 2993 sub viewgrades {
|
} |
} |
$result.='</table>'.'</td></tr></table>'.'</td></tr></table>'."\n". |
$result.='</table>'.'</td></tr></table>'.'</td></tr></table>'."\n". |
'<input type="hidden" name="totalparts" value="'.$ctsparts.'" />'; |
'<input type="hidden" name="totalparts" value="'.$ctsparts.'" />'; |
$result.='<input type="button" value="Reset" '. |
$result.='<input type="button" value="Revert to Default" '. |
'onClick="javascript:resetEntry('.$ctsparts.');" TARGET=_self>'; |
'onClick="javascript:resetEntry('.$ctsparts.');" TARGET=_self>'; |
|
|
#table listing all the students in a section/class |
#table listing all the students in a section/class |
Line 3781 LISTJAVASCRIPT
|
Line 3834 LISTJAVASCRIPT
|
'<input type="hidden" name="symb" value="'.$symb.'" />'."\n". |
'<input type="hidden" name="symb" value="'.$symb.'" />'."\n". |
'<input type="hidden" name="saveState" value="'.$env{'form.saveState'}.'" />'."<br />\n"; |
'<input type="hidden" name="saveState" value="'.$env{'form.saveState'}.'" />'."<br />\n"; |
|
|
|
$result.=' <b>'.&mt('Use CODE:').' </b>'. |
|
'<input type="text" name="CODE" value="" /><br />'."\n"; |
|
|
$result.=' <input type="button" '. |
$result.=' <input type="button" '. |
'onClick="javascript:checkPickOne(this.form);"value="Next->" /><br />'."\n"; |
'onClick="javascript:checkPickOne(this.form);"value="Next->" /><br />'."\n"; |
|
|
Line 3811 LISTJAVASCRIPT
|
Line 3867 LISTJAVASCRIPT
|
$studentTable.=($ptr%2 == 0 ? '</td></tr>' : ''); |
$studentTable.=($ptr%2 == 0 ? '</td></tr>' : ''); |
$ptr++; |
$ptr++; |
} |
} |
$studentTable.='</td><td> </td><td> ' if ($ptr%2 == 0); |
$studentTable.='</td><td> </td><td> </td></tr>' if ($ptr%2 == 0); |
$studentTable.='</td></tr></table></td></tr></table>'."\n"; |
$studentTable.='</table></td></tr></table>'."\n"; |
$studentTable.='<input type="button" '. |
$studentTable.='<input type="button" '. |
'onClick="javascript:checkPickOne(this.form);"value="Next->" /></form>'."\n"; |
'onClick="javascript:checkPickOne(this.form);"value="Next->" /></form>'."\n"; |
|
|
Line 3835 sub getSymbMap {
|
Line 3891 sub getSymbMap {
|
1,0,1); |
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.'.'. |
push @titles, $title; # minder in case two titles are identical |
&HTML::Entities::encode($sequence->compTitle(),'"\'&'); |
$symbx{$title} = $sequence->symb(); |
push(@titles, $title); # minder in case two titles are identical |
|
$symbx{$title} = &HTML::Entities::encode($sequence->symb(),'"\'&'); |
$minder++; |
$minder++; |
} |
} |
} |
} |
Line 3873 sub displayPage {
|
Line 3930 sub displayPage {
|
my $result='<h3><font color="#339933"> '.$env{'form.title'}.'</font></h3>'; |
my $result='<h3><font color="#339933"> '.$env{'form.title'}.'</font></h3>'; |
$result.='<h3> Student: '.&nameUserString(undef,$$fullname{$env{'form.student'}},$uname,$udom). |
$result.='<h3> Student: '.&nameUserString(undef,$$fullname{$env{'form.student'}},$uname,$udom). |
'</h3>'."\n"; |
'</h3>'."\n"; |
|
if (&Apache::lonnet::validCODE($env{'form.CODE'})) { |
|
$result.='<h3> CODE: '.$env{'form.CODE'}.'</h3>'."\n"; |
|
} else { |
|
delete($env{'form.CODE'}); |
|
} |
&sub_page_js($request); |
&sub_page_js($request); |
$request->print($result); |
$request->print($result); |
|
|
Line 3897 sub displayPage {
|
Line 3959 sub displayPage {
|
'<input type="hidden" name="overRideScore" value="no" />'."\n". |
'<input type="hidden" name="overRideScore" value="no" />'."\n". |
'<input type="hidden" name="saveState" value="'.$env{'form.saveState'}.'" />'."\n"; |
'<input type="hidden" name="saveState" value="'.$env{'form.saveState'}.'" />'."\n"; |
|
|
my $checkIcon = '<img src="'.$request->dir_config('lonIconsURL'). |
if (defined($env{'form.CODE'})) { |
|
$studentTable.= |
|
'<input type="hidden" name="CODE" value="'.$env{'form.CODE'}.'" />'."\n"; |
|
} |
|
my $checkIcon = '<img alt="'.&mt('Check Mark'). |
|
'" src="'.$request->dir_config('lonIconsURL'). |
'/check.gif" height="16" border="0" />'; |
'/check.gif" height="16" border="0" />'; |
|
|
$studentTable.=' <b>Note:</b> Problems graded correct by the computer are marked with a '.$checkIcon. |
$studentTable.=' <b>Note:</b> Problems graded correct by the computer are marked with a '.$checkIcon. |
Line 3915 sub displayPage {
|
Line 3982 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() && !$curRes->randomout) { |
if (ref($curRes) && $curRes->is_problem()) { |
my $parts = $curRes->parts(); |
my $parts = $curRes->parts(); |
my $title = $curRes->compTitle(); |
my $title = $curRes->compTitle(); |
my $symbx = $curRes->symb(); |
my $symbx = $curRes->symb(); |
$studentTable.='<tr bgcolor="#ffffe6"><td align="center" valign="top" >'.$prob. |
$studentTable.='<tr bgcolor="#ffffe6"><td align="center" valign="top" >'.$prob. |
(scalar(@{$parts}) == 1 ? '' : '<br />('.scalar(@{$parts}).' parts)').'</td>'; |
(scalar(@{$parts}) == 1 ? '' : '<br />('.scalar(@{$parts}).' parts)').'</td>'; |
$studentTable.='<td valign="top">'; |
$studentTable.='<td valign="top">'; |
|
my %form = ('CODE' => $env{'form.CODE'},); |
if ($env{'form.vProb'} eq 'yes' ) { |
if ($env{'form.vProb'} eq 'yes' ) { |
$studentTable.=&show_problem($request,$symbx,$uname,$udom,1, |
$studentTable.=&show_problem($request,$symbx,$uname,$udom,1, |
undef,'both'); |
undef,'both',\%form); |
} else { |
} else { |
my $companswer = &Apache::loncommon::get_student_answers($symbx,$uname,$udom,$env{'request.course.id'}); |
my $companswer = &Apache::loncommon::get_student_answers($symbx,$uname,$udom,$env{'request.course.id'},%form); |
$companswer =~ s|<form(.*?)>||g; |
$companswer =~ s|<form(.*?)>||g; |
$companswer =~ s|</form>||g; |
$companswer =~ s|</form>||g; |
# while ($companswer =~ /(<a href\=\"javascript:newWindow.*?Script Vars<\/a>)/s) { #<a href="javascript:newWindow</a> |
# while ($companswer =~ /(<a href\=\"javascript:newWindow.*?Script Vars<\/a>)/s) { #<a href="javascript:newWindow</a> |
Line 3977 sub displayPage {
|
Line 4045 sub displayPage {
|
$curRes = $iterator->next(); |
$curRes = $iterator->next(); |
} |
} |
|
|
$studentTable.='</td></tr></table></td></tr></table>'."\n". |
$studentTable.='</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.');" />'. |
'</form>'."\n"; |
'</form>'."\n"; |
$studentTable.=&show_grading_menu_form($symb); |
$studentTable.=&show_grading_menu_form($symb); |
$request->print($studentTable); |
$request->print($studentTable); |
Line 4139 sub updateGradeByPage {
|
Line 4207 sub updateGradeByPage {
|
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() && !$curRes->randomout) { |
if (ref($curRes) && $curRes->is_problem()) { |
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 4194 sub updateGradeByPage {
|
Line 4262 sub updateGradeByPage {
|
$displayPts[1].=' <b>Part:</b> '.$display_part.' = '. |
$displayPts[1].=' <b>Part:</b> '.$display_part.' = '. |
(($score eq 'excused') ? 'excused' : $newpts). |
(($score eq 'excused') ? 'excused' : $newpts). |
' <br />'; |
' <br />'; |
|
|
$question++; |
$question++; |
next if ($dropMenu eq 'reset status' || ($newpts == $oldpts && $score ne 'excused')); |
next if ($dropMenu eq 'reset status' || ($newpts eq $oldpts && $score ne 'excused')); |
|
|
$newrecord{'resource.'.$partid.'.awarded'} = $partial if $partial ne ''; |
$newrecord{'resource.'.$partid.'.awarded'} = $partial if $partial ne ''; |
$newrecord{'resource.'.$partid.'.solved'} = $score if $score ne ''; |
$newrecord{'resource.'.$partid.'.solved'} = $score if $score ne ''; |
Line 4206 sub updateGradeByPage {
|
Line 4273 sub updateGradeByPage {
|
$changeflag++; |
$changeflag++; |
} |
} |
if (scalar(keys(%newrecord)) > 0) { |
if (scalar(keys(%newrecord)) > 0) { |
|
my %record = |
|
&Apache::lonnet::restore($symbx,$env{'request.course.id'}, |
|
$udom,$uname); |
|
|
|
if (&Apache::lonnet::validCODE($env{'form.CODE'})) { |
|
$newrecord{'resource.CODE'} = $env{'form.CODE'}; |
|
} elsif (&Apache::lonnet::validCODE($record{'resource.CODE'})) { |
|
$newrecord{'resource.CODE'} = ''; |
|
} |
&Apache::lonnet::cstore(\%newrecord,$symbx,$env{'request.course.id'}, |
&Apache::lonnet::cstore(\%newrecord,$symbx,$env{'request.course.id'}, |
$udom,$uname); |
$udom,$uname); |
|
%record = &Apache::lonnet::restore($symbx, |
|
$env{'request.course.id'}, |
|
$udom,$uname); |
|
&check_and_remove_from_queue($parts,\%record,undef,$symbx, |
|
$cdom,$cnum,$udom,$uname); |
} |
} |
|
|
if ($aggregateflag) { |
if ($aggregateflag) { |
&Apache::lonnet::cinc('nohist_resourcetracker',\%aggregate, |
&Apache::lonnet::cinc('nohist_resourcetracker',\%aggregate, |
$env{'course.'.$env{'request.course.id'}.'.domain'}, |
$env{'course.'.$env{'request.course.id'}.'.domain'}, |
Line 4322 sub scantron_CODElist {
|
Line 4404 sub scantron_CODElist {
|
} |
} |
|
|
sub scantron_CODEunique { |
sub scantron_CODEunique { |
my $result='<nobr> |
my $result='<span style="white-space: nowrap;"> |
<label><input type="radio" name="scantron_CODEunique" |
<label><input type="radio" name="scantron_CODEunique" |
value="yes" checked="checked" /> Yes </label> |
value="yes" checked="checked" /> Yes </label> |
</nobr> |
</span> |
<nobr> |
<span style="white-space: nowrap;"> |
<label><input type="radio" name="scantron_CODEunique" |
<label><input type="radio" name="scantron_CODEunique" |
value="no" /> No </label> |
value="no" /> No </label> |
</nobr>'; |
</span>'; |
return $result; |
return $result; |
} |
} |
|
|
Line 4448 SCANTRONFORM
|
Line 4530 SCANTRONFORM
|
<tr> |
<tr> |
<form action='/adm/grades' name='scantron_download'> |
<form action='/adm/grades' name='scantron_download'> |
<td bgcolor="#777777"> |
<td bgcolor="#777777"> |
|
$default_form_data |
<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 4564 sub scantron_fixup_scanline {
|
Line 4647 sub scantron_fixup_scanline {
|
$answer=$alphabet[$args->{'response'}]; |
$answer=$alphabet[$args->{'response'}]; |
} elsif ($on eq 'number') { |
} elsif ($on eq 'number') { |
$answer=$args->{'response'}+1; |
$answer=$args->{'response'}+1; |
|
if ($answer == 10) { $answer = '0'; } |
} else { |
} else { |
substr($answer,$args->{'response'},1)=$on; |
substr($answer,$args->{'response'},1)=$on; |
} |
} |
Line 4634 sub scantron_parse_scanline {
|
Line 4718 sub scantron_parse_scanline {
|
|| $currentquest eq '*') { |
|| $currentquest eq '*') { |
push(@{$record{'scantron.doubleerror'}},$questnum); |
push(@{$record{'scantron.doubleerror'}},$questnum); |
$record{"scantron.$questnum.answer"}=''; |
$record{"scantron.$questnum.answer"}=''; |
} elsif (!$currentquest |
} elsif (!defined($currentquest) |
|| $currentquest eq $$scantron_config{'Qoff'} |
|| $currentquest eq $$scantron_config{'Qoff'} |
|| $currentquest !~ /^[A-Z]$/) { |
|| $currentquest !~ /^[A-Z]$/) { |
$record{"scantron.$questnum.answer"}=''; |
$record{"scantron.$questnum.answer"}=''; |
Line 4649 sub scantron_parse_scanline {
|
Line 4733 sub scantron_parse_scanline {
|
|| $currentquest eq '*') { |
|| $currentquest eq '*') { |
push(@{$record{'scantron.doubleerror'}},$questnum); |
push(@{$record{'scantron.doubleerror'}},$questnum); |
$record{"scantron.$questnum.answer"}=''; |
$record{"scantron.$questnum.answer"}=''; |
} elsif (!$currentquest |
} elsif (!defined($currentquest) |
|| $currentquest eq $$scantron_config{'Qoff'} |
|| $currentquest eq $$scantron_config{'Qoff'} |
|| $currentquest !~ /^\d$/) { |
|| $currentquest !~ /^\d$/) { |
$record{"scantron.$questnum.answer"}=''; |
$record{"scantron.$questnum.answer"}=''; |
if (!&scan_data($scan_data,"$whichline.no_bubble.$questnum")) { |
if (!&scan_data($scan_data,"$whichline.no_bubble.$questnum")) { |
push(@{$record{"scantron.missingerror"}},$questnum); |
push(@{$record{"scantron.missingerror"}},$questnum); |
Line 4794 sub reset_skipping_status {
|
Line 4878 sub reset_skipping_status {
|
&scantron_putfile(undef,$scan_data); |
&scantron_putfile(undef,$scan_data); |
} |
} |
|
|
sub allow_skipping { |
sub start_skipping { |
my ($scan_data,$i)=@_; |
my ($scan_data,$i)=@_; |
my %remembered=split(':',&scan_data($scan_data,'remember_skipping')); |
my %remembered=split(':',&scan_data($scan_data,'remember_skipping')); |
delete($remembered{$i}); |
if ($env{'form.scantron_options_redo'} =~ /^redo_/) { |
|
$remembered{$i}=2; |
|
} else { |
|
$remembered{$i}=1; |
|
} |
&scan_data($scan_data,'remember_skipping',join(':',%remembered)); |
&scan_data($scan_data,'remember_skipping',join(':',%remembered)); |
} |
} |
|
|
sub should_be_skipped { |
sub should_be_skipped { |
my ($scan_data,$i)=@_; |
my ($scanlines,$scan_data,$i)=@_; |
if ($env{'form.scantron_options_redo'} !~ /^redo_/) { |
if ($env{'form.scantron_options_redo'} !~ /^redo_/) { |
# not redoing old skips |
# not redoing old skips |
|
if ($scanlines->{'skipped'}[$i]) { return 1; } |
return 0; |
return 0; |
} |
} |
my %remembered=split(':',&scan_data($scan_data,'remember_skipping')); |
my %remembered=split(':',&scan_data($scan_data,'remember_skipping')); |
if (exists($remembered{$i})) { return 0; } |
|
|
if (exists($remembered{$i}) && $remembered{$i} != 2 ) { |
|
return 0; |
|
} |
return 1; |
return 1; |
} |
} |
|
|
Line 4820 sub remember_current_skipped {
|
Line 4912 sub remember_current_skipped {
|
$to_remember{$i}=1; |
$to_remember{$i}=1; |
} |
} |
} |
} |
|
|
&scan_data($scan_data,'remember_skipping',join(':',%to_remember)); |
&scan_data($scan_data,'remember_skipping',join(':',%to_remember)); |
&scantron_putfile(undef,$scan_data); |
&scantron_putfile(undef,$scan_data); |
} |
} |
Line 4925 sub scantron_validate_file {
|
Line 5018 sub scantron_validate_file {
|
} |
} |
if ($env{'form.scantron_options_redo'} eq 'redo_skipped') { |
if ($env{'form.scantron_options_redo'} eq 'redo_skipped') { |
&remember_current_skipped(); |
&remember_current_skipped(); |
&scantron_remove_file('skipped'); |
|
$env{'form.scantron_options_redo'}='redo_skipped_ready'; |
$env{'form.scantron_options_redo'}='redo_skipped_ready'; |
} |
} |
|
|
Line 5095 sub scantron_putfile {
|
Line 5187 sub scantron_putfile {
|
|
|
sub scantron_get_line { |
sub scantron_get_line { |
my ($scanlines,$scan_data,$i)=@_; |
my ($scanlines,$scan_data,$i)=@_; |
if (&should_be_skipped($scan_data,$i)) { return undef; } |
if (&should_be_skipped($scanlines,$scan_data,$i)) { return undef; } |
if ($scanlines->{'skipped'}[$i]) { return undef; } |
#if ($scanlines->{'skipped'}[$i]) { return undef; } |
if ($scanlines->{'corrected'}[$i]) {return $scanlines->{'corrected'}[$i];} |
if ($scanlines->{'corrected'}[$i]) {return $scanlines->{'corrected'}[$i];} |
return $scanlines->{'orig'}[$i]; |
return $scanlines->{'orig'}[$i]; |
} |
} |
Line 5116 sub scantron_put_line {
|
Line 5208 sub scantron_put_line {
|
my ($scanlines,$scan_data,$i,$newline,$skip)=@_; |
my ($scanlines,$scan_data,$i,$newline,$skip)=@_; |
if ($skip) { |
if ($skip) { |
$scanlines->{'skipped'}[$i]=$newline; |
$scanlines->{'skipped'}[$i]=$newline; |
&allow_skipping($scan_data,$i); |
&start_skipping($scan_data,$i); |
return; |
return; |
} |
} |
$scanlines->{'corrected'}[$i]=$newline; |
$scanlines->{'corrected'}[$i]=$newline; |
} |
} |
|
|
|
sub scantron_clear_skip { |
|
my ($scanlines,$scan_data,$i)=@_; |
|
if (exists($scanlines->{'skipped'}[$i])) { |
|
undef($scanlines->{'skipped'}[$i]); |
|
return 1; |
|
} |
|
return 0; |
|
} |
|
|
sub scantron_filter_not_exam { |
sub scantron_filter_not_exam { |
my ($curres)=@_; |
my ($curres)=@_; |
|
|
Line 5608 SCANTRONFORM
|
Line 5709 SCANTRONFORM
|
|
|
&Apache::lonxml::clear_problem_counter(); |
&Apache::lonxml::clear_problem_counter(); |
&Apache::lonnet::appenv(%$scan_record); |
&Apache::lonnet::appenv(%$scan_record); |
|
|
|
if (&scantron_clear_skip($scanlines,$scan_data,$i)) { |
|
&scantron_putfile($scanlines,$scan_data); |
|
} |
|
|
my $i=0; |
my $i=0; |
foreach my $resource (@resources) { |
foreach my $resource (@resources) { |
Line 5618 SCANTRONFORM
|
Line 5723 SCANTRONFORM
|
'grade_domain' =>$udom, |
'grade_domain' =>$udom, |
'grade_courseid'=>$env{'request.course.id'}, |
'grade_courseid'=>$env{'request.course.id'}, |
'grade_symb' =>$resource->symb()); |
'grade_symb' =>$resource->symb()); |
if (exists($scan_record->{'scantron.CODE'}) && |
if (exists($scan_record->{'scantron.CODE'}) |
$scan_record->{'scantron.CODE'}) { |
&& |
|
&Apache::lonnet::validCODE($scan_record->{'scantron.CODE'})) { |
$form{'CODE'}=$scan_record->{'scantron.CODE'}; |
$form{'CODE'}=$scan_record->{'scantron.CODE'}; |
} else { |
} else { |
$form{'CODE'}=''; |
$form{'CODE'}=''; |