version 1.596.2.12.2.17, 2013/06/29 16:27:39
|
version 1.596.2.12.2.47, 2019/02/23 15:50:44
|
Line 44 use Apache::Constants qw(:common :http);
|
Line 44 use Apache::Constants qw(:common :http);
|
use Apache::lonlocal; |
use Apache::lonlocal; |
use Apache::lonenc; |
use Apache::lonenc; |
use Apache::bridgetask(); |
use Apache::bridgetask(); |
|
use Apache::lontexconvert(); |
|
use HTML::Parser(); |
|
use File::MMagic; |
use String::Similarity; |
use String::Similarity; |
use LONCAPA; |
use LONCAPA; |
|
|
Line 354 sub reset_caches {
|
Line 357 sub reset_caches {
|
} |
} |
|
|
sub scantron_partids_tograde { |
sub scantron_partids_tograde { |
my ($resource,$cid,$uname,$udom,$check_for_randomlist,$bubbles_per_row) = @_; |
my ($resource,$cid,$uname,$udom,$check_for_randomlist,$bubbles_per_row,$scancode) = @_; |
my (%analysis,@parts); |
my (%analysis,@parts); |
if (ref($resource)) { |
if (ref($resource)) { |
my $symb = $resource->symb(); |
my $symb = $resource->symb(); |
Line 362 sub reset_caches {
|
Line 365 sub reset_caches {
|
if ($check_for_randomlist) { |
if ($check_for_randomlist) { |
$add_to_form = { 'check_parts_withrandomlist' => 1,}; |
$add_to_form = { 'check_parts_withrandomlist' => 1,}; |
} |
} |
|
if ($scancode) { |
|
if (ref($add_to_form) eq 'HASH') { |
|
$add_to_form->{'code_for_randomlist'} = $scancode; |
|
} else { |
|
$add_to_form = { 'code_for_randomlist' => $scancode,}; |
|
} |
|
} |
my $analyze = |
my $analyze = |
&get_analyze($symb,$uname,$udom,undef,$add_to_form, |
&get_analyze($symb,$uname,$udom,undef,$add_to_form, |
undef,undef,undef,$bubbles_per_row); |
undef,undef,undef,$bubbles_per_row); |
Line 391 sub cleanRecord {
|
Line 401 sub cleanRecord {
|
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); |
|
my @answer = %answer; |
|
%answer = map {&HTML::Entities::encode($_, '"<>&')} @answer; |
my %grading=&Apache::lonnet::str2hash($record->{$version."resource.$partid.$respid.submissiongrading"}); |
my %grading=&Apache::lonnet::str2hash($record->{$version."resource.$partid.$respid.submissiongrading"}); |
my ($toprow,$bottomrow); |
my ($toprow,$bottomrow); |
foreach my $foil (@$order) { |
foreach my $foil (@$order) { |
Line 407 sub cleanRecord {
|
Line 419 sub cleanRecord {
|
$bottomrow.'</tr></table></blockquote>'; |
$bottomrow.'</tr></table></blockquote>'; |
} elsif ($response eq 'match') { |
} elsif ($response eq 'match') { |
my %answer=&Apache::lonnet::str2hash($answer); |
my %answer=&Apache::lonnet::str2hash($answer); |
|
my @answer = %answer; |
|
%answer = map {&HTML::Entities::encode($_, '"<>&')} @answer; |
my %grading=&Apache::lonnet::str2hash($record->{$version."resource.$partid.$respid.submissiongrading"}); |
my %grading=&Apache::lonnet::str2hash($record->{$version."resource.$partid.$respid.submissiongrading"}); |
my @items=&Apache::lonnet::str2array($record->{$version."resource.$partid.$respid.submissionitems"}); |
my @items=&Apache::lonnet::str2array($record->{$version."resource.$partid.$respid.submissionitems"}); |
my ($toprow,$middlerow,$bottomrow); |
my ($toprow,$middlerow,$bottomrow); |
Line 461 sub cleanRecord {
|
Line 475 sub cleanRecord {
|
$env{'form.kwstyle'} = $keyhash{$loginuser.'_kwstyle'} ne '' ? $keyhash{$loginuser.'_kwstyle'} : ''; |
$env{'form.kwstyle'} = $keyhash{$loginuser.'_kwstyle'} ne '' ? $keyhash{$loginuser.'_kwstyle'} : ''; |
$env{'form.'.$symb} = 1; # so that we don't have to read it from disk for multiple sub of the same prob. |
$env{'form.'.$symb} = 1; # so that we don't have to read it from disk for multiple sub of the same prob. |
} |
} |
$answer =~ s-\n-<br />-g; |
$answer = &Apache::lontexconvert::msgtexconverted($answer); |
return '<br /><br /><blockquote><tt>'.&keywords_highlight($answer).'</tt></blockquote>'; |
return '<br /><br /><blockquote><tt>'.&keywords_highlight($answer).'</tt></blockquote>'; |
} elsif ( $response eq 'organic') { |
} elsif ( $response eq 'organic') { |
my $result='Smile representation: "<tt>'.$answer.'</tt>"'; |
my $result=&mt('Smile representation: [_1]', |
|
'"<tt>'.&HTML::Entities::encode($answer, '"<>&').'</tt>"'); |
my $jme=$record->{$version."resource.$partid.$respid.molecule"}; |
my $jme=$record->{$version."resource.$partid.$respid.molecule"}; |
$result.=&Apache::chemresponse::jme_img($jme,$answer,400); |
$result.=&Apache::chemresponse::jme_img($jme,$answer,400); |
return $result; |
return $result; |
Line 498 sub cleanRecord {
|
Line 513 sub cleanRecord {
|
$result.='</ul>'; |
$result.='</ul>'; |
return $result; |
return $result; |
} |
} |
} elsif ( $response =~ m/(?:numerical|formula)/) { |
} elsif ( $response =~ m/(?:numerical|formula|custom)/) { |
|
# Respect multiple input fields, see Bug #5409 |
$answer = |
$answer = |
&Apache::loncommon::format_previous_attempt_value('submission', |
&Apache::loncommon::format_previous_attempt_value('submission', |
$answer); |
$answer); |
|
return $answer; |
} |
} |
return $answer; |
return &HTML::Entities::encode($answer, '"<>&'); |
} |
} |
|
|
#-- A couple of common js functions |
#-- A couple of common js functions |
Line 811 sub verifyreceipt {
|
Line 828 sub verifyreceipt {
|
'<h3><span class="LC_info">'. |
'<h3><span class="LC_info">'. |
&mt('Verifying Receipt No. [_1]',$receipt). |
&mt('Verifying Receipt No. [_1]',$receipt). |
'</span></h3>'."\n". |
'</span></h3>'."\n". |
'<h4>'.&mt('<b>Resource: </b>[_1]',$env{'form.probTitle'}). |
'<h4>'.&mt('[_1]Resource: [_2]','<b>','</b>'.$env{'form.probTitle'}). |
'</h4>'."\n"; |
'</h4>'."\n"; |
|
|
my ($string,$contents,$matches) = ('','',0); |
my ($string,$contents,$matches) = ('','',0); |
Line 908 sub listStudents {
|
Line 925 sub listStudents {
|
|
|
my ($table,undef,$hdgrade,$partlist,$handgrade) = &showResourceInfo($symb,$env{'form.probTitle'},($env{'form.showgrading'} eq 'yes')); |
my ($table,undef,$hdgrade,$partlist,$handgrade) = &showResourceInfo($symb,$env{'form.probTitle'},($env{'form.showgrading'} eq 'yes')); |
|
|
my %lt = &Apache::lonlocal::texthash ( |
my %js_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.', |
'single' => 'Please select the student before clicking on the Next button.', |
'single' => 'Please select the student before clicking on the Next button.', |
); |
); |
|
&js_escape(\%js_lt); |
$request->print(<<LISTJAVASCRIPT); |
$request->print(<<LISTJAVASCRIPT); |
<script type="text/javascript" language="javascript"> |
<script type="text/javascript" language="javascript"> |
function checkSelect(checkBox) { |
function checkSelect(checkBox) { |
Line 923 sub listStudents {
|
Line 941 sub listStudents {
|
ctr++; |
ctr++; |
} |
} |
} |
} |
sense = '$lt{'multiple'}'; |
sense = '$js_lt{'multiple'}'; |
} else { |
} else { |
if (checkBox.checked) { |
if (checkBox.checked) { |
ctr = 1; |
ctr = 1; |
} |
} |
sense = '$lt{'single'}'; |
sense = '$js_lt{'single'}'; |
} |
} |
if (ctr == 0) { |
if (ctr == 0) { |
alert(sense); |
alert(sense); |
Line 1162 LISTJAVASCRIPT
|
Line 1180 LISTJAVASCRIPT
|
if ($submitonly eq 'graded' ) { $submissions = 'ungraded submissions'; } |
if ($submitonly eq 'graded' ) { $submissions = 'ungraded submissions'; } |
if ($submitonly eq 'queued' ) { $submissions = 'queued submissions'; } |
if ($submitonly eq 'queued' ) { $submissions = 'queued submissions'; } |
$gradeTable='<br /> <span class="LC_warning">'. |
$gradeTable='<br /> <span class="LC_warning">'. |
&mt('No '.$submissions.' found for this resource for any students. ([_1] students checked for '.$submissions.')', |
&mt('No '.$submissions.' found for this resource for any students. ([quant,_1,student] checked for '.$submissions.')', |
$num_students). |
$num_students). |
'</span><br />'; |
'</span><br />'; |
} |
} |
Line 1247 sub processGroup {
|
Line 1265 sub processGroup {
|
#--- Javascript to handle the submission page functionality --- |
#--- Javascript to handle the submission page functionality --- |
sub sub_page_js { |
sub sub_page_js { |
my $request = shift; |
my $request = shift; |
my $alertmsg = &mt('A number equal or greater than 0 is expected. Entered value = '); |
my $alertmsg = &mt('A number equal or greater than 0 is expected. Entered value = '); |
|
&js_escape(\$alertmsg); |
$request->print(<<SUBJAVASCRIPT); |
$request->print(<<SUBJAVASCRIPT); |
<script type="text/javascript" language="javascript"> |
<script type="text/javascript" language="javascript"> |
function updateRadio(formname,id,weight) { |
function updateRadio(formname,id,weight) { |
Line 1366 sub sub_page_js {
|
Line 1385 sub sub_page_js {
|
} |
} |
} |
} |
} |
} |
|
|
} |
} |
} |
} |
|
|
} |
} |
if (val == "Grade Student") { |
if (val == "Grade Student") { |
formname.showgrading.value = "yes"; |
formname.showgrading.value = "yes"; |
Line 1503 INNERJS
|
Line 1520 INNERJS
|
|
|
my $docopen=&Apache::lonhtmlcommon::javascript_docopen(); |
my $docopen=&Apache::lonhtmlcommon::javascript_docopen(); |
$docopen=~s/^document\.//; |
$docopen=~s/^document\.//; |
my %lt = &Apache::lonlocal::texthash( |
my %js_lt = &Apache::lonlocal::texthash( |
keyw => 'Keywords list, separated by a space. Add/delete to list if desired.', |
keyw => 'Keywords list, separated by a space. Add/delete to list if desired.', |
plse => 'Please select a word or group of words from document and then click this link.', |
plse => 'Please select a word or group of words from document and then click this link.', |
adds => 'Add selection to keyword list? Edit if desired.', |
adds => 'Add selection to keyword list? Edit if desired.', |
|
col1 => 'red', |
|
col2 => 'green', |
|
col3 => 'blue', |
|
siz1 => 'normal', |
|
siz2 => '+1', |
|
siz3 => '+2', |
|
sty1 => 'normal', |
|
sty2 => 'italic', |
|
sty3 => 'bold', |
|
); |
|
my %html_js_lt = &Apache::lonlocal::texthash( |
comp => 'Compose Message for: ', |
comp => 'Compose Message for: ', |
incl => 'Include', |
incl => 'Include', |
type => 'Type', |
type => 'Type', |
Line 1520 INNERJS
|
Line 1548 INNERJS
|
font => 'Font Size', |
font => 'Font Size', |
fnst => 'Font Style', |
fnst => 'Font Style', |
); |
); |
|
&js_escape(\%js_lt); |
|
&html_escape(\%html_js_lt); |
|
&js_escape(\%html_js_lt); |
$request->print(<<SUBJAVASCRIPT); |
$request->print(<<SUBJAVASCRIPT); |
<script type="text/javascript" language="javascript"> |
<script type="text/javascript" language="javascript"> |
|
|
//===================== Show list of keywords ==================== |
//===================== Show list of keywords ==================== |
function keywords(formname) { |
function keywords(formname) { |
var nret = prompt("$lt{'keyw'}",formname.keywords.value); |
var nret = prompt("$js_lt{'keyw'}",formname.keywords.value); |
if (nret==null) return; |
if (nret==null) return; |
formname.keywords.value = nret; |
formname.keywords.value = nret; |
|
|
Line 1552 INNERJS
|
Line 1583 INNERJS
|
else return; |
else return; |
var cleantxt = txt.replace(new RegExp('([\\f\\n\\r\\t\\v ])+', 'g')," "); |
var cleantxt = txt.replace(new RegExp('([\\f\\n\\r\\t\\v ])+', 'g')," "); |
if (cleantxt=="") { |
if (cleantxt=="") { |
alert("$lt{'plse'}"); |
alert("$js_lt{'plse'}"); |
return; |
return; |
} |
} |
var nret = prompt("$lt{'adds'}",cleantxt); |
var nret = prompt("$js_lt{'adds'}",cleantxt); |
if (nret==null) return; |
if (nret==null) return; |
document.SCORE.keywords.value = document.SCORE.keywords.value+" "+nret; |
document.SCORE.keywords.value = document.SCORE.keywords.value+" "+nret; |
if (document.SCORE.keywords.value != "") { |
if (document.SCORE.keywords.value != "") { |
Line 1635 INNERJS
|
Line 1666 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\\"> $lt{'comp'}\"+fullname+\"<\\/span><\\/h3><br /><br />"); |
pDoc.write("<h3><span class=\\"LC_info\\"> $html_js_lt{'comp'}\"+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>$lt{'type'}<\\/b><\\/td><td><b>$lt{'incl'}<\\/b><\\/td><td><b>$lt{'mesa'}<\\/td><\\/tr>"); |
pDoc.write("<td><b>$html_js_lt{'type'}<\\/b><\\/td><td><b>$html_js_lt{'incl'}<\\/b><\\/td><td><b>$html_js_lt{'mesa'}<\\/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>$lt{'subj'}<\\/td>"); |
pDoc.write("<td>$html_js_lt{'subj'}<\\/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>"); |
} |
} |
Line 1660 INNERJS
|
Line 1691 INNERJS
|
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\\">$lt{'new'}<\\/td>"); |
pDoc.write("<td align=\\"center\\">$html_js_lt{'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>"); |
} |
} |
Line 1669 INNERJS
|
Line 1700 INNERJS
|
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=\\"$lt{'save'}\\" onclick=\\"javascript:checkInput()\\"> "); |
pDoc.write("<input type=\\"button\\" value=\\"$html_js_lt{'save'}\\" onclick=\\"javascript:checkInput()\\"> "); |
pDoc.write("<input type=\\"button\\" value=\\"$lt{'canc'}\\" onclick=\\"self.close()\\"><br /><br />"); |
pDoc.write("<input type=\\"button\\" value=\\"$html_js_lt{'canc'}\\" 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 1684 INNERJS
|
Line 1715 INNERJS
|
var redsel = ""; |
var redsel = ""; |
var grnsel = ""; |
var grnsel = ""; |
var blusel = ""; |
var blusel = ""; |
if (kwclr=="red") {var redsel="checked"}; |
var txtcol1 = "$js_lt{'col1'}"; |
if (kwclr=="green") {var grnsel="checked"}; |
var txtcol2 = "$js_lt{'col2'}"; |
if (kwclr=="blue") {var blusel="checked"}; |
var txtcol3 = "$js_lt{'col3'}"; |
|
var txtsiz1 = "$js_lt{'siz1'}"; |
|
var txtsiz2 = "$js_lt{'siz2'}"; |
|
var txtsiz3 = "$js_lt{'siz3'}"; |
|
var txtsty1 = "$js_lt{'sty1'}"; |
|
var txtsty2 = "$js_lt{'sty2'}"; |
|
var txtsty3 = "$js_lt{'sty3'}"; |
|
if (kwclr=="red") {var redsel="checked='checked'"}; |
|
if (kwclr=="green") {var grnsel="checked='checked'"}; |
|
if (kwclr=="blue") {var blusel="checked='checked'"}; |
var sznsel = ""; |
var sznsel = ""; |
var sz1sel = ""; |
var sz1sel = ""; |
var sz2sel = ""; |
var sz2sel = ""; |
if (kwsize=="0") {var sznsel="checked"}; |
if (kwsize=="0") {var sznsel="checked='checked'"}; |
if (kwsize=="+1") {var sz1sel="checked"}; |
if (kwsize=="+1") {var sz1sel="checked='checked'"}; |
if (kwsize=="+2") {var sz2sel="checked"}; |
if (kwsize=="+2") {var sz2sel="checked='checked'"}; |
var synsel = ""; |
var synsel = ""; |
var syisel = ""; |
var syisel = ""; |
var sybsel = ""; |
var sybsel = ""; |
if (kwstyle=="") {var synsel="checked"}; |
if (kwstyle=="") {var synsel="checked='checked'"}; |
if (kwstyle=="<i>") {var syisel="checked"}; |
if (kwstyle=="<i>") {var syisel="checked='checked'"}; |
if (kwstyle=="<b>") {var sybsel="checked"}; |
if (kwstyle=="<b>") {var sybsel="checked='checked'"}; |
highlightCentral(); |
highlightCentral(); |
highlightbody('red','red',redsel,'0','normal',sznsel,'','normal',synsel); |
highlightbody('red',txtcol1,redsel,'0',txtsiz1,sznsel,'',txtsty1,synsel); |
highlightbody('green','green',grnsel,'+1','+1',sz1sel,'<i>','italic',syisel); |
highlightbody('green',txtcol2,grnsel,'+1',txtsiz2,sz1sel,'<i>',txtsty2,syisel); |
highlightbody('blue','blue',blusel,'+2','+2',sz2sel,'<b>','bold',sybsel); |
highlightbody('blue',txtcol3,blusel,'+2',txtsiz3,sz2sel,'<b>',txtsty3,sybsel); |
highlightend(); |
highlightend(); |
return; |
return; |
} |
} |
Line 1720 INNERJS
|
Line 1760 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\\"> $lt{'kehi'}<\\/span><\\/h3><br /><br />"); |
hDoc.write("<h1>$html_js_lt{'kehi'}<\\/h1>"); |
|
|
hDoc.write('<table border="0" width="100%"><tr><td bgcolor="#777777">'); |
hDoc.write('<table border="0" width="100%"><tr style="background-color:#A1D676">'); |
hDoc.write('<table border="0" width="100%"><tr bgcolor="#DDFFFF">'); |
hDoc.write("<th>$html_js_lt{'txtc'}<\\/th><th>$html_js_lt{'font'}<\\/th><th>$html_js_lt{'fnst'}<\\/th><\\/tr>"); |
hDoc.write("<td><b>$lt{'txtc'}<\\/b><\\/td><td><b>$lt{'font'}<\\/b><\\/td><td><b>$lt{'fnst'}<\\/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>"); |
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><br \\/>"); |
hDoc.write("<\\/td><\\/tr><\\/table> "); |
hDoc.write("<input type=\\"button\\" value=\\"$html_js_lt{'save'}\\" onclick=\\"javascript:updateChoice(1)\\" \\/> "); |
hDoc.write("<input type=\\"button\\" value=\\"$lt{'save'}\\" onclick=\\"javascript:updateChoice(1)\\"> "); |
hDoc.write("<input type=\\"button\\" value=\\"$html_js_lt{'canc'}\\" onclick=\\"self.close()\\" \\/><br /><br />"); |
hDoc.write("<input type=\\"button\\" value=\\"$lt{'canc'}\\" 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 1793 sub gradeBox {
|
Line 1831 sub gradeBox {
|
$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 $data_WGT='<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]); |
Line 1801 sub gradeBox {
|
Line 1839 sub gradeBox {
|
if ($last_resets{$partid}) { |
if ($last_resets{$partid}) { |
$aggtries = &get_num_tries($record,$last_resets{$partid},$partid); |
$aggtries = &get_num_tries($record,$last_resets{$partid},$partid); |
} |
} |
$result.=&Apache::loncommon::start_data_table_row(); |
my $result=&Apache::loncommon::start_data_table_row(); |
my $ctr = 0; |
my $ctr = 0; |
my $thisweight = 0; |
my $thisweight = 0; |
my $increment = &get_increment(); |
my $increment = &get_increment(); |
Line 1838 sub gradeBox {
|
Line 1876 sub gradeBox {
|
|
|
|
|
$result .= |
$result .= |
'<td>'.$display_part.'</td><td>'.$radio.'</td><td>'.&mt('or').'</td><td>'.$line.'</td>'; |
'<td>'.$data_WGT.$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().'<td colspan="6">'; |
$result.='<input type="hidden" name="stores'.$counter.'_'.$partid.'" value="" />'."\n". |
$result.='<input type="hidden" name="stores'.$counter.'_'.$partid.'" value="" />'."\n". |
'<input type="hidden" name="oldpts'.$counter.'_'.$partid.'" value="'.$score.'" />'."\n". |
'<input type="hidden" name="oldpts'.$counter.'_'.$partid.'" value="'.$score.'" />'."\n". |
'<input type="hidden" name="solved'.$counter.'_'.$partid.'" value="'. |
'<input type="hidden" name="solved'.$counter.'_'.$partid.'" value="'. |
Line 1850 sub gradeBox {
|
Line 1888 sub gradeBox {
|
$aggtries.'" />'."\n"; |
$aggtries.'" />'."\n"; |
my $res_error; |
my $res_error; |
$result.=&handback_box($symb,$uname,$udom,$counter,$partid,$record,\$res_error); |
$result.=&handback_box($symb,$uname,$udom,$counter,$partid,$record,\$res_error); |
|
$result.='</td>'.&Apache::loncommon::end_data_table_row(); |
if ($res_error) { |
if ($res_error) { |
return &navmap_errormsg(); |
return &navmap_errormsg(); |
} |
} |
Line 2016 sub submission {
|
Line 2055 sub submission {
|
$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 ($symb) = &get_symb($request); |
if ($symb eq '') { $request->print("Unable to handle ambiguous references:."); return ''; } |
if ($symb eq '') { $request->print("Unable to handle ambiguous references:."); return ''; } |
|
my ($essayurl,%coursedesc_by_cid); |
|
|
if (!&canview($usec)) { |
if (!&canview($usec)) { |
$request->print('<span class="LC_warning">Unable to view requested student.('. |
$request->print( |
$uname.':'.$udom.' in section '.$usec.' in course id '. |
'<span class="LC_warning">'. |
$env{'request.course.id'}.')</span>'); |
&mt('Unable to view requested student.'). |
|
' '.&mt('([_1] in section [_2] in course id [_3])', |
|
$uname.':'.$udom,$usec,$env{'request.course.id'}). |
|
'</span>'); |
$request->print(&show_grading_menu_form($symb)); |
$request->print(&show_grading_menu_form($symb)); |
return; |
return; |
} |
} |
Line 2043 sub submission {
|
Line 2086 sub submission {
|
&download_all_link($request, $symb); |
&download_all_link($request, $symb); |
} |
} |
$request->print('<h3> <span class="LC_info">'.&mt('Submission Record').'</span></h3>'."\n". |
$request->print('<h3> <span class="LC_info">'.&mt('Submission Record').'</span></h3>'."\n". |
'<h4> '.&mt('<b>Resource: </b> [_1]',$env{'form.probTitle'}).'</h4>'."\n"); |
'<h4> '.&mt('[_1]Resource: [_2]','<b>','</b>'.$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 2060 sub submission {
|
Line 2103 sub submission {
|
$request->print(&show_problem($request,$symb,$uname,$udom,0,1,$mode)); |
$request->print(&show_problem($request,$symb,$uname,$udom,0,1,$mode)); |
} |
} |
|
|
# kwclr is the only variable that is guaranteed to be non blank |
# kwclr is the only variable that is guaranteed not to be 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') { |
Line 2126 sub submission {
|
Line 2169 sub submission {
|
if ($env{'form.handgrade'} eq 'yes' && $env{'form.showgrading'} eq 'yes') { |
if ($env{'form.handgrade'} eq 'yes' && $env{'form.showgrading'} eq 'yes') { |
|
|
my %lt = &Apache::lonlocal::texthash( |
my %lt = &Apache::lonlocal::texthash( |
|
keyh => 'Keyword Highlighting for Essays', |
keyw => 'Keyword Options', |
keyw => 'Keyword Options', |
list => 'List', |
list => 'List', |
past => 'Paste Selection to List', |
past => 'Paste Selection to List', |
Line 2134 sub submission {
|
Line 2178 sub submission {
|
# |
# |
# Print out the keyword options line |
# Print out the keyword options line |
# |
# |
$request->print(<<KEYWORDS); |
$request->print( |
<b>$lt{'keyw'}:</b> |
'<div class="LC_columnSection">' |
<a href="javascript:keywords(document.SCORE);" target="_self">$lt{'list'}</a> |
.'<fieldset><legend>'.$lt{'keyh'}.'</legend>' |
<a href="#" onmousedown="javascript:getSel(); return false" |
.&Apache::lonhtmlcommon::funclist_from_array( |
CLASS="page">$lt{'past'}</a> |
['<a href="javascript:keywords(document.SCORE);" target="_self">'.$lt{'list'}.'</a>', |
<a href="javascript:kwhighlight();" target="_self">$lt{'high'}</a><br /><br /> |
'<a href="#" onmousedown="javascript:getSel(); return false" |
KEYWORDS |
class="page">'.$lt{'past'}.'</a>', |
|
'<a href="javascript:kwhighlight();" target="_self">'.$lt{'high'}.'</a>'], |
|
{legend => $lt{'keyw'}}) |
|
.'</fieldset></div>' |
|
); |
|
|
# |
# |
# Load the other essays for similarity check |
# Load the other essays for similarity check |
# |
# |
my (undef,undef,$essayurl) = &Apache::lonnet::decode_symb($symb); |
(undef,undef,$essayurl) = &Apache::lonnet::decode_symb($symb); |
my ($adom,$aname,$apath)=($essayurl=~/^($LONCAPA::domain_re)\/($LONCAPA::username_re)\/(.*)$/); |
if ($essayurl eq 'lib/templates/simpleproblem.problem') { |
$apath=&escape($apath); |
my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
$apath=~s/\W/\_/gs; |
my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'}; |
&init_old_essays($symb,$apath,$adom,$aname); |
if ($cdom ne '' && $cnum ne '') { |
|
my ($map,$id,$res) = &Apache::lonnet::decode_symb($symb); |
|
if ($map =~ m{^\Quploaded/$cdom/$cnum/\E(default(?:|_\d+)\.(?:sequence|page))$}) { |
|
my $apath = $1.'_'.$id; |
|
$apath=~s/\W/\_/gs; |
|
&init_old_essays($symb,$apath,$cdom,$cnum); |
|
} |
|
} |
|
} else { |
|
my ($adom,$aname,$apath)=($essayurl=~/^($LONCAPA::domain_re)\/($LONCAPA::username_re)\/(.*)$/); |
|
$apath=&escape($apath); |
|
$apath=~s/\W/\_/gs; |
|
&init_old_essays($symb,$apath,$adom,$aname); |
|
} |
} |
} |
} |
} |
|
|
Line 2165 KEYWORDS
|
Line 2227 KEYWORDS
|
if ($perm{'vgr'}) { |
if ($perm{'vgr'}) { |
$request->print( |
$request->print( |
&Apache::loncommon::track_student_link( |
&Apache::loncommon::track_student_link( |
&mt('View recent activity'), |
'View recent activity', |
$uname,$udom,'check') |
$uname,$udom,'check') |
.' ' |
.' ' |
); |
); |
Line 2229 KEYWORDS
|
Line 2291 KEYWORDS
|
# (for multi-response type part) |
# (for multi-response type part) |
# (3) Last submission plus the parts info |
# (3) Last submission plus the parts info |
# (4) The whole record for this student |
# (4) The whole record for this student |
if ($env{'form.lastSub'} =~ /^(lastonly|hdgrade)$/) { |
|
my ($string,$timestamp)= &get_last_submission(\%record); |
my ($string,$timestamp)= &get_last_submission(\%record); |
|
|
my $lastsubonly; |
my $lastsubonly; |
Line 2252 KEYWORDS
|
Line 2314 KEYWORDS
|
if ($env{"form.$uname:$udom:$partid:submitted_by"}) { |
if ($env{"form.$uname:$udom:$partid:submitted_by"}) { |
if (exists($seenparts{$partid})) { next; } |
if (exists($seenparts{$partid})) { next; } |
$seenparts{$partid}=1; |
$seenparts{$partid}=1; |
my $submitby='<b>Part:</b> '.$display_part. |
$request->print( |
' <b>Collaborative submission by:</b> '. |
'<b>'.&mt('Part: [_1]',$display_part).'</b>'. |
'<a href="javascript:viewSubmitter(\''. |
' <b>'.&mt('Collaborative submission by: [_1]', |
$env{"form.$uname:$udom:$partid:submitted_by"}. |
'<a href="javascript:viewSubmitter(\''. |
'\');" target="_self">'. |
$env{"form.$uname:$udom:$partid:submitted_by"}. |
$$fullname{$env{"form.$uname:$udom:$partid:submitted_by"}}.'</a><br />'; |
'\');" target="_self">'. |
$request->print($submitby); |
$$fullname{$env{"form.$uname:$udom:$partid:submitted_by"}}.'</a>'). |
|
'<br />'); |
next; |
next; |
} |
} |
my $responsetype = $responseType->{$partid}->{$respid}; |
my $responsetype = $responseType->{$partid}->{$respid}; |
Line 2274 KEYWORDS
|
Line 2337 KEYWORDS
|
foreach my $submission (@$string) { |
foreach my $submission (@$string) { |
my ($partid,$respid) = ($submission =~ /^resource\.([^\.]*)\.([^\.]*)\.submission/); |
my ($partid,$respid) = ($submission =~ /^resource\.([^\.]*)\.([^\.]*)\.submission/); |
if (join('_',@{$part}) ne ($partid.'_'.$respid)) { next; } |
if (join('_',@{$part}) ne ($partid.'_'.$respid)) { next; } |
my ($ressub,$hide,$subval) = split(/:/,$submission,3); |
my ($ressub,$hide,$draft,$subval) = split(/:/,$submission,4); |
# Similarity check |
# Similarity check |
my $similar=''; |
my $similar=''; |
my ($type,$trial,$rndseed); |
my ($type,$trial,$rndseed); |
Line 2283 KEYWORDS
|
Line 2346 KEYWORDS
|
$trial = $record{"resource.$partid.tries"}; |
$trial = $record{"resource.$partid.tries"}; |
$rndseed = $record{"resource.$partid.rndseed"}; |
$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,$symb,$subval); |
&most_similar($uname,$udom,$symb,$subval); |
if ($osim) { |
if ($osim) { |
$osim=int($osim*100.0); |
$osim=int($osim*100.0); |
my %old_course_desc = |
|
&Apache::lonnet::coursedescription($ocrsid, |
|
{'one_time' => 1}); |
|
|
|
if ($hide eq 'anon') { |
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 { |
$similar="<hr /><h3><span class=\"LC_warning\">". |
$similar='<hr />'; |
&mt('Essay is [_1]% similar to an essay by [_2] in course [_3] (course id [_4]:[_5])', |
if ($essayurl eq 'lib/templates/simpleproblem.problem') { |
$osim, |
$similar .= '<h3><span class="LC_warning">'. |
&Apache::loncommon::plainname($oname,$odom).' ('.$oname.':'.$odom.')', |
&mt('Essay is [_1]% similar to an essay by [_2]', |
$old_course_desc{'description'}, |
$osim, |
$old_course_desc{'num'}, |
&Apache::loncommon::plainname($oname,$odom).' ('.$oname.':'.$odom.')'). |
$old_course_desc{'domain'}). |
'</span></h3>'; |
'</span></h3><blockquote><i>'. |
} elsif ($ocrsid ne '') { |
&keywords_highlight($oessay). |
my %old_course_desc; |
'</i></blockquote><hr />'; |
if (ref($coursedesc_by_cid{$ocrsid}) eq 'HASH') { |
} |
%old_course_desc = %{$coursedesc_by_cid{$ocrsid}}; |
} |
} else { |
} |
my $args; |
|
if ($ocrsid ne $env{'request.course.id'}) { |
|
$args = {'one_time' => 1}; |
|
} |
|
%old_course_desc = |
|
&Apache::lonnet::coursedescription($ocrsid,$args); |
|
$coursedesc_by_cid{$ocrsid} = \%old_course_desc; |
|
} |
|
$similar .= |
|
&mt('Essay is [_1]% similar to an essay by [_2] in course [_3] (course id [_4]:[_5])', |
|
$osim, |
|
&Apache::loncommon::plainname($oname,$odom).' ('.$oname.':'.$odom.')', |
|
$old_course_desc{'description'}, |
|
$old_course_desc{'num'}, |
|
$old_course_desc{'domain'}). |
|
'</span></h3>'; |
|
} else { |
|
$similar .= |
|
'<h3><span class="LC_warning">'. |
|
&mt('Essay is [_1]% similar to an essay by [_2] in an unknown course', |
|
$osim, |
|
&Apache::loncommon::plainname($oname,$odom).' ('.$oname.':'.$odom.')'). |
|
'</span></h3>'; |
|
} |
|
$similar .= '<blockquote><i>'. |
|
&keywords_highlight($oessay). |
|
'</i></blockquote><hr />'; |
|
} |
|
} |
|
} |
my $order=&get_order($partid,$respid,$symb,$uname,$udom, |
my $order=&get_order($partid,$respid,$symb,$uname,$udom, |
undef,$type,$trial,$rndseed); |
undef,$type,$trial,$rndseed); |
if ($env{'form.lastSub'} eq 'lastonly' || |
if ($env{'form.lastSub'} eq 'lastonly' || $env{'form.lastSub'} eq 'datesub' || $env{'form.lastSub'} =~ /^(last|all)$/ || ($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.='<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>'. |
Line 2325 KEYWORDS
|
Line 2412 KEYWORDS
|
if ($hide eq 'anon') { |
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 /><br />'.'<b>'.&mt('Submitted Files:').'</b>' |
|
.'<br /><span class="LC_warning">'; |
|
if(@$files == 1) { |
|
$lastsubonly .= &mt('Like all files provided by users, this file may contain viruses!'); |
|
} else { |
|
$lastsubonly .= &mt('Like all files provided by users, these files may contain viruses!'); |
|
} |
|
$lastsubonly .= '</span>'; |
|
|
foreach my $file (@$files) { |
foreach my $file (@$files) { |
&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" alt="" /> '.$file.'</a>'; |
} |
} |
} |
} |
$lastsubonly.='<br />'; |
$lastsubonly.='<br />'; |
} |
} |
if ($hide eq 'anon') { |
if ($hide eq 'anon') { |
$lastsubonly.='<b>'.&mt('Anonymous Survey').'</b>'; |
$lastsubonly.='<br /><b>'.&mt('Anonymous Survey').'</b>'; |
} else { |
} else { |
$lastsubonly.='<b>'.&mt('Submitted Answer:').' </b>'. |
$lastsubonly.='<br /><b>'.&mt('Submitted Answer:').' </b>'; |
|
if ($draft) { |
|
$lastsubonly.= ' <span class="LC_warning">'.&mt('Draft Copy').'</span>'; |
|
} |
|
$subval = |
&cleanRecord($subval,$responsetype,$symb,$partid, |
&cleanRecord($subval,$responsetype,$symb,$partid, |
$respid,\%record,$order,undef,$uname,$udom,$type,$trial,$rndseed); |
$respid,\%record,$order,undef,$uname,$udom,$type,$trial,$rndseed); |
|
if ($responsetype eq 'essay') { |
|
$subval =~ s{\n}{<br />}g; |
|
} |
|
$lastsubonly.=$subval."\n"; |
} |
} |
if ($similar) {$lastsubonly.="<br /><br />$similar\n";} |
if ($similar) {$lastsubonly.="<br /><br />$similar\n";} |
$lastsubonly.='</div>'; |
$lastsubonly.='</div>'; |
Line 2348 KEYWORDS
|
Line 2451 KEYWORDS
|
$lastsubonly.='</div>'."\n"; # End: LC_grade_submissions_body |
$lastsubonly.='</div>'."\n"; # End: LC_grade_submissions_body |
} |
} |
$request->print($lastsubonly); |
$request->print($lastsubonly); |
} elsif ($env{'form.lastSub'} eq 'datesub') { |
if ($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)$/) { |
} |
|
if ($env{'form.lastSub'} =~ /^(last|all)$/) { |
|
my $identifier = (&canmodify($usec)? $counter : ''); |
$request->print(&Apache::loncommon::get_previous_attempt($symb,$uname,$udom, |
$request->print(&Apache::loncommon::get_previous_attempt($symb,$uname,$udom, |
$env{'request.course.id'}, |
$env{'request.course.id'}, |
$last,'.submission', |
$last,'.submission', |
'Apache::grades::keywords_highlight')); |
'Apache::grades::keywords_highlight', |
|
$usec,$identifier)); |
} |
} |
|
|
$request->print('<input type="hidden" name="unamedom'.$counter.'" value="'.$uname.':' |
$request->print('<input type="hidden" name="unamedom'.$counter.'" value="'.$uname.':' |
Line 2393 KEYWORDS
|
Line 2499 KEYWORDS
|
'<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"; |
Line 2583 sub get_last_submission {
|
Line 2689 sub get_last_submission {
|
} |
} |
unless ($hide) { |
unless ($hide) { |
if (@randomize) { |
if (@randomize) { |
foreach my $id (@hidden) { |
foreach my $id (@randomize) { |
if ($key =~ /^\Q$id\E/) { |
if ($key =~ /^\Q$id\E/) { |
$hide = 'rand'; |
$hide = 'rand'; |
last; |
last; |
Line 2592 sub get_last_submission {
|
Line 2698 sub get_last_submission {
|
} |
} |
} |
} |
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' ? 1: 0; |
'<span class="LC_warning">Draft Copy</span> ' : ''; |
push(@string, join(':', $key, $hide, $draft, ( |
push(@string, join(':', $key, $hide, $draft.$lasthash{$key})); |
ref($lasthash{$key}) eq 'ARRAY' ? |
|
join(',', @{$lasthash{$key}}) : $lasthash{$key}) )); |
} |
} |
} |
} |
if (!@string) { |
if (!@string) { |
Line 2622 sub keywords_highlight {
|
Line 2729 sub keywords_highlight {
|
sub show_previous_task_version { |
sub show_previous_task_version { |
my ($request,$symb) = @_; |
my ($request,$symb) = @_; |
if ($symb eq '') { |
if ($symb eq '') { |
$request->print("Unable to handle ambiguous references."); |
$request->print( |
|
'<span class="LC_error">'. |
|
&mt('Unable to handle ambiguous references.'). |
|
'</span>'); |
return ''; |
return ''; |
} |
} |
my ($uname,$udom) = ($env{'form.student'},$env{'form.userdom'}); |
my ($uname,$udom) = ($env{'form.student'},$env{'form.userdom'}); |
my $usec = &Apache::lonnet::getsection($udom,$uname,$env{'request.course.id'}); |
my $usec = &Apache::lonnet::getsection($udom,$uname,$env{'request.course.id'}); |
if (!&canview($usec)) { |
if (!&canview($usec)) { |
$request->print('<span class="LC_warning">Unable to view previous version for requested student.('. |
$request->print('<span class="LC_warning">'. |
$uname.':'.$udom.' in section '.$usec.' in course id '. |
&mt('Unable to view previous version for requested student.'). |
$env{'request.course.id'}.')</span>'); |
' '.&mt('([_1] in section [_2] in course id [_3])', |
|
$uname.':'.$udom,$usec,$env{'request.course.id'}). |
|
'</span>'); |
return; |
return; |
} |
} |
my $mode = 'both'; |
my $mode = 'both'; |
Line 2809 sub processHandGrade {
|
Line 2920 sub processHandGrade {
|
my $ctr = 0; |
my $ctr = 0; |
while ($ctr < $ngrade) { |
while ($ctr < $ngrade) { |
my ($uname,$udom) = split(/:/,$env{'form.unamedom'.$ctr}); |
my ($uname,$udom) = split(/:/,$env{'form.unamedom'.$ctr}); |
my ($errorflag,$pts,$wgt) = &saveHandGrade($request,$symb,$uname,$udom,$ctr); |
my ($errorflag,$pts,$wgt,$numhidden) = |
|
&saveHandGrade($request,$symb,$uname,$udom,$ctr); |
if ($errorflag eq 'no_score') { |
if ($errorflag eq 'no_score') { |
$ctr++; |
$ctr++; |
next; |
next; |
} |
} |
if ($errorflag eq 'not_allowed') { |
if ($errorflag eq 'not_allowed') { |
$request->print("<span class=\"LC_warning\">Not allowed to modify grades for $uname:$udom</span>"); |
$request->print( |
|
'<span class="LC_error">' |
|
.&mt('Not allowed to modify grades for [_1]',"$uname:$udom") |
|
.'</span>'); |
$ctr++; |
$ctr++; |
next; |
next; |
} |
} |
|
if ($numhidden) { |
|
$request->print( |
|
'<span class="LC_info">' |
|
.&mt('For [_1]: [quant,_2,transaction] hidden',"$uname:$udom",$numhidden) |
|
.'</span><br />'); |
|
} |
my $includemsg = $env{'form.includemsg'.$ctr}; |
my $includemsg = $env{'form.includemsg'.$ctr}; |
my ($subject,$message,$msgstatus) = ('','',''); |
my ($subject,$message,$msgstatus) = ('','',''); |
my $restitle = &Apache::lonnet::gettitle($symb); |
my $restitle = &Apache::lonnet::gettitle($symb); |
Line 3050 sub saveHandGrade {
|
Line 3171 sub saveHandGrade {
|
my %record = &Apache::lonnet::restore($symb,$env{'request.course.id'},$domain,$stuname); |
my %record = &Apache::lonnet::restore($symb,$env{'request.course.id'},$domain,$stuname); |
my @parts_graded; |
my @parts_graded; |
my %newrecord = (); |
my %newrecord = (); |
my ($pts,$wgt) = ('',''); |
my ($pts,$wgt,$totchg) = ('','',0); |
my %aggregate = (); |
my %aggregate = (); |
my $aggregateflag = 0; |
my $aggregateflag = 0; |
|
if ($env{'form.HIDE'.$newflg}) { |
|
my ($version,$parts) = split(/:/,$env{'form.HIDE'.$newflg},2); |
|
my $numchgs = &makehidden($version,$parts,\%record,$symb,$domain,$stuname,1); |
|
$totchg += $numchgs; |
|
} |
my @parts = split(/:/,$env{'form.partlist'.$newflg}); |
my @parts = split(/:/,$env{'form.partlist'.$newflg}); |
foreach my $new_part (@parts) { |
foreach my $new_part (@parts) { |
#collaborator ($submi may vary for different parts |
#collaborator ($submi may vary for different parts |
Line 3155 sub saveHandGrade {
|
Line 3281 sub saveHandGrade {
|
&Apache::lonnet::cinc('nohist_resourcetracker',\%aggregate, |
&Apache::lonnet::cinc('nohist_resourcetracker',\%aggregate, |
$cdom,$cnum); |
$cdom,$cnum); |
} |
} |
return ('',$pts,$wgt); |
return ('',$pts,$wgt,$totchg); |
|
} |
|
|
|
sub makehidden { |
|
my ($version,$parts,$record,$symb,$domain,$stuname,$tolog) = @_; |
|
return unless (ref($record) eq 'HASH'); |
|
my %modified; |
|
my $numchanged = 0; |
|
if (exists($record->{$version.':keys'})) { |
|
my $partsregexp = $parts; |
|
$partsregexp =~ s/,/|/g; |
|
foreach my $key (split(/\:/,$record->{$version.':keys'})) { |
|
if ($key =~ /^resource\.(?:$partsregexp)\.([^\.]+)$/) { |
|
my $item = $1; |
|
unless (($item eq 'solved') || ($item =~ /^award(|msg|ed)$/)) { |
|
$modified{$key} = $record->{$version.':'.$key}; |
|
} |
|
} elsif ($key =~ m{^(resource\.(?:$partsregexp)\.[^\.]+\.)(.+)$}) { |
|
$modified{$1.'hidden'.$2} = $record->{$version.':'.$key}; |
|
} elsif ($key =~ /^(ip|timestamp|host)$/) { |
|
$modified{$key} = $record->{$version.':'.$key}; |
|
} |
|
} |
|
if (keys(%modified)) { |
|
if (&Apache::lonnet::putstore($env{'request.course.id'},$symb,$version,\%modified, |
|
$domain,$stuname,$tolog) eq 'ok') { |
|
$numchanged ++; |
|
} |
|
} |
|
} |
|
return $numchanged; |
} |
} |
|
|
sub check_and_remove_from_queue { |
sub check_and_remove_from_queue { |
Line 3452 sub viewgrades_js {
|
Line 3608 sub viewgrades_js {
|
my ($request) = shift; |
my ($request) = shift; |
|
|
my $alertmsg = &mt('A number equal or greater than 0 is expected. Entered value = '); |
my $alertmsg = &mt('A number equal or greater than 0 is expected. Entered value = '); |
|
&js_escape(\$alertmsg); |
$request->print(<<VIEWJAVASCRIPT); |
$request->print(<<VIEWJAVASCRIPT); |
<script type="text/javascript" language="javascript"> |
<script type="text/javascript" language="javascript"> |
function writePoint(partid,weight,point) { |
function writePoint(partid,weight,point) { |
Line 3632 sub viewgrades {
|
Line 3789 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"; |
$result.='<h4><b>'.&mt('Current Resource').':</b> '.$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 3647 sub viewgrades {
|
Line 3804 sub viewgrades {
|
'<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"; |
'<input type="hidden" name="probTitle" value="'.$env{'form.probTitle'}.'" />'."\n"; |
|
|
my ($common_header,$specific_header); |
#retrieve selected groups |
if ($env{'form.section'} eq 'all') { |
my (@groups,$group_display); |
$common_header = &mt('Assign Common Grade to Class'); |
@groups = &Apache::loncommon::get_env_multiple('form.group'); |
$specific_header = &mt('Assign Grade to Specific Students in Class'); |
if (grep(/^all$/,@groups)) { |
} elsif ($env{'form.section'} eq 'none') { |
@groups = ('all'); |
$common_header = &mt('Assign Common Grade to Students in no Section'); |
} elsif (grep(/^none$/,@groups)) { |
$specific_header = &mt('Assign Grade to Specific Students in no Section'); |
@groups = ('none'); |
} else { |
} elsif (@groups > 0) { |
my $section_display = join (", ",&Apache::loncommon::get_env_multiple('form.section')); |
$group_display = join(', ',@groups); |
$common_header = &mt('Assign Common Grade to Students in Section(s) [_1]',$section_display); |
} |
$specific_header = &mt('Assign Grade to Specific Students in Section(s) [_1]',$section_display); |
|
|
my ($common_header,$specific_header,@sections,$section_display); |
|
@sections = &Apache::loncommon::get_env_multiple('form.section'); |
|
if (grep(/^all$/,@sections)) { |
|
@sections = ('all'); |
|
if ($group_display) { |
|
$common_header = &mt('Assign Common Grade to Students in Group(s) [_1]',$group_display); |
|
$specific_header = &mt('Assign Grade to Specific Students in Group(s) [_1]',$group_display); |
|
} elsif (grep(/^none$/,@groups)) { |
|
$common_header = &mt('Assign Common Grade to Students not assigned to any groups'); |
|
$specific_header = &mt('Assign Grade to Specific Students not assigned to any groups'); |
|
} else { |
|
$common_header = &mt('Assign Common Grade to Class'); |
|
$specific_header = &mt('Assign Grade to Specific Students in Class'); |
|
} |
|
} elsif (grep(/^none$/,@sections)) { |
|
@sections = ('none'); |
|
if ($group_display) { |
|
$common_header = &mt('Assign Common Grade to Students in no Section and in Group(s) [_1]',$group_display); |
|
$specific_header = &mt('Assign Grade to Specific Students in no Section and in Group(s)',$group_display); |
|
} elsif (grep(/^none$/,@groups)) { |
|
$common_header = &mt('Assign Common Grade to Students in no Section and in no Group'); |
|
$specific_header = &mt('Assign Grade to Specific Students in no Section and in no Group'); |
|
} else { |
|
$common_header = &mt('Assign Common Grade to Students in no Section'); |
|
$specific_header = &mt('Assign Grade to Specific Students in no Section'); |
|
} |
|
} else { |
|
$section_display = join (", ",@sections); |
|
if ($group_display) { |
|
$common_header = &mt('Assign Common Grade to Students in Section(s) [_1], and in Group(s) [_2]', |
|
$section_display,$group_display); |
|
$specific_header = &mt('Assign Grade to Specific Students in Section(s) [_1], and in Group(s) [_2]', |
|
$section_display,$group_display); |
|
} elsif (grep(/^none$/,@groups)) { |
|
$common_header = &mt('Assign Common Grade to Students in Section(s) [_1] and no Group',$section_display); |
|
$specific_header = &mt('Assign Grade to Specific Students in Section(s) [_1] and no Group',$section_display); |
|
} else { |
|
$common_header = &mt('Assign Common Grade to Students in Section(s) [_1]',$section_display); |
|
$specific_header = &mt('Assign Grade to Specific Students in Section(s) [_1]',$section_display); |
|
} |
|
} |
|
my %submit_types = &substatus_options(); |
|
my $submission_status = $submit_types{$env{'form.submitonly'}}; |
|
|
|
if ($env{'form.submitonly'} eq 'all') { |
|
$result.= '<h3>'.$common_header.'</h3>'; |
|
} else { |
|
$result.= '<h3>'.$common_header.' '.&mt('(submission status: "[_1]")',$submission_status).'</h3>'; |
} |
} |
$result.= '<h3>'.$common_header.'</h3>'.&Apache::loncommon::start_data_table(); |
$result .= &Apache::loncommon::start_data_table(); |
#radio buttons/text box for assigning points for a section or class. |
#radio buttons/text box for assigning points for a section or class. |
#handles different parts of a problem |
#handles different parts of a problem |
my $res_error; |
my $res_error; |
Line 3695 sub viewgrades {
|
Line 3900 sub viewgrades {
|
$partid.'" size="4" '.'onchange="javascript:writePoint(\''. |
$partid.'" size="4" '.'onchange="javascript:writePoint(\''. |
$partid.'\','.$weight{$partid}.',\'textval\')" /> /'. |
$partid.'\','.$weight{$partid}.',\'textval\')" /> /'. |
$weight{$partid}.' '.&mt('(problem weight)').'</td>'."\n"; |
$weight{$partid}.' '.&mt('(problem weight)').'</td>'."\n"; |
$line.= '<td><b>'.&mt('Grade Status').':</b><select name="SELVAL_'.$partid.'"'. |
$line.= '<td><b>'.&mt('Grade Status').':</b>'. |
'onchange="javascript:writeRadText(\''.$partid.'\','. |
'<select name="SELVAL_'.$partid.'" '. |
|
'onchange="javascript:writeRadText(\''.$partid.'\','. |
$weight{$partid}.')"> '. |
$weight{$partid}.')"> '. |
'<option selected="selected"> </option>'. |
'<option selected="selected"> </option>'. |
'<option value="excused">'.&mt('excused').'</option>'. |
'<option value="excused">'.&mt('excused').'</option>'. |
Line 3721 sub viewgrades {
|
Line 3927 sub viewgrades {
|
|
|
#table listing all the students in a section/class |
#table listing all the students in a section/class |
#header of table |
#header of table |
$result.= '<h3>'.$specific_header.'</h3>'. |
if ($env{'form.submitonly'} eq 'all') { |
&Apache::loncommon::start_data_table(). |
$result.= '<h3>'.$specific_header.'</h3>'; |
|
} else { |
|
$result.= '<h3>'.$specific_header.' '.&mt('(submission status: "[_1]")',$submission_status).'</h3>'; |
|
} |
|
$result.= &Apache::loncommon::start_data_table(). |
&Apache::loncommon::start_data_table_header_row(). |
&Apache::loncommon::start_data_table_header_row(). |
'<th>'.&mt('No.').'</th>'. |
'<th>'.&mt('No.').'</th>'. |
'<th>'.&nameUserString('header')."</th>\n"; |
'<th>'.&nameUserString('header')."</th>\n"; |
Line 3743 sub viewgrades {
|
Line 3953 sub viewgrades {
|
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>'. |
&mt('Score Part: [_1]<br /> (weight = [_2])', |
&mt('Score Part: [_1][_2](weight = [_3])', |
$display_part,$weight{$partid}).'</th>'."\n"; |
$display_part,'<br />',$weight{$partid}).'</th>'."\n"; |
next; |
next; |
|
|
} else { |
} else { |
Line 3765 sub viewgrades {
|
Line 3975 sub viewgrades {
|
|
|
#get info for each student |
#get info for each student |
#list all the students - with points and grade status |
#list all the students - with points and grade status |
my (undef,undef,$fullname) = &getclasslist($env{'form.section'},'1'); |
my (undef,undef,$fullname) = &getclasslist(\@sections,'1',\@groups); |
my $ctr = 0; |
my $ctr = 0; |
foreach (sort |
foreach (sort |
{ |
{ |
Line 3774 sub viewgrades {
|
Line 3984 sub viewgrades {
|
} |
} |
return $a cmp $b; |
return $a cmp $b; |
} (keys(%$fullname))) { |
} (keys(%$fullname))) { |
$ctr++; |
|
$result.=&viewstudentgrade($symb,$env{'request.course.id'}, |
$result.=&viewstudentgrade($symb,$env{'request.course.id'}, |
$_,$$fullname{$_},\@parts,\%weight,$ctr,\%last_resets); |
$_,$$fullname{$_},\@parts,\%weight,\$ctr,\%last_resets); |
} |
} |
$result.=&Apache::loncommon::end_data_table(); |
$result.=&Apache::loncommon::end_data_table(); |
$result.='<input type="hidden" name="total" value="'.$ctr.'" />'."\n"; |
$result.='<input type="hidden" name="total" value="'.$ctr.'" />'."\n"; |
$result.='<input type="button" value="'.&mt('Save').'" '. |
$result.='<input type="button" value="'.&mt('Save').'" '. |
'onclick="javascript:submit();" target="_self" /></form>'."\n"; |
'onclick="javascript:submit();" target="_self" /></form>'."\n"; |
if (scalar(%$fullname) eq 0) { |
if ($ctr == 0) { |
my $colspan=3+scalar(@parts); |
|
my $section_display = join (", ",&Apache::loncommon::get_env_multiple('form.section')); |
|
my $stu_status = join(' or ',&Apache::loncommon::get_env_multiple('form.Status')); |
my $stu_status = join(' or ',&Apache::loncommon::get_env_multiple('form.Status')); |
$result='<span class="LC_warning">'. |
$result='<h3><span class="LC_info">'.&mt('Manual Grading').'</span></h3>'. |
&mt('There are no students in section(s) [_1] with enrollment status [_2] to modify or grade.', |
'<span class="LC_warning">'; |
$section_display, $stu_status). |
if ($env{'form.submitonly'} eq 'all') { |
'</span>'; |
if (grep(/^all$/,@sections)) { |
|
if (grep(/^all$/,@groups)) { |
|
$result .= &mt('There are no students with enrollment status [_1] to modify or grade.', |
|
$stu_status); |
|
} elsif (grep(/^none$/,@groups)) { |
|
$result .= &mt('There are no students with no group assigned and with enrollment status [_1] to modify or grade.', |
|
$stu_status); |
|
} else { |
|
$result .= &mt('There are no students in group(s) [_1] with enrollment status [_2] to modify or grade.', |
|
$group_display,$stu_status); |
|
} |
|
} elsif (grep(/^none$/,@sections)) { |
|
if (grep(/^all$/,@groups)) { |
|
$result .= &mt('There are no students in no section with enrollment status [_1] to modify or grade.', |
|
$stu_status); |
|
} elsif (grep(/^none$/,@groups)) { |
|
$result .= &mt('There are no students in no section and no group with enrollment status [_1] to modify or grade.', |
|
$stu_status); |
|
} else { |
|
$result .= &mt('There are no students in no section in group(s) [_1] with enrollment status [_2] to modify or grade.', |
|
$group_display,$stu_status); |
|
} |
|
} else { |
|
if (grep(/^all$/,@groups)) { |
|
$result .= &mt('There are no students in section(s) [_1] with enrollment status [_2] to modify or grade.', |
|
$section_display,$stu_status); |
|
} elsif (grep(/^none$/,@groups)) { |
|
$result .= &mt('There are no students in section(s) [_1] and no group with enrollment status [_2] to modify or grade.', |
|
$section_display,$stu_status); |
|
} else { |
|
$result .= &mt('There are no students in section(s) [_1] and group(s) [_2] with enrollment status [_3] to modify or grade.', |
|
$section_display,$group_display,$stu_status); |
|
} |
|
} |
|
} else { |
|
if (grep(/^all$/,@sections)) { |
|
if (grep(/^all$/,@groups)) { |
|
$result .= &mt('There are no students with enrollment status [_1] and submission status "[_2]" to modify or grade.', |
|
$stu_status,$submission_status); |
|
} elsif (grep(/^none$/,@groups)) { |
|
$result .= &mt('There are no students with no group assigned with enrollment status [_1] and submission status "[_2]" to modify or grade.', |
|
$stu_status,$submission_status); |
|
} else { |
|
$result .= &mt('There are no students in group(s) [_1] with enrollment status [_2] and submission status "[_3]" to modify or grade.', |
|
$group_display,$stu_status,$submission_status); |
|
} |
|
} elsif (grep(/^none$/,@sections)) { |
|
if (grep(/^all$/,@groups)) { |
|
$result .= &mt('There are no students in no section with enrollment status [_1] and submission status "[_2]" to modify or grade.', |
|
$stu_status,$submission_status); |
|
} elsif (grep(/^none$/,@groups)) { |
|
$result .= &mt('There are no students in no section and no group with enrollment status [_1] and submission status "[_2]" to modify or grade.', |
|
$stu_status,$submission_status); |
|
} else { |
|
$result .= &mt('There are no students in no section in group(s) [_1] with enrollment status [_2] and submission status "[_3]" to modify or grade.', |
|
$group_display,$stu_status,$submission_status); |
|
} |
|
} else { |
|
if (grep(/^all$/,@groups)) { |
|
$result .= &mt('There are no students in section(s) [_1] with enrollment status [_2] and submission status "[_3]" to modify or grade.', |
|
$section_display,$stu_status,$submission_status); |
|
} elsif (grep(/^none$/,@groups)) { |
|
$result .= &mt('There are no students in section(s) [_1] and no group with enrollment status [_2] and submission status "[_3]" to modify or grade.', |
|
$section_display,$stu_status,$submission_status); |
|
} else { |
|
$result .= &mt('There are no students in section(s) [_1] and group(s) [_2] with enrollment status [_3] and submission status "[_4]" to modify or grade.', |
|
$section_display,$group_display,$stu_status,$submission_status); |
|
} |
|
} |
|
} |
|
$result .= '</span><br />'; |
} |
} |
$result.=&show_grading_menu_form($symb); |
$result.=&show_grading_menu_form($symb); |
return $result; |
return $result; |
} |
} |
|
|
#--- call by previous routine to display each student |
#--- call by previous routine to display each student who satisfies submission filter. |
sub viewstudentgrade { |
sub viewstudentgrade { |
my ($symb,$courseid,$student,$fullname,$parts,$weight,$ctr,$last_resets) = @_; |
my ($symb,$courseid,$student,$fullname,$parts,$weight,$ctr,$last_resets) = @_; |
my ($uname,$udom) = split(/:/,$student); |
my ($uname,$udom) = split(/:/,$student); |
my %record=&Apache::lonnet::restore($symb,$courseid,$udom,$uname); |
my %record=&Apache::lonnet::restore($symb,$courseid,$udom,$uname); |
my %aggregates = (); |
my $submitonly = $env{'form.submitonly'}; |
|
unless (($submitonly eq 'all') || ($submitonly eq 'queued')) { |
|
my %partstatus = (); |
|
if (ref($parts) eq 'ARRAY') { |
|
foreach my $apart (@{$parts}) { |
|
my ($part,$type) = &split_part_type($apart); |
|
my ($status,undef) = split(/_/,$record{"resource.$part.solved"},2); |
|
$status = 'nothing' if ($status eq ''); |
|
$partstatus{$part} = $status; |
|
my $subkey = "resource.$part.submitted_by"; |
|
$partstatus{$subkey} = $record{$subkey} if ($record{$subkey} ne ''); |
|
} |
|
my $submitted = 0; |
|
my $graded = 0; |
|
my $incorrect = 0; |
|
foreach my $key (keys(%partstatus)) { |
|
$submitted = 1 if ($partstatus{$key} ne 'nothing'); |
|
$graded = 1 if ($partstatus{$key} =~ /^ungraded/); |
|
$incorrect = 1 if ($partstatus{$key} =~ /^incorrect/); |
|
|
|
my $partid = (split(/\./,$key))[1]; |
|
if ($partstatus{'resource.'.$partid.'.'.$key.'.submitted_by'} ne '') { |
|
$submitted = 0; |
|
} |
|
} |
|
return if (!$submitted && ($submitonly eq 'yes' || |
|
$submitonly eq 'incorrect' || |
|
$submitonly eq 'graded')); |
|
return if (!$graded && ($submitonly eq 'graded')); |
|
return if (!$incorrect && $submitonly eq 'incorrect'); |
|
} |
|
} |
|
if ($submitonly eq 'queued') { |
|
my ($cdom,$cnum) = split(/_/,$courseid); |
|
my %queue_status = |
|
&Apache::bridgetask::get_student_status($symb,$cdom,$cnum, |
|
$udom,$uname); |
|
return if (!defined($queue_status{'gradingqueue'})); |
|
} |
|
$$ctr++; |
|
my %aggregates = (); |
my $result=&Apache::loncommon::start_data_table_row().'<td align="right">'. |
my $result=&Apache::loncommon::start_data_table_row().'<td align="right">'. |
'<input type="hidden" name="ctr'.($ctr-1).'" value="'.$student.'" />'. |
'<input type="hidden" name="ctr'.($$ctr-1).'" value="'.$student.'" />'. |
"\n".$ctr.' </td><td> '. |
"\n".$$ctr.' </td><td> '. |
'<a href="javascript:viewOneStudent(\''.$uname.'\',\''.$udom. |
'<a href="javascript:viewOneStudent(\''.$uname.'\',\''.$udom. |
'\');" target="_self">'.$fullname.'</a> '. |
'\');" target="_self">'.$fullname.'</a> '. |
'<span class="LC_internal_info">('.$uname.($env{'user.domain'} eq $udom ? '' : ':'.$udom).')</span></td>'."\n"; |
'<span class="LC_internal_info">('.$uname.($env{'user.domain'} eq $udom ? '' : ':'.$udom).')</span></td>'."\n"; |
Line 3868 sub editgrades {
|
Line 4185 sub editgrades {
|
my ($symb)=&get_symb($request); |
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><b>'.&mt('Current Resource').':</b> '.$env{'form.probTitle'}.'</h4>'."\n"; |
$title.='<h4>'.&mt('<b>Section: </b>[_1]',$section_display).'</h4>'."\n"; |
$title.='<h4><b>'.&mt('Section:').'</b> '.$section_display.'</h4>'."\n"; |
|
|
my $result= &Apache::loncommon::start_data_table(). |
my $result= &Apache::loncommon::start_data_table(). |
&Apache::loncommon::start_data_table_header_row(). |
&Apache::loncommon::start_data_table_header_row(). |
Line 3903 sub editgrades {
|
Line 4220 sub editgrades {
|
$ctr++; |
$ctr++; |
} |
} |
my (undef,undef,$url) = &Apache::lonnet::decode_symb($symb); |
my (undef,undef,$url) = &Apache::lonnet::decode_symb($symb); |
|
my $totcolspan = 0; |
foreach my $partid (@partid) { |
foreach my $partid (@partid) { |
$header .= '<th align="center">'.&mt('Old Score').'</th>'. |
$header .= '<th align="center">'.&mt('Old Score').'</th>'. |
'<th align="center">'.&mt('New Score').'</th>'; |
'<th align="center">'.&mt('New Score').'</th>'; |
Line 3919 sub editgrades {
|
Line 4237 sub editgrades {
|
'<th align="center">'.&mt('New').' '.$display.'</th>'; |
'<th align="center">'.&mt('New').' '.$display.'</th>'; |
$columns{$partid}+=2; |
$columns{$partid}+=2; |
} |
} |
|
$totcolspan += $columns{$partid}; |
} |
} |
foreach my $partid (@partid) { |
foreach my $partid (@partid) { |
my $display_part=&get_display_part($partid,$symb); |
my $display_part=&get_display_part($partid,$symb); |
Line 3934 sub editgrades {
|
Line 4253 sub editgrades {
|
my @noupdate; |
my @noupdate; |
my ($updateCtr,$noupdateCtr) = (1,1); |
my ($updateCtr,$noupdateCtr) = (1,1); |
for ($i=0; $i<$env{'form.total'}; $i++) { |
for ($i=0; $i<$env{'form.total'}; $i++) { |
my $line; |
|
my $user = $env{'form.ctr'.$i}; |
my $user = $env{'form.ctr'.$i}; |
my ($uname,$udom)=split(/:/,$user); |
my ($uname,$udom)=split(/:/,$user); |
my %newrecord; |
my %newrecord; |
my $updateflag = 0; |
my $updateflag = 0; |
$line .= '<td>'.&nameUserString(undef,$$fullname{$user},$uname,$udom).'</td>'; |
my $usec=$classlist->{"$uname:$udom"}[5]; |
my $usec=$classlist->{"$uname:$udom"}[5]; |
my $canmodify = &canmodify($usec); |
if (!&canmodify($usec)) { |
my $line = '<td'.($canmodify?'':' colspan="2"').'>'. |
my $numcols=scalar(@partid)*4+2; |
&nameUserString(undef,$$fullname{$user},$uname,$udom).'</td>'; |
push(@noupdate, |
if (!$canmodify) { |
$line."<td colspan=\"$numcols\"><span class=\"LC_warning\">". |
push(@noupdate, |
&mt('Not allowed to modify student')."</span></td></tr>"); |
$line."<td colspan=\"$totcolspan\"><span class=\"LC_warning\">". |
next; |
&mt('Not allowed to modify student')."</span></td>"); |
} |
next; |
|
} |
my %aggregate = (); |
my %aggregate = (); |
my $aggregateflag = 0; |
my $aggregateflag = 0; |
$user=~s/:/_/; # colon doen't work in javascript for names |
$user=~s/:/_/; # colon doen't work in javascript for names |
Line 4062 sub editgrades {
|
Line 4381 sub editgrades {
|
} |
} |
} |
} |
if (@noupdate) { |
if (@noupdate) { |
# my $numcols=(scalar(@partid)*(scalar(@parts)-1)*2)+3; |
my $numcols=$totcolspan+2; |
my $numcols=scalar(@partid)*4+2; |
|
$result .= &Apache::loncommon::start_data_table_row('LC_empty_row'). |
$result .= &Apache::loncommon::start_data_table_row('LC_empty_row'). |
'<td align="center" colspan="'.$numcols.'">'. |
'<td align="center" colspan="'.$numcols.'">'. |
&mt('No Changes Occurred For the Students Below'). |
&mt('No Changes Occurred For the Students Below'). |
Line 4107 sub split_part_type {
|
Line 4425 sub split_part_type {
|
sub csvupload_javascript_reverse_associate { |
sub csvupload_javascript_reverse_associate { |
my $error1=&mt('You need to specify the username or the student/employee ID'); |
my $error1=&mt('You need to specify the username or the student/employee ID'); |
my $error2=&mt('You need to specify at least one grading field'); |
my $error2=&mt('You need to specify at least one grading field'); |
|
&js_escape(\$error1); |
|
&js_escape(\$error2); |
return(<<ENDPICK); |
return(<<ENDPICK); |
function verify(vf) { |
function verify(vf) { |
var foundsomething=0; |
var foundsomething=0; |
Line 4147 ENDPICK
|
Line 4467 ENDPICK
|
sub csvupload_javascript_forward_associate { |
sub csvupload_javascript_forward_associate { |
my $error1=&mt('You need to specify the username or the student/employee ID'); |
my $error1=&mt('You need to specify the username or the student/employee ID'); |
my $error2=&mt('You need to specify at least one grading field'); |
my $error2=&mt('You need to specify at least one grading field'); |
|
&js_escape(\$error1); |
|
&js_escape(\$error2); |
return(<<ENDPICK); |
return(<<ENDPICK); |
function verify(vf) { |
function verify(vf) { |
var foundsomething=0; |
var foundsomething=0; |
Line 4254 sub csvupload_fields {
|
Line 4576 sub csvupload_fields {
|
|
|
sub csvuploadmap_footer { |
sub csvuploadmap_footer { |
my ($request,$i,$keyfields) =@_; |
my ($request,$i,$keyfields) =@_; |
|
my $buttontext = &mt('Assign Grades'); |
$request->print(<<ENDPICK); |
$request->print(<<ENDPICK); |
</table> |
</table> |
<input type="hidden" name="nfields" value="$i" /> |
<input type="hidden" name="nfields" value="$i" /> |
<input type="hidden" name="keyfields" value="$keyfields" /> |
<input type="hidden" name="keyfields" value="$keyfields" /> |
<input type="button" onclick="javascript:verify(this.form)" value="Assign Grades" /><br /> |
<input type="button" onclick="javascript:verify(this.form)" value="$buttontext" /><br /> |
</form> |
</form> |
ENDPICK |
ENDPICK |
} |
} |
|
|
sub checkforfile_js { |
sub checkforfile_js { |
my $alertmsg = &mt('Please use the browse button to select a file from your local directory.'); |
my $alertmsg = &mt('Please use the browse button to select a file from your local directory.'); |
|
&js_escape(\$alertmsg); |
my $result =<<CSVFORMJS; |
my $result =<<CSVFORMJS; |
<script type="text/javascript" language="javascript"> |
<script type="text/javascript" language="javascript"> |
function checkUpload(formname) { |
function checkUpload(formname) { |
Line 4325 sub csvuploadmap {
|
Line 4649 sub csvuploadmap {
|
if (!$env{'form.datatoken'}) { |
if (!$env{'form.datatoken'}) { |
$datatoken=&Apache::loncommon::upfile_store($request); |
$datatoken=&Apache::loncommon::upfile_store($request); |
} else { |
} else { |
$datatoken=$env{'form.datatoken'}; |
$datatoken=&Apache::loncommon::valid_datatoken($env{'form.datatoken'}); |
&Apache::loncommon::load_tmp_file($request); |
if ($datatoken ne '') { |
|
&Apache::loncommon::load_tmp_file($request,$datatoken); |
|
} |
} |
} |
my @records=&Apache::loncommon::upfile_record_sep(); |
my @records=&Apache::loncommon::upfile_record_sep(); |
if ($env{'form.noFirstLine'}) { shift(@records); } |
if ($env{'form.noFirstLine'}) { shift(@records); } |
Line 4402 ENDPICK
|
Line 4728 ENDPICK
|
} |
} |
# FIXME do a check for any duplicated user ids... |
# FIXME do a check for any duplicated user ids... |
# FIXME do a check for any invalid user ids?... |
# FIXME do a check for any invalid user ids?... |
$request->print('<input type="submit" value="Assign Grades" /><br /> |
$request->print('<input type="submit" value="'.&mt('Assign Grades').'" /><br /> |
<hr /></form>'."\n"); |
<hr /></form>'."\n"); |
$request->print(&show_grading_menu_form($symb)); |
$request->print(&show_grading_menu_form($symb)); |
return ''; |
return ''; |
Line 4430 sub csvuploadassign {
|
Line 4756 sub csvuploadassign {
|
my ($symb)=&get_symb($request); |
my ($symb)=&get_symb($request); |
if (!$symb) {return '';} |
if (!$symb) {return '';} |
my $error_msg = ''; |
my $error_msg = ''; |
&Apache::loncommon::load_tmp_file($request); |
my $datatoken = &Apache::loncommon::valid_datatoken($env{'form.datatoken'}); |
|
if ($datatoken ne '') { |
|
&Apache::loncommon::load_tmp_file($request,$datatoken); |
|
} |
my @gradedata = &Apache::loncommon::upfile_record_sep(); |
my @gradedata = &Apache::loncommon::upfile_record_sep(); |
if ($env{'form.noFirstLine'}) { shift(@gradedata); } |
if ($env{'form.noFirstLine'}) { shift(@gradedata); } |
my %fields=&get_fields(); |
my %fields=&get_fields(); |
Line 4561 sub pickStudentPage {
|
Line 4890 sub pickStudentPage {
|
my ($request) = shift; |
my ($request) = shift; |
|
|
my $alertmsg = &mt('Please select the student you wish to grade.'); |
my $alertmsg = &mt('Please select the student you wish to grade.'); |
|
&js_escape(\$alertmsg); |
$request->print(<<LISTJAVASCRIPT); |
$request->print(<<LISTJAVASCRIPT); |
<script type="text/javascript" language="javascript"> |
<script type="text/javascript" language="javascript"> |
|
|
Line 4736 sub displayPage {
|
Line 5066 sub displayPage {
|
&Apache::lonnet::clear_EXT_cache_status(); |
&Apache::lonnet::clear_EXT_cache_status(); |
|
|
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">'. |
$request->print(&show_grading_menu_form($symb)); |
&mt('Unable to view requested student. ([_1])', |
return; |
$env{'form.student'}). |
|
'</span>'); |
|
$request->print(&show_grading_menu_form($symb)); |
|
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>'; |
$result.='<h3> '.&mt('Student: [_1]',&nameUserString(undef,$$fullname{$env{'form.student'}},$uname,$udom)). |
$result.='<h3> '.&mt('Student: [_1]',&nameUserString(undef,$$fullname{$env{'form.student'}},$uname,$udom)). |
Line 4852 sub displayPage {
|
Line 5185 sub displayPage {
|
} |
} |
} elsif ($env{'form.lastSub'} eq 'all') { |
} elsif ($env{'form.lastSub'} eq 'all') { |
my $last = ($env{'form.lastSub'} eq 'last' ? 'last' : ''); |
my $last = ($env{'form.lastSub'} eq 'last' ? 'last' : ''); |
|
my $identifier = (&canmodify($usec)? $prob : ''); |
$studentTable.=&Apache::loncommon::get_previous_attempt($symbx,$uname,$udom, |
$studentTable.=&Apache::loncommon::get_previous_attempt($symbx,$uname,$udom, |
$env{'request.course.id'}, |
$env{'request.course.id'}, |
'','.submission'); |
'','.submission',undef, |
|
$usec,$identifier); |
|
|
} |
} |
if (&canmodify($usec)) { |
if (&canmodify($usec)) { |
Line 4907 sub displaySubByDates {
|
Line 5242 sub displaySubByDates {
|
|
|
my $interaction; |
my $interaction; |
my $no_increment = 1; |
my $no_increment = 1; |
my %lastrndseed; |
my (%lastrndseed,%lasttype); |
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 4965 sub displaySubByDates {
|
Line 5300 sub displaySubByDates {
|
} 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} ne '')) { |
if ($rndseed ne $lastrndseed{$partid}) { |
if (($rndseed ne $lastrndseed{$partid}) && |
|
(($type eq 'randomizetry') || ($lasttype{$partid} eq 'randomizetry'))) { |
$newvariation = ' ('.&mt('New variation this try').')'; |
$newvariation = ' ('.&mt('New variation this try').')'; |
} |
} |
} |
} |
|
$lastrndseed{$partid} = $rndseed; |
|
$lasttype{$partid} = $type; |
} |
} |
my $responseType=($isTask ? 'Task' |
my $responseType=($isTask ? 'Task' |
: $responseType->{$partid}->{$responseId}); |
: $responseType->{$partid}->{$responseId}); |
Line 5070 sub updateGradeByPage {
|
Line 5408 sub updateGradeByPage {
|
|
|
$iterator->next(); # skip the first BEGIN_MAP |
$iterator->next(); # skip the first BEGIN_MAP |
my $curRes = $iterator->next(); # for "current resource" |
my $curRes = $iterator->next(); # for "current resource" |
my ($depth,$question,$prob,$changeflag)= (1,1,1,0); |
my ($depth,$question,$prob,$changeflag,$hideflag)= (1,1,1,0,0); |
while ($depth > 0) { |
while ($depth > 0) { |
if($curRes == $iterator->BEGIN_MAP) { $depth++; } |
if($curRes == $iterator->BEGIN_MAP) { $depth++; } |
if($curRes == $iterator->END_MAP) { $depth--; } |
if($curRes == $iterator->END_MAP) { $depth--; } |
Line 5091 sub updateGradeByPage {
|
Line 5429 sub updateGradeByPage {
|
my @displayPts=(); |
my @displayPts=(); |
my %aggregate = (); |
my %aggregate = (); |
my $aggregateflag = 0; |
my $aggregateflag = 0; |
|
if ($env{'form.HIDE'.$prob}) { |
|
my %record = &Apache::lonnet::restore($symbx,$env{'request.course.id'},$udom,$uname); |
|
my ($version,$parts) = split(/:/,$env{'form.HIDE'.$prob},2); |
|
my $numchgs = &makehidden($version,$parts,\%record,$symbx,$udom,$uname,1); |
|
$hideflag += $numchgs; |
|
} |
foreach my $partid (@{$parts}) { |
foreach my $partid (@{$parts}) { |
my $newpts = $env{'form.GD_BOX'.$question.'_'.$partid}; |
my $newpts = $env{'form.GD_BOX'.$question.'_'.$partid}; |
my $oldpts = $env{'form.oldpts'.$question.'_'.$partid}; |
my $oldpts = $env{'form.oldpts'.$question.'_'.$partid}; |
Line 5182 sub updateGradeByPage {
|
Line 5526 sub updateGradeByPage {
|
$studentTable.=&show_grading_menu_form($env{'form.symb'}); |
$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).'<br />'); |
$request->print($grademsg.$studentTable); |
my $hidemsg=($hideflag == 0 ? '' : |
|
&mt('Submissions were marked "hidden" for [quant,_1,transaction].', |
|
$hideflag).'<br />'); |
|
$request->print($hidemsg.$grademsg.$studentTable); |
|
|
return ''; |
return ''; |
} |
} |
Line 5218 like.
|
Line 5565 like.
|
Next each scanline is checked for any errors of either 'missing |
Next each scanline is checked for any errors of either 'missing |
bubbles' (it's an error because it may have been mis-scanned |
bubbles' (it's an error because it may have been mis-scanned |
because too light bubbling), 'double bubble' (each bubble line should |
because too light bubbling), 'double bubble' (each bubble line should |
have no more that one letter picked), invalid or duplicated CODE, |
have no more than one letter picked), invalid or duplicated CODE, |
invalid student/employee ID |
invalid student/employee ID |
|
|
If the CODE option is used that determines the randomization of the |
If the CODE option is used that determines the randomization of the |
Line 5579 sub scantron_selectphase {
|
Line 5926 sub scantron_selectphase {
|
my $default_form_data=&defaultFormData(&get_symb($r,1)); |
my $default_form_data=&defaultFormData(&get_symb($r,1)); |
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 $alertmsg = &mt('Please use the browse button to select a file from your local directory.'); |
|
&js_escape(\$alertmsg); |
$r->print(' |
$r->print(' |
<script type="text/javascript" language="javascript"> |
<script type="text/javascript" language="javascript"> |
function checkUpload(formname) { |
function checkUpload(formname) { |
if (formname.upfile.value == "") { |
if (formname.upfile.value == "") { |
alert("'.&mt('Please use the browse button to select a file from your local directory.').'"); |
alert("'.$alertmsg.'"); |
return false; |
return false; |
} |
} |
formname.submit(); |
formname.submit(); |
Line 5681 sub scantron_selectphase {
|
Line 6030 sub scantron_selectphase {
|
|
|
&Apache::lonpickcode::code_list($r,2); |
&Apache::lonpickcode::code_list($r,2); |
|
|
$r->print('<br /><form method="post" name="checkscantron">'. |
$r->print('<br /><form method="post" name="checkscantron" action="">'. |
$default_form_data."\n". |
$default_form_data."\n". |
&Apache::loncommon::start_data_table('LC_scantron_action')."\n". |
&Apache::loncommon::start_data_table('LC_scantron_action')."\n". |
&Apache::loncommon::start_data_table_header_row()."\n". |
&Apache::loncommon::start_data_table_header_row()."\n". |
Line 5832 sub username_to_idmap {
|
Line 6181 sub username_to_idmap {
|
my ($classlist)= @_; |
my ($classlist)= @_; |
my %idmap; |
my %idmap; |
foreach my $student (keys(%$classlist)) { |
foreach my $student (keys(%$classlist)) { |
$idmap{$classlist->{$student}->[&Apache::loncoursedata::CL_ID]}= |
my $id = $classlist->{$student}->[&Apache::loncoursedata::CL_ID]; |
$student; |
unless ($id eq '') { |
|
if (!exists($idmap{$id})) { |
|
$idmap{$id} = $student; |
|
} else { |
|
my $status = $classlist->{$student}->[&Apache::loncoursedata::CL_STATUS]; |
|
if ($status eq 'Active') { |
|
$idmap{$id} = $student; |
|
} |
|
} |
|
} |
} |
} |
return %idmap; |
return %idmap; |
} |
} |
Line 6577 sub scantron_process_corrections {
|
Line 6935 sub scantron_process_corrections {
|
} |
} |
} |
} |
if ($err) { |
if ($err) { |
$r->print("<span class=\"LC_warning\">Unable to accept last correction, an error occurred :$errmsg:</span>"); |
$r->print( |
|
'<p class="LC_error">' |
|
.&mt('Unable to accept last correction, an error occurred: [_1]', |
|
$errmsg) |
|
.'</p>'); |
} else { |
} else { |
&scantron_put_line($scanlines,$scan_data,$which,$line,$skip); |
&scantron_put_line($scanlines,$scan_data,$which,$line,$skip); |
&scantron_putfile($scanlines,$scan_data); |
&scantron_putfile($scanlines,$scan_data); |
Line 6699 sub scantron_warning_screen {
|
Line 7061 sub scantron_warning_screen {
|
$scantron_config{'CODEstart'} && |
$scantron_config{'CODEstart'} && |
$scantron_config{'CODElength'}) { |
$scantron_config{'CODElength'}) { |
$CODElist=$env{'form.scantron_CODElist'}; |
$CODElist=$env{'form.scantron_CODElist'}; |
if ($env{'form.scantron_CODElist'} eq '') { $CODElist='<span class="LC_warning">None</span>'; } |
if ($env{'form.scantron_CODElist'} eq '') { $CODElist='<span class="LC_warning">'.&mt('None').'</span>'; } |
$CODElist= |
$CODElist= |
'<tr><td><b>'.&mt('List of CODES to validate against:').'</b></td><td><tt>'. |
'<tr><td><b>'.&mt('List of CODES to validate against:').'</b></td><td><tt>'. |
$env{'form.scantron_CODElist'}.'</tt></td></tr>'; |
$env{'form.scantron_CODElist'}.'</tt></td></tr>'; |
Line 6713 sub scantron_warning_screen {
|
Line 7075 sub scantron_warning_screen {
|
return (' |
return (' |
<p> |
<p> |
<span class="LC_warning"> |
<span class="LC_warning"> |
'.&mt('Please double check the information below before clicking on \'[_1]\'',&mt($button_text)).'</span> |
'.&mt("Please double check the information below before clicking on '[_1]'",&mt($button_text)).'</span> |
</p> |
</p> |
<table> |
<table> |
<tr><td><b>'.&mt('Sequence to be Graded:').'</b></td><td>'.$title.'</td></tr> |
<tr><td><b>'.&mt('Sequence to be Graded:').'</b></td><td>'.$title.'</td></tr> |
Line 6828 sub scantron_validate_file {
|
Line 7190 sub scantron_validate_file {
|
if (!$symb) {return '';} |
if (!$symb) {return '';} |
my $default_form_data=&defaultFormData($symb); |
my $default_form_data=&defaultFormData($symb); |
|
|
# do the detection of only doing skipped records first befroe we delete |
# do the detection of only doing skipped records first before we delete |
# them when doing the corrections reset |
# them when doing the corrections reset |
if ($env{'form.scantron_options_redo'} ne 'redo_skipped_ready') { |
if ($env{'form.scantron_options_redo'} ne 'redo_skipped_ready') { |
&reset_skipping_status(); |
&reset_skipping_status(); |
Line 7559 sub verify_bubbles_checked {
|
Line 7921 sub verify_bubbles_checked {
|
my (@ansnums) = @_; |
my (@ansnums) = @_; |
my $ansnumstr = join('","',@ansnums); |
my $ansnumstr = join('","',@ansnums); |
my $warning = &mt("A bubble or 'No bubble' selection has not been made for one or more lines."); |
my $warning = &mt("A bubble or 'No bubble' selection has not been made for one or more lines."); |
|
&js_escape(\$warning); |
my $output = (<<ENDSCRIPT); |
my $output = (<<ENDSCRIPT); |
<script type="text/javascript"> |
<script type="text/javascript"> |
function verify_bubble_radio(form) { |
function verify_bubble_radio(form) { |
Line 7716 sub prompt_for_corrections {
|
Line 8079 sub prompt_for_corrections {
|
} |
} |
} else { |
} else { |
$responsenum = $question-1; |
$responsenum = $question-1; |
$first = $first_bubble_line{$responsenum} + 1; |
$first = $first_bubble_line{$responsenum}; |
} |
} |
$current_line = $first + 1 ; |
$current_line = $first + 1 ; |
my @subans = split(/,/,$subdivided_bubble_lines{$responsenum}); |
my @subans = split(/,/,$subdivided_bubble_lines{$responsenum}); |
Line 8328 sub hand_bubble_option {
|
Line 8691 sub hand_bubble_option {
|
return &mt('The sequence to be graded contains response types which are handgraded.').'<p>'. |
return &mt('The sequence to be graded contains response types which are handgraded.').'<p>'. |
&mt('If you have already graded these by bubbling sheets to indicate points awarded, [_1]what point value is assigned to a filled last bubble in each row?','<br />'). |
&mt('If you have already graded these by bubbling sheets to indicate points awarded, [_1]what point value is assigned to a filled last bubble in each row?','<br />'). |
'<label><input type="radio" name="scantron_lastbubblepoints" value="'.$bubbles_per_row.'" checked="checked" />'.&mt('[quant,_1,point]',$bubbles_per_row).'</label> '.&mt('or').' '. |
'<label><input type="radio" name="scantron_lastbubblepoints" value="'.$bubbles_per_row.'" checked="checked" />'.&mt('[quant,_1,point]',$bubbles_per_row).'</label> '.&mt('or').' '. |
'<label><input type="radio" name="scantron_lastbubblepoints" value="0"/>0 points</label></p>'; |
'<label><input type="radio" name="scantron_lastbubblepoints" value="0" />'.&mt('0 points').'</label></p>'; |
} |
} |
return; |
return; |
} |
} |
Line 8365 sub scantron_process_students {
|
Line 8728 sub scantron_process_students {
|
} |
} |
my $nav_error; |
my $nav_error; |
my @resources=$navmap->retrieveResources($map,\&scantron_filter,1,0); |
my @resources=$navmap->retrieveResources($map,\&scantron_filter,1,0); |
my (%grader_partids_by_symb,%grader_randomlists_by_symb,%ordered); |
|
if ($randomorder || $randompick) { |
if ($randomorder || $randompick) { |
$nav_error = &get_master_seq(\@resources,\@master_seq,\%symb_to_resource); |
$nav_error = &get_master_seq(\@resources,\@master_seq,\%symb_to_resource); |
if ($nav_error) { |
if ($nav_error) { |
Line 8477 SCANTRONFORM
|
Line 8839 SCANTRONFORM
|
} |
} |
if ((exists($grader_randomlists_by_symb{$ressymb})) || |
if ((exists($grader_randomlists_by_symb{$ressymb})) || |
(ref($grader_partids_by_symb{$ressymb}) ne 'ARRAY')) { |
(ref($grader_partids_by_symb{$ressymb}) ne 'ARRAY')) { |
|
my $currcode; |
|
if (exists($grader_randomlists_by_symb{$ressymb})) { |
|
$currcode = $scancode; |
|
} |
my ($analysis,$parts) = |
my ($analysis,$parts) = |
&scantron_partids_tograde($resource,$env{'request.course.id'}, |
&scantron_partids_tograde($resource,$env{'request.course.id'}, |
$uname,$udom,undef,$bubbles_per_row); |
$uname,$udom,undef,$bubbles_per_row, |
|
$currcode); |
$partids_by_symb{$ressymb} = $parts; |
$partids_by_symb{$ressymb} = $parts; |
} else { |
} else { |
$partids_by_symb{$ressymb} = $grader_partids_by_symb{$ressymb}; |
$partids_by_symb{$ressymb} = $grader_partids_by_symb{$ressymb}; |
Line 8584 SCANTRONFORM
|
Line 8951 SCANTRONFORM
|
&Apache::loncommon::end_data_table_header_row()."\n". |
&Apache::loncommon::end_data_table_header_row()."\n". |
&Apache::loncommon::start_data_table_row(). |
&Apache::loncommon::start_data_table_row(). |
'<td>'.&mt('Bubblesheet').'</td>'. |
'<td>'.&mt('Bubblesheet').'</td>'. |
'<td><span class="LC_nobreak">'.$studentdata.'</span></td>'. |
'<td><span class="LC_nobreak" style="white-space: pre;"><tt>'.$studentdata.'</tt></span></td>'. |
&Apache::loncommon::end_data_table_row(). |
&Apache::loncommon::end_data_table_row(). |
&Apache::loncommon::start_data_table_row(). |
&Apache::loncommon::start_data_table_row(). |
'<td>'.&mt('Stored submissions').'</td>'. |
'<td>'.&mt('Stored submissions').'</td>'. |
'<td><span class="LC_nobreak">'.$studentrecord.'</span></td>'."\n". |
'<td><span class="LC_nobreak" style="white-space: pre;"><tt>'.$studentrecord.'</tt></span></td>'."\n". |
&Apache::loncommon::end_data_table_row(). |
&Apache::loncommon::end_data_table_row(). |
&Apache::loncommon::end_data_table().'</p>'); |
&Apache::loncommon::end_data_table().'</p>'); |
} else { |
} else { |
Line 8750 sub scantron_upload_scantron_data {
|
Line 9117 sub scantron_upload_scantron_data {
|
my ($symb) = &get_symb($r,1); |
my ($symb) = &get_symb($r,1); |
my $default_form_data=&defaultFormData($symb); |
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.'); |
|
&js_escape(\$nofile_alert); |
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."); |
|
&js_escape(\$nocourseid_alert); |
$r->print(' |
$r->print(' |
<script type="text/javascript" language="javascript"> |
<script type="text/javascript" language="javascript"> |
function checkUpload(formname) { |
function checkUpload(formname) { |
Line 8829 sub scantron_upload_scantron_data_save {
|
Line 9198 sub scantron_upload_scantron_data_save {
|
} |
} |
my %coursedata=&Apache::lonnet::coursedescription($env{'form.domainid'}.'_'.$env{'form.courseid'}); |
my %coursedata=&Apache::lonnet::coursedescription($env{'form.domainid'}.'_'.$env{'form.courseid'}); |
my $uploadedfile; |
my $uploadedfile; |
$r->print('<h3>'.&mt("Uploading file to [_1]",$coursedata{'description'}).'</h3>'); |
$r->print('<p>'.&mt("Uploading file to [_1]",$coursedata{'description'}).'</p>'); |
if (length($env{'form.upfile'}) < 2) { |
if (length($env{'form.upfile'}) < 2) { |
$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>')); |
$r->print( |
|
&Apache::lonhtmlcommon::confirm_success( |
|
&mt('The file: [_1] you attempted to upload contained no information. Please check that you entered the correct filename.', |
|
'<span class="LC_filename">'.&HTML::Entities::encode($env{'form.upfile.filename'},'<>&"').'</span>'),1)); |
} else { |
} else { |
my $result = |
my $result = |
&Apache::lonnet::userfileupload('upfile','','scantron','','','', |
&Apache::lonnet::userfileupload('upfile','','scantron','','','', |
$env{'form.courseid'},$env{'form.domainid'}); |
$env{'form.courseid'},$env{'form.domainid'}); |
if ($result =~ m{^/uploaded/}) { |
if ($result =~ m{^/uploaded/}) { |
$r->print(&mt('[_1]Success:[_2] Successfully uploaded [_3] bytes of data into location: [_4]', |
$r->print( |
'<span class="LC_success">','</span>',(length($env{'form.upfile'})-1), |
&Apache::lonhtmlcommon::confirm_success(&mt('Upload successful')).'<br />'. |
'<span class="LC_filename">'.$result.'</span>')); |
&mt('Uploaded [_1] bytes of data into location: [_2]', |
|
(length($env{'form.upfile'})-1), |
|
'<span class="LC_filename">'.$result.'</span>')); |
($uploadedfile) = ($result =~ m{/([^/]+)$}); |
($uploadedfile) = ($result =~ m{/([^/]+)$}); |
$r->print(&validate_uploaded_scantron_file($env{'form.domainid'}, |
$r->print(&validate_uploaded_scantron_file($env{'form.domainid'}, |
$env{'form.courseid'},$uploadedfile)); |
$env{'form.courseid'},$uploadedfile)); |
} else { |
} else { |
$r->print(&mt('[_1]Error:[_2] An error ([_3]) occurred when attempting to upload the file, [_4]', |
$r->print( |
'<span class="LC_error">','</span>',$result, |
&Apache::lonhtmlcommon::confirm_success(&mt('Upload failed'),1).'<br />'. |
|
&mt('An error ([_1]) occurred when attempting to upload the file: [_2]', |
|
$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>')); |
} |
} |
} |
} |
Line 8867 sub validate_uploaded_scantron_file {
|
Line 9243 sub validate_uploaded_scantron_file {
|
my $output; |
my $output; |
if (@lines) { |
if (@lines) { |
my (%counts,$max_match_format); |
my (%counts,$max_match_format); |
my ($max_match_count,$max_match_pct) = (0,0); |
my ($found_match_count,$max_match_count,$max_match_pct) = (0,0,0); |
my $classlist = &Apache::loncoursedata::get_classlist($cdom,$cname); |
my $classlist = &Apache::loncoursedata::get_classlist($cdom,$cname); |
my %idmap = &username_to_idmap($classlist); |
my %idmap = &username_to_idmap($classlist); |
foreach my $key (keys(%idmap)) { |
foreach my $key (keys(%idmap)) { |
Line 8910 sub validate_uploaded_scantron_file {
|
Line 9286 sub validate_uploaded_scantron_file {
|
if (($max_match_format eq '') || ($percent_match > $max_match_pct)) { |
if (($max_match_format eq '') || ($percent_match > $max_match_pct)) { |
$max_match_pct = $percent_match; |
$max_match_pct = $percent_match; |
$max_match_format = $key; |
$max_match_format = $key; |
|
$found_match_count = $counts{$key}{'found'}; |
$max_match_count = $counts{$key}{'total'}; |
$max_match_count = $counts{$key}{'total'}; |
} |
} |
} |
} |
Line 8928 sub validate_uploaded_scantron_file {
|
Line 9305 sub validate_uploaded_scantron_file {
|
} |
} |
} |
} |
my $showpct = sprintf("%.0f",$max_match_pct).'%'; |
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). |
$output .= '<br />'; |
'<br />'.&mt('A low percentage of matches results from one of the following:').'<ul>'. |
if ($found_match_count == $max_match_count) { |
'<li>'.&mt('The file was uploaded to the wrong course').'</li>'. |
# 100% matching entries |
'<li>'.&mt('The data are not in the format expected for the domain: [_1]', |
$output .= &Apache::lonhtmlcommon::confirm_success( |
'<i>'.$cdom.'</i>').'</li>'. |
&mt('Comparison of student IDs: [_1] matching ([quant,_2,entry,entries])', |
'<li>'.&mt('Students did not bubble their IDs, or mis-bubbled them').'</li>'. |
'<b>'.$showpct.'</b>',$found_match_count)).'<br />'. |
'<li>'.&mt('The course roster is not up to date').'</li>'. |
&mt('Comparison of student IDs in the uploaded file with'. |
'</ul>'; |
' 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); |
|
} else { |
|
# Not all entries matching? -> Show warning and additional info |
|
$output .= |
|
&Apache::lonhtmlcommon::confirm_success( |
|
&mt('Comparison of student IDs: [_1] matching ([_2]/[quant,_3,entry,entries])', |
|
'<b>'.$showpct.'</b>',$found_match_count,$max_match_count).'<br />'. |
|
&mt('Not all entries could be matched!'),1).'<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). |
|
'<p class="LC_info">'. |
|
&mt('A low percentage of matches results from one of the following:'). |
|
'</p><ul>'. |
|
'<li>'.&mt('The file was uploaded to the wrong course.').'</li>'. |
|
'<li>'.&mt('The data is 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 { |
} else { |
$output = '<span class="LC_warning">'.&mt('Uploaded file contained no data').'</span>'; |
$output = '<p class="LC_warning">'.&mt('Uploaded file contained no data').'</p>'; |
} |
} |
return $output; |
return $output; |
} |
} |
Line 8975 sub scantron_download_scantron_data {
|
Line 9375 sub scantron_download_scantron_data {
|
&Apache::lonnet::allowuploaded('/adm/grades',$skipped); |
&Apache::lonnet::allowuploaded('/adm/grades',$skipped); |
$r->print(' |
$r->print(' |
<p> |
<p> |
'.&mt('[_1]Original[_2] file as uploaded by the scantron office.', |
'.&mt('[_1]Original[_2] file as uploaded by bubblesheet scanning office.', |
'<a href="'.$orig.'">','</a>').' |
'<a href="'.$orig.'">','</a>').' |
</p> |
</p> |
<p> |
<p> |
Line 9039 sub checkscantron_results {
|
Line 9439 sub checkscantron_results {
|
|
|
my $count=&get_todo_count($scanlines,$scan_data); |
my $count=&get_todo_count($scanlines,$scan_data); |
my %prog_state=&Apache::lonhtmlcommon::Create_PrgWin($r,$count); |
my %prog_state=&Apache::lonhtmlcommon::Create_PrgWin($r,$count); |
my ($username,$domain,$started,%ordered); |
my ($username,$domain,$started); |
&scantron_get_maxbubble(\$nav_error,\%scantron_config); # Need the bubble lines array to parse. |
&scantron_get_maxbubble(\$nav_error,\%scantron_config); # Need the bubble lines array to parse. |
if ($nav_error) { |
if ($nav_error) { |
$r->print(&navmap_errormsg()); |
$r->print(&navmap_errormsg()); |
Line 9116 sub checkscantron_results {
|
Line 9516 sub checkscantron_results {
|
my $ressymb = $resource->symb(); |
my $ressymb = $resource->symb(); |
if ((exists($grader_randomlists_by_symb{$ressymb})) || |
if ((exists($grader_randomlists_by_symb{$ressymb})) || |
(ref($grader_partids_by_symb{$ressymb}) ne 'ARRAY')) { |
(ref($grader_partids_by_symb{$ressymb}) ne 'ARRAY')) { |
|
my $currcode; |
|
if (exists($grader_randomlists_by_symb{$ressymb})) { |
|
$currcode = $scancode; |
|
} |
(my $analysis,$parts) = |
(my $analysis,$parts) = |
&scantron_partids_tograde($resource,$env{'request.course.id'}, |
&scantron_partids_tograde($resource,$env{'request.course.id'}, |
$username,$domain,undef, |
$username,$domain,undef, |
$bubbles_per_row); |
$bubbles_per_row,$currcode); |
} else { |
} else { |
$parts = $grader_partids_by_symb{$ressymb}; |
$parts = $grader_partids_by_symb{$ressymb}; |
} |
} |
Line 9151 sub checkscantron_results {
|
Line 9555 sub checkscantron_results {
|
'<td>'.&mt('Bubblesheet').'</td><td>'.$showscandata.'</td><td rowspan="2">'.$last.'</td><td rowspan="2">'.$pid.'</td>'."\n". |
'<td>'.&mt('Bubblesheet').'</td><td>'.$showscandata.'</td><td rowspan="2">'.$last.'</td><td rowspan="2">'.$pid.'</td>'."\n". |
'</tr>'."\n". |
'</tr>'."\n". |
'<tr class="'.$css_class.'">'."\n". |
'<tr class="'.$css_class.'">'."\n". |
'<td>Submissions</td><td>'.$showrecord.'</td></tr>'."\n"; |
'<td>'.&mt('Submissions').'</td><td>'.$showrecord.'</td></tr>'."\n"; |
$passed ++; |
$passed ++; |
} else { |
} else { |
my $css_class = ($failed % 2)?'LC_odd_row':'LC_even_row'; |
my $css_class = ($failed % 2)?'LC_odd_row':'LC_even_row'; |
$badstudents .= '<tr class="'.$css_class.'"><td>'.&mt('Bubblesheet').'</td><td><span class="LC_nobreak">'.$scandata{$pid}.'</span></td><td rowspan="2">'.$last.'</td><td rowspan="2">'.$pid.'</td>'."\n". |
$badstudents .= '<tr class="'.$css_class.'"><td>'.&mt('Bubblesheet').'</td><td><span class="LC_nobreak">'.$scandata{$pid}.'</span></td><td rowspan="2">'.$last.'</td><td rowspan="2">'.$pid.'</td>'."\n". |
'</tr>'."\n". |
'</tr>'."\n". |
'<tr class="'.$css_class.'">'."\n". |
'<tr class="'.$css_class.'">'."\n". |
'<td>Submissions</td><td><span class="LC_nobreak">'.$record{$pid}.'</span></td>'."\n". |
'<td>'.&mt('Submissions').'</td><td><span class="LC_nobreak">'.$record{$pid}.'</span></td>'."\n". |
'</tr>'."\n"; |
'</tr>'."\n"; |
$failed ++; |
$failed ++; |
} |
} |
Line 9663 GRADINGMENUJS
|
Line 10067 GRADINGMENUJS
|
return $result; |
return $result; |
} |
} |
|
|
|
sub substatus_options { |
|
return &Apache::lonlocal::texthash( |
|
'yes' => 'with submissions', |
|
'queued' => 'in grading queue', |
|
'graded' => 'with ungraded submissions', |
|
'incorrect' => 'with incorrect submissions', |
|
'all' => 'with any status', |
|
); |
|
} |
|
|
sub reset_perm { |
sub reset_perm { |
undef(%perm); |
undef(%perm); |
} |
} |
Line 9931 sub process_clicker_file {
|
Line 10345 sub process_clicker_file {
|
$number++; |
$number++; |
} |
} |
$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 .= |
return $result.&show_grading_menu_form($symb); |
&Apache::lonhtmlcommon::confirm_success( |
} |
&mt('No IDs found to determine correct answer'),1); |
|
return $result.&show_grading_menu_form($symb); |
|
} |
} |
} |
if (length($env{'form.upfile'}) < 2) { |
if (length($env{'form.upfile'}) < 2) { |
$result.=&mt('[_1] Error: [_2] The file you attempted to upload, [_3] contained no information. Please check that you entered the correct filename.', |
$result .= |
'<span class="LC_error">', |
&Apache::lonhtmlcommon::confirm_success( |
'</span>', |
&mt('The file: [_1] you attempted to upload contained no information. Please check that you entered the correct filename.', |
'<span class="LC_filename">'.&HTML::Entities::encode($env{'form.upfile.filename'},'<>&"').'</span>'); |
'<span class="LC_filename">'.&HTML::Entities::encode($env{'form.upfile.filename'},'<>&"').'</span>'),1); |
|
return $result.&show_grading_menu_form($symb); |
|
} |
|
my $mimetype; |
|
if ($env{'form.upfiletype'} eq 'iclicker') { |
|
my $mm = new File::MMagic; |
|
$mimetype = $mm->checktype_contents($env{'form.upfile'}); |
|
unless (($mimetype eq 'text/plain') || ($mimetype eq 'text/html')) { |
|
$result.= '<p>'. |
|
&Apache::lonhtmlcommon::confirm_success( |
|
&mt('File format is neither csv (iclicker 6) nor xml (iclicker 7)'),1).'</p>'; |
|
return $result.&show_grading_menu_form($symb); |
|
} |
|
} elsif (($env{'form.upfiletype'} ne 'interwrite') && ($env{'form.upfiletype'} ne 'turning')) { |
|
$result .= '<p>'. |
|
&Apache::lonhtmlcommon::confirm_success( |
|
&mt('Invalid clicker type: choose one of: i>clicker, Interwrite PRS, or Turning Technologies.'),1).'</p>'; |
return $result.&show_grading_menu_form($symb); |
return $result.&show_grading_menu_form($symb); |
} |
} |
|
|
Line 9970 ENDHEADER
|
Line 10402 ENDHEADER
|
my $errormsg=''; |
my $errormsg=''; |
my $number=0; |
my $number=0; |
if ($env{'form.upfiletype'} eq 'iclicker') { |
if ($env{'form.upfiletype'} eq 'iclicker') { |
($errormsg,$number)=&iclicker_eval(\@questiontitles,\%responses); |
if ($mimetype eq 'text/plain') { |
} |
($errormsg,$number)=&iclicker_eval(\@questiontitles,\%responses); |
if ($env{'form.upfiletype'} eq 'interwrite') { |
} elsif ($mimetype eq 'text/html') { |
|
($errormsg,$number)=&iclickerxml_eval(\@questiontitles,\%responses); |
|
} |
|
} elsif ($env{'form.upfiletype'} eq 'interwrite') { |
($errormsg,$number)=&interwrite_eval(\@questiontitles,\%responses); |
($errormsg,$number)=&interwrite_eval(\@questiontitles,\%responses); |
} |
} elsif ($env{'form.upfiletype'} eq 'turning') { |
if ($env{'form.upfiletype'} eq 'turning') { |
|
($errormsg,$number)=&turning_eval(\@questiontitles,\%responses); |
($errormsg,$number)=&turning_eval(\@questiontitles,\%responses); |
} |
} |
$result.='<br />'.&mt('Found [_1] question(s)',$number).'<br />'. |
$result.='<br />'.&mt('Found [_1] question(s)',$number).'<br />'. |
Line 10032 ENDHEADER
|
Line 10466 ENDHEADER
|
&mt('Found [_1] registered and [_2] unregistered clickers.',$student_count,$unknown_count); |
&mt('Found [_1] registered and [_2] unregistered clickers.',$student_count,$unknown_count); |
if (($env{'form.gradingmechanism'} ne 'attendance') && ($env{'form.gradingmechanism'} ne 'given')) { |
if (($env{'form.gradingmechanism'} ne 'attendance') && ($env{'form.gradingmechanism'} ne 'given')) { |
if ($correct_count==0) { |
if ($correct_count==0) { |
$errormsg.="Found no correct answers answers for grading!"; |
$errormsg.="Found no correct answers for grading!"; |
} elsif ($correct_count>1) { |
} elsif ($correct_count>1) { |
$result.='<br /><span class="LC_warning">'.&mt("Found [_1] entries for grading!",$correct_count).'</span>'; |
$result.='<br /><span class="LC_warning">'.&mt("Found [_1] entries for grading!",$correct_count).'</span>'; |
} |
} |
Line 10078 sub iclicker_eval {
|
Line 10512 sub iclicker_eval {
|
return ($errormsg,$number); |
return ($errormsg,$number); |
} |
} |
|
|
|
sub iclickerxml_eval { |
|
my ($questiontitles,$responses)=@_; |
|
my $number=0; |
|
my $errormsg=''; |
|
my @state; |
|
my %respbyid; |
|
my $p = HTML::Parser->new |
|
( |
|
xml_mode => 1, |
|
start_h => |
|
[sub { |
|
my ($tagname,$attr) = @_; |
|
push(@state,$tagname); |
|
if ("@state" eq "ssn p") { |
|
my $title = $attr->{qn}; |
|
$title =~ s/(^\s+|\s+$)//g; |
|
$questiontitles->[$number]=$title; |
|
} elsif ("@state" eq "ssn p v") { |
|
my $id = $attr->{id}; |
|
my $entry = $attr->{ans}; |
|
$id=~s/^[\#0]+//; |
|
$entry =~s/[^a-zA-Z0-9\.\*\-\+]+//g; |
|
$respbyid{$id}[$number] = $entry; |
|
} |
|
}, "tagname, attr"], |
|
end_h => |
|
[sub { |
|
my ($tagname) = @_; |
|
if ("@state" eq "ssn p") { |
|
$number++; |
|
} |
|
pop(@state); |
|
}, "tagname"], |
|
); |
|
|
|
$p->parse($env{'form.upfile'}); |
|
$p->eof; |
|
foreach my $id (keys(%respbyid)) { |
|
$responses->{$id}=join(',',@{$respbyid{$id}}); |
|
} |
|
return ($errormsg,$number); |
|
} |
|
|
sub interwrite_eval { |
sub interwrite_eval { |
my ($questiontitles,$responses)=@_; |
my ($questiontitles,$responses)=@_; |
my $number=0; |
my $number=0; |
Line 10207 sub assign_clicker_grades {
|
Line 10684 sub assign_clicker_grades {
|
if ($user) { |
if ($user) { |
if ($users{$user}) { |
if ($users{$user}) { |
$result.='<br /><span class="LC_warning">'. |
$result.='<br /><span class="LC_warning">'. |
&mt("More than one entry found for <tt>[_1]</tt>!",$user). |
&mt('More than one entry found for [_1]!','<tt>'.$user.'</tt>'). |
'</span><br />'; |
'</span><br />'; |
} |
} |
$users{$user}=1; |
$users{$user}=1; |
Line 10498 At least the logic that drives this has
|
Line 10975 At least the logic that drives this has
|
ssi_with_retries - Does the server side include of a resource. |
ssi_with_retries - Does the server side include of a resource. |
if the ssi call returns an error we'll retry it up to |
if the ssi call returns an error we'll retry it up to |
the number of times requested by the caller. |
the number of times requested by the caller. |
If we still have a proble, no text is appended to the |
If we still have a problem, no text is appended to the |
output and we set some global variables. |
output and we set some global variables. |
to indicate to the caller an SSI error occurred. |
to indicate to the caller an SSI error occurred. |
All of this is supposed to deal with the issues described |
All of this is supposed to deal with the issues described |
in LonCAPA BZ 5631 see: |
in LON-CAPA BZ 5631 see: |
http://bugs.lon-capa.org/show_bug.cgi?id=5631 |
http://bugs.lon-capa.org/show_bug.cgi?id=5631 |
by informing the user that this happened. |
by informing the user that this happened. |
|
|