version 1.369, 2006/07/02 01:03:04
|
version 1.383, 2006/11/03 20:04:08
|
Line 112 sub nameUserString {
|
Line 112 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 (%response_types,%handgrade); |
} |
foreach my $part (@{ $partlist }) { |
my %seen = (); |
my @types = $res->responseType($part); |
my (@partlist,%handgrade,%responseType); |
my @ids = $res->responseIds($part); |
foreach (split(/,/,&Apache::lonnet::metadata($url,'packages'))) { |
for (my $i=0; $i < scalar(@ids); $i++) { |
if (/^\w+response_.*/ || /^Task_/) { |
$response_types{$part}{$ids[$i]} = $types[$i]; |
my ($responsetype,$part) = split(/_/,$_,2); |
$handgrade{$part.'_'.$ids[$i]} = |
my ($partid,$respid) = split(/_/,$part); |
&Apache::lonnet::EXT('resource.'.$part.'_'.$ids[$i]. |
if ($responsetype eq 'Task') { $respid='0'; } |
'.handgrade',$symb); |
if (&Apache::loncommon::check_if_partid_hidden($partid,$symb)) { |
} |
next; |
} |
} |
return ($partlist,\%handgrade,\%response_types); |
if (%vPart && !exists($vPart{$partid})) { |
} |
next; |
|
} |
sub flatten_responseType { |
$responsetype =~ s/response$//; # make it compatible w/ navmaps - should move to that!! |
my ($responseType) = @_; |
my ($value) = &Apache::lonnet::EXT('resource.'.$part.'.handgrade',$symb); |
my @part_response_id = |
$handgrade{$part} = ($value eq 'yes' ? 'yes' : 'no'); |
map { |
if (!exists($responseType{$partid})) { $responseType{$partid}={}; } |
my $part = $_; |
$responseType{$partid}->{$respid}=$responsetype; |
map { |
next if ($seen{$partid} > 0); |
[$part,$_] |
$seen{$partid}++; |
} sort(keys(%{ $responseType->{$part} })); |
push @partlist,$partid; |
} sort(keys(%$responseType)); |
} |
return @part_response_id; |
} |
|
return (\@partlist,\%handgrade,\%responseType); |
|
} |
} |
|
|
sub get_display_part { |
sub get_display_part { |
Line 168 sub showResourceInfo {
|
Line 166 sub showResourceInfo {
|
my %resptype = (); |
my %resptype = (); |
my $hdgrade='no'; |
my $hdgrade='no'; |
my %partsseen; |
my %partsseen; |
for my $part_resID (sort keys(%$handgrade)) { |
foreach my $partID (sort keys(%$responseType)) { |
my $handgrade=$$handgrade{$part_resID}; |
foreach my $resID (sort keys(%{ $responseType->{$partID} })) { |
my ($partID,$resID) = split(/_/,$part_resID); |
my $handgrade=$$handgrade{$partID.'_'.$resID}; |
my $responsetype = $responseType->{$partID}->{$resID}; |
my $responsetype = $responseType->{$partID}->{$resID}; |
$hdgrade = $handgrade if ($handgrade eq 'yes'); |
$hdgrade = $handgrade if ($handgrade eq 'yes'); |
$result.='<tr>'; |
$result.='<tr>'; |
if ($checkboxes) { |
if ($checkboxes) { |
if (exists($partsseen{$partID})) { |
if (exists($partsseen{$partID})) { |
$result.="<td> </td>"; |
$result.="<td> </td>"; |
} else { |
} else { |
$result.="<td><input type='checkbox' name='vPart' value='$partID' checked='on' /></td>"; |
$result.="<td><input type='checkbox' name='vPart' value='$partID' checked='on' /></td>"; |
|
} |
|
$partsseen{$partID}=1; |
} |
} |
$partsseen{$partID}=1; |
my $display_part=&get_display_part($partID,$symb); |
} |
$result.='<td><b>Part: </b>'.$display_part.' <font color="#999999">'. |
my $display_part=&get_display_part($partID,$symb); |
$resID.'</font></td>'. |
$result.='<td><b>Part: </b>'.$display_part.' <font color="#999999">'. |
'<td><b>Type: </b>'.$responsetype.'</td></tr>'; |
$resID.'</font></td>'. |
|
'<td><b>Type: </b>'.$responsetype.'</td></tr>'; |
|
# '<td><b>Handgrade: </b>'.$handgrade.'</td></tr>'; |
# '<td><b>Handgrade: </b>'.$handgrade.'</td></tr>'; |
|
} |
} |
} |
$result.='</table>'."\n"; |
$result.='</table>'."\n"; |
return $result,$responseType,$hdgrade,$partlist,$handgrade; |
return $result,$responseType,$hdgrade,$partlist,$handgrade; |
Line 589 sub verifyreceipt {
|
Line 588 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 1470 sub get_increment {
|
Line 1469 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 1493 sub gradeBox {
|
Line 1493 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 1513 sub gradeBox {
|
Line 1513 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 1538 sub handback_box {
|
Line 1538 sub handback_box {
|
my ($symb,$uname,$udom,$counter,$partid,$record) = @_; |
my ($symb,$uname,$udom,$counter,$partid,$record) = @_; |
my ($partlist,$handgrade,$responseType) = &response_type($symb); |
my ($partlist,$handgrade,$responseType) = &response_type($symb); |
my (@respids); |
my (@respids); |
foreach my $part_resp (sort(keys(%$handgrade))) { |
my @part_response_id = &flatten_responseType($responseType); |
my ($part,$resp) = split(/_/,$part_resp); |
foreach my $part_response_id (@part_response_id) { |
|
my ($part,$resp) = @{ $part_response_id }; |
if ($part eq $partid) { |
if ($part eq $partid) { |
push @respids,$resp; |
push(@respids,$resp); |
} |
} |
} |
} |
my $result; |
my $result; |
Line 1569 sub handback_box {
|
Line 1570 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; |
$rendered=~s|</form>||g; |
$rendered=~s|</form>||g; |
$rendered=~s|name="submit"|name="would_have_been_submit"|g; |
$rendered=~s|(<input[^>]*name\s*=\s*"?)(\w+)("?)|$1would_have_been_$2$3|g; |
} |
} |
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 1640 sub submission {
|
Line 1645 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 1858 KEYWORDS
|
Line 1864 KEYWORDS
|
$lastsubonly.='<tr><td bgcolor="#ffffe6">'.$$string[0]; |
$lastsubonly.='<tr><td bgcolor="#ffffe6">'.$$string[0]; |
} else { |
} else { |
my %seenparts; |
my %seenparts; |
for my $part (sort keys(%$handgrade)) { |
my @part_response_id = &flatten_responseType($responseType); |
my ($partid,$respid) = split(/_/,$part); |
foreach my $part (@part_response_id) { |
|
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"}) { |
if (exists($seenparts{$partid})) { next; } |
if (exists($seenparts{$partid})) { next; } |
Line 1883 KEYWORDS
|
Line 1890 KEYWORDS
|
} |
} |
foreach (@$string) { |
foreach (@$string) { |
my ($partid,$respid) = /^resource\.([^\.]*)\.([^\.]*)\.submission/; |
my ($partid,$respid) = /^resource\.([^\.]*)\.([^\.]*)\.submission/; |
if ($part ne ($partid.'_'.$respid)) { next; } |
if (join('_',@{$part}) ne ($partid.'_'.$respid)) { next; } |
my ($ressub,$subval) = split(/:/,$_,2); |
my ($ressub,$subval) = split(/:/,$_,2); |
# Similarity check |
# Similarity check |
my $similar=''; |
my $similar=''; |
Line 1903 KEYWORDS
|
Line 1910 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"><b>Part:</b> '. |
$display_part.' <font color="#999999">( ID '.$respid. |
$display_part.' <font color="#999999">( ID '.$respid. |
Line 1993 KEYWORDS
|
Line 2000 KEYWORDS
|
my %seen = (); |
my %seen = (); |
my @partlist; |
my @partlist; |
my @gradePartRespid; |
my @gradePartRespid; |
for my $part_resp (sort(keys(%$handgrade))) { |
my @part_response_id = &flatten_responseType($responseType); |
my ($partid,$respid) = split(/_/, $part_resp); |
foreach my $part_response_id (@part_response_id) { |
|
my ($partid,$respid) = @{ $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} =~ /:no$/ && $env{'form.lastSub'} =~ /^(hdgrade)$/); |
Line 2417 sub saveHandGrade {
|
Line 2426 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 2436 sub saveHandGrade {
|
Line 2436 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'; |
my ($partlist,$handgrade,$responseType) = &response_type($symb); |
my ($partlist,$handgrade,$responseType) = &response_type($symb); |
foreach my $part_resp (sort(keys(%$handgrade))) { |
|
my ($part_id, $resp_id) = split(/_/,$part_resp); |
my @part_response_id = &flatten_responseType($responseType); |
|
foreach my $part_response_id (@part_response_id) { |
|
my ($part_id,$resp_id) = @{ $part_response_id }; |
|
my $part_resp = join('_',@{ $part_response_id }); |
if (($env{'form.'.$newflg.'_'.$part_resp.'_returndoc1'}) && ($new_part == $part_id)) { |
if (($env{'form.'.$newflg.'_'.$part_resp.'_returndoc1'}) && ($new_part == $part_id)) { |
# if multiple files are uploaded names will be 'returndoc2','returndoc3' |
# if multiple files are uploaded names will be 'returndoc2','returndoc3' |
my $file_counter = 1; |
my $file_counter = 1; |
Line 2466 sub handback_files {
|
Line 2487 sub handback_files {
|
} else { |
} else { |
# mark the file as read only |
# mark the file as read only |
my @files = ($save_file_name); |
my @files = ($save_file_name); |
my @what = ($symb,'handback'); |
my @what = ($symb,$env{'request.course.id'},'handback'); |
&Apache::lonnet::mark_as_readonly($domain,$stuname,\@files,\@what); |
&Apache::lonnet::mark_as_readonly($domain,$stuname,\@files,\@what); |
if (exists($$newrecord{"resource.$new_part.$resp_id.handback"})) { |
if (exists($$newrecord{"resource.$new_part.$resp_id.handback"})) { |
$$newrecord{"resource.$new_part.$resp_id.handback"}.=','; |
$$newrecord{"resource.$new_part.$resp_id.handback"}.=','; |
Line 2874 sub viewgrades {
|
Line 2895 sub viewgrades {
|
'<table border=0><tr bgcolor="#ffffdd"><td>'; |
'<table border=0><tr bgcolor="#ffffdd"><td>'; |
#radio buttons/text box for assigning points for a section or class. |
#radio buttons/text box for assigning points for a section or class. |
#handles different parts of a problem |
#handles different parts of a problem |
my ($partlist,$handgrade) = &response_type($symb); |
my ($partlist,$handgrade,$responseType) = &response_type($symb); |
my %weight = (); |
my %weight = (); |
my $ctsparts = 0; |
my $ctsparts = 0; |
$result.='<table border="0">'; |
$result.='<table border="0">'; |
my %seen = (); |
my %seen = (); |
for (sort keys(%$handgrade)) { |
my @part_response_id = &flatten_responseType($responseType); |
my ($partid,$respid) = split (/_/,$_,2); |
foreach my $part_response_id (@part_response_id) { |
|
my ($partid,$respid) = @{ $part_response_id }; |
|
my $part_resp = join('_',@{ $part_response_id }); |
next if $seen{$partid}; |
next if $seen{$partid}; |
$seen{$partid}++; |
$seen{$partid}++; |
my $handgrade=$$handgrade{$_}; |
my $handgrade=$$handgrade{$part_resp}; |
my $wgt = &Apache::lonnet::EXT('resource.'.$partid.'.weight',$symb); |
my $wgt = &Apache::lonnet::EXT('resource.'.$partid.'.weight',$symb); |
$weight{$partid} = $wgt eq '' ? '1' : $wgt; |
$weight{$partid} = $wgt eq '' ? '1' : $wgt; |
|
|
Line 3442 sub upcsvScores_form {
|
Line 3465 sub upcsvScores_form {
|
$result.=$table; |
$result.=$table; |
$result.='<br /><table width="100%" border="0"><tr><td bgcolor="#777777">'."\n"; |
$result.='<br /><table width="100%" border="0"><tr><td bgcolor="#777777">'."\n"; |
$result.='<table width="100%" border="0"><tr bgcolor="#e6ffff"><td>'."\n"; |
$result.='<table width="100%" border="0"><tr bgcolor="#e6ffff"><td>'."\n"; |
$result.=' <b>Specify a file containing the class scores for current resource'. |
$result.=' <b>'.&mt('Specify a file containing the class scores for current resource'). |
'.</b></td></tr>'."\n"; |
'.</b></td></tr>'."\n"; |
$result.='<tr bgcolor=#ffffe6><td>'."\n"; |
$result.='<tr bgcolor=#ffffe6><td>'."\n"; |
|
my $upload=&mt("Upload Scores"); |
my $upfile_select=&Apache::loncommon::upfile_select_html(); |
my $upfile_select=&Apache::loncommon::upfile_select_html(); |
my $ignore=&mt('Ignore First Line'); |
my $ignore=&mt('Ignore First Line'); |
$result.=<<ENDUPFORM; |
$result.=<<ENDUPFORM; |
Line 3454 sub upcsvScores_form {
|
Line 3478 sub upcsvScores_form {
|
<input type="hidden" name="probTitle" value="$env{'form.probTitle'}" /> |
<input type="hidden" name="probTitle" value="$env{'form.probTitle'}" /> |
<input type="hidden" name="saveState" value="$env{'form.saveState'}" /> |
<input type="hidden" name="saveState" value="$env{'form.saveState'}" /> |
$upfile_select |
$upfile_select |
<br /><input type="button" onClick="javascript:checkUpload(this.form);" value="Upload Scores" /> |
<br /><input type="button" onClick="javascript:checkUpload(this.form);" value="$upload" /> |
<label><input type="checkbox" name="noFirstLine" />$ignore</label> |
<label><input type="checkbox" name="noFirstLine" />$ignore</label> |
</form> |
</form> |
ENDUPFORM |
ENDUPFORM |
$result.='</td></tr></table>'."\n"; |
$result.=&Apache::loncommon::help_open_topic("Course_Convert_To_CSV", |
|
&mt("How do I create a CSV file from a spreadsheet")) |
|
.'</td></tr></table>'."\n"; |
$result.='</td></tr></table><br /><br />'."\n"; |
$result.='</td></tr></table><br /><br />'."\n"; |
$result.=&show_grading_menu_form($symb); |
$result.=&show_grading_menu_form($symb); |
return $result; |
return $result; |
Line 3756 LISTJAVASCRIPT
|
Line 3782 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 3786 LISTJAVASCRIPT
|
Line 3815 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 3810 sub getSymbMap {
|
Line 3839 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 3848 sub displayPage {
|
Line 3878 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 3872 sub displayPage {
|
Line 3907 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 3897 sub displayPage {
|
Line 3937 sub displayPage {
|
$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 3952 sub displayPage {
|
Line 3993 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 4169 sub updateGradeByPage {
|
Line 4210 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 4181 sub updateGradeByPage {
|
Line 4221 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 4297 sub scantron_CODElist {
|
Line 4352 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 4423 SCANTRONFORM
|
Line 4478 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 4605 sub scantron_parse_scanline {
|
Line 4661 sub scantron_parse_scanline {
|
substr($questions,0,$$scantron_config{'Qlength'})=''; |
substr($questions,0,$$scantron_config{'Qlength'})=''; |
if (length($currentquest) < $$scantron_config{'Qlength'}) { next; } |
if (length($currentquest) < $$scantron_config{'Qlength'}) { next; } |
if ($$scantron_config{'Qon'} eq 'letter') { |
if ($$scantron_config{'Qon'} eq 'letter') { |
if ($currentquest eq '?') { |
if ($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 (!$currentquest |
Line 4619 sub scantron_parse_scanline {
|
Line 4676 sub scantron_parse_scanline {
|
$record{"scantron.$questnum.answer"}=$currentquest; |
$record{"scantron.$questnum.answer"}=$currentquest; |
} |
} |
} elsif ($$scantron_config{'Qon'} eq 'number') { |
} elsif ($$scantron_config{'Qon'} eq 'number') { |
if ($currentquest eq '?') { |
if ($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 (!$currentquest |
Line 4630 sub scantron_parse_scanline {
|
Line 4688 sub scantron_parse_scanline {
|
push(@{$record{"scantron.missingerror"}},$questnum); |
push(@{$record{"scantron.missingerror"}},$questnum); |
} |
} |
} else { |
} else { |
$record{"scantron.$questnum.answer"}= |
# wrap zero back to J |
$alphabet[$currentquest-1]; |
if ($currentquest eq '0') { |
|
$record{"scantron.$questnum.answer"}= |
|
$alphabet[9]; |
|
} else { |
|
$record{"scantron.$questnum.answer"}= |
|
$alphabet[$currentquest-1]; |
|
} |
} |
} |
} else { |
} else { |
my @array=split($$scantron_config{'Qon'},$currentquest,-1); |
my @array=split($$scantron_config{'Qon'},$currentquest,-1); |
Line 4761 sub reset_skipping_status {
|
Line 4825 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 4787 sub remember_current_skipped {
|
Line 4859 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 4802 sub scantron_warning_screen {
|
Line 4875 sub scantron_warning_screen {
|
my ($button_text)=@_; |
my ($button_text)=@_; |
my $title=&Apache::lonnet::gettitle($env{'form.selectpage'}); |
my $title=&Apache::lonnet::gettitle($env{'form.selectpage'}); |
my %scantron_config=&get_scantron_config($env{'form.scantron_format'}); |
my %scantron_config=&get_scantron_config($env{'form.scantron_format'}); |
my $CODElist="a"; |
my $CODElist; |
if ($scantron_config{'CODElocation'} && |
if ($scantron_config{'CODElocation'} && |
$scantron_config{'CODEstart'} && |
$scantron_config{'CODEstart'} && |
$scantron_config{'CODElength'}) { |
$scantron_config{'CODElength'}) { |
$CODElist=$env{'form.scantron_CODElist'}; |
$CODElist=$env{'form.scantron_CODElist'}; |
if ($CODElist eq '') { $CODElist='<font color="red">None</font>'; } |
if ($env{'form.scantron_CODElist'} eq '') { $CODElist='<font color="red">None</font>'; } |
$CODElist= |
$CODElist= |
'<tr><td><b>List of CODES to validate against:</b></td><td><tt>'. |
'<tr><td><b>List of CODES to validate against:</b></td><td><tt>'. |
$CODElist.'</tt></td></tr>'; |
$env{'form.scantron_CODElist'}.'</tt></td></tr>'; |
} |
} |
return (<<STUFF); |
return (<<STUFF); |
<p> |
<p> |
Line 4892 sub scantron_validate_file {
|
Line 4965 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 5062 sub scantron_putfile {
|
Line 5134 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 5083 sub scantron_put_line {
|
Line 5155 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 5575 SCANTRONFORM
|
Line 5656 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 5585 SCANTRONFORM
|
Line 5670 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'}=''; |