version 1.461, 2007/10/17 10:48:20
|
version 1.470, 2007/10/29 09:46:28
|
Line 332 sub cleanRecord {
|
Line 332 sub cleanRecord {
|
$bottomrow.='<td>'.$grayFont.$foil.'</span> </td>'; |
$bottomrow.='<td>'.$grayFont.$foil.'</span> </td>'; |
} |
} |
return '<blockquote><table border="1">'. |
return '<blockquote><table border="1">'. |
'<tr valign="top"><td>Answer</td>'.$toprow.'</tr>'. |
'<tr valign="top"><td>'.&mt('Answer').'</td>'.$toprow.'</tr>'. |
'<tr valign="top"><td>'.$grayFont.'Option ID</span></td>'. |
'<tr valign="top"><td>'.$grayFont.&mt('Option ID').'</span></td>'. |
$grayFont.$bottomrow.'</tr>'.'</table></blockquote>'; |
$grayFont.$bottomrow.'</tr>'.'</table></blockquote>'; |
} elsif ($response eq 'match') { |
} elsif ($response eq 'match') { |
my %answer=&Apache::lonnet::str2hash($answer); |
my %answer=&Apache::lonnet::str2hash($answer); |
Line 352 sub cleanRecord {
|
Line 352 sub cleanRecord {
|
$bottomrow.='<td>'.$grayFont.$foil.'</span> </td>'; |
$bottomrow.='<td>'.$grayFont.$foil.'</span> </td>'; |
} |
} |
return '<blockquote><table border="1">'. |
return '<blockquote><table border="1">'. |
'<tr valign="top"><td>Answer</td>'.$toprow.'</tr>'. |
'<tr valign="top"><td>'.&mt('Answer').'</td>'.$toprow.'</tr>'. |
'<tr valign="top"><td>'.$grayFont.'Item ID</span></td>'. |
'<tr valign="top"><td>'.$grayFont.&mt('Item ID').'</span></td>'. |
$middlerow.'</tr>'. |
$middlerow.'</tr>'. |
'<tr valign="top"><td>'.$grayFont.'Option ID</span></td>'. |
'<tr valign="top"><td>'.$grayFont.&mt('Option ID').'</span></td>'. |
$bottomrow.'</tr>'.'</table></blockquote>'; |
$bottomrow.'</tr>'.'</table></blockquote>'; |
} elsif ($response eq 'radiobutton') { |
} elsif ($response eq 'radiobutton') { |
my %answer=&Apache::lonnet::str2hash($answer); |
my %answer=&Apache::lonnet::str2hash($answer); |
Line 365 sub cleanRecord {
|
Line 365 sub cleanRecord {
|
foreach my $foil (@$order) { |
foreach my $foil (@$order) { |
if (exists($answer{$foil})) { |
if (exists($answer{$foil})) { |
if ($foil eq $correct) { |
if ($foil eq $correct) { |
$toprow.='<td><b>true</b></td>'; |
$toprow.='<td><b>'.&mt('true').'</b></td>'; |
} else { |
} else { |
$toprow.='<td><i>true</i></td>'; |
$toprow.='<td><i>'.&mt('true').'</i></td>'; |
} |
} |
} else { |
} else { |
$toprow.='<td>false</td>'; |
$toprow.='<td>'.&mt('false').'</td>'; |
} |
} |
$bottomrow.='<td>'.$grayFont.$foil.'</span> </td>'; |
$bottomrow.='<td>'.$grayFont.$foil.'</span> </td>'; |
} |
} |
return '<blockquote><table border="1">'. |
return '<blockquote><table border="1">'. |
'<tr valign="top"><td>Answer</td>'.$toprow.'</tr>'. |
'<tr valign="top"><td>'.&mt('Answer').'</td>'.$toprow.'</tr>'. |
'<tr valign="top"><td>'.$grayFont.'Option ID</span></td>'. |
'<tr valign="top"><td>'.$grayFont.&mt('Option ID').'</span></td>'. |
$grayFont.$bottomrow.'</tr>'.'</table></blockquote>'; |
$grayFont.$bottomrow.'</tr>'.'</table></blockquote>'; |
} elsif ($response eq 'essay') { |
} elsif ($response eq 'essay') { |
if (! exists ($env{'form.'.$symb})) { |
if (! exists ($env{'form.'.$symb})) { |
Line 1480 INNERJS
|
Line 1480 INNERJS
|
|
|
pDoc.write("<form action=\\"inactive\\" name=\\"msgcenter\\">"); |
pDoc.write("<form action=\\"inactive\\" name=\\"msgcenter\\">"); |
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) { |
pDoc = pWin.document; |
pDoc = pWin.document; |
pDoc.write("<tr bgcolor=\\"#ffffdd\\">"); |
pDoc.write("<tr bgcolor=\\"#ffffdd\\">"); |
pDoc.write("<td>Subject</td>"); |
pDoc.write("<td>Subject<\\/td>"); |
pDoc.write("<td align=\\"center\\"><input name=\\"subchk\\" type=\\"checkbox\\"" +shwsel+"></td>"); |
pDoc.write("<td align=\\"center\\"><input name=\\"subchk\\" type=\\"checkbox\\"" +shwsel+"><\\/td>"); |
pDoc.write("<td><input name=\\"msgsub\\" type=\\"text\\" value=\\""+msg+"\\"size=\\"60\\" maxlength=\\"80\\"></td></tr>"); |
pDoc.write("<td><input name=\\"msgsub\\" type=\\"text\\" value=\\""+msg+"\\"size=\\"60\\" maxlength=\\"80\\"><\\/td><\\/tr>"); |
} |
} |
|
|
function displaySavedMsg(ctr,msg,shwsel) { |
function displaySavedMsg(ctr,msg,shwsel) { |
pDoc = pWin.document; |
pDoc = pWin.document; |
pDoc.write("<tr bgcolor=\\"#ffffdd\\">"); |
pDoc.write("<tr bgcolor=\\"#ffffdd\\">"); |
pDoc.write("<td align=\\"center\\">"+ctr+"</td>"); |
pDoc.write("<td align=\\"center\\">"+ctr+"<\\/td>"); |
pDoc.write("<td align=\\"center\\"><input name=\\"msgn"+ctr+"\\" type=\\"checkbox\\"" +shwsel+"></td>"); |
pDoc.write("<td align=\\"center\\"><input name=\\"msgn"+ctr+"\\" type=\\"checkbox\\"" +shwsel+"><\\/td>"); |
pDoc.write("<td><textarea name=\\"msg"+ctr+"\\" cols=\\"60\\" rows=\\"3\\">"+msg+"</textarea></td></tr>"); |
pDoc.write("<td><textarea name=\\"msg"+ctr+"\\" cols=\\"60\\" rows=\\"3\\">"+msg+"<\\/textarea><\\/td><\\/tr>"); |
} |
} |
|
|
function newMsg(newmsg,shwsel) { |
function newMsg(newmsg,shwsel) { |
pDoc = pWin.document; |
pDoc = pWin.document; |
pDoc.write("<tr bgcolor=\\"#ffffdd\\">"); |
pDoc.write("<tr bgcolor=\\"#ffffdd\\">"); |
pDoc.write("<td align=\\"center\\">New</td>"); |
pDoc.write("<td align=\\"center\\">New<\\/td>"); |
pDoc.write("<td align=\\"center\\"><input name=\\"newmsgchk\\" type=\\"checkbox\\"" +shwsel+"></td>"); |
pDoc.write("<td align=\\"center\\"><input name=\\"newmsgchk\\" type=\\"checkbox\\"" +shwsel+"><\\/td>"); |
pDoc.write("<td><textarea name=\\"newmsg\\" cols=\\"60\\" rows=\\"3\\" onchange=\\"javascript:this.form.newmsgchk.checked=true\\" >"+newmsg+"</textarea></td></tr>"); |
pDoc.write("<td><textarea name=\\"newmsg\\" cols=\\"60\\" rows=\\"3\\" onchange=\\"javascript:this.form.newmsgchk.checked=true\\" >"+newmsg+"<\\/textarea><\\/td><\\/tr>"); |
} |
} |
|
|
function msgTail() { |
function msgTail() { |
pDoc = pWin.document; |
pDoc = pWin.document; |
pDoc.write("</table>"); |
pDoc.write("<\\/table>"); |
pDoc.write("</td></tr></table> "); |
pDoc.write("<\\/td><\\/tr><\\/table> "); |
pDoc.write("<input type=\\"button\\" value=\\"Save\\" onClick=\\"javascript:checkInput()\\"> "); |
pDoc.write("<input type=\\"button\\" value=\\"Save\\" onClick=\\"javascript:checkInput()\\"> "); |
pDoc.write("<input type=\\"button\\" value=\\"Cancel\\" onClick=\\"self.close()\\"><br /><br />"); |
pDoc.write("<input type=\\"button\\" value=\\"Cancel\\" onClick=\\"self.close()\\"><br /><br />"); |
pDoc.write("</form>"); |
pDoc.write("<\\/form>"); |
pDoc.write('$end_page_msg_central'); |
pDoc.write('$end_page_msg_central'); |
pDoc.close(); |
pDoc.close(); |
} |
} |
Line 1565 INNERJS
|
Line 1565 INNERJS
|
hDoc.$docopen; |
hDoc.$docopen; |
hDoc.write('$start_page_highlight_central'); |
hDoc.write('$start_page_highlight_central'); |
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>"); |
} |
} |
|
|
function highlightbody(clrval,clrtxt,clrsel,szval,sztxt,szsel,syval,sytxt,sysel) { |
function highlightbody(clrval,clrtxt,clrsel,szval,sztxt,szsel,syval,sytxt,sysel) { |
var hDoc = hwdWin.document; |
var hDoc = hwdWin.document; |
hDoc.write("<tr bgcolor=\\"#ffffdd\\">"); |
hDoc.write("<tr bgcolor=\\"#ffffdd\\">"); |
hDoc.write("<td align=\\"left\\">"); |
hDoc.write("<td align=\\"left\\">"); |
hDoc.write("<input name=\\"kwdclr\\" type=\\"radio\\" value=\\""+clrval+"\\" "+clrsel+"> "+clrtxt+"</td>"); |
hDoc.write("<input name=\\"kwdclr\\" type=\\"radio\\" value=\\""+clrval+"\\" "+clrsel+"> "+clrtxt+"<\\/td>"); |
hDoc.write("<td align=\\"left\\">"); |
hDoc.write("<td align=\\"left\\">"); |
hDoc.write("<input name=\\"kwdsize\\" type=\\"radio\\" value=\\""+szval+"\\" "+szsel+"> "+sztxt+"</td>"); |
hDoc.write("<input name=\\"kwdsize\\" type=\\"radio\\" value=\\""+szval+"\\" "+szsel+"> "+sztxt+"<\\/td>"); |
hDoc.write("<td align=\\"left\\">"); |
hDoc.write("<td align=\\"left\\">"); |
hDoc.write("<input name=\\"kwdstyle\\" type=\\"radio\\" value=\\""+syval+"\\" "+sysel+"> "+sytxt+"</td>"); |
hDoc.write("<input name=\\"kwdstyle\\" type=\\"radio\\" value=\\""+syval+"\\" "+sysel+"> "+sytxt+"<\\/td>"); |
hDoc.write("</tr>"); |
hDoc.write("<\\/tr>"); |
} |
} |
|
|
function highlightend() { |
function highlightend() { |
var hDoc = hwdWin.document; |
var hDoc = hwdWin.document; |
hDoc.write("</table>"); |
hDoc.write("<\\/table>"); |
hDoc.write("</td></tr></table> "); |
hDoc.write("<\\/td><\\/tr><\\/table> "); |
hDoc.write("<input type=\\"button\\" value=\\"Save\\" onClick=\\"javascript:updateChoice(1)\\"> "); |
hDoc.write("<input type=\\"button\\" value=\\"Save\\" onClick=\\"javascript:updateChoice(1)\\"> "); |
hDoc.write("<input type=\\"button\\" value=\\"Cancel\\" onClick=\\"self.close()\\"><br /><br />"); |
hDoc.write("<input type=\\"button\\" value=\\"Cancel\\" onClick=\\"self.close()\\"><br /><br />"); |
hDoc.write("</form>"); |
hDoc.write("<\\/form>"); |
hDoc.write('$end_page_highlight_central'); |
hDoc.write('$end_page_highlight_central'); |
hDoc.close(); |
hDoc.close(); |
} |
} |
Line 1615 sub gradeBox {
|
Line 1615 sub gradeBox {
|
'" src="'.$request->dir_config('lonIconsURL'). |
'" src="'.$request->dir_config('lonIconsURL'). |
'/check.gif" height="16" border="0" />'; |
'/check.gif" height="16" border="0" />'; |
my $wgt = &Apache::lonnet::EXT('resource.'.$partid.'.weight',$symb,$udom,$uname); |
my $wgt = &Apache::lonnet::EXT('resource.'.$partid.'.weight',$symb,$udom,$uname); |
my $wgtmsg = ($wgt > 0 ? '(problem weight)' : |
my $wgtmsg = ($wgt > 0) ? &mt('(problem weight)') |
'<span class="LC_info">problem weight assigned by computer</span>'); |
: '<span class="LC_info">'.&mt('problem weight assigned by computer').'</span>'; |
$wgt = ($wgt > 0 ? $wgt : '1'); |
$wgt = ($wgt > 0 ? $wgt : '1'); |
my $score = ($$record{'resource.'.$partid.'.awarded'} eq '' ? |
my $score = ($$record{'resource.'.$partid.'.awarded'} eq '' ? |
'' : &compute_points($$record{'resource.'.$partid.'.awarded'},$wgt)); |
'' : &compute_points($$record{'resource.'.$partid.'.awarded'},$wgt)); |
my $result='<input type="hidden" name="WGT'.$counter.'_'.$partid.'" value="'.$wgt.'" />'."\n"; |
my $result='<input type="hidden" name="WGT'.$counter.'_'.$partid.'" value="'.$wgt.'" />'."\n"; |
my $display_part=&get_display_part($partid,$symb); |
my $display_part= &get_display_part($partid,$symb); |
my %last_resets = &get_last_resets($symb,$env{'request.course.id'}, |
my %last_resets = &get_last_resets($symb,$env{'request.course.id'}, |
[$partid]); |
[$partid]); |
my $aggtries = $$record{'resource.'.$partid.'.tries'}; |
my $aggtries = $$record{'resource.'.$partid.'.tries'}; |
Line 1703 sub handback_box {
|
Line 1703 sub handback_box {
|
'<span class="LC_filename">'.$file_disp.'</span>'); |
'<span class="LC_filename">'.$file_disp.'</span>'); |
$result.='<input type="file" name="'.$prefix.'returndoc'.$file_counter.'" />'."\n"; |
$result.='<input type="file" name="'.$prefix.'returndoc'.$file_counter.'" />'."\n"; |
$result.='<input type="hidden" name="'.$prefix.'origdoc'.$file_counter.'" value="'.$file.'" /><br />'; |
$result.='<input type="hidden" name="'.$prefix.'origdoc'.$file_counter.'" value="'.$file.'" /><br />'; |
$result.='(File will be uploaded when you click on Save & Next below.)<br />'; |
$result.='(File will be uploaded when you click on Save & Next below.)<br />'; |
$file_counter++; |
$file_counter++; |
} |
} |
} |
} |
Line 1739 sub show_problem {
|
Line 1739 sub show_problem {
|
$companswer=~s|</form>||g; |
$companswer=~s|</form>||g; |
$companswer=~s|name="submit"|name="would_have_been_submit"|g; |
$companswer=~s|name="submit"|name="would_have_been_submit"|g; |
} |
} |
my $result.='<table border="0" width="100%"><tr><td bgcolor="#777777">'; |
$rendered= |
$result.='<table border="0" width="100%">'; |
'<div class="LC_grade_show_problem_header">'. |
if ($viewon) { |
&mt('View of the problem'). |
$result.='<tr><td bgcolor="#e6ffff"><b> '; |
'</div><div class="LC_grade_show_problem_problem">'. |
if ($mode eq 'both' or $mode eq 'text') { |
$rendered. |
$result.='View of the problem - '; |
'</div>'; |
} else { |
$companswer= |
$result.='Correct answer: '; |
'<div class="LC_grade_show_problem_header">'. |
} |
&mt('Correct answer'). |
$result.=$env{'form.fullname'}.'</b></td></tr>'; |
'</div><div class="LC_grade_show_problem_problem">'. |
} |
$companswer. |
|
'</div>'; |
|
my $result; |
if ($mode eq 'both') { |
if ($mode eq 'both') { |
$result.='<tr><td bgcolor="#ffffff">'.$rendered.'<br />'; |
$result=$rendered.$companswer; |
$result.='<b>Correct answer:</b><br />'.$companswer; |
|
} elsif ($mode eq 'text') { |
} elsif ($mode eq 'text') { |
$result.='<tr><td bgcolor="#ffffff">'.$rendered; |
$result=$rendered; |
} elsif ($mode eq 'answer') { |
} elsif ($mode eq 'answer') { |
$result.='<tr><td bgcolor="#ffffff">'.$companswer; |
$result=$companswer; |
} |
} |
$result.='</td></tr></table>'; |
$result='<div class="LC_grade_show_problem">'.$result.'</div>'; |
$result.='</td></tr></table><br />'; |
|
return $result; |
return $result; |
} |
} |
|
|
Line 1852 sub submission {
|
Line 1852 sub submission {
|
$request->print('<h3> <span class="LC_info">Submission Record</span></h3>'."\n". |
$request->print('<h3> <span class="LC_info">Submission Record</span></h3>'."\n". |
'<h4> <b>Resource: </b>'.$env{'form.probTitle'}.'</h4>'."\n"); |
'<h4> <b>Resource: </b>'.$env{'form.probTitle'}.'</h4>'."\n"); |
|
|
if ($env{'form.handgrade'} eq 'no') { |
|
my $checkMark='<br /><br /> <b>Note:</b> Part(s) graded correct by the computer is marked with a '. |
|
$checkIcon.' symbol.'."\n"; |
|
$request->print($checkMark); |
|
} |
|
|
|
# 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. |
if ($env{'form.vProb'} eq 'yes' or $env{'form.vAns'} eq 'yes') { |
if ($env{'form.vProb'} eq 'yes' or $env{'form.vAns'} eq 'yes') { |
Line 1959 KEYWORDS
|
Line 1953 KEYWORDS
|
} |
} |
|
|
# This is where output for one specific student would start |
# This is where output for one specific student would start |
my $bgcolor='#DDEEDD'; |
my $add_class = ($counter%2) ? 'LC_grade_show_user_odd_row' : ''; |
if (int($counter/2) eq $counter) { $bgcolor='#DDDDEE'; } |
|
$request->print("\n\n". |
$request->print("\n\n". |
'<p><table border="2"><tr><th bgcolor="'.$bgcolor.'">'.$env{'form.fullname'}.'</th></tr><tr><td bgcolor="'.$bgcolor.'">'); |
'<div class="LC_grade_show_user '.$add_class.'">'. |
|
'<div class="LC_grade_user_name">'.&nameUserString(undef,$env{'form.fullname'},$uname,$udom).'</div>'. |
|
'<div class="LC_grade_show_user_body">'."\n"); |
|
|
if ($env{'form.vProb'} eq 'all' or $env{'form.vAns'} eq 'all') { |
if ($env{'form.vProb'} eq 'all' or $env{'form.vAns'} eq 'all') { |
my $mode; |
my $mode; |
Line 1982 KEYWORDS
|
Line 1977 KEYWORDS
|
|
|
# Display student info |
# Display student info |
$request->print(($counter == 0 ? '' : '<br />')); |
$request->print(($counter == 0 ? '' : '<br />')); |
my $result='<table border="0" width="100%"><tr><td bgcolor="#777777">'."\n". |
my $result='<div class="LC_grade_submissions">'; |
'<table border="0" width="100%"><tr bgcolor="#edffff"><td>'."\n"; |
|
|
$result.='<div class="LC_grade_submissions_header">'; |
$result.='<b>Fullname: </b>'.&nameUserString(undef,$env{'form.fullname'},$uname,$udom).'<br />'."\n"; |
$result.= &mt('Submissions'); |
$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') { |
|
$result.='<span class="LC_grade_check_note">'. |
|
&mt('Part(s) graded correct by the computer is marked with a [_1] symbol.',$checkIcon)."</span>\n"; |
|
|
|
} |
|
|
|
|
|
|
# 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 @col_fullnames; |
my $fullname; |
my ($classlist,$fullname); |
my $col_fullnames = []; |
if ($env{'form.handgrade'} eq 'yes') { |
if ($env{'form.handgrade'} eq 'yes') { |
($classlist,undef,$fullname) = &getclasslist('all','0'); |
(my $sub_result,$fullname,$col_fullnames)= |
for (keys (%$handgrade)) { |
&check_collaborators($symb,$uname,$udom,\%record,$handgrade, |
my $ncol = &Apache::lonnet::EXT('resource.'.$_. |
$counter); |
'.maxcollaborators', |
$result.=$sub_result; |
$symb,$udom,$uname); |
|
next if ($ncol <= 0); |
|
s/\_/\./g; |
|
next if ($record{'resource.'.$_.'.collaborators'} eq ''); |
|
my @goodcollaborators = (); |
|
my @badcollaborators = (); |
|
foreach (split(/,?\s+/,$record{'resource.'.$_.'.collaborators'})) { |
|
$_ =~ s/[\$\^\(\)]//g; |
|
next if ($_ eq ''); |
|
my ($co_name,$co_dom) = split /\@|:/,$_; |
|
$co_dom = $udom if (! defined($co_dom) || $co_dom =~ /^domain$/i); |
|
next if ($co_name eq $uname && $co_dom eq $udom); |
|
# Doing this grep allows 'fuzzy' specification |
|
my @Matches = grep /^$co_name:$co_dom$/i,keys %$classlist; |
|
if (! scalar(@Matches)) { |
|
push @badcollaborators,$_; |
|
} else { |
|
push @goodcollaborators, @Matches; |
|
} |
|
} |
|
if (scalar(@goodcollaborators) != 0) { |
|
$result.='<b>Collaborators: </b>'; |
|
foreach (@goodcollaborators) { |
|
my ($lastname,$givenn) = split(/,/,$$fullname{$_}); |
|
push @col_fullnames, $givenn.' '.$lastname; |
|
$result.=$$fullname{$_}.' '; |
|
} |
|
$result.='<br />'."\n"; |
|
my ($part)=split(/\./,$_); |
|
$result.='<input type="hidden" name="collaborator'.$counter. |
|
'" value="'.$part.':'.(join ':',@goodcollaborators).'" />'. |
|
"\n"; |
|
} |
|
if (scalar(@badcollaborators) > 0) { |
|
$result.='<table border="0"><tr bgcolor="#ffbbbb"><td>'; |
|
$result.='This student has submitted '; |
|
$result.=(scalar(@badcollaborators) == 1) ? 'an invalid collaborator' : 'invalid collaborators'; |
|
$result .= ': '.join(', ',@badcollaborators); |
|
$result .= '</td></tr></table>'; |
|
} |
|
if (scalar(@badcollaborators > $ncol)) { |
|
$result .= '<table border="0"><tr bgcolor="#ffbbbb"><td>'; |
|
$result .= 'This student has submitted too many '. |
|
'collaborators. Maximum is '.$ncol.'.'; |
|
$result .= '</td></tr></table>'; |
|
} |
|
} |
|
} |
} |
$request->print($result."\n"); |
$request->print($result."\n"); |
|
$request->print('</div>'."\n"); |
# print student answer/submission |
# print student answer/submission |
# Options are (1) Handgaded submission only |
# Options are (1) Handgaded submission only |
# (2) Last submission, includes submission that is not handgraded |
# (2) Last submission, includes submission that is not handgraded |
Line 2055 KEYWORDS
|
Line 2010 KEYWORDS
|
# (4) The whole record for this student |
# (4) The whole record for this student |
if ($env{'form.lastSub'} =~ /^(lastonly|hdgrade)$/) { |
if ($env{'form.lastSub'} =~ /^(lastonly|hdgrade)$/) { |
my ($string,$timestamp)= &get_last_submission(\%record); |
my ($string,$timestamp)= &get_last_submission(\%record); |
my $lastsubonly=''. |
|
($$timestamp eq '' ? '' : '<b>Date Submitted:</b> '. |
my $lastsubonly; |
$$timestamp)."</td></tr>\n"; |
|
if ($$timestamp eq '') { |
if ($$timestamp eq '') { |
$lastsubonly.='<tr><td bgcolor="#ffffe6">'.$$string[0]; |
$lastsubonly.='<div class="LC_grade_submissions_body">'.$$string[0].'</div>'; |
} else { |
} else { |
|
$lastsubonly = '<div class="LC_grade_submissions_body"> <b>Date Submitted:</b> '.$$timestamp."\n"; |
|
|
my %seenparts; |
my %seenparts; |
my @part_response_id = &flatten_responseType($responseType); |
my @part_response_id = &flatten_responseType($responseType); |
foreach my $part (@part_response_id) { |
foreach my $part (@part_response_id) { |
Line 2083 KEYWORDS
|
Line 2040 KEYWORDS
|
} |
} |
my $responsetype = $responseType->{$partid}->{$respid}; |
my $responsetype = $responseType->{$partid}->{$respid}; |
if (!exists($record{"resource.$partid.$respid.submission"})) { |
if (!exists($record{"resource.$partid.$respid.submission"})) { |
$lastsubonly.='<tr><td bgcolor="#ffffe6"><b>Part:</b> '. |
$lastsubonly.="\n".'<div class="LC_grade_submission_part"><b>Part:</b> '. |
$display_part.' <span class="LC_internal_info">( ID '.$respid. |
$display_part.' <span class="LC_internal_info">( ID '.$respid. |
' )</span> '. |
' )</span> '. |
'<span class="LC_warning">Nothing submitted - no attempts</span><br /><br />'; |
'<span class="LC_warning">'.&mt('Nothing submitted - no attempts').'</span><br /><br /></div>'; |
next; |
next; |
} |
} |
foreach (@$string) { |
foreach my $submission (@$string) { |
my ($partid,$respid) = /^resource\.([^\.]*)\.([^\.]*)\.submission/; |
my ($partid,$respid) = ($submission =~ /^resource\.([^\.]*)\.([^\.]*)\.submission/); |
if (join('_',@{$part}) ne ($partid.'_'.$respid)) { next; } |
if (join('_',@{$part}) ne ($partid.'_'.$respid)) { next; } |
my ($ressub,$subval) = split(/:/,$_,2); |
my ($ressub,$subval) = split(/:/,$submission,2); |
# Similarity check |
# Similarity check |
my $similar=''; |
my $similar=''; |
if($env{'form.checkPlag'}){ |
if($env{'form.checkPlag'}){ |
Line 2122 KEYWORDS
|
Line 2079 KEYWORDS
|
($env{'form.lastSub'} eq 'hdgrade' && |
($env{'form.lastSub'} eq 'hdgrade' && |
$$handgrade{$$part[0].'_'.$$part[1]} eq 'yes')) { |
$$handgrade{$$part[0].'_'.$$part[1]} eq 'yes')) { |
my $display_part=&get_display_part($partid,$symb); |
my $display_part=&get_display_part($partid,$symb); |
$lastsubonly.='<tr><td bgcolor="#ffffe6"><b>Part:</b> '. |
$lastsubonly.='<div class="LC_grade_submission_part"><b>Part:</b> '. |
$display_part.' <span class="LC_internal_info">( ID '.$respid. |
$display_part.' <span class="LC_internal_info">( ID '.$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) { |
$lastsubonly.='<br /><span class="LC_warning">Like all files provided by users, this file may contain virusses</span><br />'; |
$lastsubonly.='<br /><span class="LC_warning">'.&mt('Like all files provided by users, this file may contain virusses').'</span><br />'; |
my $file_counter = 0; |
my $file_counter = 0; |
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 />'; |
} |
} |
$lastsubonly.='<b>Submitted Answer: </b>'. |
$lastsubonly.='<b>'.&mt('Submitted Answer:').' </b>'. |
&cleanRecord($subval,$responsetype,$symb,$partid, |
&cleanRecord($subval,$responsetype,$symb,$partid, |
$respid,\%record,$order); |
$respid,\%record,$order); |
if ($similar) {$lastsubonly.="<br /><br />$similar\n";} |
if ($similar) {$lastsubonly.="<br /><br />$similar\n";} |
|
$lastsubonly.='</div>'; |
} |
} |
} |
} |
} |
} |
|
$lastsubonly.='</div>'."\n"; |
} |
} |
$lastsubonly.='</td></tr><tr bgcolor="#ffffff"><td>'."\n"; |
|
$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 (undef,$responseType,undef,$parts) = &showResourceInfo($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)$/) { |
Line 2158 KEYWORDS
|
Line 2116 KEYWORDS
|
|
|
$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 ($env{'form.showgrading'} eq '' || (!&canmodify($usec))) { |
my $toGrade.='<input type="button" value="Grade Student" '. |
my $toGrade.='<input type="button" value="Grade Student" '. |
'onClick="javascript:checksubmit(this.form,\'Grade Student\',\'' |
'onClick="javascript:checksubmit(this.form,\'Grade Student\',\'' |
.$counter.'\');" target="_self" /> '."\n" if (&canmodify($usec)); |
.$counter.'\');" target="_self" /> '."\n" if (&canmodify($usec)); |
$toGrade.='</td></tr></table></td></tr></table>'."\n"; |
$toGrade.='</div>'."\n"; |
if (($env{'form.command'} eq 'submission') || |
if (($env{'form.command'} eq 'submission') || |
($env{'form.command'} eq 'processGroup' && $counter == $total)) { |
($env{'form.command'} eq 'processGroup' && $counter == $total)) { |
$toGrade.='</form>'.&show_grading_menu_form($symb); |
$toGrade.='</form>'.&show_grading_menu_form($symb); |
Line 2172 KEYWORDS
|
Line 2129 KEYWORDS
|
$request->print($toGrade); |
$request->print($toGrade); |
return; |
return; |
} else { |
} else { |
$request->print('</td></tr></table></td></tr></table>'."\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') { |
|
my $result='<div class="LC_grade_message_center">'; |
|
|
|
$result.='<div class="LC_grade_message_center_header">'. |
|
&mt('Send Message').'</div><div class="LC_grade_message_center_body">'; |
my ($lastname,$givenn) = split(/,/,$env{'form.fullname'}); |
my ($lastname,$givenn) = split(/,/,$env{'form.fullname'}); |
my $msgfor = $givenn.' '.$lastname; |
my $msgfor = $givenn.' '.$lastname; |
if (scalar(@col_fullnames) > 0) { |
if (scalar(@$col_fullnames) > 0) { |
my $lastone = pop @col_fullnames; |
my $lastone = pop(@$col_fullnames); |
$msgfor .= ', '.(join ', ',@col_fullnames).' and '.$lastone.'.'; |
$msgfor .= ', '.(join ', ',@$col_fullnames).' and '.$lastone.'.'; |
} |
} |
$msgfor =~ s/\'/\\'/g; #' stupid emacs - no! javascript |
$msgfor =~ s/\'/\\'/g; #' stupid emacs - no! javascript |
$result='<input type="hidden" name="includemsg'.$counter.'" value="" />'."\n". |
$result.='<input type="hidden" name="includemsg'.$counter.'" value="" />'."\n". |
'<input type="hidden" name="newmsg'.$counter.'" value="" />'."\n"; |
'<input type="hidden" name="newmsg'.$counter.'" value="" />'."\n"; |
$result.=' <a href="javascript:msgCenter(document.SCORE,'.$counter. |
$result.=' <a href="javascript:msgCenter(document.SCORE,'.$counter. |
',\''.$msgfor.'\');" target="_self">'. |
',\''.$msgfor.'\');" target="_self">'. |
&mt('Compose message to student').(scalar(@col_fullnames) >= 1 ? 's' : '').'</a><label> ('. |
&mt('Compose message to student').(scalar(@$col_fullnames) >= 1 ? 's' : '').'</a><label> ('. |
&mt('incl. grades').' <input type="checkbox" name="withgrades'.$counter.'" /></label>)'. |
&mt('incl. grades').' <input type="checkbox" name="withgrades'.$counter.'" /></label>)'. |
'<img src="'.$request->dir_config('lonIconsURL'). |
'<img src="'.$request->dir_config('lonIconsURL'). |
'/mailbkgrd.gif" width="14" height="10" name="mailicon'.$counter.'" />'."\n". |
'/mailbkgrd.gif" width="14" height="10" name="mailicon'.$counter.'" />'."\n". |
'<br /> ('. |
'<br /> ('. |
&mt('Message will be sent when you click on Save & Next below.').")\n"; |
&mt('Message will be sent when you click on Save & Next below.').")\n"; |
|
$result.='</div></div>'; |
$request->print($result); |
$request->print($result); |
} |
} |
if ($perm{'vgr'}) { |
|
$request->print('<br />'. |
|
&Apache::loncommon::track_student_link(&mt('View recent activity'), |
|
$uname,$udom,'check')); |
|
} |
|
if ($perm{'opa'}) { |
|
$request->print('<br />'. |
|
&Apache::loncommon::pprmlink(&mt('Set/Change parameters'), |
|
$uname,$udom,$symb,'check')); |
|
} |
|
|
|
my %seen = (); |
my %seen = (); |
my @partlist; |
my @partlist; |
my @gradePartRespid; |
my @gradePartRespid; |
my @part_response_id = &flatten_responseType($responseType); |
my @part_response_id = &flatten_responseType($responseType); |
|
$request->print('<div class="LC_grade_assign">'. |
|
|
|
'<div class="LC_grade_assign_header">'. |
|
&mt('Assign Grades').'</div>'. |
|
'<div class="LC_grade_assign_body">'); |
foreach my $part_response_id (@part_response_id) { |
foreach my $part_response_id (@part_response_id) { |
my ($partid,$respid) = @{ $part_response_id }; |
my ($partid,$respid) = @{ $part_response_id }; |
my $part_resp = join('_',@{ $part_response_id }); |
my $part_resp = join('_',@{ $part_response_id }); |
Line 2222 KEYWORDS
|
Line 2179 KEYWORDS
|
push @gradePartRespid,$partid.'.'.$respid; |
push @gradePartRespid,$partid.'.'.$respid; |
$request->print(&gradeBox($request,$symb,$uname,$udom,$counter,$partid,\%record)); |
$request->print(&gradeBox($request,$symb,$uname,$udom,$counter,$partid,\%record)); |
} |
} |
|
$request->print('</div></div>'); |
|
|
|
$request->print('<div class="LC_grade_info_links">'); |
|
if ($perm{'vgr'}) { |
|
$request->print( |
|
&Apache::loncommon::track_student_link(&mt('View recent activity'), |
|
$uname,$udom,'check')); |
|
} |
|
if ($perm{'opa'}) { |
|
$request->print( |
|
&Apache::loncommon::pprmlink(&mt('Set/Change parameters'), |
|
$uname,$udom,$symb,'check')); |
|
} |
|
$request->print('</div>'); |
|
|
$result='<input type="hidden" name="partlist'.$counter. |
$result='<input type="hidden" name="partlist'.$counter. |
'" value="'.(join ":",@partlist).'" />'."\n"; |
'" value="'.(join ":",@partlist).'" />'."\n"; |
$result.='<input type="hidden" name="gradePartRespid'. |
$result.='<input type="hidden" name="gradePartRespid'. |
Line 2232 KEYWORDS
|
Line 2204 KEYWORDS
|
$partlist[$ctr].'" />'."\n"; |
$partlist[$ctr].'" />'."\n"; |
$ctr++; |
$ctr++; |
} |
} |
$request->print($result.'</td></tr></table></td></tr></table>'."\n"); |
$request->print($result.''."\n"); |
|
|
# Done with printing info for one student |
# Done with printing info for one student |
|
|
$request->print('</td></tr></table></p>'); |
$request->print('</div>');#LC_grade_show_user_body |
|
$request->print('</div>');#LC_grade_show_user |
|
|
|
|
# print end of form |
# print end of form |
Line 2266 KEYWORDS
|
Line 2239 KEYWORDS
|
return ''; |
return ''; |
} |
} |
|
|
|
sub check_collaborators { |
|
my ($symb,$uname,$udom,$record,$handgrade,$counter) = @_; |
|
my ($result,@col_fullnames); |
|
my ($classlist,undef,$fullname) = &getclasslist('all','0'); |
|
foreach my $part (keys(%$handgrade)) { |
|
my $ncol = &Apache::lonnet::EXT('resource.'.$part. |
|
'.maxcollaborators', |
|
$symb,$udom,$uname); |
|
next if ($ncol <= 0); |
|
$part =~ s/\_/\./g; |
|
next if ($record->{'resource.'.$part.'.collaborators'} eq ''); |
|
my (@good_collaborators, @bad_collaborators); |
|
foreach my $possible_collaborator |
|
(split(/,?\s+/,$record->{'resource.'.$part.'.collaborators'})) { |
|
$possible_collaborator =~ s/[\$\^\(\)]//g; |
|
next if ($possible_collaborator eq ''); |
|
my ($co_name,$co_dom) = split(/\@|:/,$possible_collaborator); |
|
$co_dom = $udom if (! defined($co_dom) || $co_dom =~ /^domain$/i); |
|
next if ($co_name eq $uname && $co_dom eq $udom); |
|
# Doing this grep allows 'fuzzy' specification |
|
my @matches = grep(/^\Q$co_name\E:\Q$co_dom\E$/i, |
|
keys(%$classlist)); |
|
if (! scalar(@matches)) { |
|
push(@bad_collaborators, $possible_collaborator); |
|
} else { |
|
push(@good_collaborators, @matches); |
|
} |
|
} |
|
if (scalar(@good_collaborators) != 0) { |
|
$result.='<br />'.&mt('Collaborators: '); |
|
foreach my $name (@good_collaborators) { |
|
my ($lastname,$givenn) = split(/,/,$$fullname{$name}); |
|
push(@col_fullnames, $givenn.' '.$lastname); |
|
$result.=$fullname->{$name}.' '; |
|
} |
|
$result.='<br />'."\n"; |
|
my ($part)=split(/\./,$part); |
|
$result.='<input type="hidden" name="collaborator'.$counter. |
|
'" value="'.$part.':'.(join ':',@good_collaborators).'" />'. |
|
"\n"; |
|
} |
|
if (scalar(@bad_collaborators) > 0) { |
|
$result.='<div class="LC_warning">'; |
|
$result.=&mt('This student has submitted [quant,_1,invalid collaborator]: [_2]',scalar(@bad_collaborators),join(', ',@bad_collaborators)); |
|
$result .= '</div>'; |
|
} |
|
if (scalar(@bad_collaborators > $ncol)) { |
|
$result .= '<div class="LC_warning">'; |
|
$result .= &mt('This student has submitted too many '. |
|
'collaborators. Maximum is [_1].',$ncol); |
|
$result .= '</div>'; |
|
} |
|
} |
|
return ($result,$fullname,\@col_fullnames); |
|
} |
|
|
#--- Retrieve the last submission for all the parts |
#--- Retrieve the last submission for all the parts |
sub get_last_submission { |
sub get_last_submission { |
my ($returnhash)=@_; |
my ($returnhash)=@_; |
Line 3912 sub csvuploadassign {
|
Line 3941 sub csvuploadassign {
|
if ($wgt) { |
if ($wgt) { |
$entries{$fields{$dest}}=~s/\s//g; |
$entries{$fields{$dest}}=~s/\s//g; |
my $pcr=$entries{$fields{$dest}} / $wgt; |
my $pcr=$entries{$fields{$dest}} / $wgt; |
my $award='correct_by_override'; |
my $award=($pcr == 0) ? 'incorrect_by_override' |
|
: 'correct_by_override'; |
$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 4263 sub displaySubByDates {
|
Line 4293 sub displaySubByDates {
|
my $isCODE=0; |
my $isCODE=0; |
my $isTask = ($symb =~/\.task$/); |
my $isTask = ($symb =~/\.task$/); |
if (exists($record->{'resource.CODE'})) { $isCODE=1; } |
if (exists($record->{'resource.CODE'})) { $isCODE=1; } |
my $studentTable='<table border="0" width="100%"><tr><td bgcolor="#777777">'. |
my $studentTable=&Apache::loncommon::start_data_table(). |
'<table border="0" width="100%"><tr bgcolor="#e6ffff">'. |
&Apache::loncommon::start_data_table_header_row(). |
'<td><b>Date/Time</b></td>'. |
'<th>'.&mt('Date/Time').'</th>'. |
($isCODE?'<td><b>CODE</b></td>':''). |
($isCODE?'<th>'.&mt('CODE').'</th>':''). |
'<td><b>Submission</b></td>'. |
'<th>'.&mt('Submission').'</th>'. |
'<td><b>Status </b></td></tr>'; |
'<th>'.&mt('Status').'</th>'. |
|
&Apache::loncommon::end_data_table_header_row(); |
my ($version); |
my ($version); |
my %mark; |
my %mark; |
my %orders; |
my %orders; |
$mark{'correct_by_student'} = $checkIcon; |
$mark{'correct_by_student'} = $checkIcon; |
if (!exists($$record{'1:timestamp'})) { |
if (!exists($$record{'1:timestamp'})) { |
return '<br /> <span class="LC_warning">Nothing submitted - no attempts</span><br />'; |
return '<br /> <span class="LC_warning">'.&mt('Nothing submitted - no attempts').'</span><br />'; |
} |
} |
|
|
my $interaction; |
my $interaction; |
for ($version=1;$version<=$$record{'version'};$version++) { |
for ($version=1;$version<=$$record{'version'};$version++) { |
my $timestamp = scalar(localtime($$record{$version.':timestamp'})); |
my $timestamp = |
|
&Apache::lonlocal::locallocaltime($$record{$version.':timestamp'}); |
if (exists($$record{$version.':resource.0.version'})) { |
if (exists($$record{$version.':resource.0.version'})) { |
$interaction = $$record{$version.':resource.0.version'}; |
$interaction = $$record{$version.':resource.0.version'}; |
} |
} |
|
|
my $where = ($isTask ? "$version:resource.$interaction" |
my $where = ($isTask ? "$version:resource.$interaction" |
: "$version:resource"); |
: "$version:resource"); |
$studentTable.='<tr bgcolor="#ffffff" valign="top"><td>'.$timestamp.'</td>'; |
$studentTable.=&Apache::loncommon::start_data_table_row(). |
|
'<td>'.$timestamp.'</td>'; |
if ($isCODE) { |
if ($isCODE) { |
$studentTable.='<td>'.$record->{$version.':resource.CODE'}.'</td>'; |
$studentTable.='<td>'.$record->{$version.':resource.CODE'}.'</td>'; |
} |
} |
Line 4305 sub displaySubByDates {
|
Line 4338 sub displaySubByDates {
|
|
|
my ($responseId)= ($isTask ? ($matchKey=~ /^resource\.(.*?)\.\Q$partid\E\.award$/) |
my ($responseId)= ($isTask ? ($matchKey=~ /^resource\.(.*?)\.\Q$partid\E\.award$/) |
: ($matchKey=~ /^resource\.\Q$partid\E\.(.*?)\.submission$/)); |
: ($matchKey=~ /^resource\.\Q$partid\E\.(.*?)\.submission$/)); |
$displaySub[0].='<b>Part:</b> '.$display_part.' '; |
$displaySub[0].='<b>'.&mt('Part:').'</b> '.$display_part.' '; |
$displaySub[0].='<span class="LC_internal_info">(ID '. |
$displaySub[0].='<span class="LC_internal_info">('.&mt('ID').' '. |
$responseId.')</span> <b>'; |
$responseId.')</span> <b>'; |
if ($$record{"$where.$partid.tries"} eq '') { |
if ($$record{"$where.$partid.tries"} eq '') { |
$displaySub[0].='Trial not counted'; |
$displaySub[0].=&mt('Trial not counted'); |
} else { |
} else { |
$displaySub[0].='Trial '. |
$displaySub[0].=&mt('Trial [_1]', |
$$record{"$where.$partid.tries"}; |
$$record{"$where.$partid.tries"}); |
} |
} |
my $responseType=($isTask ? 'Task' |
my $responseType=($isTask ? 'Task' |
: $responseType->{$partid}->{$responseId}); |
: $responseType->{$partid}->{$responseId}); |
Line 4352 sub displaySubByDates {
|
Line 4385 sub displaySubByDates {
|
} |
} |
$studentTable.='<td>'.$displaySub[0].' </td><td>'.$displaySub[1]; |
$studentTable.='<td>'.$displaySub[0].' </td><td>'.$displaySub[1]; |
if ($displaySub[2]) { |
if ($displaySub[2]) { |
$studentTable.='Manually graded by '.$displaySub[2]; |
$studentTable.=&mt('Manually graded by [_1]',$displaySub[2]); |
} |
} |
$studentTable.=' </td></tr>'; |
$studentTable.=' </td>'. |
|
&Apache::loncommon::end_data_table_row(); |
} |
} |
$studentTable.='</table></td></tr></table>'; |
$studentTable.=&Apache::loncommon::end_data_table(); |
return $studentTable; |
return $studentTable; |
} |
} |
|
|
Line 5206 sub scan_data {
|
Line 5239 sub scan_data {
|
|
|
sub scantron_parse_scanline { |
sub scantron_parse_scanline { |
my ($line,$whichline,$scantron_config,$scan_data,$just_header)=@_; |
my ($line,$whichline,$scantron_config,$scan_data,$just_header)=@_; |
|
|
my %record; |
my %record; |
my $questions=substr($line,$$scantron_config{'Qstart'}-1); # Answers |
my $questions=substr($line,$$scantron_config{'Qstart'}-1); # Answers |
my $data=substr($line,0,$$scantron_config{'Qstart'}-1); # earlier stuff |
my $data=substr($line,0,$$scantron_config{'Qstart'}-1); # earlier stuff |
Line 5244 sub scantron_parse_scanline {
|
Line 5278 sub scantron_parse_scanline {
|
my $questnum=0; |
my $questnum=0; |
my $ansnum =1; # Multiple 'answer lines'/question. |
my $ansnum =1; # Multiple 'answer lines'/question. |
|
|
while ($questions) { |
chomp($questions); # Get rid of any trailing \n. |
|
$questions =~ s/\r$//; # Get rid of trailing \r too (MAC or Win uploads). |
|
while (length($questions)) { |
my $answers_needed = $bubble_lines_per_response{$questnum}; |
my $answers_needed = $bubble_lines_per_response{$questnum}; |
my $answer_length = $$scantron_config{'Qlength'} * $answers_needed; |
my $answer_length = $$scantron_config{'Qlength'} * $answers_needed; |
|
|
Line 5280 sub scantron_parse_scanline {
|
Line 5316 sub scantron_parse_scanline {
|
} elsif (!defined($currentquest) |
} elsif (!defined($currentquest) |
|| (&occurence_count($currentquest, $$scantron_config{'Qoff'}) == length($currentquest)) |
|| (&occurence_count($currentquest, $$scantron_config{'Qoff'}) == length($currentquest)) |
|| (&occurence_count($currentquest, "[A-Z]") == 0)) { |
|| (&occurence_count($currentquest, "[A-Z]") == 0)) { |
|
&Apache::lonnet::logthis("Missing if, $questnum, $ansnum"); |
for (my $ans = 0; $ans < $answers_needed; $ans++ ) { |
for (my $ans = 0; $ans < $answers_needed; $ans++ ) { |
$record{"scantron.$ansnum.answer"}=''; |
$record{"scantron.$ansnum.answer"}=''; |
$ansnum++; |
$ansnum++; |
|
|
} |
} |
if (!&scan_data($scan_data,"$whichline.no_bubble.$questnum")) { |
if (!&scan_data($scan_data,"$whichline.no_bubble.$questnum")) { |
|
&Apache::lonnet::logthis("Parsed missing: $questnum"); |
push(@{$record{"scantron.missingerror"}},$questnum); |
push(@{$record{"scantron.missingerror"}},$questnum); |
$ansnum += $answers_needed; |
# $ansnum += $answers_needed; |
} |
} |
|
&Apache::lonnet::logthis("Residual scanline: '$questions'"); |
|
|
} else { |
} else { |
for (my $ans = 0; $ans < $answers_needed; $ans++) { |
for (my $ans = 0; $ans < $answers_needed; $ans++) { |
Line 5383 sub scantron_parse_scanline {
|
Line 5422 sub scantron_parse_scanline {
|
|
|
my $first_answer = $ansnum; |
my $first_answer = $ansnum; |
for (my $ans =0; $ans < $answers_needed; $ans++) { |
for (my $ans =0; $ans < $answers_needed; $ans++) { |
$record{"scantron.$ansnum.answer"} = ''; |
my $item = $first_answer+$ans; |
$ans++; |
$record{"scantron.$item.answer"} = ''; |
} |
} |
|
|
my @ans=@array; |
my @ans=@array; |
my $i=length($ans[0]);shift(@ans); |
my $i=0; |
|
my $increment = 0; |
while ($#ans) { |
while ($#ans) { |
$i+=length($ans[0])+1; |
$i+=length($ans[0]) + $increment; |
my $line = $i/$$scantron_config{'Qlength'} + $first_answer; |
my $line = int($i/$$scantron_config{'Qlength'} + $first_answer); |
my $bubble = $i%$$scantron_config{'Qlength'}; |
my $bubble = $i%$$scantron_config{'Qlength'}; |
|
|
$record{"scantron.$line.answer"}.=$alphabet[$bubble]; |
$record{"scantron.$line.answer"}.=$alphabet[$bubble]; |
shift(@ans); |
shift(@ans); |
|
$increment = 1; |
} |
} |
|
$ansnum += $answers_needed; |
} |
} |
} |
} |
} |
} |
Line 6445 ENDSCRIPT
|
Line 6486 ENDSCRIPT
|
join(',',@{$arg}).'" />'); |
join(',',@{$arg}).'" />'); |
foreach my $question (@{$arg}) { |
foreach my $question (@{$arg}) { |
my $selected = &get_response_bubbles($scan_record, $question); |
my $selected = &get_response_bubbles($scan_record, $question); |
&scantron_bubble_selector($r,$scan_config,$question); |
my @select_array = split(/:/,$selected); # ought to be an array of empties. |
|
&Apache::lonnet::logthis("Calling bubble selector (missing)"); |
|
&scantron_bubble_selector($r,$scan_config,$question, @select_array); |
} |
} |
} else { |
} else { |
$r->print("\n<ul>"); |
$r->print("\n<ul>"); |
Line 6465 ENDSCRIPT
|
Line 6508 ENDSCRIPT
|
$r - Apache request object |
$r - Apache request object |
$scan_config - hash from &get_scantron_config() |
$scan_config - hash from &get_scantron_config() |
$quest - number of the bubble line to make a corrector for |
$quest - number of the bubble line to make a corrector for |
$lines - array of answer lines. |
@lines - array of answer lines. |
|
|
=cut |
=cut |
|
|
Line 6486 sub scantron_bubble_selector {
|
Line 6529 sub scantron_bubble_selector {
|
|
|
my $total_lines = $lines*2; |
my $total_lines = $lines*2; |
my @alphabet=('A'..'Z'); |
my @alphabet=('A'..'Z'); |
|
&Apache::lonnet::logthis("Putting in question number $quest"); |
$r->print("<table border='1'><tr><td rowspan='".$total_lines."'>$quest</td>"); |
$r->print("<table border='1'><tr><td rowspan='".$total_lines."'>$quest</td>"); |
|
|
for (my $l = 0; $l < $lines; $l++) { |
for (my $l = 0; $l < $lines; $l++) { |
if ($l != 0) { |
if ($l != 0) { |
$r->print('<tr>'); |
$r->print('<tr>'); |
} |
} |
|
my @selected = split(//,$lines[$l]); |
for (my $i=0;$i<$max;$i++) { |
for (my $i=0;$i<$max;$i++) { |
my @selected = split(//,$lines[$l]); |
|
$r->print("\n".'<td align="center">'); |
$r->print("\n".'<td align="center">'); |
if ($selected[0] eq $alphabet[$i]) { |
if ($selected[0] eq $alphabet[$i]) { |
$r->print('X'); |
$r->print('X'); |
Line 6836 sub scantron_validate_missingbubbles {
|
Line 6880 sub scantron_validate_missingbubbles {
|
$scan_data); |
$scan_data); |
if (!defined($$scan_record{'scantron.missingerror'})) { next; } |
if (!defined($$scan_record{'scantron.missingerror'})) { next; } |
my @to_correct; |
my @to_correct; |
|
|
|
# Probably here's where the error is... |
|
|
foreach my $missing (@{$$scan_record{'scantron.missingerror'}}) { |
foreach my $missing (@{$$scan_record{'scantron.missingerror'}}) { |
if ($missing > $max_bubble) { next; } |
if ($missing > $max_bubble) { next; } |
|
&Apache::lonnet::logthis("Marking $missing for missing bubble check"); |
push(@to_correct,$missing); |
push(@to_correct,$missing); |
} |
} |
if (@to_correct) { |
if (@to_correct) { |
Line 7192 sub grading_menu {
|
Line 7240 sub grading_menu {
|
my $probTitle = &Apache::lonnet::gettitle($symb); |
my $probTitle = &Apache::lonnet::gettitle($symb); |
my ($table,undef,$hdgrade) = &showResourceInfo($symb,$probTitle); |
my ($table,undef,$hdgrade) = &showResourceInfo($symb,$probTitle); |
|
|
# |
|
# Define menu data |
|
$env{'form.probTitle'} = &Apache::lonnet::gettitle($symb); |
|
my ($table) = &showResourceInfo($symb,$env{'form.probTitle'}); |
|
$request->print($table); |
$request->print($table); |
my %fields = ('symb'=>&Apache::lonenc::check_encrypt($symb), |
my %fields = ('symb'=>&Apache::lonenc::check_encrypt($symb), |
'handgrade'=>$hdgrade, |
'handgrade'=>$hdgrade, |