version 1.560, 2009/03/19 21:00:42
|
version 1.570, 2009/05/07 15:47:06
|
Line 889 LISTJAVASCRIPT
|
Line 889 LISTJAVASCRIPT
|
my $gradeTable='<form action="/adm/grades" method="post" name="gradesub">'. |
my $gradeTable='<form action="/adm/grades" method="post" name="gradesub">'. |
"\n".$table; |
"\n".$table; |
|
|
$gradeTable .= |
$gradeTable .= &Apache::lonhtmlcommon::start_pick_box(); |
' <b>'.&mt('View Problem Text').': </b>'. |
$gradeTable .= &Apache::lonhtmlcommon::row_title(&mt('View Problem Text')) |
'<label><input type="radio" name="vProb" value="no" checked="checked" /> '.&mt('no').' </label>'."\n". |
.'<label><input type="radio" name="vProb" value="no" checked="checked" /> '.&mt('no').' </label>'."\n" |
'<label><input type="radio" name="vProb" value="yes" /> '.&mt('one student').' </label>'."\n". |
.'<label><input type="radio" name="vProb" value="yes" /> '.&mt('one student').' </label>'."\n" |
'<label><input type="radio" name="vProb" value="all" /> '.&mt('all students').' </label><br />'."\n"; |
.'<label><input type="radio" name="vProb" value="all" /> '.&mt('all students').' </label><br />'."\n" |
$gradeTable .= |
.&Apache::lonhtmlcommon::row_closure(); |
' <b>'.&mt('View Answer').': </b>'. |
$gradeTable .= &Apache::lonhtmlcommon::row_title(&mt('View Answer')) |
'<label><input type="radio" name="vAns" value="no" /> '.&mt('no').' </label>'."\n". |
.'<label><input type="radio" name="vAns" value="no" /> '.&mt('no').' </label>'."\n" |
'<label><input type="radio" name="vAns" value="yes" /> '.&mt('one student').' </label>'."\n". |
.'<label><input type="radio" name="vAns" value="yes" /> '.&mt('one student').' </label>'."\n" |
'<label><input type="radio" name="vAns" value="all" checked="checked" /> '.&mt('all students').' </label><br />'."\n"; |
.'<label><input type="radio" name="vAns" value="all" checked="checked" /> '.&mt('all students').' </label><br />'."\n" |
|
.&Apache::lonhtmlcommon::row_closure(); |
|
|
my $submission_options; |
my $submission_options; |
if ($env{'form.handgrade'} eq 'yes' && scalar(@$partlist) > 1) { |
if ($env{'form.handgrade'} eq 'yes' && scalar(@$partlist) > 1) { |
Line 913 LISTJAVASCRIPT
|
Line 914 LISTJAVASCRIPT
|
'<label><input type="radio" name="lastSub" value="last" /> '.&mt('last submission & parts info').' </label>'."\n". |
'<label><input type="radio" name="lastSub" value="last" /> '.&mt('last submission & parts info').' </label>'."\n". |
'<label><input type="radio" name="lastSub" value="datesub" /> '.&mt('by dates and submissions').' </label>'."\n". |
'<label><input type="radio" name="lastSub" value="datesub" /> '.&mt('by dates and submissions').' </label>'."\n". |
'<label><input type="radio" name="lastSub" value="all" /> '.&mt('all details').'</label>'; |
'<label><input type="radio" name="lastSub" value="all" /> '.&mt('all details').'</label>'; |
$gradeTable .= |
$gradeTable .= &Apache::lonhtmlcommon::row_title(&mt('Submissions')) |
' <b>'.&mt('Submissions').': </b>'.$submission_options.'<br />'."\n"; |
.$submission_options |
|
.&Apache::lonhtmlcommon::row_closure(); |
|
|
|
$gradeTable .= &Apache::lonhtmlcommon::row_title(&mt('Grading Increments')) |
|
.'<select name="increment">' |
|
.'<option value="1">'.&mt('Whole Points').'</option>' |
|
.'<option value=".5">'.&mt('Half Points').'</option>' |
|
.'<option value=".25">'.&mt('Quarter Points').'</option>' |
|
.'<option value=".1">'.&mt('Tenths of a Point').'</option>' |
|
.'</select>' |
|
.&Apache::lonhtmlcommon::row_closure(); |
|
|
$gradeTable .= |
$gradeTable .= |
' <b>'.&mt('Grading Increments').': </b>'. |
|
'<select name="increment">'. |
|
'<option value="1">'.&mt('Whole Points').'</option>'. |
|
'<option value=".5">'.&mt('Half Points').'</option>'. |
|
'<option value=".25">'.&mt('Quarter Points').'</option>'. |
|
'<option value=".1">'.&mt('Tenths of a Point').'</option>'. |
|
'</select>'; |
|
|
|
$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="handgrade" value="'.$env{'form.handgrade'}.'" /><br />'."\n". |
Line 936 LISTJAVASCRIPT
|
Line 938 LISTJAVASCRIPT
|
'<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.gradingMenu'}) && 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.=&mt('<b>Student Status:</b> [_1]', |
$gradeTable .= &Apache::lonhtmlcommon::row_title(&mt('Student Status')) |
&Apache::lonhtmlcommon::StatusOptions($saveStatus,undef,1,'javascript:reLoadList(this.form);')).'<br />'; |
.&Apache::lonhtmlcommon::StatusOptions( |
|
$saveStatus,undef,1,'javascript:reLoadList(this.form);') |
|
.&Apache::lonhtmlcommon::row_closure(); |
} |
} |
|
|
$gradeTable.=&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.").'<br />'."\n". |
$gradeTable .= &Apache::lonhtmlcommon::row_title(&mt('Check For Plagiarism')) |
'<input type="hidden" name="command" value="processGroup" />'."\n"; |
.'<input type="checkbox" name="checkPlag" checked="checked" />' |
|
.&Apache::lonhtmlcommon::row_closure(1) |
|
.&Apache::lonhtmlcommon::end_pick_box(); |
|
|
|
$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" |
|
.'<input type="hidden" name="command" value="processGroup" />' |
|
.'</p>'; |
|
|
# checkall buttons |
# checkall buttons |
$gradeTable.=&check_script('gradesub', 'stuinfo'); |
$gradeTable.=&check_script('gradesub', 'stuinfo'); |
Line 951 LISTJAVASCRIPT
|
Line 962 LISTJAVASCRIPT
|
'onClick="javascript:checkSelect(this.form.stuinfo);" '."\n". |
'onClick="javascript:checkSelect(this.form.stuinfo);" '."\n". |
'value="'.&mt('Next').' →" /> <br />'."\n"; |
'value="'.&mt('Next').' →" /> <br />'."\n"; |
$gradeTable.=&check_buttons(); |
$gradeTable.=&check_buttons(); |
$gradeTable.='<label><input type="checkbox" name="checkPlag" checked="checked" />'.&mt('Check For Plagiarism').'</label>'; |
|
my ($classlist, undef, $fullname) = &getclasslist($getsec,'1',$getgroup); |
my ($classlist, undef, $fullname) = &getclasslist($getsec,'1',$getgroup); |
$gradeTable.= &Apache::loncommon::start_data_table(). |
$gradeTable.= &Apache::loncommon::start_data_table(). |
&Apache::loncommon::start_data_table_header_row(); |
&Apache::loncommon::start_data_table_header_row(); |
Line 1034 LISTJAVASCRIPT
|
Line 1044 LISTJAVASCRIPT
|
$gradeTable.= &Apache::loncommon::start_data_table_row(); |
$gradeTable.= &Apache::loncommon::start_data_table_row(); |
} |
} |
$gradeTable.='<td align="right">'.$ctr.' </td>'. |
$gradeTable.='<td align="right">'.$ctr.' </td>'. |
'<td align="center"><label><input type=checkbox name="stuinfo" value="'. |
'<td align="center"><label><input type="checkbox" name="stuinfo" value="'. |
$student.':'.$$fullname{$student}.':::SECTION'.$section. |
$student.':'.$$fullname{$student}.':::SECTION'.$section. |
') " /> </label></td>'."\n".'<td>'. |
') " /> </label></td>'."\n".'<td>'. |
&nameUserString(undef,$$fullname{$student},$uname,$udom). |
&nameUserString(undef,$$fullname{$student},$uname,$udom). |
Line 1541 INNERJS
|
Line 1551 INNERJS
|
pDoc.write("<input value=\\""+usrctr+"\\" name=\\"usrctr\\" type=\\"hidden\\">"); |
pDoc.write("<input value=\\""+usrctr+"\\" name=\\"usrctr\\" type=\\"hidden\\">"); |
pDoc.write("<h3><span class=\\"LC_info\\"> Compose Message for \"+fullname+\"<\\/span><\\/h3><br /><br />"); |
pDoc.write("<h3><span class=\\"LC_info\\"> Compose Message for \"+fullname+\"<\\/span><\\/h3><br /><br />"); |
|
|
pDoc.write("<table border=0 width=100%><tr><td bgcolor=\\"#777777\\">"); |
pDoc.write('<table border="0" width="100%"><tr><td bgcolor="#777777">'); |
pDoc.write("<table border=0 width=100%><tr bgcolor=\\"#ddffff\\">"); |
pDoc.write('<table border="0" width="100%"><tr bgcolor="#DDFFFF">'); |
pDoc.write("<td><b>Type<\\/b><\\/td><td><b>Include<\\/b><\\/td><td><b>Message<\\/td><\\/tr>"); |
pDoc.write("<td><b>Type<\\/b><\\/td><td><b>Include<\\/b><\\/td><td><b>Message<\\/td><\\/tr>"); |
} |
} |
function displaySubject(msg,shwsel) { |
function displaySubject(msg,shwsel) { |
Line 1626 INNERJS
|
Line 1636 INNERJS
|
hDoc.write("<form action=\\"inactive\\" name=\\"hlCenter\\">"); |
hDoc.write("<form action=\\"inactive\\" name=\\"hlCenter\\">"); |
hDoc.write("<h3><span class=\\"LC_info\\"> Keyword Highlight Options<\\/span><\\/h3><br /><br />"); |
hDoc.write("<h3><span class=\\"LC_info\\"> Keyword Highlight Options<\\/span><\\/h3><br /><br />"); |
|
|
hDoc.write("<table border=0 width=100%><tr><td bgcolor=\\"#777777\\">"); |
hDoc.write('<table border="0" width="100%"><tr><td bgcolor="#777777">'); |
hDoc.write("<table border=0 width=100%><tr bgcolor=\\"#ddffff\\">"); |
hDoc.write('<table border="0" width="100%"><tr bgcolor="#DDFFFF">'); |
hDoc.write("<td><b>Text Color<\\/b><\\/td><td><b>Font Size<\\/b><\\/td><td><b>Font Style<\\/td><\\/tr>"); |
hDoc.write("<td><b>Text Color<\\/b><\\/td><td><b>Font Size<\\/b><\\/td><td><b>Font Style<\\/td><\\/tr>"); |
} |
} |
|
|
Line 2152 KEYWORDS
|
Line 2162 KEYWORDS
|
foreach my $file (@$files) { |
foreach my $file (@$files) { |
$file_counter++; |
$file_counter++; |
&Apache::lonnet::allowuploaded('/adm/grades',$file); |
&Apache::lonnet::allowuploaded('/adm/grades',$file); |
$lastsubonly.='<br /><a href="'.$file.'?rawmode=1" target="lonGRDs"><img src="'.&Apache::loncommon::icon($file).'" border=0"> '.$file.'</a>'; |
$lastsubonly.='<br /><a href="'.$file.'?rawmode=1" target="lonGRDs"><img src="'.&Apache::loncommon::icon($file).'" border="0" /> '.$file.'</a>'; |
} |
} |
$lastsubonly.='<br />'; |
$lastsubonly.='<br />'; |
} |
} |
Line 4080 sub csvuploadassign {
|
Line 4090 sub csvuploadassign {
|
$countdone++; |
$countdone++; |
} |
} |
} |
} |
$request->print('<br /><span class="LC_info">'.&mt("Saved [_1] students",$countdone)."</span>\n"); |
$request->print('<br />'.&Apache::lonhtmlcommon::confirm_success(&mt("Saved scores for [quant,_1,student]",$countdone),$countdone==0)); |
if (@skipped) { |
if (@skipped) { |
$request->print('<p><span class="LC_warning">'.&mt('Skipped Students').'</span></p>'); |
$request->print('<p><span class="LC_warning">'.&mt('Skipped Students').'</span></p>'); |
foreach my $student (@skipped) { $request->print("$student<br />\n"); } |
foreach my $student (@skipped) { $request->print("$student<br />\n"); } |
Line 6767 sub scantron_get_correction {
|
Line 6777 sub scantron_get_correction {
|
if ($closest > 0) { |
if ($closest > 0) { |
foreach my $testcode (@{$closest}) { |
foreach my $testcode (@{$closest}) { |
my $checked=''; |
my $checked=''; |
if (!$i) { $checked=' checked="checked" '; } |
if (!$i) { $checked=' checked="checked"'; } |
$r->print(" |
$r->print(" |
<label> |
<label> |
<input type='radio' name='scantron_CODE_resolution' value='use_closest_$i' $checked /> |
<input type='radio' name='scantron_CODE_resolution' value='use_closest_$i'$checked /> |
".&mt("Use the similar CODE [_1] instead.", |
".&mt("Use the similar CODE [_1] instead.", |
"<b><tt>".$testcode."</tt></b>")." |
"<b><tt>".$testcode."</tt></b>")." |
</label> |
</label> |
Line 6781 sub scantron_get_correction {
|
Line 6791 sub scantron_get_correction {
|
} |
} |
} |
} |
if ($$scan_record{'scantron.CODE'}=~/\S/ ) { |
if ($$scan_record{'scantron.CODE'}=~/\S/ ) { |
my $checked; if (!$i) { $checked=' checked="checked" '; } |
my $checked; if (!$i) { $checked=' checked="checked"'; } |
$r->print(" |
$r->print(" |
<label> |
<label> |
<input type='radio' name='scantron_CODE_resolution' value='use_unfound' $checked /> |
<input type='radio' name='scantron_CODE_resolution' value='use_unfound'$checked /> |
".&mt("Use the CODE [_1] that is was on the paper, ignoring the error.", |
".&mt("Use the CODE [_1] that is was on the paper, ignoring the error.", |
"<b><tt>".$$scan_record{'scantron.CODE'}."</tt></b>")." |
"<b><tt>".$$scan_record{'scantron.CODE'}."</tt></b>")." |
</label>"); |
</label>"); |
Line 7691 sub grade_student_bubbles {
|
Line 7701 sub grade_student_bubbles {
|
|
|
sub scantron_upload_scantron_data { |
sub scantron_upload_scantron_data { |
my ($r)=@_; |
my ($r)=@_; |
$r->print(&Apache::loncommon::coursebrowser_javascript($env{'request.role.domain'})); |
my $dom = $env{'request.role.domain'}; |
|
my $domdesc = &Apache::lonnet::domain($dom,'description'); |
|
$r->print(&Apache::loncommon::coursebrowser_javascript($dom)); |
my $select_link=&Apache::loncommon::selectcourse_link('rules','courseid', |
my $select_link=&Apache::loncommon::selectcourse_link('rules','courseid', |
'domainid', |
'domainid', |
'coursename'); |
'coursename',$dom); |
my $domsel=&Apache::loncommon::select_dom_form($env{'request.role.domain'}, |
my $syllabuslink = '<a href="javascript:ToSyllabus();">'.&mt('Syllabus').'</a>'. |
'domainid'); |
(' 'x2).&mt('(shows course personnel)'); |
my $default_form_data=&defaultFormData(&get_symb($r,1)); |
my $default_form_data=&defaultFormData(&get_symb($r,1)); |
$r->print(' |
$r->print(' |
<script type="text/javascript" language="javascript"> |
<script type="text/javascript" language="javascript"> |
Line 7705 sub scantron_upload_scantron_data {
|
Line 7717 sub scantron_upload_scantron_data {
|
alert("'.&mt('Please use the browse button to select a file from your local directory.').'"); |
alert("'.&mt('Please use the browse button to select a file from your local directory.').'"); |
return false; |
return false; |
} |
} |
|
if (formname.courseid.value == "") { |
|
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.').'"); |
|
return false; |
|
} |
formname.submit(); |
formname.submit(); |
} |
} |
|
|
|
function ToSyllabus() { |
|
var cdom = '."'$dom'".'; |
|
var cnum = document.rules.courseid.value; |
|
if (cdom == "" || cdom == null) { |
|
return; |
|
} |
|
if (cnum == "" || cnum == null) { |
|
return; |
|
} |
|
syllwin=window.open("/public/"+cdom+"/"+cnum+"/syllabus","LONCAPASyllabus", |
|
"height=350,width=350,scrollbars=yes,menubar=no"); |
|
return; |
|
} |
|
|
</script> |
</script> |
|
|
|
<h3>'.&mt('Send scanned bubblesheet data to a course').'</h3> |
|
|
<form enctype="multipart/form-data" action="/adm/grades" name="rules" method="post"> |
<form enctype="multipart/form-data" action="/adm/grades" name="rules" method="post"> |
'.$default_form_data.' |
'.$default_form_data. |
<table> |
&Apache::lonhtmlcommon::start_pick_box(). |
<tr><td>'.$select_link.' </td></tr> |
&Apache::lonhtmlcommon::row_title(&mt('Course ID')). |
<tr><td>'.&mt('Course ID:').' </td> |
'<input name="courseid" type="text" size="30" />'.$select_link. |
<td><input name="courseid" type="text" /> </td></tr> |
&Apache::lonhtmlcommon::row_closure(). |
<tr><td>'.&mt('Course Name:').' </td> |
&Apache::lonhtmlcommon::row_title(&mt('Course Name')). |
<td><input name="coursename" type="text" /> </td></tr> |
'<input name="coursename" type="text" size="30" />'.$syllabuslink. |
<tr><td>'.&mt('Domain:').' </td> |
&Apache::lonhtmlcommon::row_closure(). |
<td>'.$domsel.' </td></tr> |
&Apache::lonhtmlcommon::row_title(&mt('Domain')). |
<tr><td>'.&mt('File to upload:').'</td> |
'<input name="domainid" type="hidden" />'.$domdesc. |
<td><input type="file" name="upfile" size="50" /></td></tr> |
&Apache::lonhtmlcommon::row_closure(). |
</table> |
&Apache::lonhtmlcommon::row_title(&mt('File to upload')). |
|
'<input type="file" name="upfile" size="50" />'. |
|
&Apache::lonhtmlcommon::row_closure(1). |
|
&Apache::lonhtmlcommon::end_pick_box().'<br /> |
|
|
<input name="command" value="scantronupload_save" type="hidden" /> |
<input name="command" value="scantronupload_save" type="hidden" /> |
<input type="button" onClick="javascript:checkUpload(this.form);" value="'.&mt('Upload Scantron Data').'" /> |
<input type="button" onClick="javascript:checkUpload(this.form);" value="'.&mt('Upload Scantron Data').'" /> |
</form> |
</form> |
Line 7750 sub scantron_upload_scantron_data_save {
|
Line 7787 sub scantron_upload_scantron_data_save {
|
return ''; |
return ''; |
} |
} |
my %coursedata=&Apache::lonnet::coursedescription($env{'form.domainid'}.'_'.$env{'form.courseid'}); |
my %coursedata=&Apache::lonnet::coursedescription($env{'form.domainid'}.'_'.$env{'form.courseid'}); |
$r->print(&mt("Doing upload to [_1]",$coursedata{'description'})." <br />"); |
my $uploadedfile; |
my $fname=$env{'form.upfile.filename'}; |
$r->print('<h3>'.&mt("Uploading file to [_1]",$coursedata{'description'}).'</h3>'); |
#FIXME |
|
#copied from lonnet::userfileupload() |
|
#make that function able to target a specified course |
|
# Replace Windows backslashes by forward slashes |
|
$fname=~s/\\/\//g; |
|
# Get rid of everything but the actual filename |
|
$fname=~s/^.*\/([^\/]+)$/$1/; |
|
# Replace spaces by underscores |
|
$fname=~s/\s+/\_/g; |
|
# Replace all other weird characters by nothing |
|
$fname=~s/[^\w\.\-]//g; |
|
# See if there is anything left |
|
unless ($fname) { return 'error: no uploaded file'; } |
|
my $uploadedfile=$fname; |
|
$fname='scantron_orig_'.$fname; |
|
if (length($env{'form.upfile'}) < 2) { |
if (length($env{'form.upfile'}) < 2) { |
$r->print(&mt("<span class=\"LC_error\">Error:</span> The file you attempted to upload, [_1] contained no information. Please check that you entered the correct filename.",'<span class="LC_filename">'.&HTML::Entities::encode($env{'form.upfile.filename'},'<>&"')."</span>")); |
$r->print(&mt('[_1]Error:[_2] The file you attempted to upload, [_3] contained no information. Please check that you entered the correct filename.','<span class="LC_error">','</span>','<span class="LC_filename">'.&HTML::Entities::encode($env{'form.upfile.filename'},'<>&"').'</span>')); |
} else { |
} else { |
my $result=&Apache::lonnet::finishuserfileupload($env{'form.courseid'},$env{'form.domainid'},'upfile',$fname); |
my $result = |
if ($result =~ m|^/uploaded/|) { |
&Apache::lonnet::userfileupload('upfile','','scantron','','','', |
$r->print(&mt("<span class=\"LC_success\">Success:</span> Successfully uploaded [_1] bytes of data into location [_2]", |
$env{'form.courseid'},$env{'form.domainid'}); |
(length($env{'form.upfile'})-1), |
if ($result =~ m{^/uploaded/}) { |
'<span class="LC_filename">'.$result."</span>")); |
$r->print(&mt('[_1]Success:[_2] Successfully uploaded [_3] bytes of data into location: [_4]', |
|
'<span class="LC_success">','</span>',(length($env{'form.upfile'})-1), |
|
'<span class="LC_filename">'.$result.'</span>')); |
|
($uploadedfile) = ($result =~ m{/([^/]+)$}); |
|
$r->print(&validate_uploaded_scantron_file($env{'form.domainid'}, |
|
$env{'form.courseid'},$uploadedfile)); |
} else { |
} else { |
$r->print(&mt("<span class=\"LC_error\">Error:</span> An error ([_1]) occurred when attempting to upload the file, [_2]", |
$r->print(&mt('[_1]Error:[_2] An error ([_3]) occurred when attempting to upload the file, [_4]', |
$result, |
'<span class="LC_error">','</span>',$result, |
'<span class="LC_filename">'.&HTML::Entities::encode($env{'form.upfile.filename'},'<>&"')."</span>")); |
'<span class="LC_filename">'.&HTML::Entities::encode($env{'form.upfile.filename'},'<>&"').'</span>')); |
|
|
} |
} |
} |
} |
if ($symb) { |
if ($symb) { |
Line 7790 sub scantron_upload_scantron_data_save {
|
Line 7816 sub scantron_upload_scantron_data_save {
|
return ''; |
return ''; |
} |
} |
|
|
|
sub validate_uploaded_scantron_file { |
|
my ($cdom,$cname,$fname) = @_; |
|
my $scanlines=&Apache::lonnet::getfile('/uploaded/'.$cdom.'/'.$cname.'/'.$fname); |
|
my @lines; |
|
if ($scanlines ne '-1') { |
|
@lines=split("\n",$scanlines,-1); |
|
} |
|
my $output; |
|
if (@lines) { |
|
my (%counts,$max_match_format); |
|
my ($max_match_count,$max_match_pct) = (0,0); |
|
my $classlist = &Apache::loncoursedata::get_classlist($cdom,$cname); |
|
my %idmap = &username_to_idmap($classlist); |
|
foreach my $key (keys(%idmap)) { |
|
my $lckey = lc($key); |
|
$idmap{$lckey} = $idmap{$key}; |
|
} |
|
my %unique_formats; |
|
my @formatlines = &get_scantronformat_file(); |
|
foreach my $line (@formatlines) { |
|
chomp($line); |
|
my @config = split(/:/,$line); |
|
my $idstart = $config[5]; |
|
my $idlength = $config[6]; |
|
if (($idstart ne '') && ($idlength > 0)) { |
|
if (ref($unique_formats{$idstart.':'.$idlength}) eq 'ARRAY') { |
|
push(@{$unique_formats{$idstart.':'.$idlength}},$config[0].':'.$config[1]); |
|
} else { |
|
$unique_formats{$idstart.':'.$idlength} = [$config[0].':'.$config[1]]; |
|
} |
|
} |
|
} |
|
foreach my $key (keys(%unique_formats)) { |
|
my ($idstart,$idlength) = split(':',$key); |
|
%{$counts{$key}} = ( |
|
'found' => 0, |
|
'total' => 0, |
|
); |
|
foreach my $line (@lines) { |
|
next if ($line =~ /^#/); |
|
next if ($line =~ /^[\s\cz]*$/); |
|
my $id = substr($line,$idstart-1,$idlength); |
|
$id = lc($id); |
|
if (exists($idmap{$id})) { |
|
$counts{$key}{'found'} ++; |
|
} |
|
$counts{$key}{'total'} ++; |
|
} |
|
if ($counts{$key}{'total'}) { |
|
my $percent_match = (100*$counts{$key}{'found'})/($counts{$key}{'total'}); |
|
if (($max_match_format eq '') || ($percent_match > $max_match_pct)) { |
|
$max_match_pct = $percent_match; |
|
$max_match_format = $key; |
|
$max_match_count = $counts{$key}{'total'}; |
|
} |
|
} |
|
} |
|
if (ref($unique_formats{$max_match_format}) eq 'ARRAY') { |
|
my $format_descs; |
|
my $numwithformat = @{$unique_formats{$max_match_format}}; |
|
for (my $i=0; $i<$numwithformat; $i++) { |
|
my ($name,$desc) = split(':',$unique_formats{$max_match_format}[$i]); |
|
if ($i<$numwithformat-2) { |
|
$format_descs .= '"<i>'.$desc.'</i>", '; |
|
} elsif ($i==$numwithformat-2) { |
|
$format_descs .= '"<i>'.$desc.'</i>" '.&mt('and').' '; |
|
} elsif ($i==$numwithformat-1) { |
|
$format_descs .= '"<i>'.$desc.'</i>"'; |
|
} |
|
} |
|
my $showpct = sprintf("%.0f",$max_match_pct).'%'; |
|
$output .= '<br />'.&mt('Comparison of student IDs in the uploaded file with the course roster found matches for [_1] of the [_2] entries in the file (for the format defined for [_3]).','<b>'.$showpct.'</b>','<b>'.$max_match_count.'</b>',$format_descs). |
|
'<br />'.&mt('A low percentage of matches results from one of the following:').'<ul>'. |
|
'<li>'.&mt('The file was uploaded to the wrong course').'</li>'. |
|
'<li>'.&mt('The data are not in the format expected for the domain: [_1]', |
|
'<i>'.$cdom.'</i>').'</li>'. |
|
'<li>'.&mt('Students did not bubble their IDs, or mis-bubbled them').'</li>'. |
|
'<li>'.&mt('The course roster is not up to date').'</li>'. |
|
'</ul>'; |
|
} |
|
} else { |
|
$output = '<span class="LC_warning">'.&mt('Uploaded file contained no data').'</span>'; |
|
} |
|
return $output; |
|
} |
|
|
sub valid_file { |
sub valid_file { |
my ($requested_file)=@_; |
my ($requested_file)=@_; |
foreach my $filename (sort(&scantron_filenames())) { |
foreach my $filename (sort(&scantron_filenames())) { |
Line 8545 sub process_clicker {
|
Line 8657 sub process_clicker {
|
my %checked; |
my %checked; |
foreach my $gradingmechanism ('attendance','personnel','specific','given') { |
foreach my $gradingmechanism ('attendance','personnel','specific','given') { |
if ($env{'form.gradingmechanism'} eq $gradingmechanism) { |
if ($env{'form.gradingmechanism'} eq $gradingmechanism) { |
$checked{$gradingmechanism}="checked='checked'"; |
$checked{$gradingmechanism}=' checked="checked"'; |
} |
} |
} |
} |
|
|
Line 8609 function sanitycheck() {
|
Line 8721 function sanitycheck() {
|
<input type="hidden" name="saveState" value="$env{'form.saveState'}" /> |
<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> |
<br /><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" /> |
<br /><label><input type="radio" name="gradingmechanism" value="given" $checked{'given'} onClick="sanitycheck()" />$given </label> |
<br /><label><input type="radio" name="gradingmechanism" value="given"$checked{'given'} onClick="sanitycheck()" />$given </label> |
<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'}" /> |
Line 9092 sub handler {
|
Line 9204 sub handler {
|
} elsif ($command eq 'checksubmissions' && $perm{'vgr'}) { |
} elsif ($command eq 'checksubmissions' && $perm{'vgr'}) { |
$request->print(&checkscantron_results($request)); |
$request->print(&checkscantron_results($request)); |
} elsif ($command) { |
} elsif ($command) { |
$request->print("Access Denied ($command)"); |
$request->print('<p class="LC_error">'.&mt('Access Denied ([_1])',$command).'</p>'); |
} |
} |
} |
} |
if ($ssi_error) { |
if ($ssi_error) { |