version 1.257, 2005/04/07 06:56:21
|
version 1.272, 2005/06/04 19:02:19
|
Line 152 sub get_display_part {
|
Line 152 sub get_display_part {
|
} |
} |
return $display; |
return $display; |
} |
} |
|
|
#--- Show resource title |
#--- Show resource title |
#--- and parts and response type |
#--- and parts and response type |
sub showResourceInfo { |
sub showResourceInfo { |
Line 284 sub cleanRecord {
|
Line 285 sub cleanRecord {
|
} |
} |
$answer =~ s-\n-<br />-g; |
$answer =~ s-\n-<br />-g; |
return '<br /><br /><blockquote><tt>'.&keywords_highlight($answer).'</tt></blockquote>'; |
return '<br /><br /><blockquote><tt>'.&keywords_highlight($answer).'</tt></blockquote>'; |
|
} elsif ( $response eq 'organic') { |
|
my $result='Smile representation: "<tt>'.$answer.'</tt>"'; |
|
my $jme=$record->{$version."resource.$partid.$respid.molecule"}; |
|
$result.=&Apache::chemresponse::jme_img($jme,$answer,400); |
|
return $result; |
} |
} |
return $answer; |
return $answer; |
} |
} |
Line 626 LISTJAVASCRIPT
|
Line 632 LISTJAVASCRIPT
|
my $checklastsub = $checkhdgrade eq '' ? 'checked' : ''; |
my $checklastsub = $checkhdgrade eq '' ? 'checked' : ''; |
my $gradeTable='<form action="/adm/grades" method="post" name="gradesub">'. |
my $gradeTable='<form action="/adm/grades" method="post" name="gradesub">'. |
"\n".$table. |
"\n".$table. |
' <b>View Problem Text: </b><input type="radio" name="vProb" value="no" checked="on" /> no '."\n". |
' <b>View Problem Text: </b><label><input type="radio" name="vProb" value="no" checked="on" /> no </label>'."\n". |
'<input type="radio" name="vProb" value="yes" /> one student '."\n". |
'<label><input type="radio" name="vProb" value="yes" /> one student </label>'."\n". |
'<input type="radio" name="vProb" value="all" /> all students <br />'."\n". |
'<label><input type="radio" name="vProb" value="all" /> all students </label><br />'."\n". |
' <b>View Answer: </b><input type="radio" name="vAns" value="no" /> no '."\n". |
' <b>View Answer: </b><label><input type="radio" name="vAns" value="no" /> no </label>'."\n". |
'<input type="radio" name="vAns" value="yes" /> one student '."\n". |
'<label><input type="radio" name="vAns" value="yes" /> one student </label>'."\n". |
'<input type="radio" name="vAns" value="all" checked="on" /> all students <br />'."\n". |
'<label><input type="radio" name="vAns" value="all" checked="on" /> all students </label><br />'."\n". |
' <b>Submissions: </b>'."\n"; |
' <b>Submissions: </b>'."\n"; |
if ($env{'form.handgrade'} eq 'yes' && scalar(@$partlist) > 1) { |
if ($env{'form.handgrade'} eq 'yes' && scalar(@$partlist) > 1) { |
$gradeTable.='<input type="radio" name="lastSub" value="hdgrade" '.$checkhdgrade.' /> essay part only'."\n"; |
$gradeTable.='<label><input type="radio" name="lastSub" value="hdgrade" '.$checkhdgrade.' /> essay part only </label>'."\n"; |
} |
} |
|
|
my $saveStatus = $env{'form.Status'} eq '' ? 'Active' : $env{'form.Status'}; |
my $saveStatus = $env{'form.Status'} eq '' ? 'Active' : $env{'form.Status'}; |
$env{'form.Status'} = $saveStatus; |
$env{'form.Status'} = $saveStatus; |
|
|
$gradeTable.='<input type="radio" name="lastSub" value="lastonly" '.$checklastsub.' /> last submission only'."\n". |
$gradeTable.='<label><input type="radio" name="lastSub" value="lastonly" '.$checklastsub.' /> last submission only </label>'."\n". |
'<input type="radio" name="lastSub" value="last" /> last submission & parts info'."\n". |
'<label><input type="radio" name="lastSub" value="last" /> last submission & parts info </label>'."\n". |
'<input type="radio" name="lastSub" value="datesub" /> by dates and submissions'."\n". |
'<label><input type="radio" name="lastSub" value="datesub" /> by dates and submissions </label>'."\n". |
'<input type="radio" name="lastSub" value="all" /> all details'."\n". |
'<label><input type="radio" name="lastSub" value="all" /> all details</label>'."\n". |
'<input type="hidden" name="section" value="'.$getsec.'" />'."\n". |
'<input type="hidden" name="section" value="'.$getsec.'" />'."\n". |
'<input type="hidden" name="submitonly" value="'.$submitonly.'" />'."\n". |
'<input type="hidden" name="submitonly" value="'.$submitonly.'" />'."\n". |
'<input type="hidden" name="handgrade" value="'.$env{'form.handgrade'}.'" /><br />'."\n". |
'<input type="hidden" name="handgrade" value="'.$env{'form.handgrade'}.'" /><br />'."\n". |
Line 671 LISTJAVASCRIPT
|
Line 677 LISTJAVASCRIPT
|
'onClick="javascript:checkSelect(this.form.stuinfo);" '."\n". |
'onClick="javascript:checkSelect(this.form.stuinfo);" '."\n". |
'value="Next->" /> <br />'."\n"; |
'value="Next->" /> <br />'."\n"; |
$gradeTable.=&check_buttons(); |
$gradeTable.=&check_buttons(); |
$gradeTable.='<input type="checkbox" name="checkPlag" checked="on">Check For Plagiarism</input>'; |
$gradeTable.='<label><input type="checkbox" name="checkPlag" checked="on" />Check For Plagiarism</label>'; |
my ($classlist, undef, $fullname) = &getclasslist($getsec,'1'); |
my ($classlist, undef, $fullname) = &getclasslist($getsec,'1'); |
$gradeTable.='<table border="0"><tr><td bgcolor="#777777">'. |
$gradeTable.='<table border="0"><tr><td bgcolor="#777777">'. |
'<table border="0"><tr bgcolor="#e6ffff">'; |
'<table border="0"><tr bgcolor="#e6ffff">'; |
Line 1346 sub gradeBox {
|
Line 1352 sub gradeBox {
|
my $result='<input type="hidden" name="WGT'.$counter.'_'.$partid.'" value="'.$wgt.'" />'."\n"; |
my $result='<input type="hidden" name="WGT'.$counter.'_'.$partid.'" value="'.$wgt.'" />'."\n"; |
|
|
my $display_part=&get_display_part($partid,undef,$symb); |
my $display_part=&get_display_part($partid,undef,$symb); |
|
|
|
my %last_resets = &get_last_resets($symb,$env{'request.course.id'}, |
|
[$partid]); |
|
my $aggtries = $$record{'resource.'.$partid.'.tries'}; |
|
if ($last_resets{$partid}) { |
|
$aggtries = &get_num_tries($record,$last_resets{$partid},$partid); |
|
} |
|
|
$result.='<table border="0"><tr><td>'. |
$result.='<table border="0"><tr><td>'. |
'<b>Part: </b>'.$display_part.' <b>Points: </b></td><td>'."\n"; |
'<b>Part: </b>'.$display_part.' <b>Points: </b></td><td>'."\n"; |
|
|
Line 1384 sub gradeBox {
|
Line 1398 sub gradeBox {
|
$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="'. |
$$record{'resource.'.$partid.'.solved'}.'" />'."\n"; |
$$record{'resource.'.$partid.'.solved'}.'" />'."\n". |
|
'<input type="hidden" name="totaltries'.$counter.'_'.$partid.'" value="'. |
|
$$record{'resource.'.$partid.'.tries'}.'" />'."\n". |
|
'<input type="hidden" name="aggtries'.$counter.'_'.$partid.'" value="'. |
|
$aggtries.'" />'."\n"; |
$result.='</td></tr></table>'."\n"; |
$result.='</td></tr></table>'."\n"; |
return $result; |
return $result; |
} |
} |
Line 1593 KEYWORDS
|
Line 1611 KEYWORDS
|
} |
} |
|
|
my %record = &Apache::lonnet::restore($symb,$env{'request.course.id'},$udom,$uname); |
my %record = &Apache::lonnet::restore($symb,$env{'request.course.id'},$udom,$uname); |
|
|
my ($partlist,$handgrade,$responseType) = &response_type($url,$symb); |
my ($partlist,$handgrade,$responseType) = &response_type($url,$symb); |
|
|
# Display student info |
# Display student info |
Line 2109 sub processHandGrade {
|
Line 2126 sub processHandGrade {
|
#---- Save the score and award for each student, if changed |
#---- Save the score and award for each student, if changed |
sub saveHandGrade { |
sub saveHandGrade { |
my ($request,$url,$symb,$stuname,$domain,$newflg,$submitter,$part) = @_; |
my ($request,$url,$symb,$stuname,$domain,$newflg,$submitter,$part) = @_; |
|
my @v_flag; |
my $usec = &Apache::lonnet::getsection($domain,$stuname, |
my $usec = &Apache::lonnet::getsection($domain,$stuname, |
$env{'request.course.id'}); |
$env{'request.course.id'}); |
if (!&canmodify($usec)) { return('not_allowed'); } |
if (!&canmodify($usec)) { return('not_allowed'); } |
Line 2116 sub saveHandGrade {
|
Line 2134 sub saveHandGrade {
|
my @parts_graded; |
my @parts_graded; |
my %newrecord = (); |
my %newrecord = (); |
my ($pts,$wgt) = ('',''); |
my ($pts,$wgt) = ('',''); |
foreach (split(/:/,$env{'form.partlist'.$newflg})) { |
my %aggregate = (); |
|
my $aggregateflag = 0; |
|
foreach my $new_part (split(/:/,$env{'form.partlist'.$newflg})) { |
#collaborator may vary for different parts |
#collaborator may vary for different parts |
if ($submitter && $_ ne $part) { next; } |
if ($submitter && $new_part ne $part) { next; } |
my $dropMenu = $env{'form.GD_SEL'.$newflg.'_'.$_}; |
my $dropMenu = $env{'form.GD_SEL'.$newflg.'_'.$new_part}; |
if ($dropMenu eq 'excused') { |
if ($dropMenu eq 'excused') { |
if ($record{'resource.'.$_.'.solved'} ne 'excused') { |
if ($record{'resource.'.$new_part.'.solved'} ne 'excused') { |
$newrecord{'resource.'.$_.'.solved'} = 'excused'; |
$newrecord{'resource.'.$new_part.'.solved'} = 'excused'; |
if (exists($record{'resource.'.$_.'.awarded'})) { |
if (exists($record{'resource.'.$new_part.'.awarded'})) { |
$newrecord{'resource.'.$_.'.awarded'} = ''; |
$newrecord{'resource.'.$new_part.'.awarded'} = ''; |
} |
} |
$newrecord{'resource.'.$_.'.regrader'}="$env{'user.name'}:$env{'user.domain'}"; |
$newrecord{'resource.'.$new_part.'.regrader'}="$env{'user.name'}:$env{'user.domain'}"; |
} |
} |
} elsif ($dropMenu eq 'reset status' |
} elsif ($dropMenu eq 'reset status' |
&& exists($record{'resource.'.$_.'.solved'})) { #don't bother if no old records -> no attempts |
&& exists($record{'resource.'.$new_part.'.solved'})) { #don't bother if no old records -> no attempts |
foreach my $key (keys (%record)) { |
foreach my $key (keys (%record)) { |
if ($key=~/^resource\.\Q$_\E\./) { $newrecord{$key} = ''; } |
if ($key=~/^resource\.\Q$new_part\E\./) { $newrecord{$key} = ''; } |
} |
} |
$newrecord{'resource.'.$_.'.regrader'}= |
$newrecord{'resource.'.$new_part.'.regrader'}= |
"$env{'user.name'}:$env{'user.domain'}"; |
"$env{'user.name'}:$env{'user.domain'}"; |
|
my $totaltries = $record{'resource.'.$part.'.tries'}; |
|
|
|
my %last_resets = &get_last_resets($symb,$env{'request.course.id'}, |
|
[$new_part]); |
|
my $aggtries =$totaltries; |
|
if ($last_resets{$new_part}) { |
|
$aggtries = &get_num_tries(\%record,$last_resets{$new_part}, |
|
$new_part); |
|
} |
|
|
|
my $solvedstatus = $record{'resource.'.$new_part.'.solved'}; |
|
if ($aggtries > 0) { |
|
&decrement($symb,$new_part,\%aggregate,$aggtries,$totaltries,$solvedstatus); |
|
$aggregateflag = 1; |
|
} |
} elsif ($dropMenu eq '') { |
} elsif ($dropMenu eq '') { |
$pts = ($env{'form.GD_BOX'.$newflg.'_'.$_} ne '' ? |
$pts = ($env{'form.GD_BOX'.$newflg.'_'.$new_part} ne '' ? |
$env{'form.GD_BOX'.$newflg.'_'.$_} : |
$env{'form.GD_BOX'.$newflg.'_'.$new_part} : |
$env{'form.RADVAL'.$newflg.'_'.$_}); |
$env{'form.RADVAL'.$newflg.'_'.$new_part}); |
if ($pts eq '' && $env{'form.GD_SEL'.$newflg.'_'.$_} eq '') { |
if ($pts eq '' && $env{'form.GD_SEL'.$newflg.'_'.$new_part} eq '') { |
next; |
next; |
} |
} |
$wgt = $env{'form.WGT'.$newflg.'_'.$_} eq '' ? 1 : |
$wgt = $env{'form.WGT'.$newflg.'_'.$new_part} eq '' ? 1 : |
$env{'form.WGT'.$newflg.'_'.$_}; |
$env{'form.WGT'.$newflg.'_'.$new_part}; |
my $partial= $pts/$wgt; |
my $partial= $pts/$wgt; |
if ($partial eq $record{'resource.'.$_.'.awarded'}) { |
if ($partial eq $record{'resource.'.$new_part.'.awarded'}) { |
#do not update score for part if not changed. |
#do not update score for part if not changed. |
next; |
next; |
} else { |
} else { |
push @parts_graded, $_; |
push @parts_graded, $new_part; |
} |
} |
if ($record{'resource.'.$_.'.awarded'} ne $partial) { |
if ($record{'resource.'.$new_part.'.awarded'} ne $partial) { |
$newrecord{'resource.'.$_.'.awarded'} = $partial; |
$newrecord{'resource.'.$new_part.'.awarded'} = $partial; |
} |
} |
my $reckey = 'resource.'.$_.'.solved'; |
my $reckey = 'resource.'.$new_part.'.solved'; |
if ($partial == 0) { |
if ($partial == 0) { |
if ($record{$reckey} ne 'incorrect_by_override') { |
if ($record{$reckey} ne 'incorrect_by_override') { |
$newrecord{$reckey} = 'incorrect_by_override'; |
$newrecord{$reckey} = 'incorrect_by_override'; |
Line 2165 sub saveHandGrade {
|
Line 2200 sub saveHandGrade {
|
} |
} |
} |
} |
if ($submitter && |
if ($submitter && |
($record{'resource.'.$_.'.submitted_by'} ne $submitter)) { |
($record{'resource.'.$new_part.'.submitted_by'} ne $submitter)) { |
$newrecord{'resource.'.$_.'.submitted_by'} = $submitter; |
$newrecord{'resource.'.$new_part.'.submitted_by'} = $submitter; |
} |
} |
$newrecord{'resource.'.$_.'.regrader'}= |
$newrecord{'resource.'.$new_part.'.regrader'}= |
"$env{'user.name'}:$env{'user.domain'}"; |
"$env{'user.name'}:$env{'user.domain'}"; |
} |
} |
|
# unless problem has been graded, set flag to version the submitted files |
|
unless ($record{'resource.'.$new_part.'.solved'} =~ /^correct_/ || $record{'resource.'.$new_part.'.solved'} eq 'incorrect_by_override') { |
|
push (@v_flag,$new_part); |
|
} |
} |
} |
if (scalar(keys(%newrecord)) > 0) { |
if (scalar(keys(%newrecord)) > 0) { |
&version_portfiles(\%record, \@parts_graded, $env{'request.course.id'}, $symb, $domain, $stuname); |
if (scalar(@v_flag)) { |
|
&version_portfiles(\%record, \@parts_graded, $env{'request.course.id'}, $symb, $domain, $stuname, \@v_flag); |
|
} |
&Apache::lonnet::cstore(\%newrecord,$symb, |
&Apache::lonnet::cstore(\%newrecord,$symb, |
$env{'request.course.id'},$domain,$stuname); |
$env{'request.course.id'},$domain,$stuname); |
} |
} |
|
if ($aggregateflag) { |
|
&Apache::lonnet::cinc('nohist_resourcetracker',\%aggregate, |
|
$env{'course.'.$env{'request.course.id'}.'.domain'}, |
|
$env{'course.'.$env{'request.course.id'}.'.num'}); |
|
} |
return '',$pts,$wgt; |
return '',$pts,$wgt; |
} |
} |
|
|
|
# ----------- Provides number of tries since last reset. |
|
sub get_num_tries { |
|
my ($record,$last_reset,$part) = @_; |
|
my $timestamp = ''; |
|
my $num_tries = 0; |
|
if ($$record{'version'}) { |
|
for (my $version=$$record{'version'};$version>=1;$version--) { |
|
if (exists($$record{$version.':resource.'.$part.'.solved'})) { |
|
$timestamp = $$record{$version.':timestamp'}; |
|
if ($timestamp > $last_reset) { |
|
$num_tries ++; |
|
} else { |
|
last; |
|
} |
|
} |
|
} |
|
} |
|
return $num_tries; |
|
} |
|
|
|
# ----------- Determine decrements required in aggregate totals |
|
sub decrement_aggs { |
|
my ($symb,$part,$aggregate,$aggtries,$totaltries,$solvedstatus) = @_; |
|
my %decrement = ( |
|
attempts => 0, |
|
users => 0, |
|
correct => 0 |
|
); |
|
$decrement{'attempts'} = $aggtries; |
|
if ($solvedstatus =~ /^correct/) { |
|
$decrement{'correct'} = 1; |
|
} |
|
if ($aggtries == $totaltries) { |
|
$decrement{'users'} = 1; |
|
} |
|
foreach my $type (keys (%decrement)) { |
|
$$aggregate{$symb."\0".$part."\0".$type} = -$decrement{$type}; |
|
} |
|
return; |
|
} |
|
|
|
# ----------- Determine timestamps for last reset of aggregate totals for parts |
|
sub get_last_resets { |
|
my ($symb,$courseid,$partids) =@_; |
|
my %last_resets; |
|
my $cdom = $env{'course.'.$courseid.'.domain'}; |
|
my $cname = $env{'course.'.$courseid.'.num'}; |
|
my @keys; |
|
foreach my $part (@{$partids}) { |
|
push(@keys,"$symb\0$part\0resettime"); |
|
} |
|
my %results=&Apache::lonnet::get('nohist_resourcetracker',\@keys, |
|
$cdom,$cname); |
|
foreach my $part (@{$partids}) { |
|
$last_resets{$part}=$results{"$symb\0$part\0resettime"}; |
|
} |
|
return %last_resets; |
|
} |
|
|
# ----------- Handles creating versions for portfolio files as answers |
# ----------- Handles creating versions for portfolio files as answers |
sub version_portfiles { |
sub version_portfiles { |
my ($record, $parts_graded, $courseid, $symb, $domain, $stuname) = @_; |
my ($record, $parts_graded, $courseid, $symb, $domain, $stuname, $v_flag) = @_; |
|
my $version_parts = join('|',@$v_flag); |
my $parts = join('|', @$parts_graded); |
my $parts = join('|', @$parts_graded); |
my $portfolio_root = &Apache::loncommon::propath($domain, |
my $portfolio_root = &Apache::loncommon::propath($domain, |
$stuname). |
$stuname). |
'/userfiles/portfolio'; |
'/userfiles/portfolio'; |
foreach my $key(keys %$record) { |
foreach my $key(keys %$record) { |
if ($key =~ /^resource\.($parts)\./ && $key =~ /\.portfiles$/) { |
my $new_portfiles; |
|
if ($key =~ /^resource\.($version_parts)\./ && $key =~ /\.portfiles$/ ) { |
|
my @v_portfiles; |
my @portfiles = split(/,/,$$record{$key}); |
my @portfiles = split(/,/,$$record{$key}); |
|
# &Apache::lonnet::logthis("should be unmarking and remarking"); |
foreach my $file (@portfiles) { |
foreach my $file (@portfiles) { |
|
&Apache::lonnet::unmark_as_readonly($domain,$stuname,[$symb,$env{'request.course.id'}],$file); |
my ($directory,$answer_file) =($file =~ /^(.*?)([^\/]*$)/); |
my ($directory,$answer_file) =($file =~ /^(.*?)([^\/]*$)/); |
my $version = 0; |
my $version = 0; |
my @answer_file_parts = split(/\./, $answer_file); |
my @answer_file_parts = split(/\./, $answer_file); |
Line 2212 sub version_portfiles {
|
Line 2322 sub version_portfiles {
|
} |
} |
$version++; |
$version++; |
my $home_server = &Apache::lonnet::homeserver($stuname,$domain,undef); |
my $home_server = &Apache::lonnet::homeserver($stuname,$domain,undef); |
$ENV{'form.copy'} = &Apache::lonnet::getfile("/uploaded/$domain/$stuname/$directory$answer_file"); |
$env{'form.copy'} = &Apache::lonnet::getfile("/uploaded/$domain/$stuname/portfolio$directory$answer_file"); |
# $ENV{'form.copy.filename'}=''; |
if($env{'form.copy'} eq '-1') { |
my $copy_result = &Apache::lonnet::finishuserfileupload($stuname,$domain,$home_server,'copy', |
&Apache::lonnet::logthis('problem getting file '.$directory.$answer_file); |
|
} else { |
|
my $copy_result = &Apache::lonnet::finishuserfileupload($stuname,$domain,$home_server,'copy', |
'/portfolio'.$directory.$answer_file_parts[0].'.'.$version.'.'.$answer_file_parts[-1]); |
'/portfolio'.$directory.$answer_file_parts[0].'.'.$version.'.'.$answer_file_parts[-1]); |
&Apache::lonnet::logthis('copy result is '.$copy_result); |
push(@v_portfiles, $answer_file_parts[0].'.'.$version.'.'.$answer_file_parts[-1]); |
&Apache::lonnet::logthis('answer file is '.$answer_file. |
&Apache::lonnet::mark_as_readonly($domain,$stuname, |
' becomes '.$answer_file_parts[0].'.'.$version.'.'.$answer_file_parts[-1]); |
['/portfolio'.$directory.$answer_file_parts[0].'.'.$version.'.'.$answer_file_parts[-1]], |
&Apache::lonnet::logthis('from dir list is '.$file_names[0].' has '.@file_name_parts.' parts'); |
[$symb,$env{'request.course.id'},'graded']); |
|
} |
} |
} |
&Apache::lonnet::logthis('found key portfiles '.$key); |
$$record{$key} = join(',',@v_portfiles); |
&Apache::lonnet::logthis('found value portfiles '.$$record{$key}); |
|
} |
} |
} |
} |
|
return 'ok'; |
|
|
} |
} |
|
|
Line 2294 sub viewgrades_js {
|
Line 2406 sub viewgrades_js {
|
function writeRadText(partid,weight) { |
function writeRadText(partid,weight) { |
var selval = document.classgrade["SELVAL_"+partid]; |
var selval = document.classgrade["SELVAL_"+partid]; |
var radioButton = document.classgrade["RADVAL_"+partid]; |
var radioButton = document.classgrade["RADVAL_"+partid]; |
|
var override = document.classgrade["FORCE_"+partid].checked; |
var textbox = document.classgrade["TEXTVAL_"+partid]; |
var textbox = document.classgrade["TEXTVAL_"+partid]; |
if (selval[1].selected || selval[2].selected) { |
if (selval[1].selected || selval[2].selected) { |
for (var i=0; i<radioButton.length; i++) { |
for (var i=0; i<radioButton.length; i++) { |
Line 2307 sub viewgrades_js {
|
Line 2420 sub viewgrades_js {
|
var scorename = document.classgrade["GD_"+user+"_"+partid+"_awarded"]; |
var scorename = document.classgrade["GD_"+user+"_"+partid+"_awarded"]; |
var saveval = document.classgrade["GD_"+user+"_"+partid+"_solved_s"].value; |
var saveval = document.classgrade["GD_"+user+"_"+partid+"_solved_s"].value; |
var selname = document.classgrade["GD_"+user+"_"+partid+"_solved"]; |
var selname = document.classgrade["GD_"+user+"_"+partid+"_solved"]; |
if (saveval != "correct") { |
if ((saveval != "correct") || override) { |
scorename.value = ""; |
scorename.value = ""; |
if (selval[1].selected) { |
if (selval[1].selected) { |
selname[1].selected = true; |
selname[1].selected = true; |
Line 2324 sub viewgrades_js {
|
Line 2437 sub viewgrades_js {
|
var scorename = document.classgrade["GD_"+user+"_"+partid+"_awarded"]; |
var scorename = document.classgrade["GD_"+user+"_"+partid+"_awarded"]; |
var saveval = document.classgrade["GD_"+user+"_"+partid+"_solved_s"].value; |
var saveval = document.classgrade["GD_"+user+"_"+partid+"_solved_s"].value; |
var selname = document.classgrade["GD_"+user+"_"+partid+"_solved"]; |
var selname = document.classgrade["GD_"+user+"_"+partid+"_solved"]; |
if (saveval != "correct") { |
if ((saveval != "correct") || override) { |
scorename.value = document.classgrade["GD_"+user+"_"+partid+"_awarded_s"].value; |
scorename.value = document.classgrade["GD_"+user+"_"+partid+"_awarded_s"].value; |
selname[0].selected = true; |
selname[0].selected = true; |
} |
} |
Line 2361 sub viewgrades_js {
|
Line 2474 sub viewgrades_js {
|
if (selval[2].selected) { |
if (selval[2].selected) { |
document.classgrade["GD_"+user+'_'+partid+"_tries"].value = "0"; |
document.classgrade["GD_"+user+'_'+partid+"_tries"].value = "0"; |
} |
} |
} |
} |
} |
} |
|
|
function resetEntry(numpart) { |
function resetEntry(numpart) { |
Line 2478 sub viewgrades {
|
Line 2591 sub viewgrades {
|
$weight{$partid}.')"> '. |
$weight{$partid}.')"> '. |
'<option selected="on"> </option>'. |
'<option selected="on"> </option>'. |
'<option>excused</option>'. |
'<option>excused</option>'. |
'<option>reset status</option></select></td></tr>'."\n"; |
'<option>reset status</option></select></td>'. |
|
'<td><label><input type="checkbox" name="FORCE_'.$partid.'" /> Override "Correct"</label></td></tr>'."\n"; |
$ctsparts++; |
$ctsparts++; |
} |
} |
$result.='</table>'.'</td></tr></table>'.'</td></tr></table>'."\n". |
$result.='</table>'.'</td></tr></table>'.'</td></tr></table>'."\n". |
Line 2493 sub viewgrades {
|
Line 2607 sub viewgrades {
|
'<table border=0><tr bgcolor="#deffff"><td> <b>No.</b> </td>'. |
'<table border=0><tr bgcolor="#deffff"><td> <b>No.</b> </td>'. |
'<td>'.&nameUserString('header')."</td>\n"; |
'<td>'.&nameUserString('header')."</td>\n"; |
my (@parts) = sort(&getpartlist($url,$symb)); |
my (@parts) = sort(&getpartlist($url,$symb)); |
|
my @partids = (); |
foreach my $part (@parts) { |
foreach my $part (@parts) { |
my $display=&Apache::lonnet::metadata($url,$part.'.display'); |
my $display=&Apache::lonnet::metadata($url,$part.'.display'); |
$display =~ s|^Number of Attempts|Tries<br />|; # makes the column narrower |
$display =~ s|^Number of Attempts|Tries<br />|; # makes the column narrower |
if (!$display) { $display = &Apache::lonnet::metadata($url,$part.'.name'); } |
if (!$display) { $display = &Apache::lonnet::metadata($url,$part.'.name'); } |
my ($partid) = &split_part_type($part); |
my ($partid) = &split_part_type($part); |
|
push(@partids, $partid); |
my $display_part=&get_display_part($partid,$url,$symb); |
my $display_part=&get_display_part($partid,$url,$symb); |
if ($display =~ /^Partial Credit Factor/) { |
if ($display =~ /^Partial Credit Factor/) { |
$result.='<td><b>Score Part:</b> '.$display_part. |
$result.='<td><b>Score Part:</b> '.$display_part. |
Line 2511 sub viewgrades {
|
Line 2627 sub viewgrades {
|
} |
} |
$result.='</tr>'; |
$result.='</tr>'; |
|
|
|
my %last_resets = |
|
&get_last_resets($symb,$env{'request.course.id'},\@partids); |
|
|
#get info for each student |
#get info for each student |
#list all the students - with points and grade status |
#list all the students - with points and grade status |
my (undef,undef,$fullname) = &getclasslist($env{'form.section'},'1'); |
my (undef,undef,$fullname) = &getclasslist($env{'form.section'},'1'); |
Line 2518 sub viewgrades {
|
Line 2637 sub viewgrades {
|
foreach (sort {lc($$fullname{$a}) cmp lc($$fullname{$b}) } keys %$fullname) { |
foreach (sort {lc($$fullname{$a}) cmp lc($$fullname{$b}) } keys %$fullname) { |
$ctr++; |
$ctr++; |
$result.=&viewstudentgrade($url,$symb,$env{'request.course.id'}, |
$result.=&viewstudentgrade($url,$symb,$env{'request.course.id'}, |
$_,$$fullname{$_},\@parts,\%weight,$ctr); |
$_,$$fullname{$_},\@parts,\%weight,$ctr,\%last_resets); |
} |
} |
$result.='</table></td></tr></table>'; |
$result.='</table></td></tr></table>'; |
$result.='<input type="hidden" name="total" value="'.$ctr.'" />'."\n"; |
$result.='<input type="hidden" name="total" value="'.$ctr.'" />'."\n"; |
Line 2535 sub viewgrades {
|
Line 2654 sub viewgrades {
|
|
|
#--- call by previous routine to display each student |
#--- call by previous routine to display each student |
sub viewstudentgrade { |
sub viewstudentgrade { |
my ($url,$symb,$courseid,$student,$fullname,$parts,$weight,$ctr) = @_; |
my ($url,$symb,$courseid,$student,$fullname,$parts,$weight,$ctr,$last_resets) = @_; |
my ($uname,$udom) = split(/:/,$student); |
my ($uname,$udom) = split(/:/,$student); |
$student=~s/:/_/; |
$student=~s/:/_/; |
my %record=&Apache::lonnet::restore($symb,$courseid,$udom,$uname); |
my %record=&Apache::lonnet::restore($symb,$courseid,$udom,$uname); |
|
my %aggregates = (); |
my $result='<tr bgcolor="#ffffdd"><td align="right">'. |
my $result='<tr bgcolor="#ffffdd"><td align="right">'. |
'<input type="hidden" name="ctr'.($ctr-1).'" value="'.$student.'" />'. |
'<input type="hidden" name="ctr'.($ctr-1).'" value="'.$student.'" />'. |
"\n".$ctr.' </td><td> '. |
"\n".$ctr.' </td><td> '. |
Line 2548 sub viewstudentgrade {
|
Line 2668 sub viewstudentgrade {
|
foreach my $apart (@$parts) { |
foreach my $apart (@$parts) { |
my ($part,$type) = &split_part_type($apart); |
my ($part,$type) = &split_part_type($apart); |
my $score=$record{"resource.$part.$type"}; |
my $score=$record{"resource.$part.$type"}; |
$result.='<td align="middle">'; |
$result.='<td align="middle">'; |
|
my ($aggtries,$totaltries); |
|
unless (exists($aggregates{$part})) { |
|
$totaltries = $record{'resource.'.$part.'.tries'}; |
|
|
|
$aggtries = $totaltries; |
|
if ($$last_resets{$part}) { |
|
$aggtries = &get_num_tries(\%record,$$last_resets{$part}, |
|
$part); |
|
} |
|
$result.='<input type="hidden" name="'. |
|
'GD_'.$student.'_'.$part.'_aggtries" value="'.$aggtries.'" />'."\n"; |
|
$result.='<input type="hidden" name="'. |
|
'GD_'.$student.'_'.$part.'_totaltries" value="'.$totaltries.'" />'."\n"; |
|
$aggregates{$part} = 1; |
|
} |
if ($type eq 'awarded') { |
if ($type eq 'awarded') { |
my $pts = $score eq '' ? '' : $score*$$weight{$part}; |
my $pts = $score eq '' ? '' : $score*$$weight{$part}; |
$result.='<input type="hidden" name="'. |
$result.='<input type="hidden" name="'. |
Line 2663 sub editgrades {
|
Line 2798 sub editgrades {
|
$noupdate.=$line."<td colspan=\"$numcols\"><font color=\"red\">Not allowed to modify student</font></td></tr>"; |
$noupdate.=$line."<td colspan=\"$numcols\"><font color=\"red\">Not allowed to modify student</font></td></tr>"; |
next; |
next; |
} |
} |
|
my %aggregate = (); |
|
my $aggregateflag = 0; |
foreach (@partid) { |
foreach (@partid) { |
my $old_aw = $env{'form.GD_'.$user.'_'.$_.'_awarded_s'}; |
my $old_aw = $env{'form.GD_'.$user.'_'.$_.'_awarded_s'}; |
my $old_part_pcr = $old_aw/($weight{$_} ne '0' ? $weight{$_}:1); |
my $old_part_pcr = $old_aw/($weight{$_} ne '0' ? $weight{$_}:1); |
my $old_part = $old_aw eq '' ? '' : $old_part_pcr; |
my $old_part = $old_aw eq '' ? '' : $old_part_pcr; |
my $old_score = $scoreptr{$env{'form.GD_'.$user.'_'.$_.'_solved_s'}}; |
my $old_score = $scoreptr{$env{'form.GD_'.$user.'_'.$_.'_solved_s'}}; |
|
|
my $awarded = $env{'form.GD_'.$user.'_'.$_.'_awarded'}; |
my $awarded = $env{'form.GD_'.$user.'_'.$_.'_awarded'}; |
my $pcr = $awarded/($weight{$_} ne '0' ? $weight{$_} : 1); |
my $pcr = $awarded/($weight{$_} ne '0' ? $weight{$_} : 1); |
my $partial = $awarded eq '' ? '' : $pcr; |
my $partial = $awarded eq '' ? '' : $pcr; |
Line 2691 sub editgrades {
|
Line 2827 sub editgrades {
|
$newrecord{'resource.'.$_.'.awarded'} = 0; |
$newrecord{'resource.'.$_.'.awarded'} = 0; |
$newrecord{'resource.'.$_.'.regrader'}="$env{'user.name'}:$env{'user.domain'}"; |
$newrecord{'resource.'.$_.'.regrader'}="$env{'user.name'}:$env{'user.domain'}"; |
$updateflag = 1; |
$updateflag = 1; |
|
if ($env{'form.GD_'.$user.'_'.$_.'_aggtries'} > 0) { |
|
my $aggtries = $env{'form.GD_'.$user.'_'.$_.'_aggtries'}; |
|
my $totaltries = $env{'form.GD_'.$user.'_'.$_.'_totaltries'}; |
|
my $solvedstatus = $env{'form.GD_'.$user.'_'.$_.'_solved_s'}; |
|
&decrement_aggs($symb,$_,\%aggregate,$aggtries,$totaltries,$solvedstatus); |
|
$aggregateflag = 1; |
|
} |
} elsif (!($old_part eq $partial && $old_score eq $score)) { |
} elsif (!($old_part eq $partial && $old_score eq $score)) { |
$updateflag = 1; |
$updateflag = 1; |
$newrecord{'resource.'.$_.'.awarded'} = $partial if $partial ne ''; |
$newrecord{'resource.'.$_.'.awarded'} = $partial if $partial ne ''; |
Line 2730 sub editgrades {
|
Line 2873 sub editgrades {
|
$noupdate.='<tr bgcolor="#ffffde"><td align="right"> '.$noupdateCtr.' </td>'.$line; |
$noupdate.='<tr bgcolor="#ffffde"><td align="right"> '.$noupdateCtr.' </td>'.$line; |
$noupdateCtr++; |
$noupdateCtr++; |
} |
} |
|
if ($aggregateflag) { |
|
&Apache::lonnet::cinc('nohist_resourcetracker',\%aggregate, |
|
$env{'course.'.$env{'request.course.id'}.'.domain'}, |
|
$env{'course.'.$env{'request.course.id'}.'.num'}); |
|
} |
} |
} |
if ($noupdate) { |
if ($noupdate) { |
# my $numcols=(scalar(@partid)*(scalar(@parts)-1)*2)+3; |
# my $numcols=(scalar(@partid)*(scalar(@parts)-1)*2)+3; |
Line 3550 sub updateGradeByPage {
|
Line 3698 sub updateGradeByPage {
|
|
|
my %newrecord=(); |
my %newrecord=(); |
my @displayPts=(); |
my @displayPts=(); |
|
my %aggregate = (); |
|
my $aggregateflag = 0; |
foreach my $partid (@{$parts}) { |
foreach my $partid (@{$parts}) { |
my $newpts = $env{'form.GD_BOX'.$question.'_'.$partid}; |
my $newpts = $env{'form.GD_BOX'.$question.'_'.$partid}; |
my $oldpts = $env{'form.oldpts'.$question.'_'.$partid}; |
my $oldpts = $env{'form.oldpts'.$question.'_'.$partid}; |
Line 3576 sub updateGradeByPage {
|
Line 3726 sub updateGradeByPage {
|
$newrecord{'resource.'.$partid.'.regrader'} = "$env{'user.name'}:$env{'user.domain'}"; |
$newrecord{'resource.'.$partid.'.regrader'} = "$env{'user.name'}:$env{'user.domain'}"; |
$changeflag++; |
$changeflag++; |
$newpts = ''; |
$newpts = ''; |
|
|
|
my $aggtries = $env{'form.aggtries'.$question.'_'.$partid}; |
|
my $totaltries = $env{'form.totaltries'.$question.'_'.$partid}; |
|
my $solvedstatus = $env{'form.solved'.$question.'_'.$partid}; |
|
if ($aggtries > 0) { |
|
&decrement_aggs($symbx,$partid,\%aggregate,$aggtries,$totaltries,$solvedstatus); |
|
$aggregateflag = 1; |
|
} |
} |
} |
my $display_part=&get_display_part($partid,undef, |
my $display_part=&get_display_part($partid,undef, |
$curRes->symb()); |
$curRes->symb()); |
Line 3601 sub updateGradeByPage {
|
Line 3759 sub updateGradeByPage {
|
&Apache::lonnet::cstore(\%newrecord,$symbx,$env{'request.course.id'}, |
&Apache::lonnet::cstore(\%newrecord,$symbx,$env{'request.course.id'}, |
$udom,$uname); |
$udom,$uname); |
} |
} |
|
if ($aggregateflag) { |
|
&Apache::lonnet::cinc('nohist_resourcetracker',\%aggregate, |
|
$env{'course.'.$env{'request.course.id'}.'.domain'}, |
|
$env{'course.'.$env{'request.course.id'}.'.num'}); |
|
} |
|
|
$studentTable.='<td valign="top">'.$displayPts[0].'</td>'. |
$studentTable.='<td valign="top">'.$displayPts[0].'</td>'. |
'<td valign="top">'.$displayPts[1].'</td>'. |
'<td valign="top">'.$displayPts[1].'</td>'. |
Line 3710 sub scantron_CODElist {
|
Line 3873 sub scantron_CODElist {
|
|
|
sub scantron_CODEunique { |
sub scantron_CODEunique { |
my $result='<nobr> |
my $result='<nobr> |
<input type="radio" name="scantron_CODEunique" |
<label><input type="radio" name="scantron_CODEunique" |
value="Yes" checked="on" /> Yes |
value="Yes" checked="on" /> Yes </label> |
</nobr> |
</nobr> |
<nobr> |
<nobr> |
<input type="radio" name="scantron_CODEunique" |
<label><input type="radio" name="scantron_CODEunique" |
value="No" /> No |
value="No" /> No </label> |
</nobr>'; |
</nobr>'; |
return $result; |
return $result; |
} |
} |
Line 3765 sub scantron_selectphase {
|
Line 3928 sub scantron_selectphase {
|
<tr bgcolor="#ffffe6"> |
<tr bgcolor="#ffffe6"> |
<td> Options: </td> |
<td> Options: </td> |
<td> |
<td> |
<input type="checkbox" name="scantron_options_redo" value="redo_skipped"/> Do only previously skipped records <br /> |
<label><input type="checkbox" name="scantron_options_redo" value="redo_skipped"/> Do only previously skipped records</label> <br /> |
<input type="checkbox" name="scantron_options_ignore" value="ignore_corrections"/> Remove all exisiting corrections |
<label><input type="checkbox" name="scantron_options_ignore" value="ignore_corrections"/> Remove all exisiting corrections</label> |
</td> |
</td> |
</tr> |
</tr> |
<tr bgcolor="#ffffe6"> |
<tr bgcolor="#ffffe6"> |
<td colspan="2"> |
<td colspan="2"> |
<input type="submit" value="Validate Scantron Records" /> |
<input type="submit" value="Grading: Validate Scantron Records" /> |
</td> |
</td> |
</tr> |
</tr> |
</table> |
</table> |
Line 4226 sub scantron_do_warning {
|
Line 4389 sub scantron_do_warning {
|
$r->print('<p><font color="red">You have not selected a the format of the student\'s response data.</font></p>'); |
$r->print('<p><font color="red">You have not selected a the format of the student\'s response data.</font></p>'); |
} |
} |
} else { |
} else { |
my $warning=&scantron_warning_screen('Validate Records'); |
my $warning=&scantron_warning_screen('Grading: Validate Records'); |
$r->print(<<STUFF); |
$r->print(<<STUFF); |
$warning |
$warning |
<input type="submit" name="submit" value="Validate Records" /> |
<input type="submit" name="submit" value="Grading: Validate Records" /> |
<input type="hidden" name="command" value="scantron_validate" /> |
<input type="hidden" name="command" value="scantron_validate" /> |
STUFF |
STUFF |
} |
} |
Line 4577 sub scantron_get_correction {
|
Line 4740 sub scantron_get_correction {
|
foreach my $testcode (@{$closest}) { |
foreach my $testcode (@{$closest}) { |
my $checked=''; |
my $checked=''; |
if (!$i) { $checked=' checked="on" '; } |
if (!$i) { $checked=' checked="on" '; } |
$r->print("<input type='radio' name='scantron_CODE_resolution' value='use_closest_$i' $checked /> Use the similar CODE <b><tt>".$testcode."</tt></b> instead.<input type='hidden' name='scantron_CODE_closest_$i' value='$testcode' />"); |
$r->print("<label><input type='radio' name='scantron_CODE_resolution' value='use_closest_$i' $checked /> Use the similar CODE <b><tt>".$testcode."</tt></b> instead.</label><input type='hidden' name='scantron_CODE_closest_$i' value='$testcode' />"); |
$r->print("\n<br />"); |
$r->print("\n<br />"); |
$i++; |
$i++; |
} |
} |
} |
} |
my $checked; if (!$i) { $checked=' checked="on" '; } |
my $checked; if (!$i) { $checked=' checked="on" '; } |
$r->print("<input type='radio' name='scantron_CODE_resolution' value='use_unfound' $checked /> Use the CODE <b><tt>".$$scan_record{'scantron.CODE'}."</tt></b> that is was on the paper, ignoring the error."); |
$r->print("<label><input type='radio' name='scantron_CODE_resolution' value='use_unfound' $checked /> Use the CODE <b><tt>".$$scan_record{'scantron.CODE'}."</tt></b> that is was on the paper, ignoring the error.</label>"); |
$r->print("\n<br />"); |
$r->print("\n<br />"); |
|
|
$r->print(<<ENDSCRIPT); |
$r->print(<<ENDSCRIPT); |
Line 4603 ENDSCRIPT
|
Line 4766 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("<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. 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("<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("\n<br />"); |
$r->print("<input type='radio' name='scantron_CODE_resolution' value='use_typed' /> Use <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') { |
$r->print("<p>There have been multiple bubbles scanned for a some question(s)</p>\n"); |
$r->print("<p>There have been multiple bubbles scanned for a some question(s)</p>\n"); |
Line 4648 sub scantron_bubble_selector {
|
Line 4811 sub scantron_bubble_selector {
|
} |
} |
$r->print('<td></td></tr><tr>'); |
$r->print('<td></td></tr><tr>'); |
for (my $i=0;$i<$max;$i++) { |
for (my $i=0;$i<$max;$i++) { |
$r->print('<td><input type="radio" name="scantron_correct_Q_'.$quest. |
$r->print('<td><label><input type="radio" name="scantron_correct_Q_'. |
'" value="'.$i.'" />'.$alphabet[$i]."</td>"); |
$quest.'" value="'.$i.'" />'.$alphabet[$i]."</label></td>"); |
} |
} |
$r->print('<td><input type="radio" name="scantron_correct_Q_'.$quest. |
$r->print('<td><label><input type="radio" name="scantron_correct_Q_'. |
'" value="none" /> No bubble </td>'); |
$quest.'" value="none" /> No bubble </label></td>'); |
$r->print('</tr></table>'); |
$r->print('</tr></table>'); |
} |
} |
|
|