version 1.336, 2006/03/19 21:38:55
|
version 1.395, 2007/04/16 19:00:38
|
Line 36 use Apache::lonhtmlcommon;
|
Line 36 use Apache::lonhtmlcommon;
|
use Apache::lonnavmaps; |
use Apache::lonnavmaps; |
use Apache::lonhomework; |
use Apache::lonhomework; |
use Apache::loncoursedata; |
use Apache::loncoursedata; |
use Apache::lonmsg qw(:user_normal_msg); |
use Apache::lonmsg(); |
use Apache::Constants qw(:common); |
use Apache::Constants qw(:common); |
use Apache::lonlocal; |
use Apache::lonlocal; |
|
use Apache::lonenc; |
use String::Similarity; |
use String::Similarity; |
|
use lib '/home/httpd/lib/perl'; |
|
use LONCAPA; |
|
|
use POSIX qw(floor); |
use POSIX qw(floor); |
|
|
my %oldessays=(); |
my %oldessays=(); |
Line 109 sub nameUserString {
|
Line 113 sub nameUserString {
|
#--- Indicate if a response type is coded handgraded or not. --- |
#--- Indicate if a response type is coded handgraded or not. --- |
sub response_type { |
sub response_type { |
my ($symb) = shift; |
my ($symb) = shift; |
my (undef,undef,$url) = &Apache::lonnet::decode_symb($symb); |
|
my $allkeys = &Apache::lonnet::metadata($url,'keys'); |
my $navmap = Apache::lonnavmaps::navmap->new(); |
my %vPart; |
my $res = $navmap->getBySymb($symb); |
foreach my $partid (&Apache::loncommon::get_env_multiple('form.vPart')) { |
my $partlist = $res->parts(); |
$vPart{$partid}=1; |
my %vPart = |
} |
map { $_ => 1 } (&Apache::loncommon::get_env_multiple('form.vPart')); |
my %seen = (); |
my (%response_types,%handgrade); |
my (@partlist,%handgrade,%responseType); |
foreach my $part (@{ $partlist }) { |
foreach (split(/,/,&Apache::lonnet::metadata($url,'packages'))) { |
next if (%vPart && !exists($vPart{$part})); |
if (/^\w+response_.*/ || /^Task_/) { |
|
my ($responsetype,$part) = split(/_/,$_,2); |
my @types = $res->responseType($part); |
my ($partid,$respid) = split(/_/,$part); |
my @ids = $res->responseIds($part); |
if ($responsetype eq 'Task') { $respid='0'; } |
for (my $i=0; $i < scalar(@ids); $i++) { |
if (&Apache::loncommon::check_if_partid_hidden($partid,$symb)) { |
$response_types{$part}{$ids[$i]} = $types[$i]; |
next; |
$handgrade{$part.'_'.$ids[$i]} = |
} |
&Apache::lonnet::EXT('resource.'.$part.'_'.$ids[$i]. |
if (%vPart && !exists($vPart{$partid})) { |
'.handgrade',$symb); |
next; |
} |
} |
} |
$responsetype =~ s/response$//; # make it compatible w/ navmaps - should move to that!! |
return ($partlist,\%handgrade,\%response_types); |
my ($value) = &Apache::lonnet::EXT('resource.'.$part.'.handgrade',$symb); |
} |
$handgrade{$part} = ($value eq 'yes' ? 'yes' : 'no'); |
|
if (!exists($responseType{$partid})) { $responseType{$partid}={}; } |
sub flatten_responseType { |
$responseType{$partid}->{$respid}=$responsetype; |
my ($responseType) = @_; |
next if ($seen{$partid} > 0); |
my @part_response_id = |
$seen{$partid}++; |
map { |
push @partlist,$partid; |
my $part = $_; |
} |
map { |
} |
[$part,$_] |
return (\@partlist,\%handgrade,\%responseType); |
} sort(keys(%{ $responseType->{$part} })); |
|
} sort(keys(%$responseType)); |
|
return @part_response_id; |
} |
} |
|
|
sub get_display_part { |
sub get_display_part { |
Line 165 sub showResourceInfo {
|
Line 171 sub showResourceInfo {
|
my %resptype = (); |
my %resptype = (); |
my $hdgrade='no'; |
my $hdgrade='no'; |
my %partsseen; |
my %partsseen; |
for my $part_resID (sort keys(%$handgrade)) { |
foreach my $partID (sort keys(%$responseType)) { |
my $handgrade=$$handgrade{$part_resID}; |
foreach my $resID (sort keys(%{ $responseType->{$partID} })) { |
my ($partID,$resID) = split(/_/,$part_resID); |
my $handgrade=$$handgrade{$partID.'_'.$resID}; |
my $responsetype = $responseType->{$partID}->{$resID}; |
my $responsetype = $responseType->{$partID}->{$resID}; |
$hdgrade = $handgrade if ($handgrade eq 'yes'); |
$hdgrade = $handgrade if ($handgrade eq 'yes'); |
$result.='<tr>'; |
$result.='<tr>'; |
if ($checkboxes) { |
if ($checkboxes) { |
if (exists($partsseen{$partID})) { |
if (exists($partsseen{$partID})) { |
$result.="<td> </td>"; |
$result.="<td> </td>"; |
} else { |
} else { |
$result.="<td><input type='checkbox' name='vPart' value='$partID' checked='on' /></td>"; |
$result.="<td><input type='checkbox' name='vPart' value='$partID' checked='on' /></td>"; |
|
} |
|
$partsseen{$partID}=1; |
} |
} |
$partsseen{$partID}=1; |
my $display_part=&get_display_part($partID,$symb); |
} |
$result.='<td><b>Part: </b>'.$display_part.' <font color="#999999">'. |
my $display_part=&get_display_part($partID,$symb); |
$resID.'</font></td>'. |
$result.='<td><b>Part: </b>'.$display_part.' <font color="#999999">'. |
'<td><b>Type: </b>'.$responsetype.'</td></tr>'; |
$resID.'</font></td>'. |
|
'<td><b>Type: </b>'.$responsetype.'</td></tr>'; |
|
# '<td><b>Handgrade: </b>'.$handgrade.'</td></tr>'; |
# '<td><b>Handgrade: </b>'.$handgrade.'</td></tr>'; |
|
} |
} |
} |
$result.='</table>'."\n"; |
$result.='</table>'."\n"; |
return $result,$responseType,$hdgrade,$partlist,$handgrade; |
return $result,$responseType,$hdgrade,$partlist,$handgrade; |
Line 586 sub verifyreceipt {
|
Line 593 sub verifyreceipt {
|
my $receipt = &Apache::lonnet::recprefix($courseid).'-'. |
my $receipt = &Apache::lonnet::recprefix($courseid).'-'. |
$env{'form.receipt'}; |
$env{'form.receipt'}; |
$receipt =~ s/[^\-\d]//g; |
$receipt =~ s/[^\-\d]//g; |
my $symb = &Apache::lonnet::symbread(); |
my ($symb) = &get_symb($request); |
|
|
my $title.='<h3><font color="#339933">Verifying Submission Receipt '. |
my $title.='<h3><font color="#339933">Verifying Submission Receipt '. |
$receipt.'</h3></font>'."\n". |
$receipt.'</h3></font>'."\n". |
Line 596 sub verifyreceipt {
|
Line 603 sub verifyreceipt {
|
my (undef,undef,$fullname) = &getclasslist('all','0'); |
my (undef,undef,$fullname) = &getclasslist('all','0'); |
|
|
my $receiptparts=0; |
my $receiptparts=0; |
if ($env{"course.$courseid.receiptalg"} eq 'receipt2') { $receiptparts=1; } |
if ($env{"course.$courseid.receiptalg"} eq 'receipt2' || |
|
$env{"course.$courseid.receiptalg"} eq 'receipt3') { $receiptparts=1; } |
my $parts=['0']; |
my $parts=['0']; |
if ($receiptparts) { ($parts)=&response_type($symb); } |
if ($receiptparts) { ($parts)=&response_type($symb); } |
foreach (sort |
foreach (sort |
Line 722 LISTJAVASCRIPT
|
Line 730 LISTJAVASCRIPT
|
$gradeTable.='<label><input type="radio" name="lastSub" value="lastonly" '.$checklastsub.' /> last submission only </label>'."\n". |
$gradeTable.='<label><input type="radio" name="lastSub" value="lastonly" '.$checklastsub.' /> last submission only </label>'."\n". |
'<label><input type="radio" name="lastSub" value="last" /> last submission & parts info </label>'."\n". |
'<label><input type="radio" name="lastSub" value="last" /> last submission & parts info </label>'."\n". |
'<label><input type="radio" name="lastSub" value="datesub" /> by dates and submissions </label>'."\n". |
'<label><input type="radio" name="lastSub" value="datesub" /> by dates and submissions </label>'."\n". |
'<label><input type="radio" name="lastSub" value="all" /> all details</label>'."\n". |
'<label><input type="radio" name="lastSub" value="all" /> all details</label><br />'."\n". |
|
' <b>Grading Increments:</b> <select name="increment">'. |
|
'<option value="1">Whole Points</option>'. |
|
'<option value=".5">Half Points</option>'. |
|
'<option value=".25">Quarter Points</option>'. |
|
'<option value=".1">Tenths of a Point</option>'. |
|
'</select>'. |
|
|
'<input type="hidden" name="section" value="'.$getsec.'" />'."\n". |
'<input type="hidden" name="section" value="'.$getsec.'" />'."\n". |
'<input type="hidden" name="submitonly" value="'.$submitonly.'" />'."\n". |
'<input type="hidden" name="submitonly" value="'.$submitonly.'" />'."\n". |
'<input type="hidden" name="handgrade" value="'.$env{'form.handgrade'}.'" /><br />'."\n". |
'<input type="hidden" name="handgrade" value="'.$env{'form.handgrade'}.'" /><br />'."\n". |
Line 1135 sub sub_page_kw_js {
|
Line 1150 sub sub_page_kw_js {
|
my $request = shift; |
my $request = shift; |
my $iconpath = $request->dir_config('lonIconsURL'); |
my $iconpath = $request->dir_config('lonIconsURL'); |
&commonJSfunctions($request); |
&commonJSfunctions($request); |
|
|
|
my $inner_js_msg_central=<<INNERJS; |
|
<script text="text/javascript"> |
|
function checkInput() { |
|
opener.document.SCORE.msgsub.value = opener.checkEntities(document.msgcenter.msgsub.value); |
|
var nmsg = opener.document.SCORE.savemsgN.value; |
|
var usrctr = document.msgcenter.usrctr.value; |
|
var newval = opener.document.SCORE["newmsg"+usrctr]; |
|
newval.value = opener.checkEntities(document.msgcenter.newmsg.value); |
|
|
|
var msgchk = ""; |
|
if (document.msgcenter.subchk.checked) { |
|
msgchk = "msgsub,"; |
|
} |
|
var includemsg = 0; |
|
for (var i=1; i<=nmsg; i++) { |
|
var opnmsg = opener.document.SCORE["savemsg"+i]; |
|
var frmmsg = document.msgcenter["msg"+i]; |
|
opnmsg.value = opener.checkEntities(frmmsg.value); |
|
var showflg = opener.document.SCORE["shownOnce"+i]; |
|
showflg.value = "1"; |
|
var chkbox = document.msgcenter["msgn"+i]; |
|
if (chkbox.checked) { |
|
msgchk += "savemsg"+i+","; |
|
includemsg = 1; |
|
} |
|
} |
|
if (document.msgcenter.newmsgchk.checked) { |
|
msgchk += "newmsg"+usrctr; |
|
includemsg = 1; |
|
} |
|
imgformname = opener.document.SCORE["mailicon"+usrctr]; |
|
imgformname.src = "$iconpath/"+((includemsg) ? "mailto.gif" : "mailbkgrd.gif"); |
|
var includemsg = opener.document.SCORE["includemsg"+usrctr]; |
|
includemsg.value = msgchk; |
|
|
|
self.close() |
|
|
|
} |
|
</script> |
|
INNERJS |
|
|
|
my $inner_js_highlight_central=<<INNERJS; |
|
<script type="text/javascript"> |
|
function updateChoice(flag) { |
|
opener.document.SCORE.kwclr.value = opener.radioSelection(document.hlCenter.kwdclr); |
|
opener.document.SCORE.kwsize.value = opener.radioSelection(document.hlCenter.kwdsize); |
|
opener.document.SCORE.kwstyle.value = opener.radioSelection(document.hlCenter.kwdstyle); |
|
opener.document.SCORE.refresh.value = "on"; |
|
if (opener.document.SCORE.keywords.value!=""){ |
|
opener.document.SCORE.submit(); |
|
} |
|
self.close() |
|
} |
|
</script> |
|
INNERJS |
|
|
|
my $start_page_msg_central = |
|
&Apache::loncommon::start_page('Message Central',$inner_js_msg_central, |
|
{'js_ready' => 1, |
|
'only_body' => 1, |
|
'bgcolor' =>'#FFFFFF',}); |
|
my $end_page_msg_central = |
|
&Apache::loncommon::end_page({'js_ready' => 1}); |
|
|
|
|
|
my $start_page_highlight_central = |
|
&Apache::loncommon::start_page('Highlight Central', |
|
$inner_js_highlight_central, |
|
{'js_ready' => 1, |
|
'only_body' => 1, |
|
'bgcolor' =>'#FFFFFF',}); |
|
my $end_page_highlight_central = |
|
&Apache::loncommon::end_page({'js_ready' => 1}); |
|
|
my $docopen=&Apache::lonhtmlcommon::javascript_docopen(); |
my $docopen=&Apache::lonhtmlcommon::javascript_docopen(); |
$docopen=~s/^document\.//; |
$docopen=~s/^document\.//; |
$request->print(<<SUBJAVASCRIPT); |
$request->print(<<SUBJAVASCRIPT); |
Line 1250 sub sub_page_kw_js {
|
Line 1340 sub sub_page_kw_js {
|
pWin.focus(); |
pWin.focus(); |
pDoc = pWin.document; |
pDoc = pWin.document; |
pDoc.$docopen; |
pDoc.$docopen; |
pDoc.write("<html><head>"); |
pDoc.write('$start_page_msg_central'); |
pDoc.write("<title>Message Central</title>"); |
|
|
|
pDoc.write("<script language=javascript>"); |
|
pDoc.write("function checkInput() {"); |
|
pDoc.write(" opener.document.SCORE.msgsub.value = opener.checkEntities(document.msgcenter.msgsub.value);"); |
|
pDoc.write(" var nmsg = opener.document.SCORE.savemsgN.value;"); |
|
pDoc.write(" var usrctr = document.msgcenter.usrctr.value;"); |
|
pDoc.write(" var newval = opener.document.SCORE[\\"newmsg\\"+usrctr];"); |
|
pDoc.write(" newval.value = opener.checkEntities(document.msgcenter.newmsg.value);"); |
|
|
|
pDoc.write(" var msgchk = \\"\\";"); |
|
pDoc.write(" if (document.msgcenter.subchk.checked) {"); |
|
pDoc.write(" msgchk = \\"msgsub,\\";"); |
|
pDoc.write(" }"); |
|
pDoc.write(" var includemsg = 0;"); |
|
pDoc.write(" for (var i=1; i<=nmsg; i++) {"); |
|
pDoc.write(" var opnmsg = opener.document.SCORE[\\"savemsg\\"+i];"); |
|
pDoc.write(" var frmmsg = document.msgcenter[\\"msg\\"+i];"); |
|
pDoc.write(" opnmsg.value = opener.checkEntities(frmmsg.value);"); |
|
pDoc.write(" var showflg = opener.document.SCORE[\\"shownOnce\\"+i];"); |
|
pDoc.write(" showflg.value = \\"1\\";"); |
|
pDoc.write(" var chkbox = document.msgcenter[\\"msgn\\"+i];"); |
|
pDoc.write(" if (chkbox.checked) {"); |
|
pDoc.write(" msgchk += \\"savemsg\\"+i+\\",\\";"); |
|
pDoc.write(" includemsg = 1;"); |
|
pDoc.write(" }"); |
|
pDoc.write(" }"); |
|
pDoc.write(" if (document.msgcenter.newmsgchk.checked) {"); |
|
pDoc.write(" msgchk += \\"newmsg\\"+usrctr;"); |
|
pDoc.write(" includemsg = 1;"); |
|
pDoc.write(" }"); |
|
pDoc.write(" imgformname = opener.document.SCORE[\\"mailicon\\"+usrctr];"); |
|
pDoc.write(" imgformname.src = \\"$iconpath/\\"+((includemsg) ? \\"mailto.gif\\" : \\"mailbkgrd.gif\\");"); |
|
pDoc.write(" var includemsg = opener.document.SCORE[\\"includemsg\\"+usrctr];"); |
|
pDoc.write(" includemsg.value = msgchk;"); |
|
|
|
pDoc.write(" self.close()"); |
|
|
|
pDoc.write("}"); |
|
|
|
pDoc.write("<"); |
|
pDoc.write("/script>"); |
|
|
|
pDoc.write("</head><body bgcolor=white>"); |
|
|
|
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\\">"); |
Line 1335 sub sub_page_kw_js {
|
Line 1381 sub sub_page_kw_js {
|
pDoc.write("<input type=\\"button\\" value=\\"Save\\" onClick=\\"javascript:checkInput()\\"> "); |
pDoc.write("<input type=\\"button\\" value=\\"Save\\" onClick=\\"javascript:checkInput()\\"> "); |
pDoc.write("<input type=\\"button\\" value=\\"Cancel\\" onClick=\\"self.close()\\"><br /><br />"); |
pDoc.write("<input type=\\"button\\" value=\\"Cancel\\" onClick=\\"self.close()\\"><br /><br />"); |
pDoc.write("</form>"); |
pDoc.write("</form>"); |
pDoc.write("</body></html>"); |
pDoc.write('$end_page_msg_central'); |
pDoc.close(); |
pDoc.close(); |
} |
} |
|
|
Line 1381 sub sub_page_kw_js {
|
Line 1427 sub sub_page_kw_js {
|
hwdWin.focus(); |
hwdWin.focus(); |
var hDoc = hwdWin.document; |
var hDoc = hwdWin.document; |
hDoc.$docopen; |
hDoc.$docopen; |
hDoc.write("<html><head>"); |
hDoc.write('$start_page_highlight_central'); |
hDoc.write("<title>Highlight Central</title>"); |
|
|
|
hDoc.write("<script language=javascript>"); |
|
hDoc.write("function updateChoice(flag) {"); |
|
hDoc.write(" opener.document.SCORE.kwclr.value = opener.radioSelection(document.hlCenter.kwdclr);"); |
|
hDoc.write(" opener.document.SCORE.kwsize.value = opener.radioSelection(document.hlCenter.kwdsize);"); |
|
hDoc.write(" opener.document.SCORE.kwstyle.value = opener.radioSelection(document.hlCenter.kwdstyle);"); |
|
hDoc.write(" opener.document.SCORE.refresh.value = \\"on\\";"); |
|
hDoc.write(" if (opener.document.SCORE.keywords.value!=\\"\\"){"); |
|
hDoc.write(" opener.document.SCORE.submit();"); |
|
hDoc.write(" }"); |
|
hDoc.write(" self.close()"); |
|
hDoc.write("}"); |
|
|
|
hDoc.write("<"); |
|
hDoc.write("/script>"); |
|
|
|
hDoc.write("</head><body bgcolor=white>"); |
|
|
|
hDoc.write("<form action=\\"inactive\\" name=\\"hlCenter\\">"); |
hDoc.write("<form action=\\"inactive\\" name=\\"hlCenter\\">"); |
hDoc.write("<font color=\\"green\\" size=+1> Keyword Highlight Options</font><br /><br />"); |
hDoc.write("<font color=\\"green\\" size=+1> Keyword Highlight Options</font><br /><br />"); |
|
|
Line 1428 sub sub_page_kw_js {
|
Line 1455 sub sub_page_kw_js {
|
hDoc.write("<input type=\\"button\\" value=\\"Save\\" onClick=\\"javascript:updateChoice(1)\\"> "); |
hDoc.write("<input type=\\"button\\" value=\\"Save\\" onClick=\\"javascript:updateChoice(1)\\"> "); |
hDoc.write("<input type=\\"button\\" value=\\"Cancel\\" onClick=\\"self.close()\\"><br /><br />"); |
hDoc.write("<input type=\\"button\\" value=\\"Cancel\\" onClick=\\"self.close()\\"><br /><br />"); |
hDoc.write("</form>"); |
hDoc.write("</form>"); |
hDoc.write("</body></html>"); |
hDoc.write('$end_page_highlight_central'); |
hDoc.close(); |
hDoc.close(); |
} |
} |
|
|
Line 1436 sub sub_page_kw_js {
|
Line 1463 sub sub_page_kw_js {
|
SUBJAVASCRIPT |
SUBJAVASCRIPT |
} |
} |
|
|
|
sub get_increment { |
|
my $increment = $env{'form.increment'}; |
|
if ($increment != 1 && $increment != .5 && $increment != .25 && |
|
$increment != .1) { |
|
$increment = 1; |
|
} |
|
return $increment; |
|
} |
|
|
#--- displays the grading box, used in essay type problem and grading by page/sequence |
#--- displays the grading box, used in essay type problem and grading by page/sequence |
sub gradeBox { |
sub gradeBox { |
my ($request,$symb,$uname,$udom,$counter,$partid,$record) = @_; |
my ($request,$symb,$uname,$udom,$counter,$partid,$record) = @_; |
my $checkIcon = '<img src="'.$request->dir_config('lonIconsURL'). |
my $checkIcon = '<img alt="'.&mt('Check Mark'). |
|
'" src="'.$request->dir_config('lonIconsURL'). |
'/check.gif" height="16" border="0" />'; |
'/check.gif" height="16" border="0" />'; |
my $wgt = &Apache::lonnet::EXT('resource.'.$partid.'.weight',$symb,$udom,$uname); |
my $wgt = &Apache::lonnet::EXT('resource.'.$partid.'.weight',$symb,$udom,$uname); |
my $wgtmsg = ($wgt > 0 ? '(problem weight)' : |
my $wgtmsg = ($wgt > 0 ? '(problem weight)' : |
Line 1458 sub gradeBox {
|
Line 1495 sub gradeBox {
|
$result.='<table border="0"><tr><td>'. |
$result.='<table border="0"><tr><td>'. |
'<b>Part: </b>'.$display_part.' <b>Points: </b></td><td>'."\n"; |
'<b>Part: </b>'.$display_part.' <b>Points: </b></td><td>'."\n"; |
my $ctr = 0; |
my $ctr = 0; |
|
my $thisweight = 0; |
|
my $increment = &get_increment(); |
$result.='<table border="0"><tr>'."\n"; # display radio buttons in a nice table 10 across |
$result.='<table border="0"><tr>'."\n"; # display radio buttons in a nice table 10 across |
while ($ctr<=$wgt) { |
while ($thisweight<=$wgt) { |
$result.= '<td><nobr><label><input type="radio" name="RADVAL'.$counter.'_'.$partid.'" '. |
$result.= '<td><span style="white-space: nowrap;"><label><input type="radio" name="RADVAL'.$counter.'_'.$partid.'" '. |
'onclick="javascript:writeBox(this.form,\''.$counter.'_'.$partid.'\','. |
'onclick="javascript:writeBox(this.form,\''.$counter.'_'.$partid.'\','. |
$ctr.')" value="'.$ctr.'" '. |
$thisweight.')" value="'.$thisweight.'" '. |
($score eq $ctr ? 'checked':'').' /> '.$ctr."</label></nobr></td>\n"; |
($score eq $thisweight ? 'checked':'').' /> '.$thisweight."</label></span></td>\n"; |
$result.=(($ctr+1)%10 == 0 ? '</tr><tr>' : ''); |
$result.=(($ctr+1)%10 == 0 ? '</tr><tr>' : ''); |
|
$thisweight += $increment; |
$ctr++; |
$ctr++; |
} |
} |
$result.='</tr></table>'; |
$result.='</tr></table>'; |
Line 1479 sub gradeBox {
|
Line 1519 sub gradeBox {
|
$result.='<select name="GD_SEL'.$counter.'_'.$partid.'" '. |
$result.='<select name="GD_SEL'.$counter.'_'.$partid.'" '. |
'onChange="javascript:clearRadBox(this.form,\''.$counter.'_'.$partid.'\')" >'."\n"; |
'onChange="javascript:clearRadBox(this.form,\''.$counter.'_'.$partid.'\')" >'."\n"; |
if ($$record{'resource.'.$partid.'.solved'} eq 'excused') { |
if ($$record{'resource.'.$partid.'.solved'} eq 'excused') { |
$result.='<option> </option>'. |
$result.='<option></option>'. |
'<option selected="on">excused</option>'; |
'<option selected="on">excused</option>'; |
} else { |
} else { |
$result.='<option selected="on"> </option>'. |
$result.='<option selected="on"></option>'. |
'<option>excused</option>'; |
'<option>excused</option>'; |
} |
} |
$result.='<option>reset status</option></select>'."\n"; |
$result.='<option>reset status</option></select>'."\n"; |
$result.="  \n"; |
$result.=" \n"; |
$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 1504 sub handback_box {
|
Line 1544 sub handback_box {
|
my ($symb,$uname,$udom,$counter,$partid,$record) = @_; |
my ($symb,$uname,$udom,$counter,$partid,$record) = @_; |
my ($partlist,$handgrade,$responseType) = &response_type($symb); |
my ($partlist,$handgrade,$responseType) = &response_type($symb); |
my (@respids); |
my (@respids); |
foreach my $part_resp (sort(keys(%$handgrade))) { |
my @part_response_id = &flatten_responseType($responseType); |
my ($part,$resp) = split(/_/,$part_resp); |
foreach my $part_response_id (@part_response_id) { |
|
my ($part,$resp) = @{ $part_response_id }; |
if ($part eq $partid) { |
if ($part eq $partid) { |
push @respids,$resp; |
push(@respids,$resp); |
} |
} |
} |
} |
my $result; |
my $result; |
Line 1517 sub handback_box {
|
Line 1558 sub handback_box {
|
next if (!@$files); |
next if (!@$files); |
my $file_counter = 1; |
my $file_counter = 1; |
foreach my $file (@$files) { |
foreach my $file (@$files) { |
my ($file_disp) = ($file =~ m|.+/(.+)$|); |
if ($file =~ /\/portfolio\//) { |
$result.=&mt('Return commented version of [_1] to student.', |
my ($file_path, $file_disp) = ($file =~ m|(.+/)(.+)$|); |
'<span class="filename">'.$file_disp.'</span>'); |
my ($name,$version,$ext) = &file_name_version_ext($file_disp); |
$result.='<input type="file" name="'.$prefix.'returndoc'.$file_counter.'" />'."\n"; |
$file_disp = "$name.$ext"; |
$result.='<input type="hidden" name="'.$prefix.'origdoc'.$file_counter.'" value="'.$file.'" /><br />'; |
$file = $file_path.$file_disp; |
$file_counter++; |
$result.=&mt('Return commented version of [_1] to student.', |
|
'<span class="LC_filename">'.$file_disp.'</span>'); |
|
$result.='<input type="file" name="'.$prefix.'returndoc'.$file_counter.'" />'."\n"; |
|
$result.='<input type="hidden" name="'.$prefix.'origdoc'.$file_counter.'" value="'.$file.'" /><br />'; |
|
$result.='(File will be uploaded when you click on Save & Next below.)<br />'; |
|
$file_counter++; |
|
} |
} |
} |
} |
} |
return $result; |
return $result; |
} |
} |
|
|
sub show_problem { |
sub show_problem { |
my ($request,$symb,$uname,$udom,$removeform,$viewon,$mode) = @_; |
my ($request,$symb,$uname,$udom,$removeform,$viewon,$mode,$form) = @_; |
my $rendered; |
my $rendered; |
|
my %form = ((ref($form) eq 'HASH')? %{$form} : ()); |
&Apache::lonxml::remember_problem_counter(); |
&Apache::lonxml::remember_problem_counter(); |
if ($mode eq 'both' or $mode eq 'text') { |
if ($mode eq 'both' or $mode eq 'text') { |
$rendered=&Apache::loncommon::get_student_view($symb,$uname,$udom, |
$rendered=&Apache::loncommon::get_student_view($symb,$uname,$udom, |
$env{'request.course.id'}); |
$env{'request.course.id'}, |
|
undef,\%form); |
} |
} |
if ($removeform) { |
if ($removeform) { |
$rendered=~s|<form(.*?)>||g; |
$rendered=~s|<form(.*?)>||g; |
$rendered=~s|</form>||g; |
$rendered=~s|</form>||g; |
$rendered=~s|name="submit"|name="would_have_been_submit"|g; |
$rendered=~s|(<input[^>]*name\s*=\s*"?)(\w+)("?)|$1would_have_been_$2$3|g; |
} |
} |
my $companswer; |
my $companswer; |
if ($mode eq 'both' or $mode eq 'answer') { |
if ($mode eq 'both' or $mode eq 'answer') { |
&Apache::lonxml::restore_problem_counter(); |
&Apache::lonxml::restore_problem_counter(); |
$companswer=&Apache::loncommon::get_student_answers($symb,$uname,$udom, |
$companswer= |
$env{'request.course.id'}); |
&Apache::loncommon::get_student_answers($symb,$uname,$udom, |
|
$env{'request.course.id'}, |
|
%form); |
} |
} |
if ($removeform) { |
if ($removeform) { |
$companswer=~s|<form(.*?)>||g; |
$companswer=~s|<form(.*?)>||g; |
Line 1576 sub show_problem {
|
Line 1627 sub show_problem {
|
return $result; |
return $result; |
} |
} |
|
|
|
sub download_all_link { |
|
my ($r,$symb) = @_; |
|
my $all_students = |
|
join("\n", &Apache::loncommon::get_env_multiple('form.stuinfo')); |
|
|
|
my $parts = |
|
join("\n",&Apache::loncommon::get_env_multiple('form.vPart')); |
|
|
|
my $identifier = &Apache::loncommon::get_cgi_id(); |
|
&Apache::lonnet::appenv('cgi.'.$identifier.'.students' => $all_students, |
|
'cgi.'.$identifier.'.symb' => $symb, |
|
'cgi.'.$identifier.'.parts' => $parts,); |
|
$r->print('<a href="/cgi-bin/multidownload.pl?'.$identifier.'">'. |
|
&mt('Download All Submitted Documents').'</a>'); |
|
return |
|
} |
|
|
# --------------------------- show submissions of a student, option to grade |
# --------------------------- show submissions of a student, option to grade |
sub submission { |
sub submission { |
my ($request,$counter,$total) = @_; |
my ($request,$counter,$total) = @_; |
Line 1600 sub submission {
|
Line 1668 sub submission {
|
if (!$env{'form.vProb'}) { $env{'form.vProb'} = 'yes'; } |
if (!$env{'form.vProb'}) { $env{'form.vProb'} = 'yes'; } |
if (!$env{'form.vAns'}) { $env{'form.vAns'} = 'yes'; } |
if (!$env{'form.vAns'}) { $env{'form.vAns'} = 'yes'; } |
my $last = ($env{'form.lastSub'} eq 'last' ? 'last' : ''); |
my $last = ($env{'form.lastSub'} eq 'last' ? 'last' : ''); |
my $checkIcon = '<img src="'.$request->dir_config('lonIconsURL'). |
my $checkIcon = '<img alt="'.&mt('Check Mark'). |
|
'" src="'.$request->dir_config('lonIconsURL'). |
'/check.gif" height="16" border="0" />'; |
'/check.gif" height="16" border="0" />'; |
|
|
# header info |
# header info |
Line 1609 sub submission {
|
Line 1678 sub submission {
|
&sub_page_kw_js($request) if ($env{'form.handgrade'} eq 'yes'); |
&sub_page_kw_js($request) if ($env{'form.handgrade'} eq 'yes'); |
$env{'form.probTitle'} = $env{'form.probTitle'} eq '' ? |
$env{'form.probTitle'} = $env{'form.probTitle'} eq '' ? |
&Apache::lonnet::gettitle($symb) : $env{'form.probTitle'}; |
&Apache::lonnet::gettitle($symb) : $env{'form.probTitle'}; |
|
&download_all_link($request,$symb); |
$request->print('<h3> <font color="#339933">Submission Record</font></h3>'."\n". |
$request->print('<h3> <font color="#339933">Submission Record</font></h3>'."\n". |
'<font size=+1> <b>Resource: </b>'.$env{'form.probTitle'}.'</font>'."\n"); |
'<font size=+1> <b>Resource: </b>'.$env{'form.probTitle'}.'</font>'."\n"); |
|
|
Line 1712 KEYWORDS
|
Line 1781 KEYWORDS
|
# Load the other essays for similarity check |
# Load the other essays for similarity check |
# |
# |
my (undef,undef,$essayurl) = &Apache::lonnet::decode_symb($symb); |
my (undef,undef,$essayurl) = &Apache::lonnet::decode_symb($symb); |
my ($adom,$aname,$apath)=($essayurl=~/^(\w+)\/(\w+)\/(.*)$/); |
my ($adom,$aname,$apath)=($essayurl=~/^($LONCAPA::domain_re)\/($LONCAPA::username_re)\/(.*)$/); |
$apath=&Apache::lonnet::escape($apath); |
$apath=&escape($apath); |
$apath=~s/\W/\_/gs; |
$apath=~s/\W/\_/gs; |
%oldessays=&Apache::lonnet::dump('nohist_essay_'.$apath,$adom,$aname); |
%oldessays=&Apache::lonnet::dump('nohist_essay_'.$apath,$adom,$aname); |
} |
} |
Line 1818 KEYWORDS
|
Line 1887 KEYWORDS
|
$lastsubonly.='<tr><td bgcolor="#ffffe6">'.$$string[0]; |
$lastsubonly.='<tr><td bgcolor="#ffffe6">'.$$string[0]; |
} else { |
} else { |
my %seenparts; |
my %seenparts; |
for my $part (sort keys(%$handgrade)) { |
my @part_response_id = &flatten_responseType($responseType); |
my ($partid,$respid) = split(/_/,$part); |
foreach my $part (@part_response_id) { |
|
next if ($env{'form.lastSub'} eq 'hdgrade' |
|
&& $$handgrade{$$part[0].'_'.$$part[1]} ne 'yes'); |
|
|
|
my ($partid,$respid) = @{ $part }; |
my $display_part=&get_display_part($partid,$symb); |
my $display_part=&get_display_part($partid,$symb); |
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; } |
Line 1843 KEYWORDS
|
Line 1916 KEYWORDS
|
} |
} |
foreach (@$string) { |
foreach (@$string) { |
my ($partid,$respid) = /^resource\.([^\.]*)\.([^\.]*)\.submission/; |
my ($partid,$respid) = /^resource\.([^\.]*)\.([^\.]*)\.submission/; |
if ($part ne ($partid.'_'.$respid)) { next; } |
if (join('_',@{$part}) ne ($partid.'_'.$respid)) { next; } |
my ($ressub,$subval) = split(/:/,$_,2); |
my ($ressub,$subval) = split(/:/,$_,2); |
# Similarity check |
# Similarity check |
my $similar=''; |
my $similar=''; |
Line 1863 KEYWORDS
|
Line 1936 KEYWORDS
|
my $order=&get_order($partid,$respid,$symb,$uname,$udom); |
my $order=&get_order($partid,$respid,$symb,$uname,$udom); |
if ($env{'form.lastSub'} eq 'lastonly' || |
if ($env{'form.lastSub'} eq 'lastonly' || |
($env{'form.lastSub'} eq 'hdgrade' && |
($env{'form.lastSub'} eq 'hdgrade' && |
$$handgrade{$part} eq 'yes')) { |
$$handgrade{$$part[0].'_'.$$part[1]} eq 'yes')) { |
my $display_part=&get_display_part($partid,$symb); |
my $display_part=&get_display_part($partid,$symb); |
$lastsubonly.='<tr><td bgcolor="#ffffe6"><b>Part:</b> '. |
$lastsubonly.='<tr><td bgcolor="#ffffe6">Debug -'.'<b>Part:</b> '. |
$display_part.' <font color="#999999">( ID '.$respid. |
$display_part.' <font color="#999999">( hhhh ID '.$respid. |
' )</font> '; |
' )</font> '; |
my $files=&get_submitted_files($udom,$uname,$partid,$respid,\%record); |
my $files=&get_submitted_files($udom,$uname,$partid,$respid,\%record); |
if (@$files) { |
if (@$files) { |
Line 1931 KEYWORDS
|
Line 2004 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> ('. |
&mt('Compose message to student').(scalar(@col_fullnames) >= 1 ? 's' : '').'</a><label> ('. |
&mt('incl. grades').' <input type="checkbox" name="withgrades'.$counter.'" />)'. |
&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 /> ('. |
Line 1953 KEYWORDS
|
Line 2026 KEYWORDS
|
my %seen = (); |
my %seen = (); |
my @partlist; |
my @partlist; |
my @gradePartRespid; |
my @gradePartRespid; |
for my $part_resp (sort(keys(%$handgrade))) { |
my @part_response_id = &flatten_responseType($responseType); |
my ($partid,$respid) = split(/_/, $part_resp); |
foreach my $part_response_id (@part_response_id) { |
|
my ($partid,$respid) = @{ $part_response_id }; |
|
my $part_resp = join('_',@{ $part_response_id }); |
next if ($seen{$partid} > 0); |
next if ($seen{$partid} > 0); |
$seen{$partid}++; |
$seen{$partid}++; |
next if ($$handgrade{$part_resp} =~ /:no$/ && $env{'form.lastSub'} =~ /^(hdgrade)$/); |
next if ($$handgrade{$part_resp} ne 'yes' |
|
&& $env{'form.lastSub'} eq 'hdgrade'); |
push @partlist,$partid; |
push @partlist,$partid; |
push @gradePartRespid,$partid.'.'.$respid; |
push @gradePartRespid,$partid.'.'.$respid; |
$request->print(&gradeBox($request,$symb,$uname,$udom,$counter,$partid,\%record)); |
$request->print(&gradeBox($request,$symb,$uname,$udom,$counter,$partid,\%record)); |
Line 1992 KEYWORDS
|
Line 2068 KEYWORDS
|
'<input type="button" value="Next" '. |
'<input type="button" value="Next" '. |
'onClick="javascript:checksubmit(this.form,\'Next\');" TARGET=_self> '; |
'onClick="javascript:checksubmit(this.form,\'Next\');" TARGET=_self> '; |
$endform.='(Next and Previous (student) do not save the scores.)'."\n" ; |
$endform.='(Next and Previous (student) do not save the scores.)'."\n" ; |
|
$endform.="<input type='hidden' value='".&get_increment(). |
|
"' name='increment' />"; |
$endform.='</td><tr></table></form>'; |
$endform.='</td><tr></table></form>'; |
$endform.=&show_grading_menu_form($symb); |
$endform.=&show_grading_menu_form($symb); |
$request->print($endform); |
$request->print($endform); |
Line 2065 sub processHandGrade {
|
Line 2143 sub processHandGrade {
|
} |
} |
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 $encrypturl=&Apache::lonnet::EXT('resource.0.encrypturl', |
|
$symb,$udom,$uname); |
|
my ($feedurl,$baseurl,$showsymb,$messagetail); |
|
$feedurl = &Apache::lonnet::clutter($url); |
|
if ($encrypturl =~ /^yes$/i) { |
|
$baseurl = &Apache::lonenc::encrypted($feedurl,1); |
|
$showsymb = &Apache::lonenc::encrypted($symb,1); |
|
} else { |
|
$baseurl = $feedurl; |
|
$showsymb = $symb; |
|
} |
if ($includemsg =~ /savemsg|newmsg\Q$ctr\E/) { |
if ($includemsg =~ /savemsg|newmsg\Q$ctr\E/) { |
$subject = $env{'form.msgsub'} if ($includemsg =~ /msgsub/); |
$subject = $env{'form.msgsub'} if ($includemsg =~ /msgsub/); |
unless ($subject=~/\w/) { $subject=&mt('Grading Feedback'); } |
unless ($subject=~/\w/) { $subject=&mt('Grading Feedback'); } |
|
$subject.=' ['.$restitle.']'; |
my (@msgnum) = split(/,/,$includemsg); |
my (@msgnum) = split(/,/,$includemsg); |
foreach (@msgnum) { |
foreach (@msgnum) { |
$message.=$env{'form.'.$_} if ($_ =~ /savemsg|newmsg/ && $_ ne ''); |
$message.=$env{'form.'.$_} if ($_ =~ /savemsg|newmsg/ && $_ ne ''); |
Line 2075 sub processHandGrade {
|
Line 2166 sub processHandGrade {
|
$message =&Apache::lonfeedback::clear_out_html($message); |
$message =&Apache::lonfeedback::clear_out_html($message); |
if ($env{'form.withgrades'.$ctr}) { |
if ($env{'form.withgrades'.$ctr}) { |
$message.="\n\nPoint".($pts > 1 ? 's':'').' awarded = '.$pts.' out of '.$wgt; |
$message.="\n\nPoint".($pts > 1 ? 's':'').' awarded = '.$pts.' out of '.$wgt; |
$message.=" for <a href=\"". |
$messagetail = " for <a href=\"". |
&Apache::lonnet::clutter($url). |
$baseurl."?symb=$showsymb\">$env{'form.probTitle'}</a>"; |
"?symb=$symb\">$env{'form.probTitle'}</a>"; |
} |
} |
$msgstatus = |
$msgstatus = &Apache::lonmsg::user_normal_msg($uname,$udom, |
&Apache::lonmsg::user_normal_msg($uname,$udom,$subject, |
$subject.' ['. |
$message.$messagetail, |
&Apache::lonnet::declutter($url).']',$message); |
undef,$baseurl,undef, |
$request->print('<br />'.&mt('Sending message to [_1]@[_2]',$uname,$udom).': '. |
undef,undef,$showsymb, |
|
$restitle); |
|
$request->print('<br />'.&mt('Sending message to [_1]:[_2]',$uname,$udom).': '. |
$msgstatus); |
$msgstatus); |
} |
} |
if ($env{'form.collaborator'.$ctr}) { |
if ($env{'form.collaborator'.$ctr}) { |
Line 2094 sub processHandGrade {
|
Line 2187 sub processHandGrade {
|
&saveHandGrade($request,$symb,$collaborator,$udom,$ctr, |
&saveHandGrade($request,$symb,$collaborator,$udom,$ctr, |
$env{'form.unamedom'.$ctr},$part); |
$env{'form.unamedom'.$ctr},$part); |
if ($errorflag eq 'not_allowed') { |
if ($errorflag eq 'not_allowed') { |
$request->print("<font color=\"red\">Not allowed to modify grades for $collaborator:$udom</font>"); |
$request->print("<span class=\"LC_error\">".&mt('Not allowed to modify grades for [_1]',"$collaborator:$udom")."</span>"); |
next; |
next; |
} else { |
} else { |
if ($message ne '') { |
if ($message ne '') { |
$msgstatus = &Apache::lonmsg::user_normal_msg($collaborator,$udom,$env{'form.msgsub'},$message); |
$encrypturl= |
|
&Apache::lonnet::EXT('resource.0.encrypturl', |
|
$symb,$udom,$collaborator); |
|
if ($encrypturl =~ /^yes$/i) { |
|
$baseurl = &Apache::lonenc::encrypted($feedurl,1); |
|
$showsymb = &Apache::lonenc::encrypted($symb,1); |
|
} else { |
|
$baseurl = $feedurl; |
|
$showsymb = $symb; |
|
} |
|
if ($env{'form.withgrades'.$ctr}) { |
|
$messagetail = " for <a href=\"". |
|
$baseurl."?symb=$showsymb\">$env{'form.probTitle'}</a>"; |
|
|
|
} |
|
$msgstatus = |
|
&Apache::lonmsg::user_normal_msg($collaborator,$udom,$subject,$message.$messagetail,undef,$baseurl,undef,undef,undef,$showsymb,$restitle); |
} |
} |
} |
} |
} |
} |
Line 2269 sub processHandGrade {
|
Line 2378 sub processHandGrade {
|
#---- Save the score and award for each student, if changed |
#---- Save the score and award for each student, if changed |
sub saveHandGrade { |
sub saveHandGrade { |
my ($request,$symb,$stuname,$domain,$newflg,$submitter,$part) = @_; |
my ($request,$symb,$stuname,$domain,$newflg,$submitter,$part) = @_; |
my @v_flag; |
my @version_parts; |
my $usec = &Apache::lonnet::getsection($domain,$stuname, |
my $usec = &Apache::lonnet::getsection($domain,$stuname, |
$env{'request.course.id'}); |
$env{'request.course.id'}); |
if (!&canmodify($usec)) { return('not_allowed'); } |
if (!&canmodify($usec)) { return('not_allowed'); } |
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) = ('',''); |
my %aggregate = (); |
my %aggregate = (); |
my $aggregateflag = 0; |
my $aggregateflag = 0; |
|
|
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 may vary for different parts |
#collaborator ($submi may vary for different parts |
if ($submitter && $new_part ne $part) { next; } |
if ($submitter && $new_part ne $part) { next; } |
my $dropMenu = $env{'form.GD_SEL'.$newflg.'_'.$new_part}; |
my $dropMenu = $env{'form.GD_SEL'.$newflg.'_'.$new_part}; |
if ($dropMenu eq 'excused') { |
if ($dropMenu eq 'excused') { |
Line 2291 sub saveHandGrade {
|
Line 2399 sub saveHandGrade {
|
if (exists($record{'resource.'.$new_part.'.awarded'})) { |
if (exists($record{'resource.'.$new_part.'.awarded'})) { |
$newrecord{'resource.'.$new_part.'.awarded'} = ''; |
$newrecord{'resource.'.$new_part.'.awarded'} = ''; |
} |
} |
$newrecord{'resource.'.$new_part.'.regrader'}="$env{'user.name'}:$env{'user.domain'}"; |
$newrecord{'resource.'.$new_part.'.regrader'}="$env{'user.name'}:$env{'user.domain'}"; |
} |
} |
} elsif ($dropMenu eq 'reset status' |
} elsif ($dropMenu eq 'reset status' |
&& exists($record{'resource.'.$new_part.'.solved'})) { #don't bother if no old records -> no attempts |
&& exists($record{'resource.'.$new_part.'.solved'})) { #don't bother if no old records -> no attempts |
Line 2327 sub saveHandGrade {
|
Line 2435 sub saveHandGrade {
|
my $partial= $pts/$wgt; |
my $partial= $pts/$wgt; |
if ($partial eq $record{'resource.'.$new_part.'.awarded'}) { |
if ($partial eq $record{'resource.'.$new_part.'.awarded'}) { |
#do not update score for part if not changed. |
#do not update score for part if not changed. |
|
&handback_files($request,$symb,$stuname,$domain,$newflg,$new_part,\%newrecord); |
next; |
next; |
} else { |
} else { |
push @parts_graded, $new_part; |
push @parts_graded, $new_part; |
Line 2351 sub saveHandGrade {
|
Line 2460 sub saveHandGrade {
|
$newrecord{'resource.'.$new_part.'.regrader'}= |
$newrecord{'resource.'.$new_part.'.regrader'}= |
"$env{'user.name'}:$env{'user.domain'}"; |
"$env{'user.name'}:$env{'user.domain'}"; |
} |
} |
my ($partlist,$handgrade,$responseType) = &response_type($symb); |
|
foreach my $part_resp (sort(keys(%$handgrade))) { |
|
my ($part_id, $resp_id) = split(/_/,$part_resp); |
|
if (($env{'form.'.$newflg.'_'.$part_resp.'_returndoc1'}) && ($new_part == $part_id)) { |
|
# if multiple files are uploaded names will be 'returndoc2','returndoc3' |
|
my $file_counter = 1; |
|
while ($env{'form.'.$newflg.'_'.$part_resp.'_returndoc'.$file_counter}) { |
|
my $fname=$env{'form.'.$newflg.'_'.$part_resp.'_returndoc'.$file_counter.'.filename'}; |
|
$newrecord{"resource.$new_part.$resp_id.handback"} = $env{'form.returndocorig'.$file_counter}; |
|
# set the filename to match the submitted file name |
|
$env{'form.'.$newflg.'_'.$part_resp.'_returndoc1.filename'} = $env{'form.'.$newflg.'_'.$part_resp.'_origdoc'.$file_counter}; |
|
my $result=&Apache::lonnet::userfileupload($newflg.'_'.$part_resp.'_returndoc'.$file_counter,'', |
|
'portfolio',undef,undef,undef,$stuname,$domain); |
|
if ($result !~ m|^/uploaded/|) { |
|
$request->print('<font color="red"> An errror occured ('.$result. |
|
') while trying to upload '.&display_file().'</font><br />'); |
|
# $request->print(&done('Back')); |
|
} |
|
$request->print("<br />".$fname." will be the uploaded file name"); |
|
$request->print("<font color=\"red\">Will upload document</font>".$env{'form.'.$newflg.'_'.$part_resp.'_origdoc'.$file_counter}); |
|
$file_counter++; |
|
} |
|
} |
|
} |
|
|
|
# unless problem has been graded, set flag to version the submitted files |
# unless problem has been graded, set flag to version the submitted files |
unless ($record{'resource.'.$new_part.'.solved'} =~ /^correct_/ || |
unless ($record{'resource.'.$new_part.'.solved'} =~ /^correct_/ || |
$record{'resource.'.$new_part.'.solved'} eq 'incorrect_by_override' || |
$record{'resource.'.$new_part.'.solved'} eq 'incorrect_by_override' || |
$dropMenu eq 'reset status') |
$dropMenu eq 'reset status') |
{ |
{ |
push (@v_flag,$new_part); |
push (@version_parts,$new_part); |
} |
} |
} |
} |
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'}; |
|
|
if (scalar(keys(%newrecord)) > 0) { |
if (%newrecord) { |
if (scalar(@v_flag)) { |
if (@version_parts) { |
&version_portfiles(\%record, \@parts_graded, $env{'request.course.id'}, $symb, $domain, $stuname, \@v_flag); |
my @changed_keys = &version_portfiles(\%record, \@parts_graded, |
|
$env{'request.course.id'}, $symb, $domain, $stuname, \@version_parts); |
|
@newrecord{@changed_keys} = @record{@changed_keys}; |
|
foreach my $new_part (@version_parts) { |
|
&handback_files($request,$symb,$stuname,$domain,$newflg, |
|
$new_part,\%newrecord); |
|
} |
} |
} |
&Apache::lonnet::cstore(\%newrecord,$symb, |
&Apache::lonnet::cstore(\%newrecord,$symb, |
$env{'request.course.id'},$domain,$stuname); |
$env{'request.course.id'},$domain,$stuname); |
|
&check_and_remove_from_queue(\@parts,\%record,\%newrecord,$symb, |
my @ungraded_parts; |
$cdom,$cnum,$domain,$stuname); |
foreach my $part (@parts) { |
|
if ( !defined($record{'resource.'.$part.'.awarded'}) |
|
&& !defined($newrecord{'resource.'.$part.'.awarded'}) ) { |
|
push(@ungraded_parts, $part); |
|
} |
|
} |
|
if ( !@ungraded_parts ) { |
|
&Apache::bridgetask::remove_from_queue('gradingqueue',$symb,$cdom, |
|
$cnum,$domain,$stuname); |
|
} |
|
} |
} |
if ($aggregateflag) { |
if ($aggregateflag) { |
&Apache::lonnet::cinc('nohist_resourcetracker',\%aggregate, |
&Apache::lonnet::cinc('nohist_resourcetracker',\%aggregate, |
Line 2413 sub saveHandGrade {
|
Line 2493 sub saveHandGrade {
|
return ('',$pts,$wgt); |
return ('',$pts,$wgt); |
} |
} |
|
|
|
sub check_and_remove_from_queue { |
|
my ($parts,$record,$newrecord,$symb,$cdom,$cnum,$domain,$stuname) = @_; |
|
my @ungraded_parts; |
|
foreach my $part (@{$parts}) { |
|
if ( $record->{ 'resource.'.$part.'.awarded'} eq '' |
|
&& $record->{ 'resource.'.$part.'.solved' } ne 'excused' |
|
&& $newrecord->{'resource.'.$part.'.awarded'} eq '' |
|
&& $newrecord->{'resource.'.$part.'.solved' } ne 'excused' |
|
) { |
|
push(@ungraded_parts, $part); |
|
} |
|
} |
|
if ( !@ungraded_parts ) { |
|
&Apache::bridgetask::remove_from_queue('gradingqueue',$symb,$cdom, |
|
$cnum,$domain,$stuname); |
|
} |
|
} |
|
|
|
sub handback_files { |
|
my ($request,$symb,$stuname,$domain,$newflg,$new_part,$newrecord) = @_; |
|
my $portfolio_root = &propath($domain,$stuname).'/userfiles/portfolio'; |
|
my ($partlist,$handgrade,$responseType) = &response_type($symb); |
|
|
|
my @part_response_id = &flatten_responseType($responseType); |
|
foreach my $part_response_id (@part_response_id) { |
|
my ($part_id,$resp_id) = @{ $part_response_id }; |
|
my $part_resp = join('_',@{ $part_response_id }); |
|
if (($env{'form.'.$newflg.'_'.$part_resp.'_returndoc1'}) && ($new_part == $part_id)) { |
|
# if multiple files are uploaded names will be 'returndoc2','returndoc3' |
|
my $file_counter = 1; |
|
my $file_msg; |
|
while ($env{'form.'.$newflg.'_'.$part_resp.'_returndoc'.$file_counter}) { |
|
my $fname=$env{'form.'.$newflg.'_'.$part_resp.'_returndoc'.$file_counter.'.filename'}; |
|
my ($directory,$answer_file) = |
|
($env{'form.'.$newflg.'_'.$part_resp.'_origdoc'.$file_counter} =~ /^(.*?)([^\/]*)$/); |
|
my ($answer_name,$answer_ver,$answer_ext) = |
|
&file_name_version_ext($answer_file); |
|
my ($portfolio_path) = ($directory =~ /^.+$stuname\/portfolio(.*)/); |
|
my @dir_list = &Apache::lonnet::dirlist($portfolio_path,$domain,$stuname,$portfolio_root); |
|
my $version = &get_next_version($answer_name, $answer_ext, \@dir_list); |
|
# fix file name |
|
my ($save_file_name) = (($directory.$answer_name.".$version.".$answer_ext) =~ /^.+\/${stuname}\/(.*)/); |
|
my $result=&Apache::lonnet::finishuserfileupload($stuname,$domain, |
|
$newflg.'_'.$part_resp.'_returndoc'.$file_counter, |
|
$save_file_name); |
|
if ($result !~ m|^/uploaded/|) { |
|
$request->print('<font color="red"> An errror occured ('.$result. |
|
') while trying to upload '.$newflg.'_'.$part_resp.'_returndoc'.$file_counter.'</font><br />'); |
|
} else { |
|
# mark the file as read only |
|
my @files = ($save_file_name); |
|
my @what = ($symb,$env{'request.course.id'},'handback'); |
|
&Apache::lonnet::mark_as_readonly($domain,$stuname,\@files,\@what); |
|
if (exists($$newrecord{"resource.$new_part.$resp_id.handback"})) { |
|
$$newrecord{"resource.$new_part.$resp_id.handback"}.=','; |
|
} |
|
$$newrecord{"resource.$new_part.$resp_id.handback"} .= $save_file_name; |
|
$file_msg.= "\n".'<br /><span class="LC_filename"><a href="/uploaded/'."$domain/$stuname/".$save_file_name.'">'.$save_file_name."</a></span><br />"; |
|
|
|
} |
|
$request->print("<br />".$fname." will be the uploaded file name"); |
|
$request->print(" ".$env{'form.'.$newflg.'_'.$part_resp.'_origdoc'.$file_counter}); |
|
$file_counter++; |
|
} |
|
my $subject = "File Handed Back by Instructor "; |
|
my $message = "A file has been returned that was originally submitted in reponse to: <br />"; |
|
$message .= "<strong>".&Apache::lonnet::gettitle($symb)."</strong><br />"; |
|
$message .= ' The returned file(s) are named: '. $file_msg; |
|
$message .= " and can be found in your portfolio space."; |
|
my $url = (&Apache::lonnet::decode_symb($symb))[2]; |
|
my $feedurl = &Apache::lonnet::clutter($url); |
|
my $encrypturl=&Apache::lonnet::EXT('resource.0.encrypturl', |
|
$symb,$domain,$stuname); |
|
my ($baseurl,$showsymb); |
|
if ($encrypturl =~ /^yes$/i) { |
|
$baseurl = &Apache::lonenc::encrypted($feedurl,1); |
|
$showsymb = &Apache::lonenc::encrypted($symb,1); |
|
} else { |
|
$baseurl = $feedurl; |
|
$showsymb = $symb; |
|
} |
|
my $restitle = &Apache::lonnet::gettitle($symb); |
|
my $msgstatus = |
|
&Apache::lonmsg::user_normal_msg($stuname,$domain,$subject. |
|
' (File Returned) ['.$restitle.']',$message,undef, |
|
$baseurl,undef,undef,undef,$showsymb,$restitle); |
|
} |
|
} |
|
return; |
|
} |
|
|
sub get_submitted_files { |
sub get_submitted_files { |
my ($udom,$uname,$partid,$respid,$record) = @_; |
my ($udom,$uname,$partid,$respid,$record) = @_; |
my @files; |
my @files; |
Line 2491 sub get_last_resets {
|
Line 2662 sub get_last_resets {
|
sub version_portfiles { |
sub version_portfiles { |
my ($record, $parts_graded, $courseid, $symb, $domain, $stu_name, $v_flag) = @_; |
my ($record, $parts_graded, $courseid, $symb, $domain, $stu_name, $v_flag) = @_; |
my $version_parts = join('|',@$v_flag); |
my $version_parts = join('|',@$v_flag); |
|
my @returned_keys; |
my $parts = join('|', @$parts_graded); |
my $parts = join('|', @$parts_graded); |
my $portfolio_root = &Apache::loncommon::propath($domain, |
my $portfolio_root = &propath($domain,$stu_name). |
$stu_name). |
'/userfiles/portfolio'; |
'/userfiles/portfolio'; |
|
foreach my $key (keys(%$record)) { |
foreach my $key (keys(%$record)) { |
my $new_portfiles; |
my $new_portfiles; |
if ($key =~ /^resource\.($version_parts)\./ && $key =~ /\.portfiles$/ ) { |
if ($key =~ /^resource\.($version_parts)\./ && $key =~ /\.portfiles$/ ) { |
my @v_portfiles; |
my @versioned_portfiles; |
my @portfiles = split(/,/,$$record{$key}); |
my @portfiles = split(/\s*,\s*/,$$record{$key}); |
foreach my $file (@portfiles) { |
foreach my $file (@portfiles) { |
&Apache::lonnet::unmark_as_readonly($domain,$stu_name,[$symb,$env{'request.course.id'}],$file); |
&Apache::lonnet::unmark_as_readonly($domain,$stu_name,[$symb,$env{'request.course.id'}],$file); |
my ($directory,$answer_file) =($file =~ /^(.*?)([^\/]*)$/); |
my ($directory,$answer_file) =($file =~ /^(.*?)([^\/]*)$/); |
my $version = 0; |
|
my ($answer_name,$answer_ver,$answer_ext) = |
my ($answer_name,$answer_ver,$answer_ext) = |
&file_name_version_ext($answer_file); |
&file_name_version_ext($answer_file); |
my @dir_list = &Apache::lonnet::dirlist($directory,$domain,$stu_name,$portfolio_root); |
my @dir_list = &Apache::lonnet::dirlist($directory,$domain,$stu_name,$portfolio_root); |
$version = &get_next_version($answer_name, $answer_ext, \@dir_list); |
my $version = &get_next_version($answer_name, $answer_ext, \@dir_list); |
my $new_answer = &version_selected_portfile($domain, $stu_name, $directory, $answer_file, $version); |
my $new_answer = &version_selected_portfile($domain, $stu_name, $directory, $answer_file, $version); |
if ($new_answer ne 'problem getting file') { |
if ($new_answer ne 'problem getting file') { |
push(@v_portfiles, $directory.$new_answer); |
push(@versioned_portfiles, $directory.$new_answer); |
&Apache::lonnet::mark_as_readonly($domain,$stu_name, |
&Apache::lonnet::mark_as_readonly($domain,$stu_name, |
['/portfolio'.$directory.$new_answer], |
[$directory.$new_answer], |
[$symb,$env{'request.course.id'},'graded']); |
[$symb,$env{'request.course.id'},'graded']); |
} |
} |
|
|
} |
} |
$$record{$key} = join(',',@v_portfiles); |
$$record{$key} = join(',',@versioned_portfiles); |
|
push(@returned_keys,$key); |
} |
} |
} |
} |
return 'ok'; |
return (@returned_keys); |
} |
} |
|
|
sub get_next_version { |
sub get_next_version { |
my ($answer_name, $answer_ext, $dir_list); |
my ($answer_name, $answer_ext, $dir_list) = @_; |
my $version; |
my $version; |
foreach my $row (@$dir_list) { |
foreach my $row (@$dir_list) { |
my ($file) = split(/\&/,$row,2); |
my ($file) = split(/\&/,$row,2); |
Line 2794 sub viewgrades {
|
Line 2964 sub viewgrades {
|
'<table border=0><tr bgcolor="#ffffdd"><td>'; |
'<table border=0><tr bgcolor="#ffffdd"><td>'; |
#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 ($partlist,$handgrade) = &response_type($symb); |
my ($partlist,$handgrade,$responseType) = &response_type($symb); |
my %weight = (); |
my %weight = (); |
my $ctsparts = 0; |
my $ctsparts = 0; |
$result.='<table border="0">'; |
$result.='<table border="0">'; |
my %seen = (); |
my %seen = (); |
for (sort keys(%$handgrade)) { |
my @part_response_id = &flatten_responseType($responseType); |
my ($partid,$respid) = split (/_/,$_,2); |
foreach my $part_response_id (@part_response_id) { |
|
my ($partid,$respid) = @{ $part_response_id }; |
|
my $part_resp = join('_',@{ $part_response_id }); |
next if $seen{$partid}; |
next if $seen{$partid}; |
$seen{$partid}++; |
$seen{$partid}++; |
my $handgrade=$$handgrade{$_}; |
my $handgrade=$$handgrade{$part_resp}; |
my $wgt = &Apache::lonnet::EXT('resource.'.$partid.'.weight',$symb); |
my $wgt = &Apache::lonnet::EXT('resource.'.$partid.'.weight',$symb); |
$weight{$partid} = $wgt eq '' ? '1' : $wgt; |
$weight{$partid} = $wgt eq '' ? '1' : $wgt; |
|
|
Line 2838 sub viewgrades {
|
Line 3010 sub viewgrades {
|
} |
} |
$result.='</table>'.'</td></tr></table>'.'</td></tr></table>'."\n". |
$result.='</table>'.'</td></tr></table>'.'</td></tr></table>'."\n". |
'<input type="hidden" name="totalparts" value="'.$ctsparts.'" />'; |
'<input type="hidden" name="totalparts" value="'.$ctsparts.'" />'; |
$result.='<input type="button" value="Reset" '. |
$result.='<input type="button" value="Revert to Default" '. |
'onClick="javascript:resetEntry('.$ctsparts.');" TARGET=_self>'; |
'onClick="javascript:resetEntry('.$ctsparts.');" TARGET=_self>'; |
|
|
#table listing all the students in a section/class |
#table listing all the students in a section/class |
Line 3362 sub upcsvScores_form {
|
Line 3534 sub upcsvScores_form {
|
$result.=$table; |
$result.=$table; |
$result.='<br /><table width="100%" border="0"><tr><td bgcolor="#777777">'."\n"; |
$result.='<br /><table width="100%" border="0"><tr><td bgcolor="#777777">'."\n"; |
$result.='<table width="100%" border="0"><tr bgcolor="#e6ffff"><td>'."\n"; |
$result.='<table width="100%" border="0"><tr bgcolor="#e6ffff"><td>'."\n"; |
$result.=' <b>Specify a file containing the class scores for current resource'. |
$result.=' <b>'.&mt('Specify a file containing the class scores for current resource'). |
'.</b></td></tr>'."\n"; |
'.</b></td></tr>'."\n"; |
$result.='<tr bgcolor=#ffffe6><td>'."\n"; |
$result.='<tr bgcolor=#ffffe6><td>'."\n"; |
|
my $upload=&mt("Upload Scores"); |
my $upfile_select=&Apache::loncommon::upfile_select_html(); |
my $upfile_select=&Apache::loncommon::upfile_select_html(); |
my $ignore=&mt('Ignore First Line'); |
my $ignore=&mt('Ignore First Line'); |
$result.=<<ENDUPFORM; |
$result.=<<ENDUPFORM; |
Line 3374 sub upcsvScores_form {
|
Line 3547 sub upcsvScores_form {
|
<input type="hidden" name="probTitle" value="$env{'form.probTitle'}" /> |
<input type="hidden" name="probTitle" value="$env{'form.probTitle'}" /> |
<input type="hidden" name="saveState" value="$env{'form.saveState'}" /> |
<input type="hidden" name="saveState" value="$env{'form.saveState'}" /> |
$upfile_select |
$upfile_select |
<br /><input type="button" onClick="javascript:checkUpload(this.form);" value="Upload Scores" /> |
<br /><input type="button" onClick="javascript:checkUpload(this.form);" value="$upload" /> |
<label><input type="checkbox" name="noFirstLine" />$ignore</label> |
<label><input type="checkbox" name="noFirstLine" />$ignore</label> |
</form> |
</form> |
ENDUPFORM |
ENDUPFORM |
$result.='</td></tr></table>'."\n"; |
$result.=&Apache::loncommon::help_open_topic("Course_Convert_To_CSV", |
|
&mt("How do I create a CSV file from a spreadsheet")) |
|
.'</td></tr></table>'."\n"; |
$result.='</td></tr></table><br /><br />'."\n"; |
$result.='</td></tr></table><br /><br />'."\n"; |
$result.=&show_grading_menu_form($symb); |
$result.=&show_grading_menu_form($symb); |
return $result; |
return $result; |
Line 3494 sub csvuploadassign {
|
Line 3669 sub csvuploadassign {
|
my ($request)= @_; |
my ($request)= @_; |
my ($symb)=&get_symb($request); |
my ($symb)=&get_symb($request); |
if (!$symb) {return '';} |
if (!$symb) {return '';} |
|
my $error_msg = ''; |
&Apache::loncommon::load_tmp_file($request); |
&Apache::loncommon::load_tmp_file($request); |
my @gradedata = &Apache::loncommon::upfile_record_sep(); |
my @gradedata = &Apache::loncommon::upfile_record_sep(); |
if ($env{'form.noFirstLine'}) { shift(@gradedata); } |
if ($env{'form.noFirstLine'}) { shift(@gradedata); } |
Line 3546 sub csvuploadassign {
|
Line 3722 sub csvuploadassign {
|
my $part=$1; |
my $part=$1; |
my $wgt =&Apache::lonnet::EXT('resource.'.$part.'.weight', |
my $wgt =&Apache::lonnet::EXT('resource.'.$part.'.weight', |
$symb,$domain,$username); |
$symb,$domain,$username); |
$entries{$fields{$dest}}=~s/\s//g; |
if ($wgt) { |
my $pcr=$entries{$fields{$dest}} / $wgt; |
$entries{$fields{$dest}}=~s/\s//g; |
my $award='correct_by_override'; |
my $pcr=$entries{$fields{$dest}} / $wgt; |
$grades{"resource.$part.awarded"}=$pcr; |
my $award='correct_by_override'; |
$grades{"resource.$part.solved"}=$award; |
$grades{"resource.$part.awarded"}=$pcr; |
$points{$part}=1; |
$grades{"resource.$part.solved"}=$award; |
|
$points{$part}=1; |
|
} else { |
|
$error_msg = "<br />" . |
|
&mt("Some point values were assigned" |
|
." for problems with a weight " |
|
."of zero. These values were " |
|
."ignored."); |
|
} |
} else { |
} else { |
if ($dest=~/stores_(.*)_awarded/) { if ($points{$1}) {next;} } |
if ($dest=~/stores_(.*)_awarded/) { if ($points{$1}) {next;} } |
if ($dest=~/stores_(.*)_solved/) { if ($points{$1}) {next;} } |
if ($dest=~/stores_(.*)_solved/) { if ($points{$1}) {next;} } |
Line 3591 sub csvuploadassign {
|
Line 3775 sub csvuploadassign {
|
} |
} |
$request->print("<br />\n"); |
$request->print("<br />\n"); |
$request->print(&show_grading_menu_form($symb)); |
$request->print(&show_grading_menu_form($symb)); |
return ''; |
return $error_msg; |
} |
} |
#------------- end of section for handling csv file upload --------- |
#------------- end of section for handling csv file upload --------- |
# |
# |
Line 3667 LISTJAVASCRIPT
|
Line 3851 LISTJAVASCRIPT
|
'<input type="hidden" name="symb" value="'.$symb.'" />'."\n". |
'<input type="hidden" name="symb" value="'.$symb.'" />'."\n". |
'<input type="hidden" name="saveState" value="'.$env{'form.saveState'}.'" />'."<br />\n"; |
'<input type="hidden" name="saveState" value="'.$env{'form.saveState'}.'" />'."<br />\n"; |
|
|
|
$result.=' <b>'.&mt('Use CODE:').' </b>'. |
|
'<input type="text" name="CODE" value="" /><br />'."\n"; |
|
|
$result.=' <input type="button" '. |
$result.=' <input type="button" '. |
'onClick="javascript:checkPickOne(this.form);"value="Next->" /><br />'."\n"; |
'onClick="javascript:checkPickOne(this.form);"value="Next->" /><br />'."\n"; |
|
|
Line 3697 LISTJAVASCRIPT
|
Line 3884 LISTJAVASCRIPT
|
$studentTable.=($ptr%2 == 0 ? '</td></tr>' : ''); |
$studentTable.=($ptr%2 == 0 ? '</td></tr>' : ''); |
$ptr++; |
$ptr++; |
} |
} |
$studentTable.='</td><td> </td><td> ' if ($ptr%2 == 0); |
$studentTable.='</td><td> </td><td> </td></tr>' if ($ptr%2 == 0); |
$studentTable.='</td></tr></table></td></tr></table>'."\n"; |
$studentTable.='</table></td></tr></table>'."\n"; |
$studentTable.='<input type="button" '. |
$studentTable.='<input type="button" '. |
'onClick="javascript:checkPickOne(this.form);"value="Next->" /></form>'."\n"; |
'onClick="javascript:checkPickOne(this.form);"value="Next->" /></form>'."\n"; |
|
|
Line 3721 sub getSymbMap {
|
Line 3908 sub getSymbMap {
|
1,0,1); |
1,0,1); |
for my $sequence ($navmap->getById('0.0'), @sequences) { |
for my $sequence ($navmap->getById('0.0'), @sequences) { |
if ($navmap->hasResource($sequence, sub { shift->is_problem(); }, 0) ) { |
if ($navmap->hasResource($sequence, sub { shift->is_problem(); }, 0) ) { |
my $title = $minder.'.'.$sequence->compTitle(); |
my $title = $minder.'.'. |
push @titles, $title; # minder in case two titles are identical |
&HTML::Entities::encode($sequence->compTitle(),'"\'&'); |
$symbx{$title} = $sequence->symb(); |
push(@titles, $title); # minder in case two titles are identical |
|
$symbx{$title} = &HTML::Entities::encode($sequence->symb(),'"\'&'); |
$minder++; |
$minder++; |
} |
} |
} |
} |
Line 3759 sub displayPage {
|
Line 3947 sub displayPage {
|
my $result='<h3><font color="#339933"> '.$env{'form.title'}.'</font></h3>'; |
my $result='<h3><font color="#339933"> '.$env{'form.title'}.'</font></h3>'; |
$result.='<h3> Student: '.&nameUserString(undef,$$fullname{$env{'form.student'}},$uname,$udom). |
$result.='<h3> Student: '.&nameUserString(undef,$$fullname{$env{'form.student'}},$uname,$udom). |
'</h3>'."\n"; |
'</h3>'."\n"; |
|
if (&Apache::lonnet::validCODE($env{'form.CODE'})) { |
|
$result.='<h3> CODE: '.$env{'form.CODE'}.'</h3>'."\n"; |
|
} else { |
|
delete($env{'form.CODE'}); |
|
} |
&sub_page_js($request); |
&sub_page_js($request); |
$request->print($result); |
$request->print($result); |
|
|
Line 3783 sub displayPage {
|
Line 3976 sub displayPage {
|
'<input type="hidden" name="overRideScore" value="no" />'."\n". |
'<input type="hidden" name="overRideScore" value="no" />'."\n". |
'<input type="hidden" name="saveState" value="'.$env{'form.saveState'}.'" />'."\n"; |
'<input type="hidden" name="saveState" value="'.$env{'form.saveState'}.'" />'."\n"; |
|
|
my $checkIcon = '<img src="'.$request->dir_config('lonIconsURL'). |
if (defined($env{'form.CODE'})) { |
|
$studentTable.= |
|
'<input type="hidden" name="CODE" value="'.$env{'form.CODE'}.'" />'."\n"; |
|
} |
|
my $checkIcon = '<img alt="'.&mt('Check Mark'). |
|
'" src="'.$request->dir_config('lonIconsURL'). |
'/check.gif" height="16" border="0" />'; |
'/check.gif" height="16" border="0" />'; |
|
|
$studentTable.=' <b>Note:</b> Problems graded correct by the computer are marked with a '.$checkIcon. |
$studentTable.=' <b>Note:</b> Problems graded correct by the computer are marked with a '.$checkIcon. |
Line 3801 sub displayPage {
|
Line 3999 sub displayPage {
|
if($curRes == $iterator->BEGIN_MAP) { $depth++; } |
if($curRes == $iterator->BEGIN_MAP) { $depth++; } |
if($curRes == $iterator->END_MAP) { $depth--; } |
if($curRes == $iterator->END_MAP) { $depth--; } |
|
|
if (ref($curRes) && $curRes->is_problem() && !$curRes->randomout) { |
if (ref($curRes) && $curRes->is_problem()) { |
my $parts = $curRes->parts(); |
my $parts = $curRes->parts(); |
my $title = $curRes->compTitle(); |
my $title = $curRes->compTitle(); |
my $symbx = $curRes->symb(); |
my $symbx = $curRes->symb(); |
$studentTable.='<tr bgcolor="#ffffe6"><td align="center" valign="top" >'.$prob. |
$studentTable.='<tr bgcolor="#ffffe6"><td align="center" valign="top" >'.$prob. |
(scalar(@{$parts}) == 1 ? '' : '<br />('.scalar(@{$parts}).' parts)').'</td>'; |
(scalar(@{$parts}) == 1 ? '' : '<br />('.scalar(@{$parts}).' parts)').'</td>'; |
$studentTable.='<td valign="top">'; |
$studentTable.='<td valign="top">'; |
|
my %form = ('CODE' => $env{'form.CODE'},); |
if ($env{'form.vProb'} eq 'yes' ) { |
if ($env{'form.vProb'} eq 'yes' ) { |
$studentTable.=&show_problem($request,$symbx,$uname,$udom,1, |
$studentTable.=&show_problem($request,$symbx,$uname,$udom,1, |
undef,'both'); |
undef,'both',\%form); |
} else { |
} else { |
my $companswer = &Apache::loncommon::get_student_answers($symbx,$uname,$udom,$env{'request.course.id'}); |
my $companswer = &Apache::loncommon::get_student_answers($symbx,$uname,$udom,$env{'request.course.id'},%form); |
$companswer =~ s|<form(.*?)>||g; |
$companswer =~ s|<form(.*?)>||g; |
$companswer =~ s|</form>||g; |
$companswer =~ s|</form>||g; |
# while ($companswer =~ /(<a href\=\"javascript:newWindow.*?Script Vars<\/a>)/s) { #<a href="javascript:newWindow</a> |
# while ($companswer =~ /(<a href\=\"javascript:newWindow.*?Script Vars<\/a>)/s) { #<a href="javascript:newWindow</a> |
Line 3863 sub displayPage {
|
Line 4062 sub displayPage {
|
$curRes = $iterator->next(); |
$curRes = $iterator->next(); |
} |
} |
|
|
$studentTable.='</td></tr></table></td></tr></table>'."\n". |
$studentTable.='</table></td></tr></table>'."\n". |
'<input type="button" value="Save" '. |
'<input type="button" value="Save" '. |
'onClick="javascript:checkSubmitPage(this.form,'.$question.');" TARGET=_self />'. |
'onClick="javascript:checkSubmitPage(this.form,'.$question.');" />'. |
'</form>'."\n"; |
'</form>'."\n"; |
$studentTable.=&show_grading_menu_form($symb); |
$studentTable.=&show_grading_menu_form($symb); |
$request->print($studentTable); |
$request->print($studentTable); |
Line 4025 sub updateGradeByPage {
|
Line 4224 sub updateGradeByPage {
|
if($curRes == $iterator->BEGIN_MAP) { $depth++; } |
if($curRes == $iterator->BEGIN_MAP) { $depth++; } |
if($curRes == $iterator->END_MAP) { $depth--; } |
if($curRes == $iterator->END_MAP) { $depth--; } |
|
|
if (ref($curRes) && $curRes->is_problem() && !$curRes->randomout) { |
if (ref($curRes) && $curRes->is_problem()) { |
my $parts = $curRes->parts(); |
my $parts = $curRes->parts(); |
my $title = $curRes->compTitle(); |
my $title = $curRes->compTitle(); |
my $symbx = $curRes->symb(); |
my $symbx = $curRes->symb(); |
Line 4080 sub updateGradeByPage {
|
Line 4279 sub updateGradeByPage {
|
$displayPts[1].=' <b>Part:</b> '.$display_part.' = '. |
$displayPts[1].=' <b>Part:</b> '.$display_part.' = '. |
(($score eq 'excused') ? 'excused' : $newpts). |
(($score eq 'excused') ? 'excused' : $newpts). |
' <br />'; |
' <br />'; |
|
|
$question++; |
$question++; |
next if ($dropMenu eq 'reset status' || ($newpts == $oldpts && $score ne 'excused')); |
next if ($dropMenu eq 'reset status' || ($newpts eq $oldpts && $score ne 'excused')); |
|
|
$newrecord{'resource.'.$partid.'.awarded'} = $partial if $partial ne ''; |
$newrecord{'resource.'.$partid.'.awarded'} = $partial if $partial ne ''; |
$newrecord{'resource.'.$partid.'.solved'} = $score if $score ne ''; |
$newrecord{'resource.'.$partid.'.solved'} = $score if $score ne ''; |
Line 4092 sub updateGradeByPage {
|
Line 4290 sub updateGradeByPage {
|
$changeflag++; |
$changeflag++; |
} |
} |
if (scalar(keys(%newrecord)) > 0) { |
if (scalar(keys(%newrecord)) > 0) { |
|
my %record = |
|
&Apache::lonnet::restore($symbx,$env{'request.course.id'}, |
|
$udom,$uname); |
|
|
|
if (&Apache::lonnet::validCODE($env{'form.CODE'})) { |
|
$newrecord{'resource.CODE'} = $env{'form.CODE'}; |
|
} elsif (&Apache::lonnet::validCODE($record{'resource.CODE'})) { |
|
$newrecord{'resource.CODE'} = ''; |
|
} |
&Apache::lonnet::cstore(\%newrecord,$symbx,$env{'request.course.id'}, |
&Apache::lonnet::cstore(\%newrecord,$symbx,$env{'request.course.id'}, |
$udom,$uname); |
$udom,$uname); |
|
%record = &Apache::lonnet::restore($symbx, |
|
$env{'request.course.id'}, |
|
$udom,$uname); |
|
&check_and_remove_from_queue($parts,\%record,undef,$symbx, |
|
$cdom,$cnum,$udom,$uname); |
} |
} |
|
|
if ($aggregateflag) { |
if ($aggregateflag) { |
&Apache::lonnet::cinc('nohist_resourcetracker',\%aggregate, |
&Apache::lonnet::cinc('nohist_resourcetracker',\%aggregate, |
$env{'course.'.$env{'request.course.id'}.'.domain'}, |
$env{'course.'.$env{'request.course.id'}.'.domain'}, |
Line 4157 sub scantron_filenames {
|
Line 4370 sub scantron_filenames {
|
my $cdom=$env{'course.'.$env{'request.course.id'}.'.domain'}; |
my $cdom=$env{'course.'.$env{'request.course.id'}.'.domain'}; |
my $cname=$env{'course.'.$env{'request.course.id'}.'.num'}; |
my $cname=$env{'course.'.$env{'request.course.id'}.'.num'}; |
my @files=&Apache::lonnet::dirlist('userfiles',$cdom,$cname, |
my @files=&Apache::lonnet::dirlist('userfiles',$cdom,$cname, |
&Apache::loncommon::propath($cdom,$cname)); |
&propath($cdom,$cname)); |
my @possiblenames; |
my @possiblenames; |
foreach my $filename (sort(@files)) { |
foreach my $filename (sort(@files)) { |
($filename)=split(/&/,$filename); |
($filename)=split(/&/,$filename); |
Line 4208 sub scantron_CODElist {
|
Line 4421 sub scantron_CODElist {
|
} |
} |
|
|
sub scantron_CODEunique { |
sub scantron_CODEunique { |
my $result='<nobr> |
my $result='<span style="white-space: nowrap;"> |
<label><input type="radio" name="scantron_CODEunique" |
<label><input type="radio" name="scantron_CODEunique" |
value="yes" checked="checked" /> Yes </label> |
value="yes" checked="checked" /> Yes </label> |
</nobr> |
</span> |
<nobr> |
<span style="white-space: nowrap;"> |
<label><input type="radio" name="scantron_CODEunique" |
<label><input type="radio" name="scantron_CODEunique" |
value="no" /> No </label> |
value="no" /> No </label> |
</nobr>'; |
</span>'; |
return $result; |
return $result; |
} |
} |
|
|
Line 4334 SCANTRONFORM
|
Line 4547 SCANTRONFORM
|
<tr> |
<tr> |
<form action='/adm/grades' name='scantron_download'> |
<form action='/adm/grades' name='scantron_download'> |
<td bgcolor="#777777"> |
<td bgcolor="#777777"> |
|
$default_form_data |
<input type="hidden" name="command" value="scantron_download" /> |
<input type="hidden" name="command" value="scantron_download" /> |
<table width="100%" border="0"> |
<table width="100%" border="0"> |
<tr bgcolor="#e6ffff"> |
<tr bgcolor="#e6ffff"> |
Line 4450 sub scantron_fixup_scanline {
|
Line 4664 sub scantron_fixup_scanline {
|
$answer=$alphabet[$args->{'response'}]; |
$answer=$alphabet[$args->{'response'}]; |
} elsif ($on eq 'number') { |
} elsif ($on eq 'number') { |
$answer=$args->{'response'}+1; |
$answer=$args->{'response'}+1; |
|
if ($answer == 10) { $answer = '0'; } |
} else { |
} else { |
substr($answer,$args->{'response'},1)=$on; |
substr($answer,$args->{'response'},1)=$on; |
} |
} |
Line 4516 sub scantron_parse_scanline {
|
Line 4731 sub scantron_parse_scanline {
|
substr($questions,0,$$scantron_config{'Qlength'})=''; |
substr($questions,0,$$scantron_config{'Qlength'})=''; |
if (length($currentquest) < $$scantron_config{'Qlength'}) { next; } |
if (length($currentquest) < $$scantron_config{'Qlength'}) { next; } |
if ($$scantron_config{'Qon'} eq 'letter') { |
if ($$scantron_config{'Qon'} eq 'letter') { |
if ($currentquest eq '?') { |
if ($currentquest eq '?' |
|
|| $currentquest eq '*') { |
push(@{$record{'scantron.doubleerror'}},$questnum); |
push(@{$record{'scantron.doubleerror'}},$questnum); |
$record{"scantron.$questnum.answer"}=''; |
$record{"scantron.$questnum.answer"}=''; |
} elsif (!$currentquest |
} elsif (!defined($currentquest) |
|| $currentquest eq $$scantron_config{'Qoff'} |
|| $currentquest eq $$scantron_config{'Qoff'} |
|| $currentquest !~ /^[A-Z]$/) { |
|| $currentquest !~ /^[A-Z]$/) { |
$record{"scantron.$questnum.answer"}=''; |
$record{"scantron.$questnum.answer"}=''; |
Line 4530 sub scantron_parse_scanline {
|
Line 4746 sub scantron_parse_scanline {
|
$record{"scantron.$questnum.answer"}=$currentquest; |
$record{"scantron.$questnum.answer"}=$currentquest; |
} |
} |
} elsif ($$scantron_config{'Qon'} eq 'number') { |
} elsif ($$scantron_config{'Qon'} eq 'number') { |
if ($currentquest eq '?') { |
if ($currentquest eq '?' |
|
|| $currentquest eq '*') { |
push(@{$record{'scantron.doubleerror'}},$questnum); |
push(@{$record{'scantron.doubleerror'}},$questnum); |
$record{"scantron.$questnum.answer"}=''; |
$record{"scantron.$questnum.answer"}=''; |
} elsif (!$currentquest |
} elsif (!defined($currentquest) |
|| $currentquest eq $$scantron_config{'Qoff'} |
|| $currentquest eq $$scantron_config{'Qoff'} |
|| $currentquest !~ /^\d$/) { |
|| $currentquest !~ /^\d$/) { |
$record{"scantron.$questnum.answer"}=''; |
$record{"scantron.$questnum.answer"}=''; |
if (!&scan_data($scan_data,"$whichline.no_bubble.$questnum")) { |
if (!&scan_data($scan_data,"$whichline.no_bubble.$questnum")) { |
push(@{$record{"scantron.missingerror"}},$questnum); |
push(@{$record{"scantron.missingerror"}},$questnum); |
} |
} |
} else { |
} else { |
$record{"scantron.$questnum.answer"}= |
# wrap zero back to J |
$alphabet[$currentquest-1]; |
if ($currentquest eq '0') { |
|
$record{"scantron.$questnum.answer"}= |
|
$alphabet[9]; |
|
} else { |
|
$record{"scantron.$questnum.answer"}= |
|
$alphabet[$currentquest-1]; |
|
} |
} |
} |
} else { |
} else { |
my @array=split($$scantron_config{'Qon'},$currentquest,-1); |
my @array=split($$scantron_config{'Qon'},$currentquest,-1); |
Line 4672 sub reset_skipping_status {
|
Line 4895 sub reset_skipping_status {
|
&scantron_putfile(undef,$scan_data); |
&scantron_putfile(undef,$scan_data); |
} |
} |
|
|
sub allow_skipping { |
sub start_skipping { |
my ($scan_data,$i)=@_; |
my ($scan_data,$i)=@_; |
my %remembered=split(':',&scan_data($scan_data,'remember_skipping')); |
my %remembered=split(':',&scan_data($scan_data,'remember_skipping')); |
delete($remembered{$i}); |
if ($env{'form.scantron_options_redo'} =~ /^redo_/) { |
|
$remembered{$i}=2; |
|
} else { |
|
$remembered{$i}=1; |
|
} |
&scan_data($scan_data,'remember_skipping',join(':',%remembered)); |
&scan_data($scan_data,'remember_skipping',join(':',%remembered)); |
} |
} |
|
|
sub should_be_skipped { |
sub should_be_skipped { |
my ($scan_data,$i)=@_; |
my ($scanlines,$scan_data,$i)=@_; |
if ($env{'form.scantron_options_redo'} !~ /^redo_/) { |
if ($env{'form.scantron_options_redo'} !~ /^redo_/) { |
# not redoing old skips |
# not redoing old skips |
|
if ($scanlines->{'skipped'}[$i]) { return 1; } |
return 0; |
return 0; |
} |
} |
my %remembered=split(':',&scan_data($scan_data,'remember_skipping')); |
my %remembered=split(':',&scan_data($scan_data,'remember_skipping')); |
if (exists($remembered{$i})) { return 0; } |
|
|
if (exists($remembered{$i}) && $remembered{$i} != 2 ) { |
|
return 0; |
|
} |
return 1; |
return 1; |
} |
} |
|
|
Line 4698 sub remember_current_skipped {
|
Line 4929 sub remember_current_skipped {
|
$to_remember{$i}=1; |
$to_remember{$i}=1; |
} |
} |
} |
} |
|
|
&scan_data($scan_data,'remember_skipping',join(':',%to_remember)); |
&scan_data($scan_data,'remember_skipping',join(':',%to_remember)); |
&scantron_putfile(undef,$scan_data); |
&scantron_putfile(undef,$scan_data); |
} |
} |
Line 4713 sub scantron_warning_screen {
|
Line 4945 sub scantron_warning_screen {
|
my ($button_text)=@_; |
my ($button_text)=@_; |
my $title=&Apache::lonnet::gettitle($env{'form.selectpage'}); |
my $title=&Apache::lonnet::gettitle($env{'form.selectpage'}); |
my %scantron_config=&get_scantron_config($env{'form.scantron_format'}); |
my %scantron_config=&get_scantron_config($env{'form.scantron_format'}); |
my $CODElist="a"; |
my $CODElist; |
if ($scantron_config{'CODElocation'} && |
if ($scantron_config{'CODElocation'} && |
$scantron_config{'CODEstart'} && |
$scantron_config{'CODEstart'} && |
$scantron_config{'CODElength'}) { |
$scantron_config{'CODElength'}) { |
$CODElist=$env{'form.scantron_CODElist'}; |
$CODElist=$env{'form.scantron_CODElist'}; |
if ($CODElist eq '') { $CODElist='<font color="red">None</font>'; } |
if ($env{'form.scantron_CODElist'} eq '') { $CODElist='<font color="red">None</font>'; } |
$CODElist= |
$CODElist= |
'<tr><td><b>List of CODES to validate against:</b></td><td><tt>'. |
'<tr><td><b>List of CODES to validate against:</b></td><td><tt>'. |
$CODElist.'</tt></td></tr>'; |
$env{'form.scantron_CODElist'}.'</tt></td></tr>'; |
} |
} |
return (<<STUFF); |
return (<<STUFF); |
<p> |
<p> |
Line 4769 $warning
|
Line 5001 $warning
|
<input type="hidden" name="command" value="scantron_validate" /> |
<input type="hidden" name="command" value="scantron_validate" /> |
STUFF |
STUFF |
} |
} |
$r->print("</form><br />".&show_grading_menu_form($symb)."</body></html>"); |
$r->print("</form><br />".&show_grading_menu_form($symb)); |
return ''; |
return ''; |
} |
} |
|
|
Line 4803 sub scantron_validate_file {
|
Line 5035 sub scantron_validate_file {
|
} |
} |
if ($env{'form.scantron_options_redo'} eq 'redo_skipped') { |
if ($env{'form.scantron_options_redo'} eq 'redo_skipped') { |
&remember_current_skipped(); |
&remember_current_skipped(); |
&scantron_remove_file('skipped'); |
|
$env{'form.scantron_options_redo'}='redo_skipped_ready'; |
$env{'form.scantron_options_redo'}='redo_skipped_ready'; |
} |
} |
|
|
Line 4870 STUFF
|
Line 5101 STUFF
|
$r->print(" this scanline saving it for later."); |
$r->print(" this scanline saving it for later."); |
} |
} |
} |
} |
$r->print(" </form><br />".&show_grading_menu_form($symb). |
$r->print(" </form><br />".&show_grading_menu_form($symb)); |
"</body></html>"); |
|
return ''; |
return ''; |
} |
} |
|
|
Line 4974 sub scantron_putfile {
|
Line 5204 sub scantron_putfile {
|
|
|
sub scantron_get_line { |
sub scantron_get_line { |
my ($scanlines,$scan_data,$i)=@_; |
my ($scanlines,$scan_data,$i)=@_; |
if (&should_be_skipped($scan_data,$i)) { return undef; } |
if (&should_be_skipped($scanlines,$scan_data,$i)) { return undef; } |
if ($scanlines->{'skipped'}[$i]) { return undef; } |
#if ($scanlines->{'skipped'}[$i]) { return undef; } |
if ($scanlines->{'corrected'}[$i]) {return $scanlines->{'corrected'}[$i];} |
if ($scanlines->{'corrected'}[$i]) {return $scanlines->{'corrected'}[$i];} |
return $scanlines->{'orig'}[$i]; |
return $scanlines->{'orig'}[$i]; |
} |
} |
Line 4995 sub scantron_put_line {
|
Line 5225 sub scantron_put_line {
|
my ($scanlines,$scan_data,$i,$newline,$skip)=@_; |
my ($scanlines,$scan_data,$i,$newline,$skip)=@_; |
if ($skip) { |
if ($skip) { |
$scanlines->{'skipped'}[$i]=$newline; |
$scanlines->{'skipped'}[$i]=$newline; |
&allow_skipping($scan_data,$i); |
&start_skipping($scan_data,$i); |
return; |
return; |
} |
} |
$scanlines->{'corrected'}[$i]=$newline; |
$scanlines->{'corrected'}[$i]=$newline; |
} |
} |
|
|
|
sub scantron_clear_skip { |
|
my ($scanlines,$scan_data,$i)=@_; |
|
if (exists($scanlines->{'skipped'}[$i])) { |
|
undef($scanlines->{'skipped'}[$i]); |
|
return 1; |
|
} |
|
return 0; |
|
} |
|
|
sub scantron_filter_not_exam { |
sub scantron_filter_not_exam { |
my ($curres)=@_; |
my ($curres)=@_; |
|
|
Line 5032 sub scantron_validate_sequence {
|
Line 5271 sub scantron_validate_sequence {
|
my @resources= |
my @resources= |
$navmap->retrieveResources($map,\&scantron_filter_not_exam,1,0); |
$navmap->retrieveResources($map,\&scantron_filter_not_exam,1,0); |
if (@resources) { |
if (@resources) { |
$r->print("<p>".&mt('Some resource in the sequece currently are not set to exam mode. Grading these resources currently may not work correctly.')."</p>"); |
$r->print("<p>".&mt('Some resources in the sequence currently are not set to exam mode. Grading these resources currently may not work correctly.')."</p>"); |
return (1,$currentphase); |
return (1,$currentphase); |
} |
} |
} |
} |
Line 5186 function change_radio(field) {
|
Line 5425 function change_radio(field) {
|
</script> |
</script> |
ENDSCRIPT |
ENDSCRIPT |
my $href="/adm/pickcode?". |
my $href="/adm/pickcode?". |
"form=".&Apache::lonnet::escape("scantronupload"). |
"form=".&escape("scantronupload"). |
"&scantron_format=".&Apache::lonnet::escape($env{'form.scantron_format'}). |
"&scantron_format=".&escape($env{'form.scantron_format'}). |
"&scantron_CODElist=".&Apache::lonnet::escape($env{'form.scantron_CODElist'}). |
"&scantron_CODElist=".&escape($env{'form.scantron_CODElist'}). |
"&curCODE=".&Apache::lonnet::escape($$scan_record{'scantron.CODE'}). |
"&curCODE=".&escape($$scan_record{'scantron.CODE'}). |
"&scantron_selectfile=".&Apache::lonnet::escape($env{'form.scantron_selectfile'}); |
"&scantron_selectfile=".&escape($env{'form.scantron_selectfile'}); |
if ($env{'form.scantron_CODElist'} =~ /\S/) { |
if ($env{'form.scantron_CODElist'} =~ /\S/) { |
$r->print("<label><input type='radio' name='scantron_CODE_resolution' value='use_found' /> <a target='_blank' href='$href'>Select</a> a CODE from the list of all CODEs and use it.</label> Selected CODE is <input readonly='true' type='text' size='8' name='scantron_CODE_selectedvalue' onfocus=\"javascript:change_radio('use_found')\" onchange=\"javascript:change_radio('use_found')\" />"); |
$r->print("<label><input type='radio' name='scantron_CODE_resolution' value='use_found' /> <a target='_blank' href='$href'>Select</a> a CODE from the list of all CODEs and use it.</label> Selected CODE is <input readonly='true' type='text' size='8' name='scantron_CODE_selectedvalue' onfocus=\"javascript:change_radio('use_found')\" onchange=\"javascript:change_radio('use_found')\" />"); |
$r->print("\n<br />"); |
$r->print("\n<br />"); |
Line 5487 SCANTRONFORM
|
Line 5726 SCANTRONFORM
|
|
|
&Apache::lonxml::clear_problem_counter(); |
&Apache::lonxml::clear_problem_counter(); |
&Apache::lonnet::appenv(%$scan_record); |
&Apache::lonnet::appenv(%$scan_record); |
|
|
|
if (&scantron_clear_skip($scanlines,$scan_data,$i)) { |
|
&scantron_putfile($scanlines,$scan_data); |
|
} |
|
|
my $i=0; |
my $i=0; |
foreach my $resource (@resources) { |
foreach my $resource (@resources) { |
Line 5497 SCANTRONFORM
|
Line 5740 SCANTRONFORM
|
'grade_domain' =>$udom, |
'grade_domain' =>$udom, |
'grade_courseid'=>$env{'request.course.id'}, |
'grade_courseid'=>$env{'request.course.id'}, |
'grade_symb' =>$resource->symb()); |
'grade_symb' =>$resource->symb()); |
if (exists($scan_record->{'scantron.CODE'}) && |
if (exists($scan_record->{'scantron.CODE'}) |
$scan_record->{'scantron.CODE'}) { |
&& |
|
&Apache::lonnet::validCODE($scan_record->{'scantron.CODE'})) { |
$form{'CODE'}=$scan_record->{'scantron.CODE'}; |
$form{'CODE'}=$scan_record->{'scantron.CODE'}; |
} else { |
} else { |
$form{'CODE'}=''; |
$form{'CODE'}=''; |
Line 5874 sub handler {
|
Line 6118 sub handler {
|
if ($#commands > 0) { |
if ($#commands > 0) { |
&Apache::lonnet::logthis("grades got multiple commands ".join(':',@commands)); |
&Apache::lonnet::logthis("grades got multiple commands ".join(':',@commands)); |
} |
} |
&send_header($request); |
$request->print(&Apache::loncommon::start_page('Grading')); |
if ($symb eq '' && $command eq '') { |
if ($symb eq '' && $command eq '') { |
if ($env{'user.adv'}) { |
if ($env{'user.adv'}) { |
if (($env{'form.codeone'}) && ($env{'form.codetwo'}) && |
if (($env{'form.codeone'}) && ($env{'form.codetwo'}) && |
Line 5965 sub handler {
|
Line 6209 sub handler {
|
$request->print("Access Denied ($command)"); |
$request->print("Access Denied ($command)"); |
} |
} |
} |
} |
&send_footer($request); |
$request->print(&Apache::loncommon::end_page()); |
return ''; |
return ''; |
} |
} |
|
|
sub send_header { |
|
my ($request)= @_; |
|
$request->print(&Apache::lontexconvert::header()); |
|
# $request->print(" |
|
#<script> |
|
#remotewindow=open('','homeworkremote'); |
|
#remotewindow.close(); |
|
#</script>"); |
|
$request->print(&Apache::loncommon::bodytag('Grading')); |
|
$request->rflush(); |
|
} |
|
|
|
sub send_footer { |
|
my ($request)= @_; |
|
$request->print('</body></html>'); |
|
} |
|
|
|
1; |
1; |
|
|
__END__; |
__END__; |