version 1.602, 2010/03/25 19:56:33
|
version 1.642, 2010/12/20 22:01:26
|
Line 43 use Apache::lonmsg();
|
Line 43 use Apache::lonmsg();
|
use Apache::Constants qw(:common); |
use Apache::Constants qw(:common); |
use Apache::lonlocal; |
use Apache::lonlocal; |
use Apache::lonenc; |
use Apache::lonenc; |
|
use Apache::lonstathelpers; |
|
use Apache::lonquickgrades; |
use String::Similarity; |
use String::Similarity; |
use LONCAPA; |
use LONCAPA; |
|
|
Line 123 sub getpartlist {
|
Line 125 sub getpartlist {
|
return @stores; |
return @stores; |
} |
} |
|
|
# --- Get the symbolic name of a problem and the url |
|
# Generate an error message if symb could not be found unless silent flag is set |
|
# Takes $env{'form.symb'} by default; if not present, takes $env{'form.url'} and tries to get symb from that |
|
# |
|
|
|
sub get_symb { |
|
my ($request,$silent) = @_; |
|
(my $url=$env{'form.url'}) =~ s-^http://($ENV{'SERVER_NAME'}|$ENV{'HTTP_HOST'})--; |
|
my $symb=($env{'form.symb'} ne '' ? $env{'form.symb'} : (&Apache::lonnet::symbread($url))); |
|
if ($symb eq '') { |
|
if (!$silent) { |
|
$request->print(&mt("Unable to handle ambiguous references: [_1].",$url)); |
|
return (); |
|
} |
|
} |
|
&Apache::lonenc::check_decrypt(\$symb); |
|
return ($symb); |
|
} |
|
|
|
#--- Format fullname, username:domain if different for display |
#--- Format fullname, username:domain if different for display |
#--- Use anywhere where the student names are listed |
#--- Use anywhere where the student names are listed |
sub nameUserString { |
sub nameUserString { |
Line 156 sub nameUserString {
|
Line 139 sub nameUserString {
|
|
|
#--- Get the partlist and the response type for a given problem. --- |
#--- Get the partlist and the response type for a given problem. --- |
#--- Indicate if a response type is coded handgraded or not. --- |
#--- Indicate if a response type is coded handgraded or not. --- |
|
#--- Sets response_error pointer to "1" if navmaps object broken --- |
sub response_type { |
sub response_type { |
my ($symb,$response_error) = @_; |
my ($symb,$response_error) = @_; |
|
|
Line 229 sub reset_caches {
|
Line 213 sub reset_caches {
|
} |
} |
|
|
sub get_analyze { |
sub get_analyze { |
my ($symb,$uname,$udom,$no_increment,$add_to_hash)=@_; |
my ($symb,$uname,$udom,$no_increment,$add_to_hash,$type,$trial,$rndseed)=@_; |
my $key = "$symb\0$uname\0$udom"; |
my $key = "$symb\0$uname\0$udom"; |
|
if ($type eq 'randomizetry') { |
|
if ($trial ne '') { |
|
$key .= "\0".$trial; |
|
} |
|
} |
if (exists($analyze_cache{$key})) { |
if (exists($analyze_cache{$key})) { |
my $getupdate = 0; |
my $getupdate = 0; |
if (ref($add_to_hash) eq 'HASH') { |
if (ref($add_to_hash) eq 'HASH') { |
Line 258 sub reset_caches {
|
Line 247 sub reset_caches {
|
'grade_courseid' => $env{'request.course.id'}, |
'grade_courseid' => $env{'request.course.id'}, |
'grade_username' => $uname, |
'grade_username' => $uname, |
'grade_noincrement' => $no_increment); |
'grade_noincrement' => $no_increment); |
|
if ($type eq 'randomizetry') { |
|
$form{'grade_questiontype'} = $type; |
|
if ($rndseed ne '') { |
|
$form{'grade_rndseed'} = $rndseed; |
|
} |
|
} |
if (ref($add_to_hash)) { |
if (ref($add_to_hash)) { |
%form = (%form,%{$add_to_hash}); |
%form = (%form,%{$add_to_hash}); |
} |
} |
my $subresult=&ssi_with_retries($url, $ssi_retries,%form); |
my $subresult=&ssi_with_retries($url, $ssi_retries,%form); |
(undef,$subresult)=split(/_HASH_REF__/,$subresult,2); |
(undef,$subresult)=split(/_HASH_REF__/,$subresult,2); |
my %analyze=&Apache::lonnet::str2hash($subresult); |
my %analyze=&Apache::lonnet::str2hash($subresult); |
Line 273 sub reset_caches {
|
Line 268 sub reset_caches {
|
} |
} |
|
|
sub get_order { |
sub get_order { |
my ($partid,$respid,$symb,$uname,$udom,$no_increment)=@_; |
my ($partid,$respid,$symb,$uname,$udom,$no_increment,$type,$trial,$rndseed)=@_; |
my $analyze = &get_analyze($symb,$uname,$udom,$no_increment); |
my $analyze = &get_analyze($symb,$uname,$udom,$no_increment,undef,$type,$trial,$rndseed); |
return $analyze->{"$partid.$respid.shown"}; |
return $analyze->{"$partid.$respid.shown"}; |
} |
} |
|
|
sub get_radiobutton_correct_foil { |
sub get_radiobutton_correct_foil { |
my ($partid,$respid,$symb,$uname,$udom)=@_; |
my ($partid,$respid,$symb,$uname,$udom,$type,$trial,$rndseed)=@_; |
my $analyze = &get_analyze($symb,$uname,$udom); |
my $analyze = &get_analyze($symb,$uname,$udom,undef,undef,$type,$trial,$rndseed); |
my $foils = &get_order($partid,$respid,$symb,$uname,$udom); |
my $foils = &get_order($partid,$respid,$symb,$uname,$udom,undef,$type,$trial,$rndseed); |
if (ref($foils) eq 'ARRAY') { |
if (ref($foils) eq 'ARRAY') { |
foreach my $foil (@{$foils}) { |
foreach my $foil (@{$foils}) { |
if ($analyze->{"$partid.$respid.foil.value.$foil"} eq 'true') { |
if ($analyze->{"$partid.$respid.foil.value.$foil"} eq 'true') { |
Line 323 sub reset_caches {
|
Line 318 sub reset_caches {
|
# response types only. |
# response types only. |
sub cleanRecord { |
sub cleanRecord { |
my ($answer,$response,$symb,$partid,$respid,$record,$order,$version, |
my ($answer,$response,$symb,$partid,$respid,$record,$order,$version, |
$uname,$udom) = @_; |
$uname,$udom,$type,$trial,$rndseed) = @_; |
my $grayFont = '<span class="LC_internal_info">'; |
my $grayFont = '<span class="LC_internal_info">'; |
if ($response =~ /^(option|rank)$/) { |
if ($response =~ /^(option|rank)$/) { |
my %answer=&Apache::lonnet::str2hash($answer); |
my %answer=&Apache::lonnet::str2hash($answer); |
Line 367 sub cleanRecord {
|
Line 362 sub cleanRecord {
|
my %answer=&Apache::lonnet::str2hash($answer); |
my %answer=&Apache::lonnet::str2hash($answer); |
my ($toprow,$bottomrow); |
my ($toprow,$bottomrow); |
my $correct = |
my $correct = |
&get_radiobutton_correct_foil($partid,$respid,$symb,$uname,$udom); |
&get_radiobutton_correct_foil($partid,$respid,$symb,$uname,$udom,$type,$trial,$rndseed); |
foreach my $foil (@$order) { |
foreach my $foil (@$order) { |
if (exists($answer{$foil})) { |
if (exists($answer{$foil})) { |
if ($foil eq $correct) { |
if ($foil eq $correct) { |
Line 636 sub jscriptNform {
|
Line 631 sub jscriptNform {
|
"\n"); |
"\n"); |
$jscript.= '<form action="/adm/grades" method="post" name="onestudent">'."\n". |
$jscript.= '<form action="/adm/grades" method="post" name="onestudent">'."\n". |
'<input type="hidden" name="symb" value="'.&Apache::lonenc::check_encrypt($symb).'" />'."\n". |
'<input type="hidden" name="symb" value="'.&Apache::lonenc::check_encrypt($symb).'" />'."\n". |
'<input type="hidden" name="saveState" value="'.$env{'form.saveState'}.'" />'."\n". |
|
'<input type="hidden" name="probTitle" value="'.$env{'form.probTitle'}.'" />'."\n". |
|
'<input type="hidden" name="Status" value="'.$stu_status.'" />'."\n". |
'<input type="hidden" name="Status" value="'.$stu_status.'" />'."\n". |
'<input type="hidden" name="command" value="submission" />'."\n". |
'<input type="hidden" name="command" value="submission" />'."\n". |
'<input type="hidden" name="student" value="" />'."\n". |
'<input type="hidden" name="student" value="" />'."\n". |
Line 729 sub most_similar {
|
Line 722 sub most_similar {
|
# |
# |
|
|
sub initialverifyreceipt { |
sub initialverifyreceipt { |
my $request = shift; |
my ($request,$symb) = @_; |
&commonJSfunctions($request); |
&commonJSfunctions($request); |
$request->print('<form name="gradingMenu"><input type="submit" value="'.&mt('Verify Receipt No.').'" />'. |
return '<form name="gradingMenu"><input type="submit" value="'.&mt('Verify Receipt Number.').'" />'. |
&Apache::lonnet::recprefix($env{'request.course.id'}). |
&Apache::lonnet::recprefix($env{'request.course.id'}). |
'-<input type="text" name="receipt" size="4" />'. |
'-<input type="text" name="receipt" size="4" />'. |
"</form>\n"); |
'<input type="hidden" name="symb" value="'.&Apache::lonenc::check_encrypt($symb).'" />'."\n". |
|
'<input type="hidden" name="command" value="verify" />'. |
|
"</form>\n"; |
} |
} |
|
|
#--- Check whether a receipt number is valid.--- |
#--- Check whether a receipt number is valid.--- |
sub verifyreceipt { |
sub verifyreceipt { |
my $request = shift; |
my ($request,$symb) = @_; |
|
|
my $courseid = $env{'request.course.id'}; |
my $courseid = $env{'request.course.id'}; |
my $receipt = &Apache::lonnet::recprefix($courseid).'-'. |
my $receipt = &Apache::lonnet::recprefix($courseid).'-'. |
$env{'form.receipt'}; |
$env{'form.receipt'}; |
$receipt =~ s/[^\-\d]//g; |
$receipt =~ s/[^\-\d]//g; |
my ($symb) = &get_symb($request); |
|
|
|
my $title.= |
my $title.= |
'<h3><span class="LC_info">'. |
'<h3><span class="LC_info">'. |
&mt('Verifying Receipt No. [_1]',$receipt). |
&mt('Verifying Receipt Number [_1]',$receipt). |
'</span></h3>'."\n". |
'</span></h3>'."\n"; |
'<h4>'.&mt('<b>Resource: </b>[_1]',$env{'form.probTitle'}). |
|
'</h4>'."\n"; |
|
|
|
my ($string,$contents,$matches) = ('','',0); |
my ($string,$contents,$matches) = ('','',0); |
my (undef,undef,$fullname) = &getclasslist('all','0'); |
my (undef,undef,$fullname) = &getclasslist('all','0'); |
Line 822 sub verifyreceipt {
|
Line 814 sub verifyreceipt {
|
$contents. |
$contents. |
&Apache::loncommon::end_data_table()."\n"; |
&Apache::loncommon::end_data_table()."\n"; |
} |
} |
return $string.&show_grading_menu_form($symb); |
return $string; |
} |
} |
|
|
#--- This is called by a number of programs. |
#--- This is called by a number of programs. |
Line 830 sub verifyreceipt {
|
Line 822 sub verifyreceipt {
|
#--- Also called directly when one clicks on the subm button |
#--- Also called directly when one clicks on the subm button |
# on the problem page. |
# on the problem page. |
sub listStudents { |
sub listStudents { |
my ($request) = shift; |
my ($request,$symb,$submitonly) = @_; |
|
|
my ($symb) = &get_symb($request); |
|
my $cdom = $env{"course.$env{'request.course.id'}.domain"}; |
my $cdom = $env{"course.$env{'request.course.id'}.domain"}; |
my $cnum = $env{"course.$env{'request.course.id'}.num"}; |
my $cnum = $env{"course.$env{'request.course.id'}.num"}; |
my $getsec = $env{'form.section'} eq '' ? 'all' : $env{'form.section'}; |
my $getsec = $env{'form.section'} eq '' ? 'all' : $env{'form.section'}; |
my $getgroup = $env{'form.group'} eq '' ? 'all' : $env{'form.group'}; |
my $getgroup = $env{'form.group'} eq '' ? 'all' : $env{'form.group'}; |
my $submitonly= $env{'form.submitonly'} eq '' ? 'all' : $env{'form.submitonly'}; |
unless ($submitonly) { |
my $viewgrade = $env{'form.showgrading'} eq 'yes' ? 'View/Grade/Regrade' : 'View'; |
$submitonly= $env{'form.submitonly'} eq '' ? 'all' : $env{'form.submitonly'}; |
$env{'form.probTitle'} = $env{'form.probTitle'} eq '' ? |
} |
&Apache::lonnet::gettitle($symb) : $env{'form.probTitle'}; |
|
|
|
my $result='<h3><span class="LC_info"> ' |
|
.&mt("$viewgrade Submissions for a Student or a Group of Students") |
|
.'</span></h3>'; |
|
|
|
my ($partlist,$handgrade,$responseType) = &response_type($symb |
my $result=''; |
#,$res_error |
my $res_error; |
); |
my ($partlist,$handgrade,$responseType) = &response_type($symb,\$res_error); |
|
|
my %lt = &Apache::lonlocal::texthash ( |
my %lt = &Apache::lonlocal::texthash ( |
'multiple' => 'Please select a student or group of students before clicking on the Next button.', |
'multiple' => 'Please select a student or group of students before clicking on the Next button.', |
Line 888 LISTJAVASCRIPT
|
Line 874 LISTJAVASCRIPT
|
&commonJSfunctions($request); |
&commonJSfunctions($request); |
$request->print($result); |
$request->print($result); |
|
|
my $checkhdgrade = ($env{'form.handgrade'} eq 'yes' && scalar(@$partlist) > 1 ) ? 'checked="checked"' : ''; |
|
my $checklastsub = $checkhdgrade eq '' ? 'checked="checked"' : ''; |
|
my $gradeTable='<form action="/adm/grades" method="post" name="gradesub">'. |
my $gradeTable='<form action="/adm/grades" method="post" name="gradesub">'. |
"\n"; |
"\n"; |
|
|
Line 906 LISTJAVASCRIPT
|
Line 890 LISTJAVASCRIPT
|
.&Apache::lonhtmlcommon::row_closure(); |
.&Apache::lonhtmlcommon::row_closure(); |
|
|
my $submission_options; |
my $submission_options; |
if ($env{'form.handgrade'} eq 'yes' && scalar(@$partlist) > 1) { |
|
$submission_options.= |
|
'<label><input type="radio" name="lastSub" value="hdgrade" '.$checkhdgrade.' /> '.&mt('essay part only').' </label>'."\n"; |
|
} |
|
my $stu_status = join(':',&Apache::loncommon::get_env_multiple('form.Status')); |
my $stu_status = join(':',&Apache::loncommon::get_env_multiple('form.Status')); |
my $saveStatus = $stu_status eq '' ? 'Active' : $stu_status; |
my $saveStatus = $stu_status eq '' ? 'Active' : $stu_status; |
$env{'form.Status'} = $saveStatus; |
$env{'form.Status'} = $saveStatus; |
$submission_options.= |
$submission_options.= |
'<span class="LC_nobreak">'. |
'<span class="LC_nobreak">'. |
'<label><input type="radio" name="lastSub" value="lastonly" '.$checklastsub.' /> '. |
'<label><input type="radio" name="lastSub" value="lastonly" /> '. |
&mt('last submission only').' </label></span>'."\n". |
&mt('last submission only').' </label></span>'."\n". |
'<span class="LC_nobreak">'. |
'<span class="LC_nobreak">'. |
'<label><input type="radio" name="lastSub" value="last" /> '. |
'<label><input type="radio" name="lastSub" value="last" /> '. |
&mt('last submission & parts info').' </label></span>'."\n". |
&mt('last submission & parts info').' </label></span>'."\n". |
'<span class="LC_nobreak">'. |
'<span class="LC_nobreak">'. |
'<label><input type="radio" name="lastSub" value="datesub" /> '. |
'<label><input type="radio" name="lastSub" value="datesub" checked="checked" /> '. |
&mt('by dates and submissions').'</label></span>'."\n". |
&mt('by dates and submissions').'</label></span>'."\n". |
'<span class="LC_nobreak">'. |
'<span class="LC_nobreak">'. |
'<label><input type="radio" name="lastSub" value="all" /> '. |
'<label><input type="radio" name="lastSub" value="all" /> '. |
Line 942 LISTJAVASCRIPT
|
Line 922 LISTJAVASCRIPT
|
$gradeTable .= |
$gradeTable .= |
&build_section_inputs(). |
&build_section_inputs(). |
'<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="showgrading" value="'.$env{'form.showgrading'}.'" /><br />'."\n". |
|
'<input type="hidden" name="saveState" value="'.$env{'form.saveState'}.'" />'."\n". |
|
'<input type="hidden" name="probTitle" value="'.$env{'form.probTitle'}.'" />'."\n". |
|
'<input type="hidden" name="symb" value="'.&Apache::lonenc::check_encrypt($symb).'" />'."\n". |
'<input type="hidden" name="symb" value="'.&Apache::lonenc::check_encrypt($symb).'" />'."\n". |
'<input type="hidden" name="saveStatusOld" value="'.$saveStatus.'" />'."\n"; |
'<input type="hidden" name="saveStatusOld" value="'.$saveStatus.'" />'."\n"; |
|
|
if (exists($env{'form.gradingMenu'}) && exists($env{'form.Status'})) { |
if (exists($env{'form.Status'})) { |
$gradeTable .= '<input type="hidden" name="Status" value="'.$stu_status.'" />'."\n"; |
$gradeTable .= '<input type="hidden" name="Status" value="'.$stu_status.'" />'."\n"; |
} else { |
} else { |
$gradeTable .= &Apache::lonhtmlcommon::row_title(&mt('Student Status')) |
$gradeTable .= &Apache::lonhtmlcommon::row_title(&mt('Student Status')) |
Line 964 LISTJAVASCRIPT
|
Line 940 LISTJAVASCRIPT
|
.&Apache::lonhtmlcommon::end_pick_box(); |
.&Apache::lonhtmlcommon::end_pick_box(); |
|
|
$gradeTable .= '<p>' |
$gradeTable .= '<p>' |
.&mt('To '.lc($viewgrade)." a submission or a group of submissions, click on the check box(es) next to the student's name(s). Then click on the Next button.")."\n" |
.&mt("To view/grade/regrade a submission or a group of submissions, click on the check box(es) next to the student's name(s). Then click on the Next button.")."\n" |
.'<input type="hidden" name="command" value="processGroup" />' |
.'<input type="hidden" name="command" value="processGroup" />' |
.'</p>'; |
.'</p>'; |
|
|
Line 981 LISTJAVASCRIPT
|
Line 957 LISTJAVASCRIPT
|
while ($loop < 2) { |
while ($loop < 2) { |
$gradeTable.='<th>'.&mt('No.').'</th><th>'.&mt('Select').'</th>'. |
$gradeTable.='<th>'.&mt('No.').'</th><th>'.&mt('Select').'</th>'. |
'<th>'.&nameUserString('header').' '.&mt('Section/Group').'</th>'; |
'<th>'.&nameUserString('header').' '.&mt('Section/Group').'</th>'; |
if ($env{'form.showgrading'} eq 'yes' |
if (($submitonly ne 'queued') && ($submitonly ne 'all')) { |
&& $submitonly ne 'queued' |
|
&& $submitonly ne 'all') { |
|
foreach my $part (sort(@$partlist)) { |
foreach my $part (sort(@$partlist)) { |
my $display_part= |
my $display_part= |
&get_display_part((split(/_/,$part))[0],$symb); |
&get_display_part((split(/_/,$part))[0],$symb); |
Line 1019 LISTJAVASCRIPT
|
Line 993 LISTJAVASCRIPT
|
$status{'gradingqueue'} = $queue_status{'gradingqueue'}; |
$status{'gradingqueue'} = $queue_status{'gradingqueue'}; |
} |
} |
|
|
if ($env{'form.showgrading'} eq 'yes' |
if (($submitonly ne 'queued') && ($submitonly ne 'all')) { |
&& $submitonly ne 'queued' |
|
&& $submitonly ne 'all') { |
|
(%status) =&student_gradeStatus($symb,$udom,$uname,$partlist); |
(%status) =&student_gradeStatus($symb,$udom,$uname,$partlist); |
my $submitted = 0; |
my $submitted = 0; |
my $graded = 0; |
my $graded = 0; |
Line 1062 LISTJAVASCRIPT
|
Line 1034 LISTJAVASCRIPT
|
&nameUserString(undef,$$fullname{$student},$uname,$udom). |
&nameUserString(undef,$$fullname{$student},$uname,$udom). |
' '.$section.($group ne '' ?'/'.$group:'').'</td>'."\n"; |
' '.$section.($group ne '' ?'/'.$group:'').'</td>'."\n"; |
|
|
if ($env{'form.showgrading'} eq 'yes' && $submitonly ne 'all') { |
if ($submitonly ne 'all') { |
foreach (sort(keys(%status))) { |
foreach (sort(keys(%status))) { |
next if ($_ =~ /^resource.*?submitted_by$/); |
next if ($_ =~ /^resource.*?submitted_by$/); |
$gradeTable.='<td align="center"> '.&mt($status{$_}).' </td>'."\n"; |
$gradeTable.='<td align="center"> '.&mt($status{$_}).' </td>'."\n"; |
Line 1076 LISTJAVASCRIPT
|
Line 1048 LISTJAVASCRIPT
|
} |
} |
if ($ctr%2 ==1) { |
if ($ctr%2 ==1) { |
$gradeTable.='<td> </td><td> </td><td> </td>'; |
$gradeTable.='<td> </td><td> </td><td> </td>'; |
if ($env{'form.showgrading'} eq 'yes' |
if (($submitonly ne 'queued') && ($submitonly ne 'all')) { |
&& $submitonly ne 'queued' |
|
&& $submitonly ne 'all') { |
|
foreach (@$partlist) { |
foreach (@$partlist) { |
$gradeTable.='<td> </td>'; |
$gradeTable.='<td> </td>'; |
} |
} |
Line 1109 LISTJAVASCRIPT
|
Line 1079 LISTJAVASCRIPT
|
} elsif ($ctr == 1) { |
} elsif ($ctr == 1) { |
$gradeTable =~ s/type="checkbox"/type="checkbox" checked="checked"/; |
$gradeTable =~ s/type="checkbox"/type="checkbox" checked="checked"/; |
} |
} |
$gradeTable.=&show_grading_menu_form($symb); |
|
$request->print($gradeTable); |
$request->print($gradeTable); |
return ''; |
return ''; |
} |
} |
Line 1163 sub check_buttons {
|
Line 1132 sub check_buttons {
|
|
|
# Displays the submissions for one student or a group of students |
# Displays the submissions for one student or a group of students |
sub processGroup { |
sub processGroup { |
my ($request) = shift; |
my ($request,$symb) = @_; |
my $ctr = 0; |
my $ctr = 0; |
my @stuchecked = &Apache::loncommon::get_env_multiple('form.stuinfo'); |
my @stuchecked = &Apache::loncommon::get_env_multiple('form.stuinfo'); |
my $total = scalar(@stuchecked)-1; |
my $total = scalar(@stuchecked)-1; |
Line 1173 sub processGroup {
|
Line 1142 sub processGroup {
|
$env{'form.student'} = $uname; |
$env{'form.student'} = $uname; |
$env{'form.userdom'} = $udom; |
$env{'form.userdom'} = $udom; |
$env{'form.fullname'} = $fullname; |
$env{'form.fullname'} = $fullname; |
&submission($request,$ctr,$total); |
&submission($request,$ctr,$total,$symb); |
$ctr++; |
$ctr++; |
} |
} |
return ''; |
return ''; |
Line 1310 sub sub_page_js {
|
Line 1279 sub sub_page_js {
|
} |
} |
|
|
} |
} |
if (val == "Grade Student") { |
|
formname.showgrading.value = "yes"; |
|
if (formname.Status.value == "") { |
|
formname.Status.value = "Active"; |
|
} |
|
formname.studentNo.value = total; |
|
} |
|
formname.submit(); |
formname.submit(); |
} |
} |
|
|
Line 1365 sub sub_page_kw_js {
|
Line 1327 sub sub_page_kw_js {
|
my $iconpath = $request->dir_config('lonIconsURL'); |
my $iconpath = $request->dir_config('lonIconsURL'); |
&commonJSfunctions($request); |
&commonJSfunctions($request); |
|
|
my $inner_js_msg_central= &Apache::lonhtmlcommon::scripttag(<<INNERJS); |
my $inner_js_msg_central= (<<INNERJS); |
|
<script type="text/javascript"> |
function checkInput() { |
function checkInput() { |
opener.document.SCORE.msgsub.value = opener.checkEntities(document.msgcenter.msgsub.value); |
opener.document.SCORE.msgsub.value = opener.checkEntities(document.msgcenter.msgsub.value); |
var nmsg = opener.document.SCORE.savemsgN.value; |
var nmsg = opener.document.SCORE.savemsgN.value; |
Line 1402 sub sub_page_kw_js {
|
Line 1365 sub sub_page_kw_js {
|
self.close() |
self.close() |
|
|
} |
} |
|
</script> |
INNERJS |
INNERJS |
|
|
my $inner_js_highlight_central= &Apache::lonhtmlcommon::scripttag(<<INNERJS); |
my $inner_js_highlight_central= (<<INNERJS); |
|
<script type="text/javascript"> |
function updateChoice(flag) { |
function updateChoice(flag) { |
opener.document.SCORE.kwclr.value = opener.radioSelection(document.hlCenter.kwdclr); |
opener.document.SCORE.kwclr.value = opener.radioSelection(document.hlCenter.kwdclr); |
opener.document.SCORE.kwsize.value = opener.radioSelection(document.hlCenter.kwdsize); |
opener.document.SCORE.kwsize.value = opener.radioSelection(document.hlCenter.kwdsize); |
Line 1415 INNERJS
|
Line 1380 INNERJS
|
} |
} |
self.close() |
self.close() |
} |
} |
|
</script> |
INNERJS |
INNERJS |
|
|
my $start_page_msg_central = |
my $start_page_msg_central = |
Line 1755 sub gradeBox {
|
Line 1721 sub gradeBox {
|
$line.='<option value="reset status">'.&mt('reset status').'</option></select>'."\n"; |
$line.='<option value="reset status">'.&mt('reset status').'</option></select>'."\n"; |
|
|
|
|
#&mt('<td><b>Part:</b></td><td>[_1]</td><td><b>Points:</b></td><td>[_2]</td><td>or</td><td>[_3]</td>',$display_part,$radio,$line); |
|
$result .= |
$result .= |
'<td>'.$display_part.'</td><td>'.$radio.'</td><td>'.&mt('or').'</td><td>'.$line.'</td>'; |
'<td>'.$display_part.'</td><td>'.$radio.'</td><td>'.&mt('or').'</td><td>'.$line.'</td>'; |
$result.=&Apache::loncommon::end_data_table_row(); |
$result.=&Apache::loncommon::end_data_table_row(); |
Line 1776 sub gradeBox {
|
Line 1741 sub gradeBox {
|
} |
} |
|
|
sub handback_box { |
sub handback_box { |
my ($symb,$uname,$udom,$counter,$partid,$record,$res_error) = @_; |
my ($symb,$uname,$udom,$counter,$partid,$record,$res_error_pointer) = @_; |
my ($partlist,$handgrade,$responseType) = &response_type($symb,$res_error); |
my ($partlist,$handgrade,$responseType) = &response_type($symb,$res_error_pointer); |
my (@respids); |
my (@respids); |
my @part_response_id = &flatten_responseType($responseType); |
my @part_response_id = &flatten_responseType($responseType); |
foreach my $part_response_id (@part_response_id) { |
foreach my $part_response_id (@part_response_id) { |
Line 1881 sub files_exist {
|
Line 1846 sub files_exist {
|
|
|
sub download_all_link { |
sub download_all_link { |
my ($r,$symb) = @_; |
my ($r,$symb) = @_; |
|
unless (&files_exist($r, $symb)) { |
|
$r->print(&mt('There are currently no submitted documents.')); |
|
return; |
|
} |
|
|
my $all_students = |
my $all_students = |
join("\n", &Apache::loncommon::get_env_multiple('form.stuinfo')); |
join("\n", &Apache::loncommon::get_env_multiple('form.stuinfo')); |
|
|
Line 1893 sub download_all_link {
|
Line 1863 sub download_all_link {
|
'cgi.'.$identifier.'.parts' => $parts,}); |
'cgi.'.$identifier.'.parts' => $parts,}); |
$r->print('<a href="/cgi-bin/multidownload.pl?'.$identifier.'">'. |
$r->print('<a href="/cgi-bin/multidownload.pl?'.$identifier.'">'. |
&mt('Download All Submitted Documents').'</a>'); |
&mt('Download All Submitted Documents').'</a>'); |
return |
return; |
|
} |
|
|
|
sub submit_download_link { |
|
my ($request,$symb) = @_; |
|
if (!$symb) { return ''; } |
|
#FIXME: Figure out which type of problem this is and provide appropriate download |
|
&download_all_link($request,$symb); |
} |
} |
|
|
sub build_section_inputs { |
sub build_section_inputs { |
Line 1911 sub build_section_inputs {
|
Line 1888 sub build_section_inputs {
|
|
|
# --------------------------- show submissions of a student, option to grade |
# --------------------------- show submissions of a student, option to grade |
sub submission { |
sub submission { |
my ($request,$counter,$total) = @_; |
my ($request,$counter,$total,$symb) = @_; |
my ($uname,$udom) = ($env{'form.student'},$env{'form.userdom'}); |
my ($uname,$udom) = ($env{'form.student'},$env{'form.userdom'}); |
$udom = ($udom eq '' ? $env{'user.domain'} : $udom); #has form.userdom changed for a student? |
$udom = ($udom eq '' ? $env{'user.domain'} : $udom); #has form.userdom changed for a student? |
my $usec = &Apache::lonnet::getsection($udom,$uname,$env{'request.course.id'}); |
my $usec = &Apache::lonnet::getsection($udom,$uname,$env{'request.course.id'}); |
$env{'form.fullname'} = &Apache::loncommon::plainname($uname,$udom,'lastname') if $env{'form.fullname'} eq ''; |
$env{'form.fullname'} = &Apache::loncommon::plainname($uname,$udom,'lastname') if $env{'form.fullname'} eq ''; |
my $symb = &get_symb($request); |
|
|
my $probtitle=&Apache::lonnet::gettitle($symb); |
if ($symb eq '') { $request->print("Unable to handle ambiguous references:."); return ''; } |
if ($symb eq '') { $request->print("Unable to handle ambiguous references:."); return ''; } |
|
|
if (!&canview($usec)) { |
if (!&canview($usec)) { |
$request->print('<span class="LC_warning">Unable to view requested student.('. |
$request->print('<span class="LC_warning">Unable to view requested student.('. |
$uname.':'.$udom.' in section '.$usec.' in course id '. |
$uname.':'.$udom.' in section '.$usec.' in course id '. |
$env{'request.course.id'}.')</span>'); |
$env{'request.course.id'}.')</span>'); |
$request->print(&show_grading_menu_form($symb)); |
|
return; |
return; |
} |
} |
|
|
Line 1939 sub submission {
|
Line 1916 sub submission {
|
# header info |
# header info |
if ($counter == 0) { |
if ($counter == 0) { |
&sub_page_js($request); |
&sub_page_js($request); |
&sub_page_kw_js($request) if ($env{'form.handgrade'} eq 'yes'); |
&sub_page_kw_js($request); |
$env{'form.probTitle'} = $env{'form.probTitle'} eq '' ? |
|
&Apache::lonnet::gettitle($symb) : $env{'form.probTitle'}; |
|
if ($env{'form.handgrade'} eq 'yes' && &files_exist($request, $symb)) { |
|
&download_all_link($request, $symb); |
|
} |
|
$request->print('<h3> <span class="LC_info">'.&mt('Submission Record').'</span></h3>'."\n". |
|
'<h4> '.&mt('<b>Resource: </b> [_1]',$env{'form.probTitle'}).'</h4>'."\n"); |
|
|
|
# option to display problem, only once else it cause problems |
# option to display problem, only once else it cause problems |
# with the form later since the problem has a form. |
# with the form later since the problem has a form. |
Line 1966 sub submission {
|
Line 1936 sub submission {
|
# kwclr is the only variable that is guaranteed to be non blank |
# kwclr is the only variable that is guaranteed to be non blank |
# if this subroutine has been called once. |
# if this subroutine has been called once. |
my %keyhash = (); |
my %keyhash = (); |
if ($env{'form.kwclr'} eq '' && $env{'form.handgrade'} eq 'yes') { |
# if ($env{'form.kwclr'} eq '' && $env{'form.handgrade'} eq 'yes') { |
|
if (1) { |
%keyhash = &Apache::lonnet::dump('nohist_handgrade', |
%keyhash = &Apache::lonnet::dump('nohist_handgrade', |
$env{'course.'.$env{'request.course.id'}.'.domain'}, |
$env{'course.'.$env{'request.course.id'}.'.domain'}, |
$env{'course.'.$env{'request.course.id'}.'.num'}); |
$env{'course.'.$env{'request.course.id'}.'.num'}); |
Line 1977 sub submission {
|
Line 1948 sub submission {
|
$env{'form.kwsize'} = $keyhash{$loginuser.'_kwsize'} ne '' ? $keyhash{$loginuser.'_kwsize'} : '0'; |
$env{'form.kwsize'} = $keyhash{$loginuser.'_kwsize'} ne '' ? $keyhash{$loginuser.'_kwsize'} : '0'; |
$env{'form.kwstyle'} = $keyhash{$loginuser.'_kwstyle'} ne '' ? $keyhash{$loginuser.'_kwstyle'} : ''; |
$env{'form.kwstyle'} = $keyhash{$loginuser.'_kwstyle'} ne '' ? $keyhash{$loginuser.'_kwstyle'} : ''; |
$env{'form.msgsub'} = $keyhash{$symb.'_subject'} ne '' ? |
$env{'form.msgsub'} = $keyhash{$symb.'_subject'} ne '' ? |
$keyhash{$symb.'_subject'} : $env{'form.probTitle'}; |
$keyhash{$symb.'_subject'} : $probtitle; |
$env{'form.savemsgN'} = $keyhash{$symb.'_savemsgN'} ne '' ? $keyhash{$symb.'_savemsgN'} : '0'; |
$env{'form.savemsgN'} = $keyhash{$symb.'_savemsgN'} ne '' ? $keyhash{$symb.'_savemsgN'} : '0'; |
} |
} |
my $overRideScore = $env{'form.overRideScore'} eq '' ? 'no' : $env{'form.overRideScore'}; |
my $overRideScore = $env{'form.overRideScore'} eq '' ? 'no' : $env{'form.overRideScore'}; |
my $stu_status = join(':',&Apache::loncommon::get_env_multiple('form.Status')); |
my $stu_status = join(':',&Apache::loncommon::get_env_multiple('form.Status')); |
$request->print('<form action="/adm/grades" method="post" name="SCORE" enctype="multipart/form-data">'."\n". |
$request->print('<form action="/adm/grades" method="post" name="SCORE" enctype="multipart/form-data">'."\n". |
'<input type="hidden" name="command" value="handgrade" />'."\n". |
'<input type="hidden" name="command" value="handgrade" />'."\n". |
'<input type="hidden" name="saveState" value="'.$env{'form.saveState'}.'" />'."\n". |
|
'<input type="hidden" name="Status" value="'.$stu_status.'" />'."\n". |
'<input type="hidden" name="Status" value="'.$stu_status.'" />'."\n". |
'<input type="hidden" name="overRideScore" value="'.$overRideScore.'" />'."\n". |
'<input type="hidden" name="overRideScore" value="'.$overRideScore.'" />'."\n". |
'<input type="hidden" name="probTitle" value="'.$env{'form.probTitle'}.'" />'."\n". |
|
'<input type="hidden" name="refresh" value="off" />'."\n". |
'<input type="hidden" name="refresh" value="off" />'."\n". |
'<input type="hidden" name="studentNo" value="" />'."\n". |
'<input type="hidden" name="studentNo" value="" />'."\n". |
'<input type="hidden" name="gradeOpt" value="" />'."\n". |
'<input type="hidden" name="gradeOpt" value="" />'."\n". |
'<input type="hidden" name="symb" value="'.&Apache::lonenc::check_encrypt($symb).'" />'."\n". |
'<input type="hidden" name="symb" value="'.&Apache::lonenc::check_encrypt($symb).'" />'."\n". |
'<input type="hidden" name="showgrading" value="'.$env{'form.showgrading'}.'" />'."\n". |
|
'<input type="hidden" name="vProb" value="'.$env{'form.vProb'}.'" />'."\n". |
'<input type="hidden" name="vProb" value="'.$env{'form.vProb'}.'" />'."\n". |
'<input type="hidden" name="vAns" value="'.$env{'form.vAns'}.'" />'."\n". |
'<input type="hidden" name="vAns" value="'.$env{'form.vAns'}.'" />'."\n". |
'<input type="hidden" name="lastSub" value="'.$env{'form.lastSub'}.'" />'."\n". |
'<input type="hidden" name="lastSub" value="'.$env{'form.lastSub'}.'" />'."\n". |
&build_section_inputs(). |
&build_section_inputs(). |
'<input type="hidden" name="submitonly" value="'.$env{'form.submitonly'}.'" />'."\n". |
'<input type="hidden" name="submitonly" value="'.$env{'form.submitonly'}.'" />'."\n". |
'<input type="hidden" name="handgrade" value="'.$env{'form.handgrade'}.'" />'."\n". |
|
'<input type="hidden" name="NCT"'. |
'<input type="hidden" name="NCT"'. |
' value="'.($env{'form.NTSTU'} ne '' ? $env{'form.NTSTU'} : $total+1).'" />'."\n"); |
' value="'.($env{'form.NTSTU'} ne '' ? $env{'form.NTSTU'} : $total+1).'" />'."\n"); |
if ($env{'form.handgrade'} eq 'yes') { |
# if ($env{'form.handgrade'} eq 'yes') { |
|
if (1) { |
$request->print('<input type="hidden" name="keywords" value="'.$env{'form.keywords'}.'" />'."\n". |
$request->print('<input type="hidden" name="keywords" value="'.$env{'form.keywords'}.'" />'."\n". |
'<input type="hidden" name="kwclr" value="'.$env{'form.kwclr'}.'" />'."\n". |
'<input type="hidden" name="kwclr" value="'.$env{'form.kwclr'}.'" />'."\n". |
'<input type="hidden" name="kwsize" value="'.$env{'form.kwsize'}.'" />'."\n". |
'<input type="hidden" name="kwsize" value="'.$env{'form.kwsize'}.'" />'."\n". |
Line 2026 sub submission {
|
Line 1994 sub submission {
|
} |
} |
$request->print($prnmsg); |
$request->print($prnmsg); |
|
|
if ($env{'form.handgrade'} eq 'yes' && $env{'form.showgrading'} eq 'yes') { |
# if ($env{'form.handgrade'} eq 'yes') { |
|
if (1) { |
# |
# |
# Print out the keyword options line |
# Print out the keyword options line |
# |
# |
Line 2102 KEYWORDS
|
Line 2071 KEYWORDS
|
.'<h3 class="LC_hcell">'.&mt('Submissions').'</h3>'; |
.'<h3 class="LC_hcell">'.&mt('Submissions').'</h3>'; |
$result.='<input type="hidden" name="name'.$counter. |
$result.='<input type="hidden" name="name'.$counter. |
'" value="'.$env{'form.fullname'}.'" />'."\n"; |
'" value="'.$env{'form.fullname'}.'" />'."\n"; |
if ($env{'form.handgrade'} eq 'no') { |
# if ($env{'form.handgrade'} eq 'no') { |
|
if (1) { |
$result.='<p class="LC_info">' |
$result.='<p class="LC_info">' |
.&mt('Part(s) graded correct by the computer is marked with a [_1] symbol.',$checkIcon) |
.&mt('Part(s) graded correct by the computer is marked with a [_1] symbol.',$checkIcon) |
."</p>\n"; |
."</p>\n"; |
Line 2111 KEYWORDS
|
Line 2081 KEYWORDS
|
# If any part of the problem is an essay-response (handgraded), then check for collaborators |
# If any part of the problem is an essay-response (handgraded), then check for collaborators |
my $fullname; |
my $fullname; |
my $col_fullnames = []; |
my $col_fullnames = []; |
if ($env{'form.handgrade'} eq 'yes') { |
# if ($env{'form.handgrade'} eq 'yes') { |
|
if (1) { |
(my $sub_result,$fullname,$col_fullnames)= |
(my $sub_result,$fullname,$col_fullnames)= |
&check_collaborators($symb,$uname,$udom,\%record,$handgrade, |
&check_collaborators($symb,$uname,$udom,\%record,$handgrade, |
$counter); |
$counter); |
Line 2162 KEYWORDS
|
Line 2133 KEYWORDS
|
$lastsubonly.="\n".'<div class="LC_grade_submission_part">'. |
$lastsubonly.="\n".'<div class="LC_grade_submission_part">'. |
'<b>'.&mt('Part: [_1]',$display_part).'</b>'. |
'<b>'.&mt('Part: [_1]',$display_part).'</b>'. |
' <span class="LC_internal_info">'. |
' <span class="LC_internal_info">'. |
'('.&mt('Part ID: [_1]',$respid).')'. |
'('.&mt('Response ID: [_1]',$respid).')'. |
'</span> '. |
'</span> '. |
'<span class="LC_warning">'.&mt('Nothing submitted - no attempts.').'</span><br /><br /></div>'; |
'<span class="LC_warning">'.&mt('Nothing submitted - no attempts.').'</span><br /><br /></div>'; |
next; |
next; |
Line 2173 KEYWORDS
|
Line 2144 KEYWORDS
|
my ($ressub,$hide,$subval) = split(/:/,$submission,3); |
my ($ressub,$hide,$subval) = split(/:/,$submission,3); |
# Similarity check |
# Similarity check |
my $similar=''; |
my $similar=''; |
|
my ($type,$trial,$rndseed); |
|
if ($hide eq 'rand') { |
|
$type = 'randomizetry'; |
|
$trial = $record{"resource.$partid.tries"}; |
|
$rndseed = $record{"resource.$partid.rndseed"}; |
|
} |
if($env{'form.checkPlag'}){ |
if($env{'form.checkPlag'}){ |
my ($oname,$odom,$ocrsid,$oessay,$osim)= |
my ($oname,$odom,$ocrsid,$oessay,$osim)= |
&most_similar($uname,$udom,$subval,\%old_essays); |
&most_similar($uname,$udom,$subval,\%old_essays); |
Line 2182 KEYWORDS
|
Line 2159 KEYWORDS
|
&Apache::lonnet::coursedescription($ocrsid, |
&Apache::lonnet::coursedescription($ocrsid, |
{'one_time' => 1}); |
{'one_time' => 1}); |
|
|
if ($hide) { |
if ($hide eq 'anon') { |
$similar='<hr /><span class="LC_warning">'.&mt("Essay was found to be similar to another essay submitted for this assignment.").'<br />'. |
$similar='<hr /><span class="LC_warning">'.&mt("Essay was found to be similar to another essay submitted for this assignment.").'<br />'. |
&mt('As the current submission is for an anonymous survey, no other details are available.').'</span><hr />'; |
&mt('As the current submission is for an anonymous survey, no other details are available.').'</span><hr />'; |
} else { |
} else { |
Line 2199 KEYWORDS
|
Line 2176 KEYWORDS
|
} |
} |
} |
} |
} |
} |
my $order=&get_order($partid,$respid,$symb,$uname,$udom); |
my $order=&get_order($partid,$respid,$symb,$uname,$udom, |
|
undef,$type,$trial,$rndseed); |
if ($env{'form.lastSub'} eq 'lastonly' || |
if ($env{'form.lastSub'} eq 'lastonly' || |
($env{'form.lastSub'} eq 'hdgrade' && |
($env{'form.lastSub'} eq 'hdgrade' && |
$$handgrade{$$part[0].'_'.$$part[1]} eq 'yes')) { |
$$handgrade{$$part[0].'_'.$$part[1]} eq 'yes')) { |
Line 2207 KEYWORDS
|
Line 2185 KEYWORDS
|
$lastsubonly.='<div class="LC_grade_submission_part">'. |
$lastsubonly.='<div class="LC_grade_submission_part">'. |
'<b>'.&mt('Part: [_1]',$display_part).'</b>'. |
'<b>'.&mt('Part: [_1]',$display_part).'</b>'. |
' <span class="LC_internal_info">'. |
' <span class="LC_internal_info">'. |
'('.&mt('Part ID: [_1]',$respid).')'. |
'('.&mt('Response ID: [_1]',$respid).')'. |
'</span> '; |
'</span> '; |
my $files=&get_submitted_files($udom,$uname,$partid,$respid,\%record); |
my $files=&get_submitted_files($udom,$uname,$partid,$respid,\%record); |
if (@$files) { |
if (@$files) { |
if ($hide) { |
if ($hide eq 'anon') { |
$lastsubonly.='<br />'.&mt('[quant,_1,file] uploaded to this anonymous survey',scalar(@{$files})); |
$lastsubonly.='<br />'.&mt('[quant,_1,file] uploaded to this anonymous survey',scalar(@{$files})); |
} else { |
} else { |
$lastsubonly.='<br /><span class="LC_warning">'.&mt('Like all files provided by users, this file may contain viruses').'</span><br />'; |
$lastsubonly.='<br /><span class="LC_warning">'.&mt('Like all files provided by users, this file may contain viruses').'</span><br />'; |
Line 2222 KEYWORDS
|
Line 2200 KEYWORDS
|
} |
} |
$lastsubonly.='<br />'; |
$lastsubonly.='<br />'; |
} |
} |
if ($hide) { |
if ($hide eq 'anon') { |
$lastsubonly.='<b>'.&mt('Anonymous Survey').'</b>'; |
$lastsubonly.='<b>'.&mt('Anonymous Survey').'</b>'; |
} else { |
} else { |
$lastsubonly.='<b>'.&mt('Submitted Answer:').' </b>'. |
$lastsubonly.='<b>'.&mt('Submitted Answer:').' </b>'. |
&cleanRecord($subval,$responsetype,$symb,$partid, |
&cleanRecord($subval,$responsetype,$symb,$partid, |
$respid,\%record,$order,undef,$uname,$udom); |
$respid,\%record,$order,undef,$uname,$udom,$type,$trial,$rndseed); |
} |
} |
if ($similar) {$lastsubonly.="<br /><br />$similar\n";} |
if ($similar) {$lastsubonly.="<br /><br />$similar\n";} |
$lastsubonly.='</div>'; |
$lastsubonly.='</div>'; |
Line 2238 KEYWORDS
|
Line 2216 KEYWORDS
|
} |
} |
$request->print($lastsubonly); |
$request->print($lastsubonly); |
} elsif ($env{'form.lastSub'} eq 'datesub') { |
} elsif ($env{'form.lastSub'} eq 'datesub') { |
# my (undef,$responseType,undef,$parts) = &showResourceInfo($symb); |
my ($parts,$handgrade,$responseType) = &response_type($symb,\$res_error); |
my ($parts,$handgrade,$responseType) = &response_type($symb); |
|
|
|
$request->print(&displaySubByDates($symb,\%record,$parts,$responseType,$checkIcon,$uname,$udom)); |
$request->print(&displaySubByDates($symb,\%record,$parts,$responseType,$checkIcon,$uname,$udom)); |
} elsif ($env{'form.lastSub'} =~ /^(last|all)$/) { |
} elsif ($env{'form.lastSub'} =~ /^(last|all)$/) { |
$request->print(&Apache::loncommon::get_previous_attempt($symb,$uname,$udom, |
$request->print(&Apache::loncommon::get_previous_attempt($symb,$uname,$udom, |
Line 2248 KEYWORDS
|
Line 2224 KEYWORDS
|
$last,'.submission', |
$last,'.submission', |
'Apache::grades::keywords_highlight')); |
'Apache::grades::keywords_highlight')); |
} |
} |
|
|
$request->print('<input type="hidden" name="unamedom'.$counter.'" value="'.$uname.':' |
$request->print('<input type="hidden" name="unamedom'.$counter.'" value="'.$uname.':' |
.$udom.'" />'."\n"); |
.$udom.'" />'."\n"); |
# return if view submission with no grading option |
# return if view submission with no grading option |
if ($env{'form.showgrading'} eq '' || (!&canmodify($usec))) { |
if (!&canmodify($usec)) { |
my $toGrade.='<input type="button" value="Grade Student" '. |
$request->print('<p><span class="LC_warning">'.&mt('No grading privileges').'</span></p></div>'); |
'onclick="javascript:checksubmit(this.form,\'Grade Student\',\'' |
|
.$counter.'\');" target="_self" /> '."\n" if (&canmodify($usec)); |
|
$toGrade.='</div>'."\n"; |
|
if (($env{'form.command'} eq 'submission') || |
|
($env{'form.command'} eq 'processGroup' && $counter == $total)) { |
|
$toGrade.='</form>'.&show_grading_menu_form($symb); |
|
} |
|
$request->print($toGrade); |
|
return; |
return; |
} else { |
} else { |
$request->print('</div>'."\n"); |
$request->print('</div>'."\n"); |
} |
} |
|
|
# essay grading message center |
# essay grading message center |
if ($env{'form.handgrade'} eq 'yes') { |
# if ($env{'form.handgrade'} eq 'yes') { |
|
if (1) { |
my $result='<div class="LC_grade_message_center">'; |
my $result='<div class="LC_grade_message_center">'; |
|
|
$result.='<div class="LC_grade_message_center_header">'. |
$result.='<div class="LC_grade_message_center_header">'. |
Line 2360 KEYWORDS
|
Line 2328 KEYWORDS
|
$endform.="<input type='hidden' value='".&get_increment(). |
$endform.="<input type='hidden' value='".&get_increment(). |
"' name='increment' />"; |
"' name='increment' />"; |
$endform.='</td></tr></table></form>'; |
$endform.='</td></tr></table></form>'; |
$endform.=&show_grading_menu_form($symb); |
|
$request->print($endform); |
$request->print($endform); |
} |
} |
return ''; |
return ''; |
Line 2379 sub check_collaborators {
|
Line 2346 sub check_collaborators {
|
next if ($record->{'resource.'.$part.'.collaborators'} eq ''); |
next if ($record->{'resource.'.$part.'.collaborators'} eq ''); |
my (@good_collaborators, @bad_collaborators); |
my (@good_collaborators, @bad_collaborators); |
foreach my $possible_collaborator |
foreach my $possible_collaborator |
(split(/,?\s+/,$record->{'resource.'.$part.'.collaborators'})) { |
(split(/[,;\s]+/,$record->{'resource.'.$part.'.collaborators'})) { |
$possible_collaborator =~ s/[\$\^\(\)]//g; |
$possible_collaborator =~ s/[\$\^\(\)]//g; |
next if ($possible_collaborator eq ''); |
next if ($possible_collaborator eq ''); |
my ($co_name,$co_dom) = split(/\@|:/,$possible_collaborator); |
my ($co_name,$co_dom) = split(/:/,$possible_collaborator); |
$co_dom = $udom if (! defined($co_dom) || $co_dom =~ /^domain$/i); |
$co_dom = $udom if (! defined($co_dom) || $co_dom =~ /^domain$/i); |
next if ($co_name eq $uname && $co_dom eq $udom); |
next if ($co_name eq $uname && $co_dom eq $udom); |
# Doing this grep allows 'fuzzy' specification |
# Doing this grep allows 'fuzzy' specification |
Line 2395 sub check_collaborators {
|
Line 2362 sub check_collaborators {
|
} |
} |
} |
} |
if (scalar(@good_collaborators) != 0) { |
if (scalar(@good_collaborators) != 0) { |
$result.='<br />'.&mt('Collaborators: '); |
$result.='<br />'.&mt('Collaborators:').'<ol>'; |
foreach my $name (@good_collaborators) { |
foreach my $name (@good_collaborators) { |
my ($lastname,$givenn) = split(/,/,$$fullname{$name}); |
my ($lastname,$givenn) = split(/,/,$$fullname{$name}); |
push(@col_fullnames, $givenn.' '.$lastname); |
push(@col_fullnames, $givenn.' '.$lastname); |
$result.=$fullname->{$name}.' '; |
$result.='<li>'.$fullname->{$name}.'</li>'; |
} |
} |
$result.='<br />'."\n"; |
$result.='</ol><br />'."\n"; |
my ($part)=split(/\./,$part); |
my ($part)=split(/\./,$part); |
$result.='<input type="hidden" name="collaborator'.$counter. |
$result.='<input type="hidden" name="collaborator'.$counter. |
'" value="'.$part.':'.(join ':',@good_collaborators).'" />'. |
'" value="'.$part.':'.(join ':',@good_collaborators).'" />'. |
Line 2437 sub get_last_submission {
|
Line 2404 sub get_last_submission {
|
&Apache::lonlocal::locallocaltime($$returnhash{$version.':timestamp'}); |
&Apache::lonlocal::locallocaltime($$returnhash{$version.':timestamp'}); |
} |
} |
} |
} |
my %typeparts; |
my (%typeparts,%randombytry); |
my $showsurv = |
my $showsurv = |
&Apache::lonnet::allowed('vas',$env{'request.course.id'}); |
&Apache::lonnet::allowed('vas',$env{'request.course.id'}); |
foreach my $key (sort(keys(%lasthash))) { |
foreach my $key (sort(keys(%lasthash))) { |
if ($key =~ /\.type$/) { |
if ($key =~ /\.type$/) { |
if (($lasthash{$key} eq 'anonsurvey') || |
if (($lasthash{$key} eq 'anonsurvey') || |
($lasthash{$key} eq 'anonsurveycred')) { |
($lasthash{$key} eq 'anonsurveycred') || |
|
($lasthash{$key} eq 'randomizetry')) { |
my ($ign,@parts) = split(/\./,$key); |
my ($ign,@parts) = split(/\./,$key); |
pop(@parts); |
pop(@parts); |
unless ($showsurv) { |
my $id = join('.',@parts); |
my $id = join(',',@parts); |
if ($lasthash{$key} eq 'randomizetry') { |
$typeparts{$ign.'.'.$id} = $lasthash{$key}; |
$randombytry{$ign.'.'.$id} = $lasthash{$key}; |
|
} else { |
|
unless ($showsurv) { |
|
$typeparts{$ign.'.'.$id} = $lasthash{$key}; |
|
} |
} |
} |
delete($lasthash{$key}); |
delete($lasthash{$key}); |
} |
} |
} |
} |
} |
} |
my @hidden = keys(%typeparts); |
my @hidden = keys(%typeparts); |
|
my @randomize = keys(%randombytry); |
foreach my $key (keys(%lasthash)) { |
foreach my $key (keys(%lasthash)) { |
next if ($key !~ /\.submission$/); |
next if ($key !~ /\.submission$/); |
my $hide; |
my $hide; |
if (@hidden) { |
if (@hidden) { |
foreach my $id (@hidden) { |
foreach my $id (@hidden) { |
if ($key =~ /^\Q$id\E/) { |
if ($key =~ /^\Q$id\E/) { |
$hide = 1; |
$hide = 'anon'; |
last; |
last; |
} |
} |
} |
} |
} |
} |
|
unless ($hide) { |
|
if (@randomize) { |
|
foreach my $id (@hidden) { |
|
if ($key =~ /^\Q$id\E/) { |
|
$hide = 'rand'; |
|
last; |
|
} |
|
} |
|
} |
|
} |
my ($partid,$foo) = split(/submission$/,$key); |
my ($partid,$foo) = split(/submission$/,$key); |
my $draft = $lasthash{$partid.'awarddetail'} eq 'DRAFT' ? |
my $draft = $lasthash{$partid.'awarddetail'} eq 'DRAFT' ? |
'<span class="LC_warning">Draft Copy</span> ' : ''; |
'<span class="LC_warning">Draft Copy</span> ' : ''; |
Line 2494 sub keywords_highlight {
|
Line 2477 sub keywords_highlight {
|
|
|
#--- Called from submission routine |
#--- Called from submission routine |
sub processHandGrade { |
sub processHandGrade { |
my ($request) = shift; |
my ($request,$symb) = @_; |
my $symb = &get_symb($request); |
|
my (undef,undef,$url) = &Apache::lonnet::decode_symb($symb); |
my (undef,undef,$url) = &Apache::lonnet::decode_symb($symb); |
my $button = $env{'form.gradeOpt'}; |
my $button = $env{'form.gradeOpt'}; |
my $ngrade = $env{'form.NCT'}; |
my $ngrade = $env{'form.NCT'}; |
Line 2535 sub processHandGrade {
|
Line 2517 sub processHandGrade {
|
if ($env{'form.withgrades'.$ctr}) { |
if ($env{'form.withgrades'.$ctr}) { |
$message.="\n\nPoint".($pts > 1 ? 's':'').' awarded = '.$pts.' out of '.$wgt; |
$message.="\n\nPoint".($pts > 1 ? 's':'').' awarded = '.$pts.' out of '.$wgt; |
$messagetail = " for <a href=\"". |
$messagetail = " for <a href=\"". |
$feedurl."?symb=$showsymb\">$env{'form.probTitle'}</a>"; |
$feedurl."?symb=$showsymb\">$restitle</a>"; |
} |
} |
$msgstatus = |
$msgstatus = |
&Apache::lonmsg::user_normal_msg($uname,$udom,$subject, |
&Apache::lonmsg::user_normal_msg($uname,$udom,$subject, |
Line 2563 sub processHandGrade {
|
Line 2545 sub processHandGrade {
|
$udom); |
$udom); |
if ($env{'form.withgrades'.$ctr}) { |
if ($env{'form.withgrades'.$ctr}) { |
$messagetail = " for <a href=\"". |
$messagetail = " for <a href=\"". |
$baseurl."?symb=$showsymb\">$env{'form.probTitle'}</a>"; |
$baseurl."?symb=$showsymb\">$restitle</a>"; |
} |
} |
$msgstatus = |
$msgstatus = |
&Apache::lonmsg::user_normal_msg($collaborator,$udom,$subject,$message.$messagetail,undef,$baseurl,undef,undef,undef,$showsymb,$restitle); |
&Apache::lonmsg::user_normal_msg($collaborator,$udom,$subject,$message.$messagetail,undef,$baseurl,undef,undef,undef,$showsymb,$restitle); |
Line 2575 sub processHandGrade {
|
Line 2557 sub processHandGrade {
|
} |
} |
} |
} |
|
|
if ($env{'form.handgrade'} eq 'yes') { |
# if ($env{'form.handgrade'} eq 'yes') { |
|
if (1) { |
# Keywords sorted in alphabatical order |
# Keywords sorted in alphabatical order |
my $loginuser = $env{'user.name'}.':'.$env{'user.domain'}; |
my $loginuser = $env{'user.name'}.':'.$env{'user.domain'}; |
my %keyhash = (); |
my %keyhash = (); |
Line 2628 sub processHandGrade {
|
Line 2611 sub processHandGrade {
|
my $processUser = $env{'form.unamedom'.$ctr}; |
my $processUser = $env{'form.unamedom'.$ctr}; |
($env{'form.student'},$env{'form.userdom'}) = split(/:/,$processUser); |
($env{'form.student'},$env{'form.userdom'}) = split(/:/,$processUser); |
$env{'form.fullname'} = $$fullname{$processUser}; |
$env{'form.fullname'} = $$fullname{$processUser}; |
&submission($request,$ctr,$total-1); |
&submission($request,$ctr,$total-1,$symb); |
$ctr++; |
$ctr++; |
} |
} |
return ''; |
return ''; |
} |
} |
|
|
# Go directly to grade student - from submission or link from chart page |
|
if ($button eq 'Grade Student') { |
|
# (undef,undef,$env{'form.handgrade'},undef,undef) = &showResourceInfo($symb); |
|
my $processUser = $env{'form.unamedom'.$env{'form.studentNo'}}; |
|
($env{'form.student'},$env{'form.userdom'}) = split(/:/,$processUser); |
|
$env{'form.fullname'} = $$fullname{$processUser}; |
|
&submission($request,0,0); |
|
return ''; |
|
} |
|
|
|
# Get the next/previous one or group of students |
# Get the next/previous one or group of students |
my $firststu = $env{'form.unamedom0'}; |
my $firststu = $env{'form.unamedom0'}; |
my $laststu = $env{'form.unamedom'.($ngrade-1)}; |
my $laststu = $env{'form.unamedom'.($ngrade-1)}; |
Line 2663 sub processHandGrade {
|
Line 2636 sub processHandGrade {
|
} |
} |
return $a cmp $b; |
return $a cmp $b; |
} (keys(%$fullname))) { |
} (keys(%$fullname))) { |
|
# FIXME: this is fishy, looks like the button label |
if ($nextflg == 1 && $button =~ /Next$/) { |
if ($nextflg == 1 && $button =~ /Next$/) { |
push(@parsedlist,$item); |
push(@parsedlist,$item); |
} |
} |
Line 2673 sub processHandGrade {
|
Line 2647 sub processHandGrade {
|
} |
} |
} |
} |
$ctr = 0; |
$ctr = 0; |
|
# FIXME: this is fishy, looks like the button label |
@parsedlist = reverse @parsedlist if ($button eq 'Previous'); |
@parsedlist = reverse @parsedlist if ($button eq 'Previous'); |
my $res_error; |
my $res_error; |
my ($partlist) = &response_type($symb,\$res_error); |
my ($partlist) = &response_type($symb,\$res_error); |
Line 2725 sub processHandGrade {
|
Line 2700 sub processHandGrade {
|
$env{'form.student'} = $uname; |
$env{'form.student'} = $uname; |
$env{'form.userdom'} = $udom; |
$env{'form.userdom'} = $udom; |
$env{'form.fullname'} = $$fullname{$_}; |
$env{'form.fullname'} = $$fullname{$_}; |
&submission($request,$ctr,$total); |
&submission($request,$ctr,$total,$symb); |
$ctr++; |
$ctr++; |
} |
} |
if ($total < 0) { |
if ($total < 0) { |
my $the_end = '<h3><span class="LC_info">'.&mt('LON-CAPA User Message').'</span></h3><br />'."\n"; |
my $the_end.=&mt('<b>Message: </b> No more students for this section or class.').'<br /><br />'."\n"; |
$the_end.=&mt('<b>Message: </b> No more students for this section or class.').'<br /><br />'."\n"; |
|
$the_end.=&mt('Click on the button below to return to the grading menu.').'<br /><br />'."\n"; |
|
$the_end.=&show_grading_menu_form($symb); |
|
$request->print($the_end); |
$request->print($the_end); |
} |
} |
return ''; |
return ''; |
Line 3296 VIEWJAVASCRIPT
|
Line 3268 VIEWJAVASCRIPT
|
|
|
#--- show scores for a section or whole class w/ option to change/update a score |
#--- show scores for a section or whole class w/ option to change/update a score |
sub viewgrades { |
sub viewgrades { |
my ($request) = shift; |
my ($request,$symb) = @_; |
&viewgrades_js($request); |
&viewgrades_js($request); |
|
|
my ($symb) = &get_symb($request); |
|
#need to make sure we have the correct data for later EXT calls, |
#need to make sure we have the correct data for later EXT calls, |
#thus invalidate the cache |
#thus invalidate the cache |
&Apache::lonnet::devalidatecourseresdata( |
&Apache::lonnet::devalidatecourseresdata( |
Line 3308 sub viewgrades {
|
Line 3279 sub viewgrades {
|
&Apache::lonnet::clear_EXT_cache_status(); |
&Apache::lonnet::clear_EXT_cache_status(); |
|
|
my $result='<h3><span class="LC_info">'.&mt('Manual Grading').'</span></h3>'; |
my $result='<h3><span class="LC_info">'.&mt('Manual Grading').'</span></h3>'; |
$result.='<h4>'.&mt('<b>Current Resource: </b>[_1]',$env{'form.probTitle'}).'</h4>'."\n"; |
|
|
|
#view individual student submission form - called using Javascript viewOneStudent |
#view individual student submission form - called using Javascript viewOneStudent |
$result.=&jscriptNform($symb); |
$result.=&jscriptNform($symb); |
Line 3319 sub viewgrades {
|
Line 3289 sub viewgrades {
|
'<input type="hidden" name="symb" value="'.&Apache::lonenc::check_encrypt($symb).'" />'."\n". |
'<input type="hidden" name="symb" value="'.&Apache::lonenc::check_encrypt($symb).'" />'."\n". |
'<input type="hidden" name="command" value="editgrades" />'."\n". |
'<input type="hidden" name="command" value="editgrades" />'."\n". |
&build_section_inputs(). |
&build_section_inputs(). |
'<input type="hidden" name="saveState" value="'.$env{'form.saveState'}.'" />'."\n". |
|
'<input type="hidden" name="Status" value="'.$env{'stu_status'}.'" />'."\n". |
'<input type="hidden" name="Status" value="'.$env{'stu_status'}.'" />'."\n". |
'<input type="hidden" name="probTitle" value="'.$env{'form.probTitle'}.'" />'."\n"; |
|
|
|
my ($common_header,$specific_header); |
my ($common_header,$specific_header); |
if ($env{'form.section'} eq 'all') { |
if ($env{'form.section'} eq 'all') { |
Line 3416 sub viewgrades {
|
Line 3384 sub viewgrades {
|
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); |
push(@partids,$partid); |
|
# |
|
# FIXME: Looks like $display looks at English text |
|
# |
my $display_part=&get_display_part($partid,$symb); |
my $display_part=&get_display_part($partid,$symb); |
if ($display =~ /^Partial Credit Factor/) { |
if ($display =~ /^Partial Credit Factor/) { |
$result.='<th>'. |
$result.='<th>'. |
Line 3467 sub viewgrades {
|
Line 3438 sub viewgrades {
|
$section_display, $stu_status). |
$section_display, $stu_status). |
'</span>'; |
'</span>'; |
} |
} |
$result.=&show_grading_menu_form($symb); |
|
return $result; |
return $result; |
} |
} |
|
|
Line 3539 sub viewstudentgrade {
|
Line 3509 sub viewstudentgrade {
|
#--- change scores for all the students in a section/class |
#--- change scores for all the students in a section/class |
# record does not get update if unchanged |
# record does not get update if unchanged |
sub editgrades { |
sub editgrades { |
my ($request) = @_; |
my ($request,$symb) = @_; |
|
|
my $symb=&get_symb($request); |
|
my $section_display = join (", ",&Apache::loncommon::get_env_multiple('form.section')); |
my $section_display = join (", ",&Apache::loncommon::get_env_multiple('form.section')); |
my $title='<h2>'.&mt('Current Grade Status').'</h2>'; |
my $title='<h2>'.&mt('Current Grade Status').'</h2>'; |
$title.='<h4>'.&mt('<b>Current Resource: </b>[_1]',$env{'form.probTitle'}).'</h4>'."\n"; |
|
$title.='<h4>'.&mt('<b>Section: </b>[_1]',$section_display).'</h4>'."\n"; |
$title.='<h4>'.&mt('<b>Section: </b>[_1]',$section_display).'</h4>'."\n"; |
|
|
my $result= &Apache::loncommon::start_data_table(). |
my $result= &Apache::loncommon::start_data_table(). |
Line 3752 sub editgrades {
|
Line 3720 sub editgrades {
|
&Apache::loncommon::end_data_table_row(); |
&Apache::loncommon::end_data_table_row(); |
} |
} |
} |
} |
$result .= &Apache::loncommon::end_data_table(). |
$result .= &Apache::loncommon::end_data_table(); |
&show_grading_menu_form($symb); |
|
my $msg = '<p><b>'. |
my $msg = '<p><b>'. |
&mt('Number of records updated = [_1] for [quant,_2,student].', |
&mt('Number of records updated = [_1] for [quant,_2,student].', |
$rec_update,$count).'</b><br />'. |
$rec_update,$count).'</b><br />'. |
Line 3866 sub csvuploadmap_header {
|
Line 3833 sub csvuploadmap_header {
|
$javascript=&csvupload_javascript_forward_associate(); |
$javascript=&csvupload_javascript_forward_associate(); |
} |
} |
|
|
# my ($result) = &showResourceInfo($symb,$env{'form.probTitle'}); |
|
my $result=''; |
|
my $checked=(($env{'form.noFirstLine'})?' checked="checked"':''); |
|
my $ignore=&mt('Ignore First Line'); |
|
$symb = &Apache::lonenc::check_encrypt($symb); |
$symb = &Apache::lonenc::check_encrypt($symb); |
|
$request->print('<form method="post" enctype="multipart/form-data" action="/adm/grades" name="gradesupload">'. |
|
&mt('Total number of records found in file: [_1]',$distotal).'<hr />'. |
|
&mt('Associate entries from the uploaded file with as many fields as you can.')); |
|
my $reverse=&mt("Reverse Association"); |
$request->print(<<ENDPICK); |
$request->print(<<ENDPICK); |
<form method="post" enctype="multipart/form-data" action="/adm/grades" name="gradesupload"> |
<br /> |
<h3><span class="LC_info">Uploading Class Grades</span></h3> |
<input type="button" value="$reverse" onclick="javascript:this.form.associate.value='Reverse Association';submit(this.form);" /> |
$result |
|
<hr /> |
|
<h3>Identify fields</h3> |
|
Total number of records found in file: $distotal <hr /> |
|
Enter as many fields as you can. The system will inform you and bring you back |
|
to this page if the data selected is insufficient to run your class.<hr /> |
|
<input type="button" value="Reverse Association" onclick="javascript:this.form.associate.value='Reverse Association';submit(this.form);" /> |
|
<label><input type="checkbox" name="noFirstLine" $checked />$ignore</label> |
|
<input type="hidden" name="associate" value="" /> |
<input type="hidden" name="associate" value="" /> |
<input type="hidden" name="phase" value="three" /> |
<input type="hidden" name="phase" value="three" /> |
<input type="hidden" name="datatoken" value="$datatoken" /> |
<input type="hidden" name="datatoken" value="$datatoken" /> |
Line 3890 to this page if the data selected is ins
|
Line 3849 to this page if the data selected is ins
|
<input type="hidden" name="upfile_associate" |
<input type="hidden" name="upfile_associate" |
value="$env{'form.upfile_associate'}" /> |
value="$env{'form.upfile_associate'}" /> |
<input type="hidden" name="symb" value="$symb" /> |
<input type="hidden" name="symb" value="$symb" /> |
<input type="hidden" name="saveState" value="$env{'form.saveState'}" /> |
|
<input type="hidden" name="probTitle" value="$env{'form.probTitle'}" /> |
|
<input type="hidden" name="command" value="csvuploadoptions" /> |
<input type="hidden" name="command" value="csvuploadoptions" /> |
<hr /> |
<hr /> |
ENDPICK |
ENDPICK |
Line 3953 CSVFORMJS
|
Line 3910 CSVFORMJS
|
} |
} |
|
|
sub upcsvScores_form { |
sub upcsvScores_form { |
my ($request) = shift; |
my ($request,$symb) = @_; |
my ($symb)=&get_symb($request); |
|
if (!$symb) {return '';} |
if (!$symb) {return '';} |
my $result=&checkforfile_js(); |
my $result=&checkforfile_js(); |
$env{'form.probTitle'} = &Apache::lonnet::gettitle($symb); |
$result.=&Apache::loncommon::start_data_table(). |
# my ($table) = &showResourceInfo($symb,$env{'form.probTitle'}); |
&Apache::loncommon::start_data_table_header_row(). |
# $result.=$table; |
'<th>'.&mt('Specify a file containing the class scores for current resource.').'</th>'. |
$result.='<br /><table width="100%" border="0"><tr><td bgcolor="#777777">'."\n"; |
&Apache::loncommon::end_data_table_header_row(). |
$result.='<table width="100%" border="0"><tr bgcolor="#e6ffff"><td>'."\n"; |
&Apache::loncommon::start_data_table_row().'<td>'; |
$result.=' <b>'.&mt('Specify a file containing the class scores for current resource.'). |
|
'</b></td></tr>'."\n"; |
|
$result.='<tr bgcolor=#ffffe6><td>'."\n"; |
|
my $upload=&mt("Upload Scores"); |
my $upload=&mt("Upload Scores"); |
my $upfile_select=&Apache::loncommon::upfile_select_html(); |
my $upfile_select=&Apache::loncommon::upfile_select_html(); |
my $ignore=&mt('Ignore First Line'); |
my $ignore=&mt('Ignore First Line'); |
Line 3973 sub upcsvScores_form {
|
Line 3926 sub upcsvScores_form {
|
<form method="post" enctype="multipart/form-data" action="/adm/grades" name="gradesupload"> |
<form method="post" enctype="multipart/form-data" action="/adm/grades" name="gradesupload"> |
<input type="hidden" name="symb" value="$symb" /> |
<input type="hidden" name="symb" value="$symb" /> |
<input type="hidden" name="command" value="csvuploadmap" /> |
<input type="hidden" name="command" value="csvuploadmap" /> |
<input type="hidden" name="probTitle" value="$env{'form.probTitle'}" /> |
|
<input type="hidden" name="saveState" value="$env{'form.saveState'}" /> |
|
$upfile_select |
$upfile_select |
<br /><input type="button" onclick="javascript:checkUpload(this.form);" value="$upload" /> |
<br /><input type="button" onclick="javascript:checkUpload(this.form);" value="$upload" /> |
<label><input type="checkbox" name="noFirstLine" />$ignore</label> |
|
</form> |
</form> |
ENDUPFORM |
ENDUPFORM |
$result.=&Apache::loncommon::help_open_topic("Course_Convert_To_CSV", |
$result.=&Apache::loncommon::help_open_topic("Course_Convert_To_CSV", |
&mt("How do I create a CSV file from a spreadsheet")) |
&mt("How do I create a CSV file from a spreadsheet")). |
.'</td></tr></table>'."\n"; |
'</td>'. |
$result.='</td></tr></table><br /><br />'."\n"; |
&Apache::loncommon::end_data_table_row(). |
$result.=&show_grading_menu_form($symb); |
&Apache::loncommon::end_data_table(); |
return $result; |
return $result; |
} |
} |
|
|
|
|
sub csvuploadmap { |
sub csvuploadmap { |
my ($request)= @_; |
my ($request,$symb)= @_; |
my ($symb)=&get_symb($request); |
|
if (!$symb) {return '';} |
if (!$symb) {return '';} |
|
|
my $datatoken; |
my $datatoken; |
Line 4002 sub csvuploadmap {
|
Line 3951 sub csvuploadmap {
|
&Apache::loncommon::load_tmp_file($request); |
&Apache::loncommon::load_tmp_file($request); |
} |
} |
my @records=&Apache::loncommon::upfile_record_sep(); |
my @records=&Apache::loncommon::upfile_record_sep(); |
if ($env{'form.noFirstLine'}) { shift(@records); } |
|
&csvuploadmap_header($request,$symb,$datatoken,$#records+1); |
&csvuploadmap_header($request,$symb,$datatoken,$#records+1); |
my ($i,$keyfields); |
my ($i,$keyfields); |
if (@records) { |
if (@records) { |
Line 4032 sub csvuploadmap {
|
Line 3980 sub csvuploadmap {
|
} |
} |
} |
} |
&csvuploadmap_footer($request,$i,$keyfields); |
&csvuploadmap_footer($request,$i,$keyfields); |
$request->print(&show_grading_menu_form($symb)); |
|
|
|
return ''; |
return ''; |
} |
} |
|
|
sub csvuploadoptions { |
sub csvuploadoptions { |
my ($request)= @_; |
my ($request,$symb)= @_; |
my ($symb)=&get_symb($request); |
my $overwrite=&mt('Overwrite any existing score'); |
my $checked=(($env{'form.noFirstLine'})?'1':'0'); |
|
my $ignore=&mt('Ignore First Line'); |
|
$request->print(<<ENDPICK); |
$request->print(<<ENDPICK); |
<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><span class="LC_info">Uploading Class Grade Options</span></h3> |
|
<input type="hidden" name="command" value="csvuploadassign" /> |
<input type="hidden" name="command" value="csvuploadassign" /> |
<!-- |
|
<p> |
|
<label> |
|
<input type="checkbox" name="show_full_results" /> |
|
Show a table of all changes |
|
</label> |
|
</p> |
|
--> |
|
<p> |
<p> |
<label> |
<label> |
<input type="checkbox" name="overwite_scores" checked="checked" /> |
<input type="checkbox" name="overwite_scores" checked="checked" /> |
Overwrite any existing score |
$overwrite |
</label> |
</label> |
</p> |
</p> |
ENDPICK |
ENDPICK |
my %fields=&get_fields(); |
my %fields=&get_fields(); |
if (!defined($fields{'domain'})) { |
if (!defined($fields{'domain'})) { |
my $domform = &Apache::loncommon::select_dom_form($env{'request.role.domain'},'default_domain'); |
my $domform = &Apache::loncommon::select_dom_form($env{'request.role.domain'},'default_domain'); |
$request->print("\n<p> Users are in domain: ".$domform."</p>\n"); |
$request->print("\n<p>".&mt('Users are in domain: [_1]',$domform)."</p>\n"); |
} |
} |
foreach my $key (sort(keys(%env))) { |
foreach my $key (sort(keys(%env))) { |
if ($key !~ /^form\.(.*)$/) { next; } |
if ($key !~ /^form\.(.*)$/) { next; } |
Line 4077 ENDPICK
|
Line 4013 ENDPICK
|
# FIXME do a check for any invalid user ids?... |
# FIXME do a check for any invalid user ids?... |
$request->print('<input type="submit" value="Assign Grades" /><br /> |
$request->print('<input type="submit" value="Assign Grades" /><br /> |
<hr /></form>'."\n"); |
<hr /></form>'."\n"); |
$request->print(&show_grading_menu_form($symb)); |
|
return ''; |
return ''; |
} |
} |
|
|
Line 4099 sub get_fields {
|
Line 4034 sub get_fields {
|
} |
} |
|
|
sub csvuploadassign { |
sub csvuploadassign { |
my ($request)= @_; |
my ($request,$symb)= @_; |
my ($symb)=&get_symb($request); |
|
if (!$symb) {return '';} |
if (!$symb) {return '';} |
my $error_msg = ''; |
my $error_msg = ''; |
&Apache::loncommon::load_tmp_file($request); |
&Apache::loncommon::load_tmp_file($request); |
my @gradedata = &Apache::loncommon::upfile_record_sep(); |
my @gradedata = &Apache::loncommon::upfile_record_sep(); |
if ($env{'form.noFirstLine'}) { shift(@gradedata); } |
|
my %fields=&get_fields(); |
my %fields=&get_fields(); |
$request->print('<h3>Assigning Grades</h3>'); |
|
my $courseid=$env{'request.course.id'}; |
my $courseid=$env{'request.course.id'}; |
my ($classlist) = &getclasslist('all',0); |
my ($classlist) = &getclasslist('all',0); |
my @notallowed; |
my @notallowed; |
Line 4160 sub csvuploadassign {
|
Line 4092 sub csvuploadassign {
|
my $pcr=$entries{$fields{$dest}} / $wgt; |
my $pcr=$entries{$fields{$dest}} / $wgt; |
my $award=($pcr == 0) ? 'incorrect_by_override' |
my $award=($pcr == 0) ? 'incorrect_by_override' |
: 'correct_by_override'; |
: 'correct_by_override'; |
|
if ($pcr>1) { |
|
push(@skipped,&mt("[_1]: point value larger than weight","$username:$domain")); |
|
} |
$grades{"resource.$part.awarded"}=$pcr; |
$grades{"resource.$part.awarded"}=$pcr; |
$grades{"resource.$part.solved"}=$award; |
$grades{"resource.$part.solved"}=$award; |
$points{$part}=1; |
$points{$part}=1; |
Line 4187 sub csvuploadassign {
|
Line 4122 sub csvuploadassign {
|
$env{'request.course.id'}, |
$env{'request.course.id'}, |
$domain,$username); |
$domain,$username); |
if ($result eq 'ok') { |
if ($result eq 'ok') { |
|
# Successfully stored |
$request->print('.'); |
$request->print('.'); |
} else { |
# Remove from grading queue |
|
&Apache::bridgetask::remove_from_queue('gradingqueue',$symb, |
|
$env{'course.'.$env{'request.course.id'}.'.domain'}, |
|
$env{'course.'.$env{'request.course.id'}.'.num'}, |
|
$domain,$username); |
|
$countdone++; |
|
} else { |
$request->print("<p><span class=\"LC_error\">". |
$request->print("<p><span class=\"LC_error\">". |
&mt("Failed to save data for student [_1]. Message when trying to save was: [_2]", |
&mt("Failed to save data for student [_1]. Message when trying to save was: [_2]", |
"$username:$domain",$result)."</span></p>"); |
"$username:$domain",$result)."</span></p>"); |
} |
} |
$request->rflush(); |
$request->rflush(); |
$countdone++; |
|
} |
} |
} |
} |
$request->print('<br />'.&Apache::lonhtmlcommon::confirm_success(&mt("Saved scores for [quant,_1,student]",$countdone),$countdone==0)); |
$request->print('<br />'.&Apache::lonhtmlcommon::confirm_success(&mt("Saved scores for [quant,_1,student]",$countdone),$countdone==0)); |
Line 4207 sub csvuploadassign {
|
Line 4148 sub csvuploadassign {
|
$request->print(join(', ',@notallowed)); |
$request->print(join(', ',@notallowed)); |
} |
} |
$request->print("<br />\n"); |
$request->print("<br />\n"); |
$request->print(&show_grading_menu_form($symb)); |
|
return $error_msg; |
return $error_msg; |
} |
} |
#------------- end of section for handling csv file upload --------- |
#------------- end of section for handling csv file upload --------- |
Line 4218 sub csvuploadassign {
|
Line 4158 sub csvuploadassign {
|
# |
# |
#--- Select a page/sequence and a student to grade |
#--- Select a page/sequence and a student to grade |
sub pickStudentPage { |
sub pickStudentPage { |
my ($request) = shift; |
my ($request,$symb) = @_; |
|
|
my $alertmsg = &mt('Please select the student you wish to grade.'); |
my $alertmsg = &mt('Please select the student you wish to grade.'); |
$request->print(&Apache::lonhtmlcommon::scripttag(<<LISTJAVASCRIPT)); |
$request->print(&Apache::lonhtmlcommon::scripttag(<<LISTJAVASCRIPT)); |
Line 4236 function checkPickOne(formname) {
|
Line 4176 function checkPickOne(formname) {
|
|
|
LISTJAVASCRIPT |
LISTJAVASCRIPT |
&commonJSfunctions($request); |
&commonJSfunctions($request); |
my ($symb) = &get_symb($request); |
|
my $cdom = $env{"course.$env{'request.course.id'}.domain"}; |
my $cdom = $env{"course.$env{'request.course.id'}.domain"}; |
my $cnum = $env{"course.$env{'request.course.id'}.num"}; |
my $cnum = $env{"course.$env{'request.course.id'}.num"}; |
my $getsec = $env{'form.section'} eq '' ? 'all' : $env{'form.section'}; |
my $getsec = $env{'form.section'} eq '' ? 'all' : $env{'form.section'}; |
Line 4291 LISTJAVASCRIPT
|
Line 4231 LISTJAVASCRIPT
|
my $stu_status = join(':',&Apache::loncommon::get_env_multiple('form.Status')); |
my $stu_status = join(':',&Apache::loncommon::get_env_multiple('form.Status')); |
$result.='<input type="hidden" name="Status" value="'.$stu_status.'" />'."\n". |
$result.='<input type="hidden" name="Status" value="'.$stu_status.'" />'."\n". |
'<input type="hidden" name="command" value="displayPage" />'."\n". |
'<input type="hidden" name="command" value="displayPage" />'."\n". |
'<input type="hidden" name="symb" value="'.&Apache::lonenc::check_encrypt($symb).'" />'."\n". |
'<input type="hidden" name="symb" value="'.&Apache::lonenc::check_encrypt($symb).'" />'."<br />\n"; |
'<input type="hidden" name="saveState" value="'.$env{'form.saveState'}.'" />'."<br />\n"; |
|
|
|
$result.=' <b>'.&mt('Use CODE').': </b> <input type="text" name="CODE" value="" /> <br />'."\n"; |
$result.=' <b>'.&mt('Use CODE').': </b> <input type="text" name="CODE" value="" /> <br />'."\n"; |
|
|
Line 4338 LISTJAVASCRIPT
|
Line 4277 LISTJAVASCRIPT
|
$studentTable.='<input type="button" '. |
$studentTable.='<input type="button" '. |
'onclick="javascript:checkPickOne(this.form);" value="'.&mt('Next').' →" /></form>'."\n"; |
'onclick="javascript:checkPickOne(this.form);" value="'.&mt('Next').' →" /></form>'."\n"; |
|
|
$studentTable.=&show_grading_menu_form($symb); |
|
$request->print($studentTable); |
$request->print($studentTable); |
|
|
return ''; |
return ''; |
Line 4375 sub getSymbMap {
|
Line 4313 sub getSymbMap {
|
# |
# |
#--- Displays a page/sequence w/wo problems, w/wo submissions |
#--- Displays a page/sequence w/wo problems, w/wo submissions |
sub displayPage { |
sub displayPage { |
my ($request) = shift; |
my ($request,$symb) = @_; |
|
|
my ($symb) = &get_symb($request); |
|
my $cdom = $env{"course.$env{'request.course.id'}.domain"}; |
my $cdom = $env{"course.$env{'request.course.id'}.domain"}; |
my $cnum = $env{"course.$env{'request.course.id'}.num"}; |
my $cnum = $env{"course.$env{'request.course.id'}.num"}; |
my $getsec = $env{'form.section'} eq '' ? 'all' : $env{'form.section'}; |
my $getsec = $env{'form.section'} eq '' ? 'all' : $env{'form.section'}; |
Line 4395 sub displayPage {
|
Line 4331 sub displayPage {
|
|
|
if (!&canview($usec)) { |
if (!&canview($usec)) { |
$request->print('<span class="LC_warning">'.&mt('Unable to view requested student. ([_1])',$env{'form.student'}).'</span>'); |
$request->print('<span class="LC_warning">'.&mt('Unable to view requested student. ([_1])',$env{'form.student'}).'</span>'); |
$request->print(&show_grading_menu_form($symb)); |
|
return; |
return; |
} |
} |
my $result='<h3><span class="LC_info"> '.$env{'form.title'}.'</span></h3>'; |
my $result='<h3><span class="LC_info"> '.$env{'form.title'}.'</span></h3>'; |
Line 4413 sub displayPage {
|
Line 4348 sub displayPage {
|
my $navmap = Apache::lonnavmaps::navmap->new(); |
my $navmap = Apache::lonnavmaps::navmap->new(); |
unless (ref($navmap)) { |
unless (ref($navmap)) { |
$request->print(&navmap_errormsg()); |
$request->print(&navmap_errormsg()); |
$request->print(&show_grading_menu_form($symb)); |
|
return; |
return; |
} |
} |
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) { |
if (!$map) { |
$request->print('<span class="LC_warning">'.&mt('Unable to view requested sequence. ([_1])',$resUrl).'</span>'); |
$request->print('<span class="LC_warning">'.&mt('Unable to view requested sequence. ([_1])',$resUrl).'</span>'); |
$request->print(&show_grading_menu_form($symb)); |
|
return; |
return; |
} |
} |
my $iterator = $navmap->getIterator($map->map_start(), |
my $iterator = $navmap->getIterator($map->map_start(), |
Line 4433 sub displayPage {
|
Line 4366 sub displayPage {
|
'<input type="hidden" name="page" value="'.$pageTitle.'" />'."\n". |
'<input type="hidden" name="page" value="'.$pageTitle.'" />'."\n". |
'<input type="hidden" name="title" value="'.$env{'form.title'}.'" />'."\n". |
'<input type="hidden" name="title" value="'.$env{'form.title'}.'" />'."\n". |
'<input type="hidden" name="symb" value="'.&Apache::lonenc::check_encrypt($symb).'" />'."\n". |
'<input type="hidden" name="symb" value="'.&Apache::lonenc::check_encrypt($symb).'" />'."\n". |
'<input type="hidden" name="overRideScore" value="no" />'."\n". |
'<input type="hidden" name="overRideScore" value="no" />'."\n"; |
'<input type="hidden" name="saveState" value="'.$env{'form.saveState'}.'" />'."\n"; |
|
|
|
if (defined($env{'form.CODE'})) { |
if (defined($env{'form.CODE'})) { |
$studentTable.= |
$studentTable.= |
Line 4468 sub displayPage {
|
Line 4400 sub displayPage {
|
&Apache::loncommon::start_data_table_row(). |
&Apache::loncommon::start_data_table_row(). |
'<td align="center" valign="top" >'.$prob. |
'<td align="center" valign="top" >'.$prob. |
(scalar(@{$parts}) == 1 ? '' |
(scalar(@{$parts}) == 1 ? '' |
: '<br />('.&mt('[_1] parts)', |
: '<br />('.&mt('[_1]parts)', |
scalar(@{$parts})) |
scalar(@{$parts}).' ') |
). |
). |
'</td>'; |
'</td>'; |
$studentTable.='<td valign="top">'; |
$studentTable.='<td valign="top">'; |
Line 4536 sub displayPage {
|
Line 4468 sub displayPage {
|
'<input type="button" value="'.&mt('Save').'" '. |
'<input type="button" value="'.&mt('Save').'" '. |
'onclick="javascript:checkSubmitPage(this.form,'.$question.');" />'. |
'onclick="javascript:checkSubmitPage(this.form,'.$question.');" />'. |
'</form>'."\n"; |
'</form>'."\n"; |
$studentTable.=&show_grading_menu_form($symb); |
|
$request->print($studentTable); |
$request->print($studentTable); |
|
|
return ''; |
return ''; |
Line 4564 sub displaySubByDates {
|
Line 4495 sub displaySubByDates {
|
|
|
my $interaction; |
my $interaction; |
my $no_increment = 1; |
my $no_increment = 1; |
|
my %lastrndseed; |
for ($version=1;$version<=$$record{'version'};$version++) { |
for ($version=1;$version<=$$record{'version'};$version++) { |
my $timestamp = |
my $timestamp = |
&Apache::lonlocal::locallocaltime($$record{$version.':timestamp'}); |
&Apache::lonlocal::locallocaltime($$record{$version.':timestamp'}); |
Line 4581 sub displaySubByDates {
|
Line 4513 sub displaySubByDates {
|
my @versionKeys = split(/\:/,$$record{$version.':keys'}); |
my @versionKeys = split(/\:/,$$record{$version.':keys'}); |
my @displaySub = (); |
my @displaySub = (); |
foreach my $partid (@{$parts}) { |
foreach my $partid (@{$parts}) { |
my $hidden; |
my ($hidden,$type); |
if (($$record{$version.':resource.'.$partid.'.type'} eq 'anonsurvey') || |
$type = $$record{$version.':resource.'.$partid.'.type'}; |
($$record{$version.':resource.'.$partid.'.type'} eq 'anonsurveycred')) { |
if (($type eq 'anonsurvey') || ($type eq 'anonsurveycred')) { |
$hidden = 1; |
$hidden = 1; |
} |
} |
my @matchKey = ($isTask ? sort(grep /^resource\.\d+\.\Q$partid\E\.award$/,@versionKeys) |
my @matchKey = ($isTask ? sort(grep /^resource\.\d+\.\Q$partid\E\.award$/,@versionKeys) |
Line 4600 sub displaySubByDates {
|
Line 4532 sub displaySubByDates {
|
$displaySub[0].='<span class="LC_nobreak"'; |
$displaySub[0].='<span class="LC_nobreak"'; |
$displaySub[0].='<b>'.&mt('Part: [_1]',$display_part).'</b>' |
$displaySub[0].='<b>'.&mt('Part: [_1]',$display_part).'</b>' |
.' <span class="LC_internal_info">' |
.' <span class="LC_internal_info">' |
.'('.&mt('Part ID: [_1]',$responseId).')' |
.'('.&mt('Response ID: [_1]',$responseId).')' |
.'</span>' |
.'</span>' |
.' <b>'; |
.' <b>'; |
if ($hidden) { |
if ($hidden) { |
$displaySub[0].= &mt('Anonymous Survey').'</b>'; |
$displaySub[0].= &mt('Anonymous Survey').'</b>'; |
} else { |
} else { |
|
my ($trial,$rndseed,$newvariation); |
|
if ($type eq 'randomizetry') { |
|
$trial = $$record{"$where.$partid.tries"}; |
|
$rndseed = $$record{"$where.$partid.rndseed"}; |
|
} |
if ($$record{"$where.$partid.tries"} eq '') { |
if ($$record{"$where.$partid.tries"} eq '') { |
$displaySub[0].=&mt('Trial not counted'); |
$displaySub[0].=&mt('Trial not counted'); |
} else { |
} else { |
$displaySub[0].=&mt('Trial: [_1]', |
$displaySub[0].=&mt('Trial: [_1]', |
$$record{"$where.$partid.tries"}); |
$$record{"$where.$partid.tries"}); |
|
if ($rndseed || $lastrndseed{$partid}) { |
|
if ($rndseed ne $lastrndseed{$partid}) { |
|
$newvariation = ' ('.&mt('New variation this try').')'; |
|
} |
|
} |
|
$lastrndseed{$partid} = $rndseed; |
} |
} |
my $responseType=($isTask ? 'Task' |
my $responseType=($isTask ? 'Task' |
: $responseType->{$partid}->{$responseId}); |
: $responseType->{$partid}->{$responseId}); |
if (!exists($orders{$partid})) { $orders{$partid}={}; } |
if (!exists($orders{$partid})) { $orders{$partid}={}; } |
if (!exists($orders{$partid}->{$responseId})) { |
if ((!exists($orders{$partid}->{$responseId})) || ($trial)) { |
$orders{$partid}->{$responseId}= |
$orders{$partid}->{$responseId}= |
&get_order($partid,$responseId,$symb,$uname,$udom, |
&get_order($partid,$responseId,$symb,$uname,$udom, |
$no_increment); |
$no_increment,$type,$trial,$rndseed); |
} |
} |
$displaySub[0].='</b></span>'; # /nobreak |
$displaySub[0].='</b>'.$newvariation.'</span>'; # /nobreak |
$displaySub[0].=' '. |
$displaySub[0].=' '. |
&cleanRecord($$record{$version.':'.$matchKey},$responseType,$symb,$partid,$responseId,$record,$orders{$partid}->{$responseId},"$version:",$uname,$udom).'<br />'; |
&cleanRecord($$record{$version.':'.$matchKey},$responseType,$symb,$partid,$responseId,$record,$orders{$partid}->{$responseId},"$version:",$uname,$udom,$type,$trial,$rndseed).'<br />'; |
} |
} |
} |
} |
} |
} |
Line 4663 sub displaySubByDates {
|
Line 4606 sub displaySubByDates {
|
} |
} |
|
|
sub updateGradeByPage { |
sub updateGradeByPage { |
my ($request) = shift; |
my ($request,$symb) = @_; |
|
|
my $cdom = $env{"course.$env{'request.course.id'}.domain"}; |
my $cdom = $env{"course.$env{'request.course.id'}.domain"}; |
my $cnum = $env{"course.$env{'request.course.id'}.num"}; |
my $cnum = $env{"course.$env{'request.course.id'}.num"}; |
Line 4674 sub updateGradeByPage {
|
Line 4617 sub updateGradeByPage {
|
my $usec=$classlist->{$env{'form.student'}}[5]; |
my $usec=$classlist->{$env{'form.student'}}[5]; |
if (!&canmodify($usec)) { |
if (!&canmodify($usec)) { |
$request->print('<span class="LC_warning">'.&mt('Unable to modify requested student ([_1])',$env{'form.student'}).'</span>'); |
$request->print('<span class="LC_warning">'.&mt('Unable to modify requested student ([_1])',$env{'form.student'}).'</span>'); |
$request->print(&show_grading_menu_form($env{'form.symb'})); |
|
return; |
return; |
} |
} |
my $result='<h3><span class="LC_info"> '.$env{'form.title'}.'</span></h3>'; |
my $result='<h3><span class="LC_info"> '.$env{'form.title'}.'</span></h3>'; |
Line 4693 sub updateGradeByPage {
|
Line 4635 sub updateGradeByPage {
|
my $map = $navmap->getResourceByUrl($resUrl); # add to navmaps |
my $map = $navmap->getResourceByUrl($resUrl); # add to navmaps |
if (!$map) { |
if (!$map) { |
$request->print('<span class="LC_warning">'.&mt('Unable to grade requested sequence ([_1]).',$resUrl).'</span>'); |
$request->print('<span class="LC_warning">'.&mt('Unable to grade requested sequence ([_1]).',$resUrl).'</span>'); |
my ($symb)=&get_symb($request); |
|
$request->print(&show_grading_menu_form($symb)); |
|
return; |
return; |
} |
} |
my $iterator = $navmap->getIterator($map->map_start(), |
my $iterator = $navmap->getIterator($map->map_start(), |
Line 4724 sub updateGradeByPage {
|
Line 4664 sub updateGradeByPage {
|
&Apache::loncommon::start_data_table_row(). |
&Apache::loncommon::start_data_table_row(). |
'<td align="center" valign="top" >'.$prob. |
'<td align="center" valign="top" >'.$prob. |
(scalar(@{$parts}) == 1 ? '' |
(scalar(@{$parts}) == 1 ? '' |
: '<br />('.&mt('[quant,_1, part]',scalar(@{$parts})) |
: '<br />('.&mt('[quant,_1,part]',scalar(@{$parts})) |
.')').'</td>'; |
.')').'</td>'; |
$studentTable.='<td valign="top"> <b>'.$title.'</b> </td>'; |
$studentTable.='<td valign="top"> <b>'.$title.'</b> </td>'; |
|
|
Line 4820 sub updateGradeByPage {
|
Line 4760 sub updateGradeByPage {
|
} |
} |
|
|
$studentTable.=&Apache::loncommon::end_data_table(); |
$studentTable.=&Apache::loncommon::end_data_table(); |
$studentTable.=&show_grading_menu_form($env{'form.symb'}); |
|
my $grademsg=($changeflag == 0 ? &mt('No score was changed or updated.') : |
my $grademsg=($changeflag == 0 ? &mt('No score was changed or updated.') : |
&mt('The scores were changed for [quant,_1,problem].', |
&mt('The scores were changed for [quant,_1,problem].', |
$changeflag)); |
$changeflag)); |
Line 4898 the homework problem.
|
Line 4837 the homework problem.
|
|
|
sub defaultFormData { |
sub defaultFormData { |
my ($symb)=@_; |
my ($symb)=@_; |
return '<input type="hidden" name="symb" value="'.&Apache::lonenc::check_encrypt($symb).'" />'."\n". |
return '<input type="hidden" name="symb" value="'.&Apache::lonenc::check_encrypt($symb).'" />'; |
'<input type="hidden" name="saveState" value="'.$env{'form.saveState'}.'" />'."\n". |
|
'<input type="hidden" name="probTitle" value="'.$env{'form.probTitle'}.'" />'."\n"; |
|
} |
} |
|
|
|
|
Line 5186 sub scantron_CODEunique {
|
Line 5123 sub scantron_CODEunique {
|
=cut |
=cut |
|
|
sub scantron_selectphase { |
sub scantron_selectphase { |
my ($r,$file2grade) = @_; |
my ($r,$file2grade,$symb) = @_; |
my ($symb)=&get_symb($r); |
|
if (!$symb) {return '';} |
if (!$symb) {return '';} |
my $map_error; |
my $map_error; |
my $sequence_selector=&getSequenceDropDown($symb,\$map_error); |
my $sequence_selector=&getSequenceDropDown($symb,\$map_error); |
Line 5196 sub scantron_selectphase {
|
Line 5132 sub scantron_selectphase {
|
return; |
return; |
} |
} |
my $default_form_data=&defaultFormData($symb); |
my $default_form_data=&defaultFormData($symb); |
my $grading_menu_button=&show_grading_menu_form($symb); |
|
my $file_selector=&scantron_uploads($file2grade); |
my $file_selector=&scantron_uploads($file2grade); |
my $format_selector=&scantron_scantab(); |
my $format_selector=&scantron_scantab(); |
my $CODE_selector=&scantron_CODElist(); |
my $CODE_selector=&scantron_CODElist(); |
Line 5205 sub scantron_selectphase {
|
Line 5140 sub scantron_selectphase {
|
|
|
$ssi_error = 0; |
$ssi_error = 0; |
|
|
|
if (&Apache::lonnet::allowed('usc',$env{'request.role.domain'}) || |
|
&Apache::lonnet::allowed('usc',$env{'request.course.id'})) { |
|
|
|
# Chunk of form to prompt for a scantron file upload. |
|
|
|
$r->print(' |
|
<br /> |
|
'.&Apache::loncommon::start_data_table('LC_scantron_action').' |
|
'.&Apache::loncommon::start_data_table_header_row().' |
|
<th> |
|
'.&mt('Specify a bubblesheet data file to upload.').' |
|
</th> |
|
'.&Apache::loncommon::end_data_table_header_row().' |
|
'.&Apache::loncommon::start_data_table_row().' |
|
<td> |
|
'); |
|
my $default_form_data=&defaultFormData($symb); |
|
my $cdom= $env{'course.'.$env{'request.course.id'}.'.domain'}; |
|
my $cnum= $env{'course.'.$env{'request.course.id'}.'.num'}; |
|
$r->print(&Apache::lonhtmlcommon::scripttag(' |
|
function checkUpload(formname) { |
|
if (formname.upfile.value == "") { |
|
alert("'.&mt('Please use the browse button to select a file from your local directory.').'"); |
|
return false; |
|
} |
|
formname.submit(); |
|
}')); |
|
$r->print(' |
|
<form enctype="multipart/form-data" action="/adm/grades" name="rules" method="post"> |
|
'.$default_form_data.' |
|
<input name="courseid" type="hidden" value="'.$cnum.'" /> |
|
<input name="domainid" type="hidden" value="'.$cdom.'" /> |
|
<input name="command" value="scantronupload_save" type="hidden" /> |
|
'.&mt('File to upload: [_1]','<input type="file" name="upfile" size="50" />').' |
|
<br /> |
|
<input type="button" onclick="javascript:checkUpload(this.form);" value="'.&mt('Upload Bubblesheet Data').'" /> |
|
</form> |
|
'); |
|
|
|
$r->print(' |
|
</td> |
|
'.&Apache::loncommon::end_data_table_row().' |
|
'.&Apache::loncommon::end_data_table().' |
|
'); |
|
} |
|
|
# Chunk of form to prompt for a file to grade and how: |
# Chunk of form to prompt for a file to grade and how: |
|
|
$result.= ' |
$result.= ' |
Line 5252 sub scantron_selectphase {
|
Line 5233 sub scantron_selectphase {
|
|
|
$r->print($result); |
$r->print($result); |
|
|
if (&Apache::lonnet::allowed('usc',$env{'request.role.domain'}) || |
|
&Apache::lonnet::allowed('usc',$env{'request.course.id'})) { |
|
|
|
# Chunk of form to prompt for a scantron file upload. |
|
|
|
$r->print(' |
|
<br /> |
|
'.&Apache::loncommon::start_data_table('LC_scantron_action').' |
|
'.&Apache::loncommon::start_data_table_header_row().' |
|
<th> |
|
'.&mt('Specify a bubblesheet data file to upload.').' |
|
</th> |
|
'.&Apache::loncommon::end_data_table_header_row().' |
|
'.&Apache::loncommon::start_data_table_row().' |
|
<td> |
|
'); |
|
my $default_form_data=&defaultFormData(&get_symb($r,1)); |
|
my $cdom= $env{'course.'.$env{'request.course.id'}.'.domain'}; |
|
my $cnum= $env{'course.'.$env{'request.course.id'}.'.num'}; |
|
$r->print(&Apache::lonhtmlcommon::scripttag(' |
|
function checkUpload(formname) { |
|
if (formname.upfile.value == "") { |
|
alert("'.&mt('Please use the browse button to select a file from your local directory.').'"); |
|
return false; |
|
} |
|
formname.submit(); |
|
}')); |
|
$r->print(' |
|
<form enctype="multipart/form-data" action="/adm/grades" name="rules" method="post"> |
|
'.$default_form_data.' |
|
<input name="courseid" type="hidden" value="'.$cnum.'" /> |
|
<input name="domainid" type="hidden" value="'.$cdom.'" /> |
|
<input name="command" value="scantronupload_save" type="hidden" /> |
|
'.&mt('File to upload: [_1]','<input type="file" name="upfile" size="50" />').' |
|
<br /> |
|
<input type="button" onclick="javascript:checkUpload(this.form);" value="'.&mt('Upload Bubblesheet Data').'" /> |
|
</form> |
|
'); |
|
|
|
$r->print(' |
|
</td> |
|
'.&Apache::loncommon::end_data_table_row().' |
|
'.&Apache::loncommon::end_data_table().' |
|
'); |
|
} |
|
|
|
# Chunk of the form that prompts to view a scoring office file, |
# Chunk of the form that prompts to view a scoring office file, |
# corrected file, skipped records in a file. |
# corrected file, skipped records in a file. |
Line 5356 sub scantron_selectphase {
|
Line 5293 sub scantron_selectphase {
|
&Apache::loncommon::end_data_table_row()."\n". |
&Apache::loncommon::end_data_table_row()."\n". |
&Apache::loncommon::end_data_table()."\n". |
&Apache::loncommon::end_data_table()."\n". |
'</form><br />'); |
'</form><br />'); |
$r->print($grading_menu_button); |
|
return; |
return; |
} |
} |
|
|
Line 6256 sub scantron_warning_screen {
|
Line 6192 sub scantron_warning_screen {
|
=cut |
=cut |
|
|
sub scantron_do_warning { |
sub scantron_do_warning { |
my ($r)=@_; |
my ($r,$symb)=@_; |
my ($symb)=&get_symb($r); |
|
if (!$symb) {return '';} |
if (!$symb) {return '';} |
my $default_form_data=&defaultFormData($symb); |
my $default_form_data=&defaultFormData($symb); |
$r->print(&scantron_form_start().$default_form_data); |
$r->print(&scantron_form_start().$default_form_data); |
if ( $env{'form.selectpage'} eq '' || |
if ( $env{'form.selectpage'} eq '' || |
$env{'form.scantron_selectfile'} eq '' || |
$env{'form.scantron_selectfile'} eq '' || |
$env{'form.scantron_format'} eq '' ) { |
$env{'form.scantron_format'} eq '' ) { |
$r->print("<p>".&mt('You have forgetten to specify some information. Please go Back and try again.')."</p>"); |
$r->print("<p>".&mt('You have forgotten to specify some information. Please go Back and try again.')."</p>"); |
if ( $env{'form.selectpage'} eq '') { |
if ( $env{'form.selectpage'} eq '') { |
$r->print('<p><span class="LC_error">'.&mt('You have not selected a Sequence to grade').'</span></p>'); |
$r->print('<p><span class="LC_error">'.&mt('You have not selected a Sequence to grade').'</span></p>'); |
} |
} |
if ( $env{'form.scantron_selectfile'} eq '') { |
if ( $env{'form.scantron_selectfile'} eq '') { |
$r->print('<p><span class="LC_error">'.&mt('You have not selected a file that contains the student\'s response data.').'</span></p>'); |
$r->print('<p><span class="LC_error">'.&mt("You have not selected a file that contains the student's response data.").'</span></p>'); |
} |
} |
if ( $env{'form.scantron_format'} eq '') { |
if ( $env{'form.scantron_format'} eq '') { |
$r->print('<p><span class="LC_error">'.&mt('You have not selected a the format of the student\'s response data.').'</span></p>'); |
$r->print('<p><span class="LC_error">'.&mt("You have not selected the format of the student's response data.").'</span></p>'); |
} |
} |
} else { |
} else { |
my $warning=&scantron_warning_screen('Grading: Validate Records'); |
my $warning=&scantron_warning_screen('Grading: Validate Records'); |
Line 6282 sub scantron_do_warning {
|
Line 6217 sub scantron_do_warning {
|
<input type="hidden" name="command" value="scantron_validate" /> |
<input type="hidden" name="command" value="scantron_validate" /> |
'); |
'); |
} |
} |
$r->print("</form><br />".&show_grading_menu_form($symb)); |
$r->print("</form><br />"); |
return ''; |
return ''; |
} |
} |
|
|
Line 6338 SCANTRONFORM
|
Line 6273 SCANTRONFORM
|
=cut |
=cut |
|
|
sub scantron_validate_file { |
sub scantron_validate_file { |
my ($r) = @_; |
my ($r,$symb) = @_; |
my ($symb)=&get_symb($r); |
|
if (!$symb) {return '';} |
if (!$symb) {return '';} |
my $default_form_data=&defaultFormData($symb); |
my $default_form_data=&defaultFormData($symb); |
|
|
Line 6431 sub scantron_validate_file {
|
Line 6365 sub scantron_validate_file {
|
$r->print(" ".&mt("this scanline saving it for later.")); |
$r->print(" ".&mt("this scanline saving it for later.")); |
} |
} |
} |
} |
$r->print(" </form><br />".&show_grading_menu_form($symb)); |
$r->print(" </form><br />"); |
return ''; |
return ''; |
} |
} |
|
|
Line 7611 sub scantron_validate_missingbubbles {
|
Line 7545 sub scantron_validate_missingbubbles {
|
|
|
|
|
sub scantron_process_students { |
sub scantron_process_students { |
my ($r) = @_; |
my ($r,$symb) = @_; |
|
|
my (undef,undef,$sequence)=&Apache::lonnet::decode_symb($env{'form.selectpage'}); |
my (undef,undef,$sequence)=&Apache::lonnet::decode_symb($env{'form.selectpage'}); |
my ($symb)=&get_symb($r); |
|
if (!$symb) { |
if (!$symb) { |
return ''; |
return ''; |
} |
} |
Line 7695 SCANTRONFORM
|
Line 7628 SCANTRONFORM
|
if ($ssi_error) { |
if ($ssi_error) { |
$r->print("</form>"); |
$r->print("</form>"); |
&ssi_print_error($r); |
&ssi_print_error($r); |
$r->print(&show_grading_menu_form($symb)); |
|
&Apache::lonnet::remove_lock($lock); |
&Apache::lonnet::remove_lock($lock); |
return ''; # Dunno why the other returns return '' rather than just returning. |
return ''; # Dunno why the other returns return '' rather than just returning. |
} |
} |
Line 7773 SCANTRONFORM
|
Line 7705 SCANTRONFORM
|
$ssi_error = 0; # So end of handler error message does not trigger. |
$ssi_error = 0; # So end of handler error message does not trigger. |
$r->print("</form>"); |
$r->print("</form>"); |
&ssi_print_error($r); |
&ssi_print_error($r); |
$r->print(&show_grading_menu_form($symb)); |
|
&Apache::lonnet::remove_lock($lock); |
&Apache::lonnet::remove_lock($lock); |
return ''; # Why return ''? Beats me. |
return ''; # Why return ''? Beats me. |
} |
} |
Line 7801 SCANTRONFORM
|
Line 7732 SCANTRONFORM
|
$ssi_error = 0; # So end of handler error message does not trigger. |
$ssi_error = 0; # So end of handler error message does not trigger. |
$r->print("</form>"); |
$r->print("</form>"); |
&ssi_print_error($r); |
&ssi_print_error($r); |
$r->print(&show_grading_menu_form($symb)); |
|
&Apache::lonnet::remove_lock($lock); |
&Apache::lonnet::remove_lock($lock); |
delete($completedstudents{$uname}); |
delete($completedstudents{$uname}); |
return ''; |
return ''; |
Line 7857 SCANTRONFORM
|
Line 7787 SCANTRONFORM
|
# $r->print("<p>took $lasttime</p>"); |
# $r->print("<p>took $lasttime</p>"); |
|
|
$r->print("</form>"); |
$r->print("</form>"); |
$r->print(&show_grading_menu_form($symb)); |
|
return ''; |
return ''; |
} |
} |
|
|
Line 7914 sub grade_student_bubbles {
|
Line 7843 sub grade_student_bubbles {
|
} |
} |
|
|
sub scantron_upload_scantron_data { |
sub scantron_upload_scantron_data { |
my ($r)=@_; |
my ($r,$symb)=@_; |
my $dom = $env{'request.role.domain'}; |
my $dom = $env{'request.role.domain'}; |
my $domdesc = &Apache::lonnet::domain($dom,'description'); |
my $domdesc = &Apache::lonnet::domain($dom,'description'); |
$r->print(&Apache::loncommon::coursebrowser_javascript($dom)); |
$r->print(&Apache::loncommon::coursebrowser_javascript($dom)); |
Line 7923 sub scantron_upload_scantron_data {
|
Line 7852 sub scantron_upload_scantron_data {
|
'coursename',$dom); |
'coursename',$dom); |
my $syllabuslink = '<a href="javascript:ToSyllabus();">'.&mt('Syllabus').'</a>'. |
my $syllabuslink = '<a href="javascript:ToSyllabus();">'.&mt('Syllabus').'</a>'. |
(' 'x2).&mt('(shows course personnel)'); |
(' 'x2).&mt('(shows course personnel)'); |
my $default_form_data=&defaultFormData(&get_symb($r,1)); |
my $default_form_data=&defaultFormData($symb); |
my $nofile_alert = &mt('Please use the browse button to select a file from your local directory.'); |
my $nofile_alert = &mt('Please use the browse button to select a file from your local directory.'); |
my $nocourseid_alert = &mt("Please use the 'Select Course' link to open a separate window where you can search for a course to which a file can be uploaded."); |
my $nocourseid_alert = &mt("Please use the 'Select Course' link to open a separate window where you can search for a course to which a file can be uploaded."); |
$r->print(&Apache::lonhtmlcommon::scripttag(' |
$r->print(&Apache::lonhtmlcommon::scripttag(' |
Line 7983 sub scantron_upload_scantron_data {
|
Line 7912 sub scantron_upload_scantron_data {
|
|
|
|
|
sub scantron_upload_scantron_data_save { |
sub scantron_upload_scantron_data_save { |
my($r)=@_; |
my($r,$symb)=@_; |
my ($symb)=&get_symb($r,1); |
|
my $doanotherupload= |
my $doanotherupload= |
'<br /><form action="/adm/grades" method="post">'."\n". |
'<br /><form action="/adm/grades" method="post">'."\n". |
'<input type="hidden" name="command" value="scantronupload" />'."\n". |
'<input type="hidden" name="command" value="scantronupload" />'."\n". |
Line 7994 sub scantron_upload_scantron_data_save {
|
Line 7922 sub scantron_upload_scantron_data_save {
|
!&Apache::lonnet::allowed('usc', |
!&Apache::lonnet::allowed('usc', |
$env{'form.domainid'}.'_'.$env{'form.courseid'})) { |
$env{'form.domainid'}.'_'.$env{'form.courseid'})) { |
$r->print(&mt("You are not allowed to upload bubblesheet data to the requested course.")."<br />"); |
$r->print(&mt("You are not allowed to upload bubblesheet data to the requested course.")."<br />"); |
if ($symb) { |
unless ($symb) { |
$r->print(&show_grading_menu_form($symb)); |
|
} else { |
|
$r->print($doanotherupload); |
$r->print($doanotherupload); |
} |
} |
return ''; |
return ''; |
Line 8024 sub scantron_upload_scantron_data_save {
|
Line 7950 sub scantron_upload_scantron_data_save {
|
} |
} |
} |
} |
if ($symb) { |
if ($symb) { |
$r->print(&scantron_selectphase($r,$uploadedfile)); |
$r->print(&scantron_selectphase($r,$uploadedfile,$symb)); |
} else { |
} else { |
$r->print($doanotherupload); |
$r->print($doanotherupload); |
} |
} |
Line 8126 sub valid_file {
|
Line 8052 sub valid_file {
|
} |
} |
|
|
sub scantron_download_scantron_data { |
sub scantron_download_scantron_data { |
my ($r)=@_; |
my ($r,$symb)=@_; |
my $default_form_data=&defaultFormData(&get_symb($r,1)); |
my $default_form_data=&defaultFormData($symb); |
my $cname=$env{'course.'.$env{'request.course.id'}.'.num'}; |
my $cname=$env{'course.'.$env{'request.course.id'}.'.num'}; |
my $cdom=$env{'course.'.$env{'request.course.id'}.'.domain'}; |
my $cdom=$env{'course.'.$env{'request.course.id'}.'.domain'}; |
my $file=$env{'form.scantron_selectfile'}; |
my $file=$env{'form.scantron_selectfile'}; |
Line 8137 sub scantron_download_scantron_data {
|
Line 8063 sub scantron_download_scantron_data {
|
'.&mt('The requested file name was invalid.').' |
'.&mt('The requested file name was invalid.').' |
</p> |
</p> |
'); |
'); |
$r->print(&show_grading_menu_form(&get_symb($r,1))); |
|
return; |
return; |
} |
} |
my $orig='/uploaded/'.$cdom.'/'.$cname.'/scantron_orig_'.$file; |
my $orig='/uploaded/'.$cdom.'/'.$cname.'/scantron_orig_'.$file; |
Line 8160 sub scantron_download_scantron_data {
|
Line 8085 sub scantron_download_scantron_data {
|
'<a href="'.$skipped.'">','</a>').' |
'<a href="'.$skipped.'">','</a>').' |
</p> |
</p> |
'); |
'); |
$r->print(&show_grading_menu_form(&get_symb($r,1))); |
|
return ''; |
return ''; |
} |
} |
|
|
sub checkscantron_results { |
sub checkscantron_results { |
my ($r) = @_; |
my ($r,$symb) = @_; |
my ($symb)=&get_symb($r); |
|
if (!$symb) {return '';} |
if (!$symb) {return '';} |
my $grading_menu_button=&show_grading_menu_form($symb); |
|
my $cid = $env{'request.course.id'}; |
my $cid = $env{'request.course.id'}; |
my %lettdig = &letter_to_digits(); |
my %lettdig = &letter_to_digits(); |
my $numletts = scalar(keys(%lettdig)); |
my $numletts = scalar(keys(%lettdig)); |
Line 8321 sub checkscantron_results {
|
Line 8243 sub checkscantron_results {
|
&Apache::loncommon::end_data_table()).'<br />'. |
&Apache::loncommon::end_data_table()).'<br />'. |
&mt('Differences can occur if submissions were modified using manual grading after a bubblesheet grading pass.').'<br />'.&mt('If unexpected discrepancies were detected, it is recommended that you inspect the original bubblesheets.'); |
&mt('Differences can occur if submissions were modified using manual grading after a bubblesheet grading pass.').'<br />'.&mt('If unexpected discrepancies were detected, it is recommended that you inspect the original bubblesheets.'); |
} |
} |
$r->print('</form><br />'.$grading_menu_button); |
$r->print('</form><br />'); |
return; |
return; |
} |
} |
|
|
Line 8463 sub letter_to_digits {
|
Line 8385 sub letter_to_digits {
|
|
|
#-------------------------- Menu interface ------------------------- |
#-------------------------- Menu interface ------------------------- |
# |
# |
#--- Show a Grading Menu button - Calls the next routine --- |
#--- Href with symb and command --- |
sub show_grading_menu_form { |
|
my ($symb)=@_; |
sub href_symb_cmd { |
my $result.='<br /><form action="/adm/grades" method="post">'."\n". |
my ($symb,$cmd)=@_; |
'<input type="hidden" name="symb" value="'.&Apache::lonenc::check_encrypt($symb).'" />'."\n". |
return '/adm/grades?symb='.&HTML::Entities::encode(&Apache::lonenc::check_encrypt($symb),'<>&"').'&command='.$cmd; |
'<input type="hidden" name="saveState" value="'.$env{'form.saveState'}.'" />'."\n". |
|
'<input type="hidden" name="command" value="gradingmenu" />'."\n". |
|
'<input type="submit" name="submit" value="'.&mt('Grading Menu').'" />'."\n". |
|
'</form>'."\n"; |
|
return $result; |
|
} |
} |
|
|
sub grading_menu { |
sub grading_menu { |
my ($request) = @_; |
my ($request,$symb) = @_; |
my ($symb)=&get_symb($request); |
|
if (!$symb) {return '';} |
if (!$symb) {return '';} |
my $probTitle = &Apache::lonnet::gettitle($symb); |
|
|
|
my %fields = ('symb'=>&Apache::lonenc::check_encrypt($symb), |
my %fields = ('symb'=>&Apache::lonenc::check_encrypt($symb), |
'probTitle'=>$probTitle, |
'command'=>'individual'); |
'command'=>'individual', |
|
'gradingMenu'=>1, |
|
'showgrading'=>"yes"); |
|
|
|
my $url1a = &Apache::lonhtmlcommon::build_url('grades/',\%fields); |
my $url1a = &Apache::lonhtmlcommon::build_url('grades/',\%fields); |
|
|
Line 8498 sub grading_menu {
|
Line 8410 sub grading_menu {
|
$fields{'command'}='all_for_one'; |
$fields{'command'}='all_for_one'; |
my $url1d=&Apache::lonhtmlcommon::build_url('grades/',\%fields); |
my $url1d=&Apache::lonhtmlcommon::build_url('grades/',\%fields); |
|
|
|
$fields{'command'}='downloadfilesselect'; |
|
my $url1e=&Apache::lonhtmlcommon::build_url('grades/',\%fields); |
|
|
$fields{'command'} = 'csvform'; |
$fields{'command'} = 'csvform'; |
my $url2 = &Apache::lonhtmlcommon::build_url('grades/',\%fields); |
my $url2 = &Apache::lonhtmlcommon::build_url('grades/',\%fields); |
|
|
Line 8515 sub grading_menu {
|
Line 8430 sub grading_menu {
|
{ linktext => 'Select individual students to grade', |
{ linktext => 'Select individual students to grade', |
url => $url1a, |
url => $url1a, |
permission => 'F', |
permission => 'F', |
icon => 'edit-find-replace.png', |
icon => 'grade_students.png', |
linktitle => 'Grade current resource for a selection of students.' |
linktitle => 'Grade current resource for a selection of students.' |
}, |
}, |
{ linktext => 'Grade ungraded submissions.', |
{ linktext => 'Grade ungraded submissions.', |
url => $url1b, |
url => $url1b, |
permission => 'F', |
permission => 'F', |
icon => 'edit-find-replace.png', |
icon => 'ungrade_sub.png', |
linktitle => 'Grade all submissions that have not been graded yet.' |
linktitle => 'Grade all submissions that have not been graded yet.' |
}, |
}, |
|
|
{ linktext => 'Grading table', |
{ linktext => 'Grading table', |
url => $url1c, |
url => $url1c, |
permission => 'F', |
permission => 'F', |
icon => 'edit-find-replace.png', |
icon => 'grading_table.png', |
linktitle => 'Grade current resource for all students.' |
linktitle => 'Grade current resource for all students.' |
}, |
}, |
{ linktext => 'Grade complete page/sequence/folder for one student', |
{ linktext => 'Grade page/folder for one student', |
url => $url1d, |
url => $url1d, |
permission => 'F', |
permission => 'F', |
icon => 'edit-find-replace.png', |
icon => 'grade_PageFolder.png', |
linktitle => 'Grade all resources in current page/sequence/folder for one student.' |
linktitle => 'Grade all resources in current page/sequence/folder for one student.' |
|
}, |
|
{ linktext => 'Download submissions', |
|
url => $url1e, |
|
permission => 'F', |
|
icon => 'download_sub.png', |
|
linktitle => 'Download all students submissions.' |
}]}, |
}]}, |
{ categorytitle=>'Automated Grading', |
{ categorytitle=>'Automated Grading', |
items =>[ |
items =>[ |
Line 8555 sub grading_menu {
|
Line 8476 sub grading_menu {
|
{ linktext => 'Grade/Manage/Review Bubblesheets', |
{ linktext => 'Grade/Manage/Review Bubblesheets', |
url => $url4, |
url => $url4, |
permission => 'F', |
permission => 'F', |
icon => 'stat.png', |
icon => 'bubblesheet.png', |
linktitle => 'Grade scantron exams, upload/download scantron data files, and review previously graded scantron exams.' |
linktitle => 'Grade scantron exams, upload/download scantron data files, and review previously graded scantron exams.' |
}, |
}, |
{ linktext => 'Verify Receipt No.', |
{ linktext => 'Verify Receipt Number', |
url => $url5, |
url => $url5, |
permission => 'F', |
permission => 'F', |
icon => 'edit-find-replace.png', |
icon => 'receipt_number.png', |
linktitle => 'Verify a system-generated receipt number for correct problem solution.' |
linktitle => 'Verify a system-generated receipt number for correct problem solution.' |
} |
} |
|
|
Line 8572 sub grading_menu {
|
Line 8493 sub grading_menu {
|
my $Str; |
my $Str; |
$Str .= '<form method="post" action="" name="gradingMenu">'; |
$Str .= '<form method="post" action="" name="gradingMenu">'; |
$Str .= '<input type="hidden" name="command" value="" />'. |
$Str .= '<input type="hidden" name="command" value="" />'. |
'<input type="hidden" name="symb" value="'.&Apache::lonenc::check_encrypt($symb).'" />'."\n". |
'<input type="hidden" name="symb" value="'.&Apache::lonenc::check_encrypt($symb).'" />'."\n"; |
'<input type="hidden" name="probTitle" value="'.$probTitle.'" />'."\n". |
|
'<input type="hidden" name="gradingMenu" value="1" />'."\n". |
|
'<input type="hidden" name="showgrading" value="yes" />'."\n"; |
|
|
|
$Str .= &Apache::lonhtmlcommon::generate_menu(@menu); |
$Str .= &Apache::lonhtmlcommon::generate_menu(@menu); |
return $Str; |
return $Str; |
Line 8588 sub ungraded {
|
Line 8506 sub ungraded {
|
} |
} |
|
|
sub submit_options_sequence { |
sub submit_options_sequence { |
my ($request) = @_; |
my ($request,$symb) = @_; |
my ($symb)=&get_symb($request); |
|
if (!$symb) {return '';} |
if (!$symb) {return '';} |
&commonJSfunctions($request); |
&commonJSfunctions($request); |
my $result; |
my $result; |
|
|
$result.='<form action="/adm/grades" method="post" name="gradingMenu">'."\n". |
$result.='<form action="/adm/grades" method="post" name="gradingMenu">'."\n". |
'<input type="hidden" name="symb" value="'.&Apache::lonenc::check_encrypt($symb).'" />'."\n". |
'<input type="hidden" name="symb" value="'.&Apache::lonenc::check_encrypt($symb).'" />'."\n"; |
'<input type="hidden" name="gradingMenu" value="1" />'."\n". |
$result.=&selectfield(0). |
'<input type="hidden" name="showgrading" value="yes" />'."\n"; |
|
|
|
$result.=' |
|
<h2> |
|
'.&mt('Grade complete page/sequence/folder for one student').' |
|
</h2>'. |
|
&selectfield(0). |
|
'<input type="hidden" name="command" value="pickStudentPage" /> |
'<input type="hidden" name="command" value="pickStudentPage" /> |
<div> |
<div> |
<input type="submit" value="'.&mt('Next').' →" /> |
<input type="submit" value="'.&mt('Next').' →" /> |
</div> |
</div> |
</div> |
</div> |
</form>'; |
</form>'; |
$result .= &show_grading_menu_form($symb); |
|
return $result; |
return $result; |
} |
} |
|
|
sub submit_options_table { |
sub submit_options_table { |
my ($request) = @_; |
my ($request,$symb) = @_; |
my ($symb)=&get_symb($request); |
|
if (!$symb) {return '';} |
if (!$symb) {return '';} |
&commonJSfunctions($request); |
&commonJSfunctions($request); |
my $result; |
my $result; |
|
|
$result.='<form action="/adm/grades" method="post" name="gradingMenu">'."\n". |
$result.='<form action="/adm/grades" method="post" name="gradingMenu">'."\n". |
'<input type="hidden" name="symb" value="'.&Apache::lonenc::check_encrypt($symb).'" />'."\n". |
'<input type="hidden" name="symb" value="'.&Apache::lonenc::check_encrypt($symb).'" />'."\n"; |
'<input type="hidden" name="gradingMenu" value="1" />'."\n". |
|
'<input type="hidden" name="showgrading" value="yes" />'."\n"; |
|
|
|
$result.=' |
$result.=&selectfield(0). |
<h2> |
|
'.&mt('Grading table').' |
|
</h2>'. |
|
&selectfield(0). |
|
'<input type="hidden" name="command" value="viewgrades" /> |
'<input type="hidden" name="command" value="viewgrades" /> |
<div> |
<div> |
<input type="submit" value="'.&mt('Next').' →" /> |
<input type="submit" value="'.&mt('Next').' →" /> |
</div> |
</div> |
</div> |
</div> |
</form>'; |
</form>'; |
$result .= &show_grading_menu_form($symb); |
|
return $result; |
return $result; |
} |
} |
|
|
|
sub submit_options_download { |
|
my ($request,$symb) = @_; |
|
if (!$symb) {return '';} |
|
|
|
&commonJSfunctions($request); |
|
|
|
my $result='<form action="/adm/grades" method="post" name="gradingMenu">'."\n". |
|
'<input type="hidden" name="symb" value="'.&Apache::lonenc::check_encrypt($symb).'" />'."\n"; |
|
$result.=' |
|
<h2> |
|
'.&mt('Select Students for Which to Download Submissions').' |
|
</h2>'.&selectfield(1).' |
|
<input type="hidden" name="command" value="downloadfileslink" /> |
|
<input type="submit" value="'.&mt('Next').' →" /> |
|
</div> |
|
</div> |
|
|
|
|
|
</form>'; |
|
return $result; |
|
} |
|
|
#--- Displays the submissions first page ------- |
#--- Displays the submissions first page ------- |
sub submit_options { |
sub submit_options { |
my ($request) = @_; |
my ($request,$symb) = @_; |
my ($symb)=&get_symb($request); |
|
if (!$symb) {return '';} |
if (!$symb) {return '';} |
my $probTitle = &Apache::lonnet::gettitle($symb); |
|
|
|
&commonJSfunctions($request); |
&commonJSfunctions($request); |
my $result; |
my $result; |
|
|
$result.='<form action="/adm/grades" method="post" name="gradingMenu">'."\n". |
$result.='<form action="/adm/grades" method="post" name="gradingMenu">'."\n". |
'<input type="hidden" name="symb" value="'.&Apache::lonenc::check_encrypt($symb).'" />'."\n". |
'<input type="hidden" name="symb" value="'.&Apache::lonenc::check_encrypt($symb).'" />'."\n"; |
'<input type="hidden" name="probTitle" value="'.$probTitle.'" />'."\n". |
$result.=&selectfield(1).' |
'<input type="hidden" name="gradingMenu" value="1" />'."\n". |
|
'<input type="hidden" name="showgrading" value="yes" />'."\n"; |
|
|
|
$result.=' |
|
<h2> |
|
'.&mt('Select individual students to grade').' |
|
</h2>'.&selectfield(1).' |
|
<input type="hidden" name="command" value="submission" /> |
<input type="hidden" name="command" value="submission" /> |
<input type="submit" value="'.&mt('Next').' →" /> |
<input type="submit" value="'.&mt('Next').' →" /> |
</div> |
</div> |
Line 8670 sub submit_options {
|
Line 8582 sub submit_options {
|
|
|
|
|
</form>'; |
</form>'; |
$result .= &show_grading_menu_form($symb); |
|
return $result; |
return $result; |
} |
} |
|
|
sub selectfield { |
sub selectfield { |
my ($full)=@_; |
my ($full)=@_; |
|
my %options = |
|
(&Apache::lonlocal::texthash( |
|
'yes' => 'with submissions', |
|
'queued' => 'in grading queue', |
|
'graded' => 'with ungraded submissions', |
|
'incorrect' => 'with incorrect submissions', |
|
'all' => 'with any status'), |
|
'select_form_order' => ['yes','queued','graded','incorrect','all']); |
my $result='<div class="LC_columnSection"> |
my $result='<div class="LC_columnSection"> |
|
|
<fieldset> |
<fieldset> |
Line 8704 sub selectfield {
|
Line 8623 sub selectfield {
|
<legend> |
<legend> |
'.&mt('Submission Status').' |
'.&mt('Submission Status').' |
</legend>'. |
</legend>'. |
&Apache::loncommon::select_form('all','submitonly', |
&Apache::loncommon::select_form('all','submitonly',\%options). |
(&Apache::lonlocal::texthash( |
|
'yes' => 'with submissions', |
|
'queued' => 'in grading queue', |
|
'graded' => 'with ungraded submissions', |
|
'incorrect' => 'with incorrect submissions', |
|
'all' => 'with any status'), |
|
'select_form_order' => ['yes','queued','graded','incorrect','all'])). |
|
'</fieldset>'; |
'</fieldset>'; |
} |
} |
$result.='</div><br />'; |
$result.='</div><br />'; |
Line 8802 sub clicker_grading_parameters {
|
Line 8714 sub clicker_grading_parameters {
|
} |
} |
|
|
sub process_clicker { |
sub process_clicker { |
my ($r)=@_; |
my ($r,$symb)=@_; |
my ($symb)=&get_symb($r); |
|
if (!$symb) {return '';} |
if (!$symb) {return '';} |
my $result=&checkforfile_js(); |
my $result=&checkforfile_js(); |
$env{'form.probTitle'} = &Apache::lonnet::gettitle($symb); |
$result.=&Apache::loncommon::start_data_table(). |
$result.='<br /><table width="100%" border="0"><tr><td bgcolor="#777777">'."\n"; |
&Apache::loncommon::start_data_table_header_row(). |
$result.='<table width="100%" border="0"><tr bgcolor="#e6ffff"><td>'."\n"; |
'<th>'.&mt('Specify a file containing clicker information and set grading options.').'</th>'. |
$result.=' <b>'.&mt('Specify a file containing the clicker information for this resource.'). |
&Apache::loncommon::end_data_table_header_row(). |
'</b></td></tr>'."\n"; |
&Apache::loncommon::start_data_table_row()."<td>\n"; |
$result.='<tr bgcolor="#ffffe6"><td>'."\n"; |
|
# Attempt to restore parameters from last session, set defaults if not present |
# Attempt to restore parameters from last session, set defaults if not present |
my %Saveable_Parameters=&clicker_grading_parameters(); |
my %Saveable_Parameters=&clicker_grading_parameters(); |
&Apache::loncommon::restore_course_settings('grades_clicker', |
&Apache::loncommon::restore_course_settings('grades_clicker', |
Line 8828 sub process_clicker {
|
Line 8738 sub process_clicker {
|
} |
} |
} |
} |
|
|
my $upload=&mt("Upload File"); |
my $upload=&mt("Evaluate File"); |
my $type=&mt("Type"); |
my $type=&mt("Type"); |
my $attendance=&mt("Award points just for participation"); |
my $attendance=&mt("Award points just for participation"); |
my $personnel=&mt("Correctness determined from response by course personnel"); |
my $personnel=&mt("Correctness determined from response by course personnel"); |
Line 8838 sub process_clicker {
|
Line 8748 sub process_clicker {
|
my $pcorrect=&mt("Percentage points for correct solution"); |
my $pcorrect=&mt("Percentage points for correct solution"); |
my $pincorrect=&mt("Percentage points for incorrect solution"); |
my $pincorrect=&mt("Percentage points for incorrect solution"); |
my $selectform=&Apache::loncommon::select_form($env{'form.upfiletype'},'upfiletype', |
my $selectform=&Apache::loncommon::select_form($env{'form.upfiletype'},'upfiletype', |
('iclicker' => 'i>clicker', |
{'iclicker' => 'i>clicker', |
'interwrite' => 'interwrite PRS')); |
'interwrite' => 'interwrite PRS'}); |
$symb = &Apache::lonenc::check_encrypt($symb); |
$symb = &Apache::lonenc::check_encrypt($symb); |
$result.= &Apache::lonhtmlcommon::scripttag(<<ENDUPFORM); |
$result.= &Apache::lonhtmlcommon::scripttag(<<ENDUPFORM); |
function sanitycheck() { |
function sanitycheck() { |
Line 8884 ENDUPFORM
|
Line 8794 ENDUPFORM
|
<form method="post" enctype="multipart/form-data" action="/adm/grades" name="gradesupload"> |
<form method="post" enctype="multipart/form-data" action="/adm/grades" name="gradesupload"> |
<input type="hidden" name="symb" value="$symb" /> |
<input type="hidden" name="symb" value="$symb" /> |
<input type="hidden" name="command" value="processclickerfile" /> |
<input type="hidden" name="command" value="processclickerfile" /> |
<input type="hidden" name="probTitle" value="$env{'form.probTitle'}" /> |
|
<input type="hidden" name="saveState" value="$env{'form.saveState'}" /> |
|
<input type="file" name="upfile" size="50" /> |
<input type="file" name="upfile" size="50" /> |
<br /><label>$type: $selectform</label> |
<br /><label>$type: $selectform</label> |
<br /><label><input type="radio" name="gradingmechanism" value="attendance"$checked{'attendance'} onclick="sanitycheck()" />$attendance </label> |
ENDUPFORM |
|
$result.='</td>'.&Apache::loncommon::end_data_table_row(). |
|
&Apache::loncommon::start_data_table_row().'<td>'.(<<ENDGRADINGFORM); |
|
<label><input type="radio" name="gradingmechanism" value="attendance"$checked{'attendance'} onclick="sanitycheck()" />$attendance </label> |
<br /><label><input type="radio" name="gradingmechanism" value="personnel"$checked{'personnel'} onclick="sanitycheck()" />$personnel</label> |
<br /><label><input type="radio" name="gradingmechanism" value="personnel"$checked{'personnel'} onclick="sanitycheck()" />$personnel</label> |
<br /><label><input type="radio" name="gradingmechanism" value="specific"$checked{'specific'} onclick="sanitycheck()" />$specific </label> |
<br /><label><input type="radio" name="gradingmechanism" value="specific"$checked{'specific'} onclick="sanitycheck()" />$specific </label> |
<input type="text" name="specificid" value="$env{'form.specificid'}" size="20" /> |
<input type="text" name="specificid" value="$env{'form.specificid'}" size="20" /> |
Line 8896 ENDUPFORM
|
Line 8807 ENDUPFORM
|
<br /> |
<br /> |
<input type="text" name="givenanswer" size="50" /> |
<input type="text" name="givenanswer" size="50" /> |
<input type="hidden" name="waschecked" value="$env{'form.gradingmechanism'}" /> |
<input type="hidden" name="waschecked" value="$env{'form.gradingmechanism'}" /> |
<br /><label>$pcorrect: <input type="text" name="pcorrect" size="4" value="$env{'form.pcorrect'}" onchange="sanitycheck()" /></label> |
ENDGRADINGFORM |
|
$result.='</td>'.&Apache::loncommon::end_data_table_row(). |
|
&Apache::loncommon::start_data_table_row().'<td>'.(<<ENDPERCFORM); |
|
<label>$pcorrect: <input type="text" name="pcorrect" size="4" value="$env{'form.pcorrect'}" onchange="sanitycheck()" /></label> |
<br /><label>$pincorrect: <input type="text" name="pincorrect" size="4" value="$env{'form.pincorrect'}" onchange="sanitycheck()" /></label> |
<br /><label>$pincorrect: <input type="text" name="pincorrect" size="4" value="$env{'form.pincorrect'}" onchange="sanitycheck()" /></label> |
<br /><input type="button" onclick="javascript:checkUpload(this.form);" value="$upload" /> |
<br /><input type="button" onclick="javascript:checkUpload(this.form);" value="$upload" /> |
</form>' |
</form>' |
ENDUPFORM |
ENDPERCFORM |
$result.='</td></tr></table>'."\n". |
$result.='</td>'. |
'</td></tr></table><br /><br />'."\n"; |
&Apache::loncommon::end_data_table_row(). |
$result.=&show_grading_menu_form($symb); |
&Apache::loncommon::end_data_table(); |
return $result; |
return $result; |
} |
} |
|
|
sub process_clicker_file { |
sub process_clicker_file { |
my ($r)=@_; |
my ($r,$symb)=@_; |
my ($symb)=&get_symb($r); |
|
if (!$symb) {return '';} |
if (!$symb) {return '';} |
|
|
my %Saveable_Parameters=&clicker_grading_parameters(); |
my %Saveable_Parameters=&clicker_grading_parameters(); |
&Apache::loncommon::store_course_settings('grades_clicker', |
&Apache::loncommon::store_course_settings('grades_clicker', |
\%Saveable_Parameters); |
\%Saveable_Parameters); |
my $result=''; |
my $result=''; |
# my ($result) = &showResourceInfo($symb,$env{'form.probTitle'}); |
|
if (($env{'form.gradingmechanism'} eq 'specific') && ($env{'form.specificid'}!~/\w/)) { |
if (($env{'form.gradingmechanism'} eq 'specific') && ($env{'form.specificid'}!~/\w/)) { |
$result.='<span class="LC_error">'.&mt('You need to specify a clicker ID for the correct answer').'</span>'; |
$result.='<span class="LC_error">'.&mt('You need to specify a clicker ID for the correct answer').'</span>'; |
return $result.&show_grading_menu_form($symb); |
return $result; |
} |
} |
if (($env{'form.gradingmechanism'} eq 'given') && ($env{'form.givenanswer'}!~/\S/)) { |
if (($env{'form.gradingmechanism'} eq 'given') && ($env{'form.givenanswer'}!~/\S/)) { |
$result.='<span class="LC_error">'.&mt('You need to specify the correct answer').'</span>'; |
$result.='<span class="LC_error">'.&mt('You need to specify the correct answer').'</span>'; |
return $result.&show_grading_menu_form($symb); |
return $result; |
} |
} |
my $foundgiven=0; |
my $foundgiven=0; |
if ($env{'form.gradingmechanism'} eq 'given') { |
if ($env{'form.gradingmechanism'} eq 'given') { |
Line 8970 sub process_clicker_file {
|
Line 8882 sub process_clicker_file {
|
$result.="</p>\n"; |
$result.="</p>\n"; |
if ($number==0) { |
if ($number==0) { |
$result.='<span class="LC_error">'.&mt('No IDs found to determine correct answer').'</span>'; |
$result.='<span class="LC_error">'.&mt('No IDs found to determine correct answer').'</span>'; |
return $result.&show_grading_menu_form($symb); |
return $result; |
} |
} |
} |
} |
if (length($env{'form.upfile'}) < 2) { |
if (length($env{'form.upfile'}) < 2) { |
Line 8978 sub process_clicker_file {
|
Line 8890 sub process_clicker_file {
|
'<span class="LC_error">', |
'<span class="LC_error">', |
'</span>', |
'</span>', |
'<span class="LC_filename">'.&HTML::Entities::encode($env{'form.upfile.filename'},'<>&"').'</span>'); |
'<span class="LC_filename">'.&HTML::Entities::encode($env{'form.upfile.filename'},'<>&"').'</span>'); |
return $result.&show_grading_menu_form($symb); |
return $result; |
} |
} |
|
|
# Were able to get all the info needed, now analyze the file |
# Were able to get all the info needed, now analyze the file |
|
|
$result.=&Apache::loncommon::studentbrowser_javascript(); |
$result.=&Apache::loncommon::studentbrowser_javascript(); |
$symb = &Apache::lonenc::check_encrypt($symb); |
$symb = &Apache::lonenc::check_encrypt($symb); |
my $heading=&mt('Scanning clicker file'); |
$result.=&Apache::loncommon::start_data_table(). |
$result.=(<<ENDHEADER); |
&Apache::loncommon::start_data_table_header_row(). |
<br /><table width="100%" border="0"><tr><td bgcolor="#777777"> |
'<th>'.&mt('Evaluate clicker file').'</th>'. |
<table width="100%" border="0"><tr bgcolor="#e6ffff"><td> |
&Apache::loncommon::end_data_table_header_row(). |
<b>$heading</b></td></tr><tr bgcolor=#ffffe6><td> |
&Apache::loncommon::start_data_table_row().(<<ENDHEADER); |
|
<td> |
<form method="post" action="/adm/grades" name="clickeranalysis"> |
<form method="post" action="/adm/grades" name="clickeranalysis"> |
<input type="hidden" name="symb" value="$symb" /> |
<input type="hidden" name="symb" value="$symb" /> |
<input type="hidden" name="command" value="assignclickergrades" /> |
<input type="hidden" name="command" value="assignclickergrades" /> |
<input type="hidden" name="probTitle" value="$env{'form.probTitle'}" /> |
|
<input type="hidden" name="saveState" value="$env{'form.saveState'}" /> |
|
<input type="hidden" name="gradingmechanism" value="$env{'form.gradingmechanism'}" /> |
<input type="hidden" name="gradingmechanism" value="$env{'form.gradingmechanism'}" /> |
<input type="hidden" name="pcorrect" value="$env{'form.pcorrect'}" /> |
<input type="hidden" name="pcorrect" value="$env{'form.pcorrect'}" /> |
<input type="hidden" name="pincorrect" value="$env{'form.pincorrect'}" /> |
<input type="hidden" name="pincorrect" value="$env{'form.pincorrect'}" /> |
Line 9019 ENDHEADER
|
Line 8930 ENDHEADER
|
'<br />'; |
'<br />'; |
if (($env{'form.gradingmechanism'} eq 'given') && ($number!=$foundgiven)) { |
if (($env{'form.gradingmechanism'} eq 'given') && ($number!=$foundgiven)) { |
$result.='<span class="LC_error">'.&mt('Number of given answers does not agree with number of questions in file.').'</span>'; |
$result.='<span class="LC_error">'.&mt('Number of given answers does not agree with number of questions in file.').'</span>'; |
return $result.&show_grading_menu_form($symb); |
return $result; |
} |
} |
# Remember Question Titles |
# Remember Question Titles |
# FIXME: Possibly need delimiter other than ":" |
# FIXME: Possibly need delimiter other than ":" |
Line 9039 ENDHEADER
|
Line 8950 ENDHEADER
|
} elsif ($clicker_ids{$id}) { |
} elsif ($clicker_ids{$id}) { |
if ($clicker_ids{$id}=~/\,/) { |
if ($clicker_ids{$id}=~/\,/) { |
# More than one user with the same clicker! |
# More than one user with the same clicker! |
$result.="\n<hr />".&mt('Clicker registered more than once').": <tt>".$id."</tt><br />"; |
$result.="</td>".&Apache::loncommon::end_data_table_row(). |
|
&Apache::loncommon::start_data_table_row()."<td>". |
|
&mt('Clicker registered more than once').": <tt>".$id."</tt><br />"; |
$result.="\n".'<input type="hidden" name="unknown:'.$id.'" value="'.$responses{$id}.'" />'. |
$result.="\n".'<input type="hidden" name="unknown:'.$id.'" value="'.$responses{$id}.'" />'. |
"<select name='multi".$id."'>"; |
"<select name='multi".$id."'>"; |
foreach my $reguser (sort(split(/\,/,$clicker_ids{$id}))) { |
foreach my $reguser (sort(split(/\,/,$clicker_ids{$id}))) { |
Line 9053 ENDHEADER
|
Line 8966 ENDHEADER
|
$student_count++; |
$student_count++; |
} |
} |
} else { |
} else { |
$result.="\n<hr />".&mt('Unregistered Clicker')." <tt>".$id."</tt><br />"; |
$result.="</td>".&Apache::loncommon::end_data_table_row(). |
|
&Apache::loncommon::start_data_table_row()."<td>". |
|
&mt('Unregistered Clicker')." <tt>".$id."</tt><br />"; |
$result.="\n".'<input type="hidden" name="unknown:'.$id.'" value="'.$responses{$id}.'" />'. |
$result.="\n".'<input type="hidden" name="unknown:'.$id.'" value="'.$responses{$id}.'" />'. |
"\n".&mt("Username").": <input type='text' name='uname".$id."' /> ". |
"\n".&mt("Username").": <input type='text' name='uname".$id."' /> ". |
"\n".&mt("Domain").": ". |
"\n".&mt("Domain").": ". |
Line 9079 ENDHEADER
|
Line 8994 ENDHEADER
|
} else { |
} else { |
$result.='<br /><input type="submit" name="finalize" value="'.&mt('Finalize Grading').'" />'; |
$result.='<br /><input type="submit" name="finalize" value="'.&mt('Finalize Grading').'" />'; |
} |
} |
$result.='</form></td></tr></table>'."\n". |
$result.='</form></td>'. |
'</td></tr></table><br /><br />'."\n"; |
&Apache::loncommon::end_data_table_row(). |
return $result.&show_grading_menu_form($symb); |
&Apache::loncommon::end_data_table(); |
|
return $result; |
} |
} |
|
|
sub iclicker_eval { |
sub iclicker_eval { |
Line 9143 sub interwrite_eval {
|
Line 9059 sub interwrite_eval {
|
} |
} |
|
|
sub assign_clicker_grades { |
sub assign_clicker_grades { |
my ($r)=@_; |
my ($r,$symb)=@_; |
my ($symb)=&get_symb($r); |
|
if (!$symb) {return '';} |
if (!$symb) {return '';} |
# See which part we are saving to |
# See which part we are saving to |
my $res_error; |
my $res_error; |
Line 9155 sub assign_clicker_grades {
|
Line 9070 sub assign_clicker_grades {
|
# FIXME: This should probably look for the first handgradeable part |
# FIXME: This should probably look for the first handgradeable part |
my $part=$$partlist[0]; |
my $part=$$partlist[0]; |
# Start screen output |
# Start screen output |
my $result=''; |
my $result=&Apache::loncommon::start_data_table(). |
# my ($result) = &showResourceInfo($symb,$env{'form.probTitle'}); |
&Apache::loncommon::start_data_table_header_row(). |
|
'<th>'.&mt('Assigning grades based on clicker file').'</th>'. |
my $heading=&mt('Assigning grades based on clicker file'); |
&Apache::loncommon::end_data_table_header_row(). |
$result.=(<<ENDHEADER); |
&Apache::loncommon::start_data_table_row().'<td>'; |
<br /><table width="100%" border="0"><tr><td bgcolor="#777777"> |
|
<table width="100%" border="0"><tr bgcolor="#e6ffff"><td> |
|
<b>$heading</b></td></tr><tr bgcolor=#ffffe6><td> |
|
ENDHEADER |
|
# Get correct result |
# Get correct result |
# FIXME: Possibly need delimiter other than ":" |
# FIXME: Possibly need delimiter other than ":" |
my @correct=(); |
my @correct=(); |
Line 9198 ENDHEADER
|
Line 9109 ENDHEADER
|
my $pcorrect=$env{'form.pcorrect'}; |
my $pcorrect=$env{'form.pcorrect'}; |
my $pincorrect=$env{'form.pincorrect'}; |
my $pincorrect=$env{'form.pincorrect'}; |
my $storecount=0; |
my $storecount=0; |
|
my %users=(); |
foreach my $key (keys(%env)) { |
foreach my $key (keys(%env)) { |
my $user=''; |
my $user=''; |
if ($key=~/^form\.student\:(.*)$/) { |
if ($key=~/^form\.student\:(.*)$/) { |
Line 9211 ENDHEADER
|
Line 9123 ENDHEADER
|
$user=$env{'form.multi'.$id}; |
$user=$env{'form.multi'.$id}; |
} |
} |
} |
} |
if ($user) { |
if ($user) { |
|
if ($users{$user}) { |
|
$result.='<br /><span class="LC_warning">'. |
|
&mt("More than one entry found for <tt>[_1]</tt>!",$user). |
|
'</span><br />'; |
|
} |
|
$users{$user}=1; |
my @answer=split(/\,/,$env{$key}); |
my @answer=split(/\,/,$env{$key}); |
my $sum=0; |
my $sum=0; |
my $realnumber=$number; |
my $realnumber=$number; |
Line 9251 ENDHEADER
|
Line 9169 ENDHEADER
|
} |
} |
# We are done |
# We are done |
$result.='<br />'.&mt('Successfully stored grades for [quant,_1,student].',$storecount). |
$result.='<br />'.&mt('Successfully stored grades for [quant,_1,student].',$storecount). |
'</td></tr></table>'."\n". |
'</td>'. |
'</td></tr></table><br /><br />'."\n"; |
&Apache::loncommon::end_data_table_row(). |
return $result.&show_grading_menu_form($symb); |
&Apache::loncommon::end_data_table(); |
|
return $result; |
} |
} |
|
|
sub navmap_errormsg { |
sub navmap_errormsg { |
Line 9263 sub navmap_errormsg {
|
Line 9182 sub navmap_errormsg {
|
'</div>'; |
'</div>'; |
} |
} |
|
|
|
sub startpage { |
|
my ($r,$symb,$crumbs,$onlyfolderflag,$nodisplayflag) = @_; |
|
unshift(@$crumbs,{href=>&href_symb_cmd($symb,'gradingmenu'),text=>"Grading"}); |
|
$r->print(&Apache::loncommon::start_page('Grading',undef, |
|
{'bread_crumbs' => $crumbs})); |
|
&Apache::lonquickgrades::startGradeScreen($r,'grading'); |
|
unless ($nodisplayflag) { |
|
$r->print(&Apache::lonhtmlcommon::resource_info_box($symb,$onlyfolderflag)); |
|
} |
|
} |
|
|
|
sub select_problem { |
|
my ($r)=@_; |
|
$r->print('<h3>'.&mt('Select the problem or one of the problems you want to grade').'</h3><form action="/adm/grades">'); |
|
$r->print(&Apache::lonstathelpers::problem_selector('.',undef,1)); |
|
$r->print('<input type="hidden" name="command" value="gradingmenu" />'); |
|
$r->print('<input type="submit" value="'.&mt('Next').' →" /></form>'); |
|
} |
|
|
sub handler { |
sub handler { |
my $request=$_[0]; |
my $request=$_[0]; |
&reset_caches(); |
&reset_caches(); |
Line 9274 sub handler {
|
Line 9212 sub handler {
|
$request->send_http_header; |
$request->send_http_header; |
return '' if $request->header_only; |
return '' if $request->header_only; |
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'}); |
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'}); |
my $symb=&get_symb($request,1); |
|
|
# see what command we need to execute |
|
|
my @commands=&Apache::loncommon::get_env_multiple('form.command'); |
my @commands=&Apache::loncommon::get_env_multiple('form.command'); |
my $command=$commands[0]; |
my $command=$commands[0]; |
|
|
Line 9282 sub handler {
|
Line 9222 sub handler {
|
&Apache::lonnet::logthis("grades got multiple commands ".join(':',@commands)); |
&Apache::lonnet::logthis("grades got multiple commands ".join(':',@commands)); |
} |
} |
|
|
|
# see what the symb is |
|
|
|
my $symb=$env{'form.symb'}; |
|
unless ($symb) { |
|
(my $url=$env{'form.url'}) =~ s-^https*://($ENV{'SERVER_NAME'}|$ENV{'HTTP_HOST'})--; |
|
$symb=&Apache::lonnet::symbread($url); |
|
} |
|
&Apache::lonenc::check_decrypt(\$symb); |
|
|
$ssi_error = 0; |
$ssi_error = 0; |
my $brcrum = [{href=>"/adm/grades",text=>"Grading"}]; |
if (($symb eq '' || $command eq '') && ($env{'request.course.id'})) { |
$request->print(&Apache::loncommon::start_page('Grading',undef, |
|
{'bread_crumbs' => $brcrum})); |
|
if ($symb eq '' && $command eq '') { |
|
# |
# |
# Not called from a resource |
# Not called from a resource, but inside a course |
# |
# |
|
&startpage($request,undef,[],1,1); |
|
&select_problem($request); |
} else { |
} else { |
&init_perm(); |
&init_perm(); |
if ($command eq 'submission' && $perm{'vgr'}) { |
if ($command eq 'submission' && $perm{'vgr'}) { |
($env{'form.student'} eq '' ? &listStudents($request) : &submission($request,0,0)); |
&startpage($request,$symb,[{href=>"", text=>"Student Submissions"}]); |
|
($env{'form.student'} eq '' ? &listStudents($request,$symb) : &submission($request,0,0,$symb)); |
} elsif ($command eq 'pickStudentPage' && $perm{'vgr'}) { |
} elsif ($command eq 'pickStudentPage' && $perm{'vgr'}) { |
&pickStudentPage($request); |
&startpage($request,$symb,[{href=>&href_symb_cmd($symb,'all_for_one'),text=>'Grade page/folder for one student'}, |
|
{href=>'',text=>'Select student'}],1,1); |
|
&pickStudentPage($request,$symb); |
} elsif ($command eq 'displayPage' && $perm{'vgr'}) { |
} elsif ($command eq 'displayPage' && $perm{'vgr'}) { |
&displayPage($request); |
&startpage($request,$symb, |
|
[{href=>&href_symb_cmd($symb,'all_for_one'),text=>'Grade page/folder for one student'}, |
|
{href=>'',text=>'Select student'}, |
|
{href=>'',text=>'Grade student'}],1,1); |
|
&displayPage($request,$symb); |
} elsif ($command eq 'gradeByPage' && $perm{'mgr'}) { |
} elsif ($command eq 'gradeByPage' && $perm{'mgr'}) { |
&updateGradeByPage($request); |
&startpage($request,$symb,[{href=>&href_symb_cmd($symb,'all_for_one'),text=>'Grade page/folder for one student'}, |
|
{href=>'',text=>'Select student'}, |
|
{href=>'',text=>'Grade student'}, |
|
{href=>'',text=>'Store grades'}],1,1); |
|
&updateGradeByPage($request,$symb); |
} elsif ($command eq 'processGroup' && $perm{'vgr'}) { |
} elsif ($command eq 'processGroup' && $perm{'vgr'}) { |
&processGroup($request); |
&startpage($request,$symb,[{href=>'',text=>'...'}, |
|
{href=>'',text=>'Modify grades'}]); |
|
&processGroup($request,$symb); |
} elsif ($command eq 'gradingmenu' && $perm{'vgr'}) { |
} elsif ($command eq 'gradingmenu' && $perm{'vgr'}) { |
$request->print(&grading_menu($request)); |
&startpage($request,$symb); |
|
$request->print(&grading_menu($request,$symb)); |
} elsif ($command eq 'individual' && $perm{'vgr'}) { |
} elsif ($command eq 'individual' && $perm{'vgr'}) { |
$request->print(&submit_options($request)); |
&startpage($request,$symb,[{href=>'',text=>'Select individual students to grade'}]); |
|
$request->print(&submit_options($request,$symb)); |
} elsif ($command eq 'ungraded' && $perm{'vgr'}) { |
} elsif ($command eq 'ungraded' && $perm{'vgr'}) { |
$request->print(&submit_options($request)); |
&startpage($request,$symb,[{href=>'',text=>'Grade ungraded submissions'}]); |
|
$request->print(&listStudents($request,$symb,'graded')); |
} elsif ($command eq 'table' && $perm{'vgr'}) { |
} elsif ($command eq 'table' && $perm{'vgr'}) { |
$request->print(&submit_options_table($request)); |
&startpage($request,$symb,[{href=>"", text=>"Grading table"}]); |
|
$request->print(&submit_options_table($request,$symb)); |
} elsif ($command eq 'all_for_one' && $perm{'vgr'}) { |
} elsif ($command eq 'all_for_one' && $perm{'vgr'}) { |
$request->print(&submit_options_sequence($request)); |
&startpage($request,$symb,[{href=>'',text=>'Grade page/folder for one student'}],1,1); |
|
$request->print(&submit_options_sequence($request,$symb)); |
} elsif ($command eq 'viewgrades' && $perm{'vgr'}) { |
} elsif ($command eq 'viewgrades' && $perm{'vgr'}) { |
$request->print(&viewgrades($request)); |
&startpage($request,$symb,[{href=>&href_symb_cmd($symb,"table"), text=>"Grading table"},{href=>'', text=>"Modify grades"}]); |
|
$request->print(&viewgrades($request,$symb)); |
} elsif ($command eq 'handgrade' && $perm{'mgr'}) { |
} elsif ($command eq 'handgrade' && $perm{'mgr'}) { |
$request->print(&processHandGrade($request)); |
&startpage($request,$symb,[{href=>'',text=>'...'}, |
|
{href=>'',text=>'Store grades'}]); |
|
$request->print(&processHandGrade($request,$symb)); |
} elsif ($command eq 'editgrades' && $perm{'mgr'}) { |
} elsif ($command eq 'editgrades' && $perm{'mgr'}) { |
$request->print(&editgrades($request)); |
&startpage($request,$symb,[{href=>&href_symb_cmd($symb,"table"), text=>"Grading table"}, |
|
{href=>&href_symb_cmd($symb,'viewgrades').'&group=all§ion=all&Status=Active', |
|
text=>"Modify grades"}, |
|
{href=>'', text=>"Store grades"}]); |
|
$request->print(&editgrades($request,$symb)); |
} elsif ($command eq 'initialverifyreceipt' && $perm{'vgr'}) { |
} elsif ($command eq 'initialverifyreceipt' && $perm{'vgr'}) { |
$request->print(&initialverifyreceipt($request)); |
&startpage($request,$symb,[{href=>'',text=>'Verify Receipt Number'}]); |
|
$request->print(&initialverifyreceipt($request,$symb)); |
} elsif ($command eq 'verify' && $perm{'vgr'}) { |
} elsif ($command eq 'verify' && $perm{'vgr'}) { |
$request->print(&verifyreceipt($request)); |
&startpage($request,$symb,[{href=>&href_symb_cmd($symb,"initialverifyreceipt"),text=>'Verify Receipt Number'}, |
|
{href=>'',text=>'Verification Result'}]); |
|
$request->print(&verifyreceipt($request,$symb)); |
} elsif ($command eq 'processclicker' && $perm{'mgr'}) { |
} elsif ($command eq 'processclicker' && $perm{'mgr'}) { |
$request->print(&process_clicker($request)); |
&startpage($request,$symb,[{href=>'', text=>'Process clicker'}]); |
|
$request->print(&process_clicker($request,$symb)); |
} elsif ($command eq 'processclickerfile' && $perm{'mgr'}) { |
} elsif ($command eq 'processclickerfile' && $perm{'mgr'}) { |
$request->print(&process_clicker_file($request)); |
&startpage($request,$symb,[{href=>&href_symb_cmd($symb,'processclicker'), text=>'Process clicker'}, |
|
{href=>'', text=>'Process clicker file'}]); |
|
$request->print(&process_clicker_file($request,$symb)); |
} elsif ($command eq 'assignclickergrades' && $perm{'mgr'}) { |
} elsif ($command eq 'assignclickergrades' && $perm{'mgr'}) { |
$request->print(&assign_clicker_grades($request)); |
&startpage($request,$symb,[{href=>&href_symb_cmd($symb,'processclicker'), text=>'Process clicker'}, |
|
{href=>'', text=>'Process clicker file'}, |
|
{href=>'', text=>'Store grades'}]); |
|
$request->print(&assign_clicker_grades($request,$symb)); |
} elsif ($command eq 'csvform' && $perm{'mgr'}) { |
} elsif ($command eq 'csvform' && $perm{'mgr'}) { |
$request->print(&upcsvScores_form($request)); |
&startpage($request,$symb,[{href=>'', text=>'Upload Scores'}],1,1); |
|
$request->print(&upcsvScores_form($request,$symb)); |
} elsif ($command eq 'csvupload' && $perm{'mgr'}) { |
} elsif ($command eq 'csvupload' && $perm{'mgr'}) { |
$request->print(&csvupload($request)); |
&startpage($request,$symb,[{href=>'', text=>'Upload Scores'}],1,1); |
|
$request->print(&csvupload($request,$symb)); |
} elsif ($command eq 'csvuploadmap' && $perm{'mgr'} ) { |
} elsif ($command eq 'csvuploadmap' && $perm{'mgr'} ) { |
$request->print(&csvuploadmap($request)); |
&startpage($request,$symb,[{href=>'', text=>'Upload Scores'}],1,1); |
|
$request->print(&csvuploadmap($request,$symb)); |
} elsif ($command eq 'csvuploadoptions' && $perm{'mgr'}) { |
} elsif ($command eq 'csvuploadoptions' && $perm{'mgr'}) { |
if ($env{'form.associate'} ne 'Reverse Association') { |
if ($env{'form.associate'} ne 'Reverse Association') { |
$request->print(&csvuploadoptions($request)); |
&startpage($request,$symb,[{href=>'', text=>'Upload Scores'}],1,1); |
|
$request->print(&csvuploadoptions($request,$symb)); |
} else { |
} else { |
if ( $env{'form.upfile_associate'} ne 'reverse' ) { |
if ( $env{'form.upfile_associate'} ne 'reverse' ) { |
$env{'form.upfile_associate'} = 'reverse'; |
$env{'form.upfile_associate'} = 'reverse'; |
} else { |
} else { |
$env{'form.upfile_associate'} = 'forward'; |
$env{'form.upfile_associate'} = 'forward'; |
} |
} |
$request->print(&csvuploadmap($request)); |
&startpage($request,$symb,[{href=>'', text=>'Upload Scores'}],1,1); |
|
$request->print(&csvuploadmap($request,$symb)); |
} |
} |
} elsif ($command eq 'csvuploadassign' && $perm{'mgr'} ) { |
} elsif ($command eq 'csvuploadassign' && $perm{'mgr'} ) { |
$request->print(&csvuploadassign($request)); |
&startpage($request,$symb,[{href=>'', text=>'Upload Scores'}],1,1); |
|
$request->print(&csvuploadassign($request,$symb)); |
} elsif ($command eq 'scantron_selectphase' && $perm{'mgr'}) { |
} elsif ($command eq 'scantron_selectphase' && $perm{'mgr'}) { |
$request->print(&scantron_selectphase($request)); |
&startpage($request,$symb,[{href=>'', text=>'Grade/Manage/Review Bubblesheets'}],1,1); |
|
$request->print(&scantron_selectphase($request,undef,$symb)); |
} elsif ($command eq 'scantron_warning' && $perm{'mgr'}) { |
} elsif ($command eq 'scantron_warning' && $perm{'mgr'}) { |
$request->print(&scantron_do_warning($request)); |
&startpage($request,$symb,[{href=>'', text=>'Grade/Manage/Review Bubblesheets'}],1,1); |
|
$request->print(&scantron_do_warning($request,$symb)); |
} elsif ($command eq 'scantron_validate' && $perm{'mgr'}) { |
} elsif ($command eq 'scantron_validate' && $perm{'mgr'}) { |
$request->print(&scantron_validate_file($request)); |
&startpage($request,$symb,[{href=>'', text=>'Grade/Manage/Review Bubblesheets'}],1,1); |
|
$request->print(&scantron_validate_file($request,$symb)); |
} elsif ($command eq 'scantron_process' && $perm{'mgr'}) { |
} elsif ($command eq 'scantron_process' && $perm{'mgr'}) { |
$request->print(&scantron_process_students($request)); |
&startpage($request,$symb,[{href=>'', text=>'Grade/Manage/Review Bubblesheets'}],1,1); |
|
$request->print(&scantron_process_students($request,$symb)); |
} elsif ($command eq 'scantronupload' && |
} elsif ($command eq 'scantronupload' && |
(&Apache::lonnet::allowed('usc',$env{'request.role.domain'})|| |
(&Apache::lonnet::allowed('usc',$env{'request.role.domain'})|| |
&Apache::lonnet::allowed('usc',$env{'request.course.id'}))) { |
&Apache::lonnet::allowed('usc',$env{'request.course.id'}))) { |
$request->print(&scantron_upload_scantron_data($request)); |
&startpage($request,$symb,[{href=>'', text=>'Grade/Manage/Review Bubblesheets'}],1,1); |
|
$request->print(&scantron_upload_scantron_data($request,$symb)); |
} elsif ($command eq 'scantronupload_save' && |
} elsif ($command eq 'scantronupload_save' && |
(&Apache::lonnet::allowed('usc',$env{'request.role.domain'})|| |
(&Apache::lonnet::allowed('usc',$env{'request.role.domain'})|| |
&Apache::lonnet::allowed('usc',$env{'request.course.id'}))) { |
&Apache::lonnet::allowed('usc',$env{'request.course.id'}))) { |
$request->print(&scantron_upload_scantron_data_save($request)); |
&startpage($request,$symb,[{href=>'', text=>'Grade/Manage/Review Bubblesheets'}],1,1); |
|
$request->print(&scantron_upload_scantron_data_save($request,$symb)); |
} elsif ($command eq 'scantron_download' && |
} elsif ($command eq 'scantron_download' && |
&Apache::lonnet::allowed('usc',$env{'request.course.id'})) { |
&Apache::lonnet::allowed('usc',$env{'request.course.id'})) { |
$request->print(&scantron_download_scantron_data($request)); |
&startpage($request,$symb,[{href=>'', text=>'Grade/Manage/Review Bubblesheets'}],1,1); |
|
$request->print(&scantron_download_scantron_data($request,$symb)); |
} elsif ($command eq 'checksubmissions' && $perm{'vgr'}) { |
} elsif ($command eq 'checksubmissions' && $perm{'vgr'}) { |
$request->print(&checkscantron_results($request)); |
&startpage($request,$symb,[{href=>'', text=>'Grade/Manage/Review Bubblesheets'}],1,1); |
|
$request->print(&checkscantron_results($request,$symb)); |
|
} elsif ($command eq 'downloadfilesselect' && $perm{'vgr'}) { |
|
&startpage($request,$symb,[{href=>'', text=>'Select which submissions to download'}]); |
|
$request->print(&submit_options_download($request,$symb)); |
|
} elsif ($command eq 'downloadfileslink' && $perm{'vgr'}) { |
|
&startpage($request,$symb, |
|
[{href=>&href_symb_cmd($symb,'downloadfilesselect'), text=>'Select which submissions to download'}, |
|
{href=>'', text=>'Download submissions'}]); |
|
&submit_download_link($request,$symb); |
} elsif ($command) { |
} elsif ($command) { |
|
&startpage($request,$symb,[{href=>'', text=>'Access denied'}]); |
$request->print('<p class="LC_error">'.&mt('Access Denied ([_1])',$command).'</p>'); |
$request->print('<p class="LC_error">'.&mt('Access Denied ([_1])',$command).'</p>'); |
} |
} |
} |
} |
if ($ssi_error) { |
if ($ssi_error) { |
&ssi_print_error($request); |
&ssi_print_error($request); |
} |
} |
|
&Apache::lonquickgrades::endGradeScreen($request); |
$request->print(&Apache::loncommon::end_page()); |
$request->print(&Apache::loncommon::end_page()); |
&reset_caches(); |
&reset_caches(); |
return ''; |
return ''; |