version 1.330, 2006/03/10 23:49:29
|
version 1.336, 2006/03/19 21:38:55
|
Line 118 sub response_type {
|
Line 118 sub response_type {
|
my %seen = (); |
my %seen = (); |
my (@partlist,%handgrade,%responseType); |
my (@partlist,%handgrade,%responseType); |
foreach (split(/,/,&Apache::lonnet::metadata($url,'packages'))) { |
foreach (split(/,/,&Apache::lonnet::metadata($url,'packages'))) { |
if (/^\w+response_.*/) { |
if (/^\w+response_.*/ || /^Task_/) { |
my ($responsetype,$part) = split(/_/,$_,2); |
my ($responsetype,$part) = split(/_/,$_,2); |
my ($partid,$respid) = split(/_/,$part); |
my ($partid,$respid) = split(/_/,$part); |
|
if ($responsetype eq 'Task') { $respid='0'; } |
if (&Apache::loncommon::check_if_partid_hidden($partid,$symb)) { |
if (&Apache::loncommon::check_if_partid_hidden($partid,$symb)) { |
next; |
next; |
} |
} |
Line 205 sub get_order {
|
Line 206 sub get_order {
|
return ($analyze{"$partid.$respid.shown"}); |
return ($analyze{"$partid.$respid.shown"}); |
} |
} |
#--- Clean response type for display |
#--- Clean response type for display |
#--- Currently filters option/rank/radiobutton/match/essay response types only. |
#--- Currently filters option/rank/radiobutton/match/essay/Task |
|
# response types only. |
sub cleanRecord { |
sub cleanRecord { |
my ($answer,$response,$symb,$partid,$respid,$record,$order,$version) = @_; |
my ($answer,$response,$symb,$partid,$respid,$record,$order,$version, |
|
$uname,$udom) = @_; |
my $grayFont = '<font color="#999999">'; |
my $grayFont = '<font color="#999999">'; |
if ($response =~ /^(option|rank)$/) { |
if ($response =~ /^(option|rank)$/) { |
my %answer=&Apache::lonnet::str2hash($answer); |
my %answer=&Apache::lonnet::str2hash($answer); |
Line 288 sub cleanRecord {
|
Line 291 sub cleanRecord {
|
my $jme=$record->{$version."resource.$partid.$respid.molecule"}; |
my $jme=$record->{$version."resource.$partid.$respid.molecule"}; |
$result.=&Apache::chemresponse::jme_img($jme,$answer,400); |
$result.=&Apache::chemresponse::jme_img($jme,$answer,400); |
return $result; |
return $result; |
|
} elsif ( $response eq 'Task') { |
|
if ( $answer eq 'SUBMITTED') { |
|
my $files = $record->{$version."resource.$respid.$partid.bridgetask.portfiles"}; |
|
my $result = &Apache::bridgetask::file_list($files,$uname,$udom); |
|
return $result; |
|
} elsif ( grep(/^\Q$version\E.*?\.instance$/, keys(%{$record})) ) { |
|
my @matches = grep(/^\Q$version\E.*?\.instance$/, |
|
keys(%{$record})); |
|
return join('<br />',($version,@matches)); |
|
|
|
|
|
} else { |
|
my $result = |
|
'<p>' |
|
.&mt('Overall result: [_1]', |
|
$record->{$version."resource.$respid.$partid.status"}) |
|
.'</p>'; |
|
|
|
$result .= '<ul>'; |
|
my @grade = grep(/^\Q${version}resource.$respid.$partid.\E[^.]*[.]status$/, |
|
keys(%{$record})); |
|
foreach my $grade (sort(@grade)) { |
|
my ($dim) = ($grade =~/[.]([^.]+)[.]status$/); |
|
$result.= '<li>'.&mt("Dimension: [_1], status [_2] ", |
|
$dim, $record->{$grade}). |
|
'</li>'; |
|
} |
|
$result.='</ul>'; |
|
return $result; |
|
} |
|
|
} |
} |
return $answer; |
return $answer; |
} |
} |
Line 1841 KEYWORDS
|
Line 1875 KEYWORDS
|
foreach my $file (@$files) { |
foreach my $file (@$files) { |
$file_counter ++; |
$file_counter ++; |
&Apache::lonnet::allowuploaded('/adm/grades',$file); |
&Apache::lonnet::allowuploaded('/adm/grades',$file); |
$lastsubonly.='<br /><a href="'.$file.'" target="lonGRDs"><img src="'.&Apache::loncommon::icon($file).'" border="0"> '.$file.'</a>'; |
$lastsubonly.='<br /><a href="'.$file.'?rawmode=1" target="lonGRDs"><img src="'.&Apache::loncommon::icon($file).'" border=0"> '.$file.'</a>'; |
} |
} |
$lastsubonly.='<br />'; |
$lastsubonly.='<br />'; |
} |
} |
Line 3842 sub displayPage {
|
Line 3876 sub displayPage {
|
sub displaySubByDates { |
sub displaySubByDates { |
my ($symb,$record,$parts,$responseType,$checkIcon,$uname,$udom) = @_; |
my ($symb,$record,$parts,$responseType,$checkIcon,$uname,$udom) = @_; |
my $isCODE=0; |
my $isCODE=0; |
|
my $isTask = ($symb =~/\.task$/); |
if (exists($record->{'resource.CODE'})) { $isCODE=1; } |
if (exists($record->{'resource.CODE'})) { $isCODE=1; } |
my $studentTable='<table border="0" width="100%"><tr><td bgcolor="#777777">'. |
my $studentTable='<table border="0" width="100%"><tr><td bgcolor="#777777">'. |
'<table border="0" width="100%"><tr bgcolor="#e6ffff">'. |
'<table border="0" width="100%"><tr bgcolor="#e6ffff">'. |
Line 3856 sub displaySubByDates {
|
Line 3891 sub displaySubByDates {
|
if (!exists($$record{'1:timestamp'})) { |
if (!exists($$record{'1:timestamp'})) { |
return '<br /> <font color="red">Nothing submitted - no attempts</font><br />'; |
return '<br /> <font color="red">Nothing submitted - no attempts</font><br />'; |
} |
} |
|
|
|
my $interaction; |
for ($version=1;$version<=$$record{'version'};$version++) { |
for ($version=1;$version<=$$record{'version'};$version++) { |
my $timestamp = scalar(localtime($$record{$version.':timestamp'})); |
my $timestamp = scalar(localtime($$record{$version.':timestamp'})); |
|
if (exists($$record{$version.':resource.0.version'})) { |
|
$interaction = $$record{$version.':resource.0.version'}; |
|
} |
|
|
|
my $where = ($isTask ? "$version:resource.$interaction" |
|
: "$version:resource"); |
|
#&Apache::lonnet::logthis(" got $where"); |
$studentTable.='<tr bgcolor="#ffffff" valign="top"><td>'.$timestamp.'</td>'; |
$studentTable.='<tr bgcolor="#ffffff" valign="top"><td>'.$timestamp.'</td>'; |
if ($isCODE) { |
if ($isCODE) { |
$studentTable.='<td>'.$record->{$version.':resource.CODE'}.'</td>'; |
$studentTable.='<td>'.$record->{$version.':resource.CODE'}.'</td>'; |
Line 3865 sub displaySubByDates {
|
Line 3909 sub displaySubByDates {
|
my @versionKeys = split(/\:/,$$record{$version.':keys'}); |
my @versionKeys = split(/\:/,$$record{$version.':keys'}); |
my @displaySub = (); |
my @displaySub = (); |
foreach my $partid (@{$parts}) { |
foreach my $partid (@{$parts}) { |
my @matchKey = sort(grep /^resource\.\Q$partid\E\..*?\.submission$/,@versionKeys); |
my @matchKey = ($isTask ? sort(grep /^resource\.\d+\.\Q$partid\E\.award$/,@versionKeys) |
|
: sort(grep /^resource\.\Q$partid\E\..*?\.submission$/,@versionKeys)); |
|
|
|
|
# next if ($$record{"$version:resource.$partid.solved"} eq ''); |
# next if ($$record{"$version:resource.$partid.solved"} eq ''); |
my $display_part=&get_display_part($partid,$symb); |
my $display_part=&get_display_part($partid,$symb); |
foreach my $matchKey (@matchKey) { |
foreach my $matchKey (@matchKey) { |
if (exists($$record{$version.':'.$matchKey}) && |
if (exists($$record{$version.':'.$matchKey}) && |
$$record{$version.':'.$matchKey} ne '') { |
$$record{$version.':'.$matchKey} ne '') { |
my ($responseId)=($matchKey=~ /^resource\.\Q$partid\E\.(.*?)\.submission$/); |
|
|
my ($responseId)= ($isTask ? ($matchKey=~ /^resource\.(.*?)\.\Q$partid\E\.award$/) |
|
: ($matchKey=~ /^resource\.\Q$partid\E\.(.*?)\.submission$/)); |
|
#&Apache::lonnet::logthis("match $matchKey $responseId (".$$record{$version.':'.$matchKey}); |
$displaySub[0].='<b>Part:</b> '.$display_part.' '; |
$displaySub[0].='<b>Part:</b> '.$display_part.' '; |
$displaySub[0].='<font color="#999999">(ID '. |
$displaySub[0].='<font color="#999999">(ID '. |
$responseId.')</font> <b>'; |
$responseId.')</font> <b>'; |
if ($$record{"$version:resource.$partid.tries"} eq '') { |
if ($$record{"$where.$partid.tries"} eq '') { |
$displaySub[0].='Trial not counted'; |
$displaySub[0].='Trial not counted'; |
} else { |
} else { |
$displaySub[0].='Trial '. |
$displaySub[0].='Trial '. |
$$record{"$version:resource.$partid.tries"}; |
$$record{"$where.$partid.tries"}; |
} |
} |
my $responseType=$responseType->{$partid}->{$responseId}; |
my $responseType=($isTask ? 'Task' |
|
: $responseType->{$partid}->{$responseId}); |
if (!exists($orders{$partid})) { $orders{$partid}={}; } |
if (!exists($orders{$partid})) { $orders{$partid}={}; } |
if (!exists($orders{$partid}->{$responseId})) { |
if (!exists($orders{$partid}->{$responseId})) { |
$orders{$partid}->{$responseId}= |
$orders{$partid}->{$responseId}= |
&get_order($partid,$responseId,$symb,$uname,$udom); |
&get_order($partid,$responseId,$symb,$uname,$udom); |
} |
} |
$displaySub[0].='</b> '. |
$displaySub[0].='</b> '. |
&cleanRecord($$record{$version.':'.$matchKey},$responseType,$symb,$partid,$responseId,$record,$orders{$partid}->{$responseId},"$version:").'<br />'; |
&cleanRecord($$record{$version.':'.$matchKey},$responseType,$symb,$partid,$responseId,$record,$orders{$partid}->{$responseId},"$version:",$uname,$udom).'<br />'; |
} |
} |
} |
} |
if (exists $$record{"$version:resource.$partid.award"}) { |
if (exists($$record{"$where.$partid.checkedin"})) { |
|
$displaySub[1].='Checked in by '. |
|
$$record{"$where.$partid.checkedin"}.' into slot '. |
|
$$record{"$where.$partid.checkedin.slot"}. |
|
'<br />'; |
|
} |
|
if (exists $$record{"$where.$partid.award"}) { |
$displaySub[1].='<b>Part:</b> '.$display_part.' '. |
$displaySub[1].='<b>Part:</b> '.$display_part.' '. |
lc($$record{"$version:resource.$partid.award"}).' '. |
lc($$record{"$where.$partid.award"}).' '. |
$mark{$$record{"$version:resource.$partid.solved"}}. |
$mark{$$record{"$where.$partid.solved"}}. |
'<br />'; |
'<br />'; |
} |
} |
if (exists $$record{"$version:resource.$partid.regrader"}) { |
if (exists $$record{"$where.$partid.regrader"}) { |
$displaySub[2].=$$record{"$version:resource.$partid.regrader"}. |
$displaySub[2].=$$record{"$where.$partid.regrader"}. |
|
' (<b>'.&mt('Part').':</b> '.$display_part.')'; |
|
} elsif ($$record{"$version:resource.$partid.regrader"} =~ /\S/) { |
|
$displaySub[2].= |
|
$$record{"$version:resource.$partid.regrader"}. |
' (<b>'.&mt('Part').':</b> '.$display_part.')'; |
' (<b>'.&mt('Part').':</b> '.$display_part.')'; |
} |
} |
} |
} |
Line 4204 sub scantron_selectphase {
|
Line 4265 sub scantron_selectphase {
|
<td> Options: </td> |
<td> Options: </td> |
<td> |
<td> |
<label><input type="checkbox" name="scantron_options_redo" value="redo_skipped"/> Do only previously skipped records</label> <br /> |
<label><input type="checkbox" name="scantron_options_redo" value="redo_skipped"/> Do only previously skipped records</label> <br /> |
<label><input type="checkbox" name="scantron_options_ignore" value="ignore_corrections"/> Remove all exisiting corrections</label> |
<label><input type="checkbox" name="scantron_options_ignore" value="ignore_corrections"/> Remove all exisiting corrections</label> <br /> |
|
<label><input type="checkbox" name="scantron_options_hidden" value="ignore_hidden"/> Skip hidden resources when grading</label> |
</td> |
</td> |
</tr> |
</tr> |
<tr bgcolor="#ffffe6"> |
<tr bgcolor="#ffffe6"> |
Line 4533 sub scantron_find_student {
|
Line 4595 sub scantron_find_student {
|
|
|
sub scantron_filter { |
sub scantron_filter { |
my ($curres)=@_; |
my ($curres)=@_; |
# randomout is dysfunctional at best for this purpose |
|
if (ref($curres) && $curres->is_problem()) { #&& !$curres->randomout) { |
if (ref($curres) && $curres->is_problem()) { |
|
# if the user has asked to not have either hidden |
|
# or 'randomout' controlled resources to be graded |
|
# don't include them |
|
if ($env{'form.scantron_options_hidden'} eq 'ignore_hidden' |
|
&& $curres->randomout) { |
|
return 0; |
|
} |
return 1; |
return 1; |
} |
} |
return 0; |
return 0; |
Line 4629 sub remember_current_skipped {
|
Line 4698 sub remember_current_skipped {
|
$to_remember{$i}=1; |
$to_remember{$i}=1; |
} |
} |
} |
} |
&Apache::lonnet::logthis('remembering '.join(':',%to_remember)); |
|
&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 4717 sub scantron_form_start {
|
Line 4785 sub scantron_form_start {
|
<input type="hidden" name="scantron_CODEunique" value="$env{'form.scantron_CODEunique'}" /> |
<input type="hidden" name="scantron_CODEunique" value="$env{'form.scantron_CODEunique'}" /> |
<input type="hidden" name="scantron_options_redo" value="$env{'form.scantron_options_redo'}" /> |
<input type="hidden" name="scantron_options_redo" value="$env{'form.scantron_options_redo'}" /> |
<input type="hidden" name="scantron_options_ignore" value="$env{'form.scantron_options_ignore'}" /> |
<input type="hidden" name="scantron_options_ignore" value="$env{'form.scantron_options_ignore'}" /> |
|
<input type="hidden" name="scantron_options_hidden" value="$env{'form.scantron_options_hidden'}" /> |
SCANTRONFORM |
SCANTRONFORM |
return $result; |
return $result; |
} |
} |
Line 4755 sub scantron_validate_file {
|
Line 4824 sub scantron_validate_file {
|
my $result=&scantron_form_start($max_bubble).$default_form_data; |
my $result=&scantron_form_start($max_bubble).$default_form_data; |
$r->print($result); |
$r->print($result); |
|
|
my @validate_phases=( 'ID', |
my @validate_phases=( 'sequence', |
|
'ID', |
'CODE', |
'CODE', |
'doublebubble', |
'doublebubble', |
'missingbubbles'); |
'missingbubbles'); |
Line 4788 STUFF
|
Line 4858 STUFF
|
$r->print("<input type='hidden' name='validatepass' value='".$currentphase."' />"); |
$r->print("<input type='hidden' name='validatepass' value='".$currentphase."' />"); |
} |
} |
if ($stop) { |
if ($stop) { |
$r->print('<input type="submit" name="submit" value="Continue ->" />'); |
if ($validate_phases[$currentphase] eq 'sequence') { |
$r->print(' using corrected info <br />'); |
$r->print('<input type="submit" name="submit" value="Ignore -> " />'); |
$r->print("<input type='submit' value='Skip' name='scantron_skip_record' />"); |
$r->print(' this error <br />'); |
$r->print(" this scanline saving it for later."); |
|
|
$r->print(" <p>Or click the 'Grading Menu' button to start over.</p>"); |
|
} else { |
|
$r->print('<input type="submit" name="submit" value="Continue ->" />'); |
|
$r->print(' using corrected info <br />'); |
|
$r->print("<input type='submit' value='Skip' name='scantron_skip_record' />"); |
|
$r->print(" this scanline saving it for later."); |
|
} |
} |
} |
$r->print(" </form><br />".&show_grading_menu_form($symb). |
$r->print(" </form><br />".&show_grading_menu_form($symb). |
"</body></html>"); |
"</body></html>"); |
Line 4924 sub scantron_put_line {
|
Line 5001 sub scantron_put_line {
|
$scanlines->{'corrected'}[$i]=$newline; |
$scanlines->{'corrected'}[$i]=$newline; |
} |
} |
|
|
|
sub scantron_filter_not_exam { |
|
my ($curres)=@_; |
|
|
|
if (ref($curres) && $curres->is_problem() && !$curres->is_exam()) { |
|
# if the user has asked to not have either hidden |
|
# or 'randomout' controlled resources to be graded |
|
# don't include them |
|
if ($env{'form.scantron_options_hidden'} eq 'ignore_hidden' |
|
&& $curres->randomout) { |
|
return 0; |
|
} |
|
return 1; |
|
} |
|
return 0; |
|
} |
|
|
|
sub scantron_validate_sequence { |
|
my ($r,$currentphase) = @_; |
|
|
|
my $navmap=Apache::lonnavmaps::navmap->new(); |
|
my (undef,undef,$sequence)= |
|
&Apache::lonnet::decode_symb($env{'form.selectpage'}); |
|
|
|
my $map=$navmap->getResourceByUrl($sequence); |
|
|
|
$r->print('<input type="hidden" name="validate_sequence_exam" |
|
value="ignore" />'); |
|
if ($env{'form.validate_sequence_exam'} ne 'ignore') { |
|
my @resources= |
|
$navmap->retrieveResources($map,\&scantron_filter_not_exam,1,0); |
|
if (@resources) { |
|
$r->print("<p>".&mt('Some resource in the sequece currently are not set to exam mode. Grading these resources currently may not work correctly.')."</p>"); |
|
return (1,$currentphase); |
|
} |
|
} |
|
|
|
return (0,$currentphase+1); |
|
} |
|
|
sub scantron_validate_ID { |
sub scantron_validate_ID { |
my ($r,$currentphase) = @_; |
my ($r,$currentphase) = @_; |
|
|
Line 4994 sub scantron_get_correction {
|
Line 5110 sub scantron_get_correction {
|
#the previous one or the current one |
#the previous one or the current one |
|
|
$r->print("<p><b>An error was detected ($error)</b>"); |
$r->print("<p><b>An error was detected ($error)</b>"); |
if ( defined($$scan_record{'scantron.PaperID'}) ) { |
if ( $$scan_record{'scantron.PaperID'} =~ /\S/) { |
$r->print(" for PaperID <tt>". |
$r->print(" for PaperID <tt>". |
$$scan_record{'scantron.PaperID'}."</tt> \n"); |
$$scan_record{'scantron.PaperID'}."</tt> \n"); |
} else { |
} else { |
Line 5075 ENDSCRIPT
|
Line 5191 ENDSCRIPT
|
"&scantron_CODElist=".&Apache::lonnet::escape($env{'form.scantron_CODElist'}). |
"&scantron_CODElist=".&Apache::lonnet::escape($env{'form.scantron_CODElist'}). |
"&curCODE=".&Apache::lonnet::escape($$scan_record{'scantron.CODE'}). |
"&curCODE=".&Apache::lonnet::escape($$scan_record{'scantron.CODE'}). |
"&scantron_selectfile=".&Apache::lonnet::escape($env{'form.scantron_selectfile'}); |
"&scantron_selectfile=".&Apache::lonnet::escape($env{'form.scantron_selectfile'}); |
$r->print("<label><input type='radio' name='scantron_CODE_resolution' value='use_found' /> <a target='_blank' href='$href'>Select</a> a CODE from the list of all CODEs and use it.</label> Selected CODE is <input readonly='true' type='text' size='8' name='scantron_CODE_selectedvalue' onfocus=\"javascript:change_radio('use_found')\" onchange=\"javascript:change_radio('use_found')\" />"); |
if ($env{'form.scantron_CODElist'} =~ /\S/) { |
$r->print("\n<br />"); |
$r->print("<label><input type='radio' name='scantron_CODE_resolution' value='use_found' /> <a target='_blank' href='$href'>Select</a> a CODE from the list of all CODEs and use it.</label> Selected CODE is <input readonly='true' type='text' size='8' name='scantron_CODE_selectedvalue' onfocus=\"javascript:change_radio('use_found')\" onchange=\"javascript:change_radio('use_found')\" />"); |
|
$r->print("\n<br />"); |
|
} |
$r->print("<label><input type='radio' name='scantron_CODE_resolution' value='use_typed' /> Use </label><input type='text' size='8' name='scantron_CODE_newvalue' onfocus=\"javascript:change_radio('use_typed')\" onkeypress=\"javascript:change_radio('use_typed')\" /> as the CODE."); |
$r->print("<label><input type='radio' name='scantron_CODE_resolution' value='use_typed' /> Use </label><input type='text' size='8' name='scantron_CODE_newvalue' onfocus=\"javascript:change_radio('use_typed')\" onkeypress=\"javascript:change_radio('use_typed')\" /> as the CODE."); |
$r->print("\n<br /><br />"); |
$r->print("\n<br /><br />"); |
} elsif ($error eq 'doublebubble') { |
} elsif ($error eq 'doublebubble') { |
Line 5501 sub scantron_upload_scantron_data_save {
|
Line 5619 sub scantron_upload_scantron_data_save {
|
sub valid_file { |
sub valid_file { |
my ($requested_file)=@_; |
my ($requested_file)=@_; |
foreach my $filename (sort(&scantron_filenames())) { |
foreach my $filename (sort(&scantron_filenames())) { |
&Apache::lonnet::logthis("$requested_file $filename"); |
|
if ($requested_file eq $filename) { return 1; } |
if ($requested_file eq $filename) { return 1; } |
} |
} |
return 0; |
return 0; |