version 1.264, 2005/04/29 17:02:06
|
version 1.293, 2005/10/30 02:40:09
|
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 328 COMMONJSFUNCTIONS
|
Line 334 COMMONJSFUNCTIONS
|
#--- section, ids and fullnames for each user. |
#--- section, ids and fullnames for each user. |
sub getclasslist { |
sub getclasslist { |
my ($getsec,$filterlist) = @_; |
my ($getsec,$filterlist) = @_; |
$getsec = $getsec eq '' ? 'all' : $getsec; |
my @getsec; |
|
if (!ref($getsec)) { |
|
if ($getsec ne '' && $getsec ne 'all') { |
|
@getsec=($getsec); |
|
} |
|
} else { |
|
@getsec=@{$getsec}; |
|
} |
|
if (grep(/^all$/,@getsec)) { undef(@getsec); } |
|
|
my $classlist=&Apache::loncoursedata::get_classlist(); |
my $classlist=&Apache::loncoursedata::get_classlist(); |
# Bail out if we were unable to get the classlist |
# Bail out if we were unable to get the classlist |
return if (! defined($classlist)); |
return if (! defined($classlist)); |
Line 357 sub getclasslist {
|
Line 372 sub getclasslist {
|
} |
} |
$section = ($section ne '' ? $section : 'none'); |
$section = ($section ne '' ? $section : 'none'); |
if (&canview($section)) { |
if (&canview($section)) { |
if ($getsec eq 'all' || $getsec eq $section) { |
if (!@getsec || grep(/^\Q$section\E$/,@getsec)) { |
$sections{$section}++; |
$sections{$section}++; |
$fullnames{$student}=$fullname; |
$fullnames{$student}=$fullname; |
} else { |
} else { |
Line 465 sub most_similar {
|
Line 480 sub most_similar {
|
|
|
$uessay=~s/\W+/ /gs; |
$uessay=~s/\W+/ /gs; |
|
|
|
# ignore empty submissions (occuring when only files are sent) |
|
|
|
unless ($uessay=~/\w+/) { return ''; } |
|
|
# these will be returned. Do not care if not at least 50 percent similar |
# these will be returned. Do not care if not at least 50 percent similar |
my $limit=0.6; |
my $limit=0.6; |
my $sname=''; |
my $sname=''; |
Line 626 LISTJAVASCRIPT
|
Line 645 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 690 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 737 LISTJAVASCRIPT
|
Line 756 LISTJAVASCRIPT
|
if ($env{'form.showgrading'} eq 'yes' && $submitonly ne 'all') { |
if ($env{'form.showgrading'} eq 'yes' && $submitonly ne 'all') { |
foreach (sort keys(%status)) { |
foreach (sort keys(%status)) { |
next if (/^resource.*?submitted_by$/); |
next if (/^resource.*?submitted_by$/); |
$gradeTable.='<td align="middle"> '.$status{$_}.' </td>'."\n"; |
$gradeTable.='<td align="center"> '.$status{$_}.' </td>'."\n"; |
} |
} |
} |
} |
# $gradeTable.='<td></td>' if ($ctr%2 ==1); |
# $gradeTable.='<td></td>' if ($ctr%2 ==1); |
Line 1346 sub gradeBox {
|
Line 1365 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"; |
|
|
my $ctr = 0; |
my $ctr = 0; |
$result.='<table border="0"><tr>'."\n"; # display radio buttons in a nice table 10 across |
$result.='<table border="0"><tr>'."\n"; # display radio buttons in a nice table 10 across |
while ($ctr<=$wgt) { |
while ($ctr<=$wgt) { |
$result.= '<td><nobr><input type="radio" name="RADVAL'.$counter.'_'.$partid.'" '. |
$result.= '<td><nobr><label><input type="radio" name="RADVAL'.$counter.'_'.$partid.'" '. |
'onclick="javascript:writeBox(this.form,\''.$counter.'_'.$partid.'\','. |
'onclick="javascript:writeBox(this.form,\''.$counter.'_'.$partid.'\','. |
$ctr.')" value="'.$ctr.'" '. |
$ctr.')" value="'.$ctr.'" '. |
($score eq $ctr ? 'checked':'').' /> '.$ctr."</nobr></td>\n"; |
($score eq $ctr ? 'checked':'').' /> '.$ctr."</label></nobr></td>\n"; |
$result.=(($ctr+1)%10 == 0 ? '</tr><tr>' : ''); |
$result.=(($ctr+1)%10 == 0 ? '</tr><tr>' : ''); |
$ctr++; |
$ctr++; |
} |
} |
Line 1384 sub gradeBox {
|
Line 1411 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 1624 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 2117 sub saveHandGrade {
|
Line 2147 sub saveHandGrade {
|
my @parts_graded; |
my @parts_graded; |
my %newrecord = (); |
my %newrecord = (); |
my ($pts,$wgt) = ('',''); |
my ($pts,$wgt) = ('',''); |
|
my %aggregate = (); |
|
my $aggregateflag = 0; |
foreach my $new_part (split(/:/,$env{'form.partlist'.$newflg})) { |
foreach my $new_part (split(/:/,$env{'form.partlist'.$newflg})) { |
#collaborator may vary for different parts |
#collaborator may vary for different parts |
if ($submitter && $new_part ne $part) { next; } |
if ($submitter && $new_part ne $part) { next; } |
Line 2136 sub saveHandGrade {
|
Line 2168 sub saveHandGrade {
|
} |
} |
$newrecord{'resource.'.$new_part.'.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.'_'.$new_part} ne '' ? |
$pts = ($env{'form.GD_BOX'.$newflg.'_'.$new_part} ne '' ? |
$env{'form.GD_BOX'.$newflg.'_'.$new_part} : |
$env{'form.GD_BOX'.$newflg.'_'.$new_part} : |
Line 2184 sub saveHandGrade {
|
Line 2231 sub saveHandGrade {
|
&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, $v_flag) = @_; |
my ($record, $parts_graded, $courseid, $symb, $domain, $stuname, $v_flag) = @_; |
Line 2195 sub version_portfiles {
|
Line 2306 sub version_portfiles {
|
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)) { |
my $new_portfiles; |
my $new_portfiles; |
|
|
if ($key =~ /^resource\.($version_parts)\./ && $key =~ /\.portfiles$/ ) { |
if ($key =~ /^resource\.($version_parts)\./ && $key =~ /\.portfiles$/ ) { |
my @v_portfiles; |
my @v_portfiles; |
my @portfiles = split(/,/,$$record{$key}); |
my @portfiles = split(/,/,$$record{$key}); |
# &Apache::lonnet::logthis("should be unmarking and remarking"); |
&Apache::lonnet::logthis("should be unmarking and remarking $key",@portfiles); |
foreach my $file (@portfiles) { |
foreach my $file (@portfiles) { |
&Apache::lonnet::unmark_as_readonly($domain,$stuname,[$symb,$env{'request.course.id'}],$file); |
&Apache::lonnet::unmark_as_readonly($domain,$stuname,[$symb,$env{'request.course.id'}],$file); |
my ($directory,$answer_file) =($file =~ /^(.*?)([^\/]*$)/); |
my ($directory,$answer_file) =($file =~ /^(.*?)([^\/]*$)/); |
Line 2223 sub version_portfiles {
|
Line 2335 sub version_portfiles {
|
} |
} |
} |
} |
$version++; |
$version++; |
my $home_server = &Apache::lonnet::homeserver($stuname,$domain,undef); |
|
$env{'form.copy'} = &Apache::lonnet::getfile("/uploaded/$domain/$stuname/portfolio$directory$answer_file"); |
$env{'form.copy'} = &Apache::lonnet::getfile("/uploaded/$domain/$stuname/portfolio$directory$answer_file"); |
if($env{'form.copy'} eq '-1') { |
if($env{'form.copy'} eq '-1') { |
&Apache::lonnet::logthis('problem getting file '.$directory.$answer_file); |
&Apache::lonnet::logthis('problem getting file '.$directory.$answer_file); |
} else { |
} else { |
my $copy_result = &Apache::lonnet::finishuserfileupload($stuname,$domain,$home_server,'copy', |
my $copy_result = &Apache::lonnet::finishuserfileupload($stuname,$domain,'copy', |
'/portfolio'.$directory.$answer_file_parts[0].'.'.$version.'.'.$answer_file_parts[-1]); |
'/portfolio'.$directory.$answer_file_parts[0].'.'.$version.'.'.$answer_file_parts[-1]); |
push(@v_portfiles, $answer_file_parts[0].'.'.$version.'.'.$answer_file_parts[-1]); |
push(@v_portfiles, $directory.$answer_file_parts[0].'.'.$version.'.'.$answer_file_parts[-1]); |
&Apache::lonnet::mark_as_readonly($domain,$stuname, |
&Apache::lonnet::mark_as_readonly($domain,$stuname, |
['/portfolio'.$directory.$answer_file_parts[0].'.'.$version.'.'.$answer_file_parts[-1]], |
['/portfolio'.$directory.$answer_file_parts[0].'.'.$version.'.'.$answer_file_parts[-1]], |
[$symb,$env{'request.course.id'},'graded']); |
[$symb,$env{'request.course.id'},'graded']); |
Line 2292 sub viewgrades_js {
|
Line 2403 sub viewgrades_js {
|
} |
} |
for (i=0;i<document.classgrade.total.value;i++) { |
for (i=0;i<document.classgrade.total.value;i++) { |
var user = document.classgrade["ctr"+i].value; |
var user = document.classgrade["ctr"+i].value; |
|
user = user.replace(new RegExp(':', 'g'),"_"); |
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"]; |
Line 2308 sub viewgrades_js {
|
Line 2420 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 2318 sub viewgrades_js {
|
Line 2431 sub viewgrades_js {
|
|
|
for (i=0;i<document.classgrade.total.value;i++) { |
for (i=0;i<document.classgrade.total.value;i++) { |
var user = document.classgrade["ctr"+i].value; |
var user = document.classgrade["ctr"+i].value; |
|
user = user.replace(new RegExp(':', 'g'),"_"); |
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 2335 sub viewgrades_js {
|
Line 2449 sub viewgrades_js {
|
} else { |
} else { |
for (i=0;i<document.classgrade.total.value;i++) { |
for (i=0;i<document.classgrade.total.value;i++) { |
var user = document.classgrade["ctr"+i].value; |
var user = document.classgrade["ctr"+i].value; |
|
user = user.replace(new RegExp(':', 'g'),"_"); |
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 2375 sub viewgrades_js {
|
Line 2490 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 2393 sub viewgrades_js {
|
Line 2508 sub viewgrades_js {
|
|
|
for (i=0;i<document.classgrade.total.value;i++) { |
for (i=0;i<document.classgrade.total.value;i++) { |
var user = document.classgrade["ctr"+i].value; |
var user = document.classgrade["ctr"+i].value; |
|
user = user.replace(new RegExp(':', 'g'),"_"); |
var resetscore = document.classgrade["GD_"+user+"_"+partid+"_awarded"]; |
var resetscore = document.classgrade["GD_"+user+"_"+partid+"_awarded"]; |
resetscore.value = document.classgrade["GD_"+user+"_"+partid+"_awarded_s"].value; |
resetscore.value = document.classgrade["GD_"+user+"_"+partid+"_awarded_s"].value; |
var resettries = document.classgrade["GD_"+user+"_"+partid+"_tries"]; |
var resettries = document.classgrade["GD_"+user+"_"+partid+"_tries"]; |
Line 2476 sub viewgrades {
|
Line 2592 sub viewgrades {
|
$result.='<table border="0"><tr>'; |
$result.='<table border="0"><tr>'; |
my $ctr = 0; |
my $ctr = 0; |
while ($ctr<=$weight{$partid}) { # display radio buttons in a nice table 10 across |
while ($ctr<=$weight{$partid}) { # display radio buttons in a nice table 10 across |
$result.= '<td><input type="radio" name="RADVAL_'.$partid.'" '. |
$result.= '<td><label><input type="radio" name="RADVAL_'.$partid.'" '. |
'onclick="javascript:writePoint(\''.$partid.'\','.$weight{$partid}. |
'onclick="javascript:writePoint(\''.$partid.'\','.$weight{$partid}. |
','.$ctr.')" />'.$ctr."</td>\n"; |
','.$ctr.')" />'.$ctr."</label></td>\n"; |
$result.=(($ctr+1)%10 == 0 ? '</tr><tr>' : ''); |
$result.=(($ctr+1)%10 == 0 ? '</tr><tr>' : ''); |
$ctr++; |
$ctr++; |
} |
} |
Line 2492 sub viewgrades {
|
Line 2608 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 2507 sub viewgrades {
|
Line 2624 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 2525 sub viewgrades {
|
Line 2644 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 2532 sub viewgrades {
|
Line 2654 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 2549 sub viewgrades {
|
Line 2671 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/:/_/; |
|
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> '. |
'<a href="javascript:viewOneStudent(\''.$uname.'\',\''.$udom. |
'<a href="javascript:viewOneStudent(\''.$uname.'\',\''.$udom. |
'\')"; TARGET=_self>'.$fullname.'</a> '. |
'\')"; TARGET=_self>'.$fullname.'</a> '. |
'<font color="#999999">('.$uname.($env{'user.domain'} eq $udom ? '' : ':'.$udom).')</font></td>'."\n"; |
'<font color="#999999">('.$uname.($env{'user.domain'} eq $udom ? '' : ':'.$udom).')</font></td>'."\n"; |
|
$student=~s/:/_/; # colon doen't work in javascript for names |
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="center">'; |
|
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 2665 sub editgrades {
|
Line 2803 sub editgrades {
|
for ($i=0; $i<$env{'form.total'}; $i++) { |
for ($i=0; $i<$env{'form.total'}; $i++) { |
my $line; |
my $line; |
my $user = $env{'form.ctr'.$i}; |
my $user = $env{'form.ctr'.$i}; |
my $usercolon = $user; |
my ($uname,$udom)=split(/:/,$user); |
$usercolon =~s/_/:/; |
|
my ($uname,$udom)=split(/_/,$user); |
|
my %newrecord; |
my %newrecord; |
my $updateflag = 0; |
my $updateflag = 0; |
$line .= '<td>'.&nameUserString(undef,$$fullname{$usercolon},$uname,$udom).'</td>'; |
$line .= '<td>'.&nameUserString(undef,$$fullname{$user},$uname,$udom).'</td>'; |
my $usec=$classlist->{"$uname:$udom"}[5]; |
my $usec=$classlist->{"$uname:$udom"}[5]; |
if (!&canmodify($usec)) { |
if (!&canmodify($usec)) { |
my $numcols=scalar(@partid)*4+2; |
my $numcols=scalar(@partid)*4+2; |
$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; |
|
$user=~s/:/_/; # colon doen't work in javascript for names |
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 2697 sub editgrades {
|
Line 2835 sub editgrades {
|
my $dropMenu = $env{'form.GD_'.$user.'_'.$_.'_solved'}; |
my $dropMenu = $env{'form.GD_'.$user.'_'.$_.'_solved'}; |
$score = 'excused' if (($dropMenu eq 'excused') && ($score ne 'excused')); |
$score = 'excused' if (($dropMenu eq 'excused') && ($score ne 'excused')); |
|
|
|
$newrecord{'resource.'.$_.'.regrader'}= |
|
"$env{'user.name'}:$env{'user.domain'}"; |
if ($dropMenu eq 'reset status' && |
if ($dropMenu eq 'reset status' && |
$old_score ne '') { # ignore if no previous attempts => nothing to reset |
$old_score ne '') { # ignore if no previous attempts => nothing to reset |
$newrecord{'resource.'.$_.'.tries'} = 0; |
$newrecord{'resource.'.$_.'.tries'} = 0; |
$newrecord{'resource.'.$_.'.solved'} = ''; |
$newrecord{'resource.'.$_.'.solved'} = ''; |
$newrecord{'resource.'.$_.'.award'} = ''; |
$newrecord{'resource.'.$_.'.award'} = ''; |
$newrecord{'resource.'.$_.'.awarded'} = 0; |
$newrecord{'resource.'.$_.'.awarded'} = 0; |
$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 2744 sub editgrades {
|
Line 2890 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 2928 sub csvuploadmap_footer {
|
Line 3079 sub csvuploadmap_footer {
|
ENDPICK |
ENDPICK |
} |
} |
|
|
sub upcsvScores_form { |
sub checkforfile_js { |
my ($request) = shift; |
|
my ($symb,$url)=&get_symb_and_url($request); |
|
if (!$symb) {return '';} |
|
my $result =<<CSVFORMJS; |
my $result =<<CSVFORMJS; |
<script type="text/javascript" language="javascript"> |
<script type="text/javascript" language="javascript"> |
function checkUpload(formname) { |
function checkUpload(formname) { |
Line 2943 sub upcsvScores_form {
|
Line 3091 sub upcsvScores_form {
|
} |
} |
</script> |
</script> |
CSVFORMJS |
CSVFORMJS |
|
return $result; |
|
} |
|
|
|
sub upcsvScores_form { |
|
my ($request) = shift; |
|
my ($symb,$url)=&get_symb_and_url($request); |
|
if (!$symb) {return '';} |
|
my $result=&checkforfile_js(); |
$env{'form.probTitle'} = &Apache::lonnet::gettitle($symb); |
$env{'form.probTitle'} = &Apache::lonnet::gettitle($symb); |
my ($table) = &showResourceInfo($url,$env{'form.probTitle'}); |
my ($table) = &showResourceInfo($url,$env{'form.probTitle'}); |
$result.=$table; |
$result.=$table; |
Line 2962 CSVFORMJS
|
Line 3118 CSVFORMJS
|
<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 Scores" /> |
<label><input type="checkbox" name="noFirstLine" />$ignore</lable> |
<label><input type="checkbox" name="noFirstLine" />$ignore</label> |
</form> |
</form> |
ENDUPFORM |
ENDUPFORM |
$result.='</td></tr></table>'."\n"; |
$result.='</td></tr></table>'."\n"; |
Line 3020 sub csvuploadoptions {
|
Line 3176 sub csvuploadoptions {
|
<form method="post" enctype="multipart/form-data" action="/adm/grades" name="gradesupload"> |
<form method="post" enctype="multipart/form-data" action="/adm/grades" name="gradesupload"> |
<h3><font color="#339933">Uploading Class Grade Options</font></h3> |
<h3><font color="#339933">Uploading Class Grade Options</font></h3> |
<input type="hidden" name="command" value="csvuploadassign" /> |
<input type="hidden" name="command" value="csvuploadassign" /> |
<input type="submit" value="Assign Grades" /><br /> |
|
<p> |
<p> |
<label> |
<label> |
<input type="checkbox" name="show_full_results" /> |
<input type="checkbox" name="show_full_results" /> |
Line 3048 ENDPICK
|
Line 3203 ENDPICK
|
} |
} |
# FIXME do a check for any duplicated user ids... |
# FIXME do a check for any duplicated user ids... |
# FIXME do a check for any invalid user ids?... |
# FIXME do a check for any invalid user ids?... |
$request->print("<hr /></form>\n"); |
$request->print('<input type="submit" value="Assign Grades" /><br /> |
|
<hr /></form>'."\n"); |
$request->print(&show_grading_menu_form($symb,$url)); |
$request->print(&show_grading_menu_form($symb,$url)); |
return ''; |
return ''; |
} |
} |
Line 3223 LISTJAVASCRIPT
|
Line 3379 LISTJAVASCRIPT
|
$result.='<input type="hidden" name="page" />'."\n". |
$result.='<input type="hidden" name="page" />'."\n". |
'<input type="hidden" name="title" />'."\n"; |
'<input type="hidden" name="title" />'."\n"; |
|
|
$result.=' <b>View Problems Text: </b><input type="radio" name="vProb" value="no" checked="on" /> no '."\n". |
$result.=' <b>View Problems Text: </b><label><input type="radio" name="vProb" value="no" checked="on" /> no </label>'."\n". |
'<input type="radio" name="vProb" value="yes" /> yes '."<br>\n"; |
'<label><input type="radio" name="vProb" value="yes" /> yes </label>'."<br />\n"; |
|
|
$result.=' <b>Submission Details: </b>'. |
$result.=' <b>Submission Details: </b>'. |
'<input type="radio" name="lastSub" value="none" /> none'."\n". |
'<label><input type="radio" name="lastSub" value="none" /> none</label>'."\n". |
'<input type="radio" name="lastSub" value="datesub" checked /> by dates and submissions'."\n". |
'<label><input type="radio" name="lastSub" value="datesub" checked /> 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"; |
|
|
$result.='<input type="hidden" name="section" value="'.$getsec.'" />'."\n". |
$result.='<input type="hidden" name="section" value="'.$getsec.'" />'."\n". |
'<input type="hidden" name="Status" value="'.$env{'form.Status'}.'" />'."\n". |
'<input type="hidden" name="Status" value="'.$env{'form.Status'}.'" />'."\n". |
Line 3257 LISTJAVASCRIPT
|
Line 3413 LISTJAVASCRIPT
|
my ($uname,$udom) = split(/:/,$student); |
my ($uname,$udom) = split(/:/,$student); |
$studentTable.=($ptr%2 == 1 ? '<tr bgcolor="#ffffe6">' : '</td>'); |
$studentTable.=($ptr%2 == 1 ? '<tr bgcolor="#ffffe6">' : '</td>'); |
$studentTable.='<td align="right">'.$ptr.' </td>'; |
$studentTable.='<td align="right">'.$ptr.' </td>'; |
$studentTable.='<td> <input type="radio" name="student" value="'.$student.'" /> ' |
$studentTable.='<td> <label><input type="radio" name="student" value="'.$student.'" /> ' |
.&nameUserString(undef,$$fullname{$student},$uname,$udom)."\n"; |
.&nameUserString(undef,$$fullname{$student},$uname,$udom)."</label>\n"; |
$studentTable.=($ptr%2 == 0 ? '</td></tr>' : ''); |
$studentTable.=($ptr%2 == 0 ? '</td></tr>' : ''); |
$ptr++; |
$ptr++; |
} |
} |
Line 3330 sub displayPage {
|
Line 3486 sub displayPage {
|
my $navmap = Apache::lonnavmaps::navmap->new(); |
my $navmap = Apache::lonnavmaps::navmap->new(); |
my ($mapUrl, $id, $resUrl)=&Apache::lonnet::decode_symb($env{'form.page'}); |
my ($mapUrl, $id, $resUrl)=&Apache::lonnet::decode_symb($env{'form.page'}); |
my $map = $navmap->getResourceByUrl($resUrl); # add to navmaps |
my $map = $navmap->getResourceByUrl($resUrl); # add to navmaps |
|
if (!$map) { |
|
$request->print('<font color="red">Unable to view requested sequence. ('.$resUrl.')</font>'); |
|
$request->print(&show_grading_menu_form($symb,$url)); |
|
return; |
|
} |
my $iterator = $navmap->getIterator($map->map_start(), |
my $iterator = $navmap->getIterator($map->map_start(), |
$map->map_finish()); |
$map->map_finish()); |
|
|
Line 3536 sub updateGradeByPage {
|
Line 3696 sub updateGradeByPage {
|
my $navmap = Apache::lonnavmaps::navmap->new(); |
my $navmap = Apache::lonnavmaps::navmap->new(); |
my ($mapUrl, $id, $resUrl) = &Apache::lonnet::decode_symb( $env{'form.page'}); |
my ($mapUrl, $id, $resUrl) = &Apache::lonnet::decode_symb( $env{'form.page'}); |
my $map = $navmap->getResourceByUrl($resUrl); # add to navmaps |
my $map = $navmap->getResourceByUrl($resUrl); # add to navmaps |
|
if (!$map) { |
|
$request->print('<font color="red">Unable to grade requested sequence. ('.$resUrl.')</font>'); |
|
my ($symb,$url)=&get_symb_and_url($request); |
|
$request->print(&show_grading_menu_form($symb,$url)); |
|
return; |
|
} |
my $iterator = $navmap->getIterator($map->map_start(), |
my $iterator = $navmap->getIterator($map->map_start(), |
$map->map_finish()); |
$map->map_finish()); |
|
|
Line 3564 sub updateGradeByPage {
|
Line 3729 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 3590 sub updateGradeByPage {
|
Line 3757 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 3615 sub updateGradeByPage {
|
Line 3790 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 3716 sub scantron_CODElist {
|
Line 3896 sub scantron_CODElist {
|
my $namechoice='<option></option>'; |
my $namechoice='<option></option>'; |
foreach my $name (sort {uc($a) cmp uc($b)} @names) { |
foreach my $name (sort {uc($a) cmp uc($b)} @names) { |
if ($name =~ /^error: 2 /) { next; } |
if ($name =~ /^error: 2 /) { next; } |
|
if ($name =~ /^type\0/) { next; } |
$namechoice.='<option value="'.$name.'">'.$name.'</option>'; |
$namechoice.='<option value="'.$name.'">'.$name.'</option>'; |
} |
} |
$namechoice='<select name="scantron_CODElist">'.$namechoice.'</select>'; |
$namechoice='<select name="scantron_CODElist">'.$namechoice.'</select>'; |
Line 3724 sub scantron_CODElist {
|
Line 3905 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 3779 sub scantron_selectphase {
|
Line 3960 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 3860 SCANTRONFORM
|
Line 4041 SCANTRONFORM
|
</tr> |
</tr> |
<tr bgcolor="#ffffe6"> |
<tr bgcolor="#ffffe6"> |
<td colspan="2"> |
<td colspan="2"> |
<input type="submit" value="Show List of Files" /> |
<input type="submit" value="Download: Show List of Associated Files" /> |
</td> |
</td> |
</tr> |
</tr> |
</table> |
</table> |
Line 3959 sub scantron_fixup_scanline {
|
Line 4140 sub scantron_fixup_scanline {
|
&scan_data($scan_data, |
&scan_data($scan_data, |
"$whichline.no_bubble.".$args->{'question'},'1'); |
"$whichline.no_bubble.".$args->{'question'},'1'); |
} else { |
} else { |
substr($answer,$args->{'response'},1)=$on; |
if ($on eq 'letter') { |
|
my @alphabet=('A'..'Z'); |
|
$answer=$alphabet[$args->{'response'}]; |
|
} elsif ($on eq 'number') { |
|
$answer=$args->{'response'}+1; |
|
} else { |
|
substr($answer,$args->{'response'},1)=$on; |
|
} |
&scan_data($scan_data, |
&scan_data($scan_data, |
"$whichline.no_bubble.".$args->{'question'},undef,'1'); |
"$whichline.no_bubble.".$args->{'question'},undef,'1'); |
} |
} |
Line 3984 sub scantron_parse_scanline {
|
Line 4172 sub scantron_parse_scanline {
|
my %record; |
my %record; |
my $questions=substr($line,$$scantron_config{'Qstart'}-1); |
my $questions=substr($line,$$scantron_config{'Qstart'}-1); |
my $data=substr($line,0,$$scantron_config{'Qstart'}-1); |
my $data=substr($line,0,$$scantron_config{'Qstart'}-1); |
if ($$scantron_config{'CODElocation'} ne 0) { |
if (!($$scantron_config{'CODElocation'} eq 0 || |
if ($$scantron_config{'CODElocation'} < 0) { |
$$scantron_config{'CODElocation'} eq 'none')) { |
|
if ($$scantron_config{'CODElocation'} < 0 || |
|
$$scantron_config{'CODElocation'} eq 'letter' || |
|
$$scantron_config{'CODElocation'} eq 'number') { |
$record{'scantron.CODE'}=substr($data, |
$record{'scantron.CODE'}=substr($data, |
$$scantron_config{'CODEstart'}-1, |
$$scantron_config{'CODEstart'}-1, |
$$scantron_config{'CODElength'}); |
$$scantron_config{'CODElength'}); |
Line 4020 sub scantron_parse_scanline {
|
Line 4211 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 || $currentquest eq $$scantron_config{'Qoff'} || |
if ($currentquest eq '?') { |
$currentquest !~ /^[A-Z]$/) { |
push(@{$record{'scantron.doubleerror'}},$questnum); |
|
$record{"scantron.$questnum.answer"}=''; |
|
} elsif (!$currentquest |
|
|| $currentquest eq $$scantron_config{'Qoff'} |
|
|| $currentquest !~ /^[A-Z]$/) { |
$record{"scantron.$questnum.answer"}=''; |
$record{"scantron.$questnum.answer"}=''; |
if (!&scan_data($scan_data,"$whichline.no_bubble.$questnum")) { |
if (!&scan_data($scan_data,"$whichline.no_bubble.$questnum")) { |
push(@{$record{"scantron.missingerror"}},$questnum); |
push(@{$record{"scantron.missingerror"}},$questnum); |
Line 4030 sub scantron_parse_scanline {
|
Line 4225 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 || $currentquest eq $$scantron_config{'Qoff'} || |
if ($currentquest eq '?') { |
$currentquest !~ /^\d$/) { |
push(@{$record{'scantron.doubleerror'}},$questnum); |
|
$record{"scantron.$questnum.answer"}=''; |
|
} elsif (!$currentquest |
|
|| $currentquest eq $$scantron_config{'Qoff'} |
|
|| $currentquest !~ /^\d$/) { |
$record{"scantron.$questnum.answer"}=''; |
$record{"scantron.$questnum.answer"}=''; |
if (!&scan_data($scan_data,"$whichline.no_bubble.$questnum")) { |
if (!&scan_data($scan_data,"$whichline.no_bubble.$questnum")) { |
push(@{$record{"scantron.missingerror"}},$questnum); |
push(@{$record{"scantron.missingerror"}},$questnum); |
Line 4148 sub scantron_process_corrections {
|
Line 4347 sub scantron_process_corrections {
|
} |
} |
} |
} |
if ($err) { |
if ($err) { |
$r->print("Unable to accept last correction, an error occurred :$errmsg:"); |
$r->print("<font color='red'>Unable to accept last correction, an error occurred :$errmsg:</font>"); |
} else { |
} else { |
&scantron_put_line($scanlines,$scan_data,$which,$line,$skip); |
&scantron_put_line($scanlines,$scan_data,$which,$line,$skip); |
&scantron_putfile($scanlines,$scan_data); |
&scantron_putfile($scanlines,$scan_data); |
Line 4202 sub check_for_error {
|
Line 4401 sub check_for_error {
|
sub scantron_warning_screen { |
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 $CODElist="a"; |
|
if ($scantron_config{'CODElocation'} && |
|
$scantron_config{'CODEstart'} && |
|
$scantron_config{'CODElength'}) { |
|
$CODElist=$env{'form.scantron_CODElist'}; |
|
if ($CODElist eq '') { $CODElist='<font color="red">None</font>'; } |
|
$CODElist= |
|
'<tr><td><b>List of CODES to validate against:</b></td><td><tt>'. |
|
$CODElist.'</tt></td></tr>'; |
|
} |
return (<<STUFF); |
return (<<STUFF); |
<p> |
<p> |
<font color="red">Please double check the information |
<font color="red">Please double check the information |
below before clicking on '$button_text'</font> |
below before clicking on '$button_text'</font> |
</p> |
</p> |
<table> |
<table> |
<tr><td><b>Sequence To be Graded:</b></td><td>$title</td></tr> |
<tr><td><b>Sequence to be Graded:</b></td><td>$title</td></tr> |
<tr><td><b>Data File that will be used:</b></td><td><tt>$env{'form.scantron_selectfile'}</tt></td></tr> |
<tr><td><b>Data File that will be used:</b></td><td><tt>$env{'form.scantron_selectfile'}</tt></td></tr> |
|
$CODElist |
</table> |
</table> |
</font> |
</font> |
<br /> |
<br /> |
Line 4240 sub scantron_do_warning {
|
Line 4451 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 4416 sub lonnet_putfile {
|
Line 4627 sub lonnet_putfile {
|
my ($contents,$filename)=@_; |
my ($contents,$filename)=@_; |
my $docuname=$env{'course.'.$env{'request.course.id'}.'.num'}; |
my $docuname=$env{'course.'.$env{'request.course.id'}.'.num'}; |
my $docudom=$env{'course.'.$env{'request.course.id'}.'.domain'}; |
my $docudom=$env{'course.'.$env{'request.course.id'}.'.domain'}; |
my $docuhome=$env{'course.'.$env{'request.course.id'}.'.home'}; |
|
$env{'form.sillywaytopassafilearound'}=$contents; |
$env{'form.sillywaytopassafilearound'}=$contents; |
&Apache::lonnet::finishuserfileupload($docuname,$docudom,$docuhome,'sillywaytopassafilearound',$filename); |
&Apache::lonnet::finishuserfileupload($docuname,$docudom,'sillywaytopassafilearound',$filename); |
|
|
} |
} |
|
|
Line 4586 sub scantron_get_correction {
|
Line 4796 sub scantron_get_correction {
|
$r->print("<p>How should I handle this? <br /> \n"); |
$r->print("<p>How should I handle this? <br /> \n"); |
$r->print("\n<br /> "); |
$r->print("\n<br /> "); |
my $i=0; |
my $i=0; |
if ($error eq 'incorrectCODE') { |
if ($error eq 'incorrectCODE' |
|
&& $$scan_record{'scantron.CODE'}=~/\S/ ) { |
my ($max,$closest)=&scantron_get_closely_matching_CODEs($arg,$$scan_record{'scantron.CODE'}); |
my ($max,$closest)=&scantron_get_closely_matching_CODEs($arg,$$scan_record{'scantron.CODE'}); |
foreach my $testcode (@{$closest}) { |
if ($closest > 0) { |
my $checked=''; |
foreach my $testcode (@{$closest}) { |
if (!$i) { $checked=' checked="on" '; } |
my $checked=''; |
$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' />"); |
if (!$i) { $checked=' checked="on" '; } |
$r->print("\n<br />"); |
$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' />"); |
$i++; |
$r->print("\n<br />"); |
|
$i++; |
|
} |
} |
} |
} |
} |
my $checked; if (!$i) { $checked=' checked="on" '; } |
if ($$scan_record{'scantron.CODE'}=~/\S/ ) { |
$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."); |
my $checked; if (!$i) { $checked=' checked="on" '; } |
$r->print("\n<br />"); |
$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(<<ENDSCRIPT); |
$r->print(<<ENDSCRIPT); |
<script type="text/javascript"> |
<script type="text/javascript"> |
Line 4617 ENDSCRIPT
|
Line 4832 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 4652 ENDSCRIPT
|
Line 4867 ENDSCRIPT
|
sub scantron_bubble_selector { |
sub scantron_bubble_selector { |
my ($r,$scan_config,$quest,@selected)=@_; |
my ($r,$scan_config,$quest,@selected)=@_; |
my $max=$$scan_config{'Qlength'}; |
my $max=$$scan_config{'Qlength'}; |
|
|
|
my $scmode=$$scan_config{'Qon'}; |
|
if ($scmode eq 'number' || $scmode eq 'letter') { $max=10; } |
|
|
my @alphabet=('A'..'Z'); |
my @alphabet=('A'..'Z'); |
$r->print("<table border='1'><tr><td rowspan='2'>$quest</td>"); |
$r->print("<table border='1'><tr><td rowspan='2'>$quest</td>"); |
for (my $i=0;$i<$max+1;$i++) { |
for (my $i=0;$i<$max+1;$i++) { |
$r->print('<td align="center">'); |
$r->print("\n".'<td align="center">'); |
if ($selected[0] eq $alphabet[$i]) { $r->print('X'); shift(@selected) } |
if ($selected[0] eq $alphabet[$i]) { $r->print('X'); shift(@selected) } |
else { $r->print(' '); } |
else { $r->print(' '); } |
$r->print('</td>'); |
$r->print('</td>'); |
} |
} |
$r->print('<td></td></tr><tr>'); |
$r->print('</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("\n". |
'" value="'.$i.'" />'.$alphabet[$i]."</td>"); |
'<td><label><input type="radio" name="scantron_correct_Q_'. |
|
$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>'); |
} |
} |
|
|
Line 4692 sub scantron_get_closely_matching_CODEs
|
Line 4912 sub scantron_get_closely_matching_CODEs
|
} |
} |
|
|
sub get_codes { |
sub get_codes { |
my $old_name=$env{'form.scantron_CODElist'}; |
my ($old_name, $cdom, $cnum) = @_; |
my $cdom =$env{'course.'.$env{'request.course.id'}.'.domain'}; |
if (!$old_name) { |
my $cnum =$env{'course.'.$env{'request.course.id'}.'.num'}; |
$old_name=$env{'form.scantron_CODElist'}; |
my %result=&Apache::lonnet::get('CODEs',[$old_name],$cdom,$cnum); |
} |
my %allcodes=map {(&Apache::lonprintout::num_to_letters($_),1)} split(',',$result{$old_name}); |
if (!$cdom) { |
|
$cdom =$env{'course.'.$env{'request.course.id'}.'.domain'}; |
|
} |
|
if (!$cnum) { |
|
$cnum =$env{'course.'.$env{'request.course.id'}.'.num'}; |
|
} |
|
my %result=&Apache::lonnet::get('CODEs',[$old_name,"type\0$old_name"], |
|
$cdom,$cnum); |
|
my %allcodes; |
|
if ($result{"type\0$old_name"} eq 'number') { |
|
%allcodes=map {($_,1)} split(',',$result{$old_name}); |
|
} else { |
|
%allcodes=map {(&Apache::lonprintout::num_to_letters($_),1)} split(',',$result{$old_name}); |
|
} |
return %allcodes; |
return %allcodes; |
} |
} |
|
|
Line 4986 sub scantron_upload_scantron_data_save {
|
Line 5219 sub scantron_upload_scantron_data_save {
|
} |
} |
my %coursedata=&Apache::lonnet::coursedescription($env{'form.domainid'}.'_'.$env{'form.courseid'}); |
my %coursedata=&Apache::lonnet::coursedescription($env{'form.domainid'}.'_'.$env{'form.courseid'}); |
$r->print("Doing upload to ".$coursedata{'description'}." <br />"); |
$r->print("Doing upload to ".$coursedata{'description'}." <br />"); |
my $home=&Apache::lonnet::homeserver($env{'form.courseid'}, |
|
$env{'form.domainid'}); |
|
my $fname=$env{'form.upfile.filename'}; |
my $fname=$env{'form.upfile.filename'}; |
#FIXME |
#FIXME |
#copied from lonnet::userfileupload() |
#copied from lonnet::userfileupload() |
Line 5007 sub scantron_upload_scantron_data_save {
|
Line 5238 sub scantron_upload_scantron_data_save {
|
if (length($env{'form.upfile'}) < 2) { |
if (length($env{'form.upfile'}) < 2) { |
$r->print("<font color='red'>Error:</font> The file you attempted to upload, <tt>".&HTML::Entities::encode($env{'form.upfile.filename'},'<>&"')."</tt>, contained no information. Please check that you entered the correct filename."); |
$r->print("<font color='red'>Error:</font> The file you attempted to upload, <tt>".&HTML::Entities::encode($env{'form.upfile.filename'},'<>&"')."</tt>, contained no information. Please check that you entered the correct filename."); |
} else { |
} else { |
my $result=&Apache::lonnet::finishuserfileupload($env{'form.courseid'},$env{'form.domainid'},$home,'upfile',$fname); |
my $result=&Apache::lonnet::finishuserfileupload($env{'form.courseid'},$env{'form.domainid'},'upfile',$fname); |
if ($result =~ m|^/uploaded/|) { |
if ($result =~ m|^/uploaded/|) { |
$r->print("<font color='green'>Success:</font> Successfully uploaded ".(length($env{'form.upfile'})-1)." bytes of data into location <tt>".$result."</tt>"); |
$r->print("<font color='green'>Success:</font> Successfully uploaded ".(length($env{'form.upfile'})-1)." bytes of data into location <tt>".$result."</tt>"); |
} else { |
} else { |
Line 5182 GRADINGMENUJS
|
Line 5413 GRADINGMENUJS
|
|
|
$result.='</td></tr>'; |
$result.='</td></tr>'; |
|
|
$result.='<tr bgcolor="#ffffe6"valign="top"><td>'. |
$result.='<tr bgcolor="#ffffe6"valign="top"><td><label>'. |
'<input type="radio" name="radioChoice" value="submission" '. |
'<input type="radio" name="radioChoice" value="submission" '. |
($saveCmd eq 'submission' ? 'checked' : '').'> '.'<b>'.&mt('Current Resource').':</b> '.&mt('For one or more students'). |
($saveCmd eq 'submission' ? 'checked' : '').'> '.'<b>'.&mt('Current Resource').':</b> '.&mt('For one or more students'). |
' <select name="submitonly">'. |
'</label> <select name="submitonly">'. |
'<option value="yes" '. |
'<option value="yes" '. |
($saveSub eq 'yes' ? 'selected="on"' : '').'>with submissions</option>'. |
($saveSub eq 'yes' ? 'selected="on"' : '').'>with submissions</option>'. |
'<option value="graded" '. |
'<option value="graded" '. |
Line 5196 GRADINGMENUJS
|
Line 5427 GRADINGMENUJS
|
($saveSub eq 'all' ? 'selected="on"' : '').'>with any status</option></select></td></tr>'."\n"; |
($saveSub eq 'all' ? 'selected="on"' : '').'>with any status</option></select></td></tr>'."\n"; |
|
|
$result.='<tr bgcolor="#ffffe6"valign="top"><td>'. |
$result.='<tr bgcolor="#ffffe6"valign="top"><td>'. |
'<input type="radio" name="radioChoice" value="viewgrades" '. |
'<label><input type="radio" name="radioChoice" value="viewgrades" '. |
($saveCmd eq 'viewgrades' ? 'checked' : '').'> '. |
($saveCmd eq 'viewgrades' ? 'checked' : '').'> '. |
'<b>Current Resource:</b> For all students in selected section or course</td></tr>'."\n"; |
'<b>Current Resource:</b> For all students in selected section or course</label></td></tr>'."\n"; |
|
|
$result.='<tr bgcolor="#ffffe6" valign="top"><td>'. |
$result.='<tr bgcolor="#ffffe6" valign="top"><td>'. |
'<input type="radio" name="radioChoice" value="pickStudentPage" '. |
'<label><input type="radio" name="radioChoice" value="pickStudentPage" '. |
($saveCmd eq 'pickStudentPage' ? 'checked' : '').'> '. |
($saveCmd eq 'pickStudentPage' ? 'checked' : '').'> '. |
'The <b>complete</b> set/page/sequence: For one student</td></tr>'."\n"; |
'The <b>complete</b> set/page/sequence: For one student</label></td></tr>'."\n"; |
|
|
$result.='<tr bgcolor="#ffffe6"><td><br />'. |
$result.='<tr bgcolor="#ffffe6"><td><br />'. |
'<input type="button" onClick="javascript:checkChoice(this.form,\'2\');" value="Next->" />'. |
'<input type="button" onClick="javascript:checkChoice(this.form,\'2\');" value="Next->" />'. |
Line 5231 GRADINGMENUJS
|
Line 5462 GRADINGMENUJS
|
$result.='<tr bgcolor="#ffffe6"valign="top"><td colspan="2">'. |
$result.='<tr bgcolor="#ffffe6"valign="top"><td colspan="2">'. |
'<input type="button" onClick="javascript:this.form.action=\'/adm/helper/resettimes.helper\';this.form.submit();'. |
'<input type="button" onClick="javascript:this.form.action=\'/adm/helper/resettimes.helper\';this.form.submit();'. |
'" value="'.&mt('Manage').'" /> access times.</td></tr>'."\n"; |
'" value="'.&mt('Manage').'" /> access times.</td></tr>'."\n"; |
|
$result.='<tr bgcolor="#ffffe6"valign="top"><td colspan="2">'. |
|
'<input type="button" onClick="javascript:this.form.command.value=\'codelist\';this.form.action=\'/adm/pickcode\';this.form.submit();'. |
|
'" value="'.&mt('View').'" /> saved CODEs.</td></tr>'."\n"; |
|
|
$result.='</form></td></tr></table>'."\n". |
$result.='</form></td></tr></table>'."\n". |
'</td></tr></table>'."\n". |
'</td></tr></table>'."\n". |
Line 5238 GRADINGMENUJS
|
Line 5472 GRADINGMENUJS
|
return $result; |
return $result; |
} |
} |
|
|
|
sub reset_perm { |
|
undef(%perm); |
|
} |
|
|
|
sub init_perm { |
|
&reset_perm(); |
|
if (!($perm{'vgr'}=&Apache::lonnet::allowed('vgr',$env{'request.course.id'}))) { |
|
if ($perm{'vgr'}=&Apache::lonnet::allowed('vgr',$env{'request.course.id'}.'/'.$env{'request.course.sec'})) { |
|
$perm{'vgr_section'}=$env{'request.course.sec'}; |
|
} else { |
|
delete($perm{'vgr'}); |
|
} |
|
} |
|
if (!($perm{'mgr'}=&Apache::lonnet::allowed('mgr',$env{'request.course.id'}))) { |
|
if ($perm{'mgr'}=&Apache::lonnet::allowed('mgr',$env{'request.course.id'}.'/'.$env{'request.course.sec'})) { |
|
$perm{'mgr_section'}=$env{'request.course.sec'}; |
|
} else { |
|
delete($perm{'mgr'}); |
|
} |
|
} |
|
} |
|
|
sub handler { |
sub handler { |
my $request=$_[0]; |
my $request=$_[0]; |
|
|
undef(%perm); |
&reset_perm(); |
if ($env{'browser.mathml'}) { |
if ($env{'browser.mathml'}) { |
&Apache::loncommon::content_type($request,'text/xml'); |
&Apache::loncommon::content_type($request,'text/xml'); |
} else { |
} else { |
Line 5290 sub handler {
|
Line 5546 sub handler {
|
} |
} |
} |
} |
} else { |
} else { |
if (!($perm{'vgr'}=&Apache::lonnet::allowed('vgr',$env{'request.course.id'}))) { |
&init_perm(); |
if ($perm{'vgr'}=&Apache::lonnet::allowed('vgr',$env{'request.course.id'}.'/'.$env{'request.course.sec'})) { |
|
$perm{'vgr_section'}=$env{'request.course.sec'}; |
|
} else { |
|
delete($perm{'vgr'}); |
|
} |
|
} |
|
if (!($perm{'mgr'}=&Apache::lonnet::allowed('mgr',$env{'request.course.id'}))) { |
|
if ($perm{'mgr'}=&Apache::lonnet::allowed('mgr',$env{'request.course.id'}.'/'.$env{'request.course.sec'})) { |
|
$perm{'mgr_section'}=$env{'request.course.sec'}; |
|
} else { |
|
delete($perm{'mgr'}); |
|
} |
|
} |
|
if ($command eq 'submission' && $perm{'vgr'}) { |
if ($command eq 'submission' && $perm{'vgr'}) { |
($env{'form.student'} eq '' ? &listStudents($request) : &submission($request,0,0)); |
($env{'form.student'} eq '' ? &listStudents($request) : &submission($request,0,0)); |
} elsif ($command eq 'pickStudentPage' && $perm{'vgr'}) { |
} elsif ($command eq 'pickStudentPage' && $perm{'vgr'}) { |