version 1.44, 2002/08/02 21:10:03
|
version 1.45, 2002/08/05 20:49:54
|
Line 45 use Apache::Constants qw(:common);
|
Line 45 use Apache::Constants qw(:common);
|
|
|
# ----- These first few routines are general use routines.----- |
# ----- These first few routines are general use routines.----- |
# |
# |
|
|
|
sub print_hash { |
|
my ($request, $hash) = @_; |
|
$request->print('<table border=1><tr><td>Key</td><td>Value</td></tr>'); |
|
for (sort keys (%$hash)) { |
|
$request->print('<tr><td>'.$_.'</td><td>'.$$hash{$_}.' </td></tr>'); |
|
} |
|
$request->print('</table>'); |
|
return ''; |
|
} |
|
|
# --- Retrieve the parts that matches stores_\d+ from the metadata file.--- |
# --- Retrieve the parts that matches stores_\d+ from the metadata file.--- |
sub getpartlist { |
sub getpartlist { |
my ($url) = @_; |
my ($url) = @_; |
Line 224 sub student_gradeStatus {
|
Line 235 sub student_gradeStatus {
|
return %partstatus; |
return %partstatus; |
} |
} |
|
|
|
# hidden form and javascript that calls the form |
|
# Use by verifyscript and viewgrades |
|
# Shows a student's view of problem and submission |
|
sub jscriptNform { |
|
my ($url,$symb) = @_; |
|
my $jscript='<script type="text/javascript" language="javascript">'."\n". |
|
' function viewOneStudent(user,domain) {'."\n". |
|
' document.onestudent.student.value = user;'."\n". |
|
' document.onestudent.userdom.value = domain;'."\n". |
|
' document.onestudent.submit();'."\n". |
|
' }'."\n". |
|
'</script>'."\n"; |
|
$jscript.= '<form action="/adm/grades" method="post" name="onestudent">'."\n". |
|
'<input type="hidden" name="symb" value="'.$symb.'" />'."\n". |
|
'<input type="hidden" name="url" value="'.$url.'" />'."\n". |
|
'<input type="hidden" name="command" value="submission" />'."\n". |
|
'<input type="hidden" name="student" value="" />'."\n". |
|
'<input type="hidden" name="userdom" value="" />'."\n". |
|
'</form>'."\n"; |
|
return $jscript; |
|
} |
|
|
#------------------ End of general use routines -------------------- |
#------------------ End of general use routines -------------------- |
#------------------------------------------------------------------- |
#------------------------------------------------------------------- |
|
|
#------------------------------------ Receipt Verification Routines |
#------------------------------------ Receipt Verification Routines |
|
# |
#--- Check whether a receipt number is valid.--- |
#--- Check whether a receipt number is valid.--- |
sub verifyreceipt { |
sub verifyreceipt { |
my $request = shift; |
my $request = shift; |
Line 243 sub verifyreceipt {
|
Line 276 sub verifyreceipt {
|
$symb = &Apache::lonnet::symbread($url); |
$symb = &Apache::lonnet::symbread($url); |
} |
} |
|
|
my $jscript='<script type="text/javascript" language="javascript">'."\n". |
my $title.='<h3><font color="#339933">Verifying Submission Receipt '. |
' function viewOneStudent(user,domain) {'."\n". |
$receipt.'</h3></font>'."\n". |
' document.onestudent.student.value = user;'."\n". |
|
' document.onestudent.userdom.value = domain;'."\n". |
|
' document.onestudent.submit();'."\n". |
|
' }'."\n". |
|
'</script>'."\n"; |
|
$jscript.= '<form action="/adm/grades" method="post" name="onestudent">'."\n". |
|
'<input type="hidden" name="symb" value="'.$symb.'" />'."\n". |
|
'<input type="hidden" name="url" value="'.$url.'" />'."\n". |
|
'<input type="hidden" name="command" value="submission" />'."\n". |
|
'<input type="hidden" name="student" value="" />'."\n". |
|
'<input type="hidden" name="userdom" value="" />'."\n". |
|
'</form>'."\n"; |
|
|
|
my $title.='<h2><font color="#339933">Verifying Submission Receipt '. |
|
$receipt.'</h2></font>'."\n". |
|
'<font size=+1><b>Resource: </b>'.$ENV{'form.url'}.'</font><br><br>'."\n"; |
'<font size=+1><b>Resource: </b>'.$ENV{'form.url'}.'</font><br><br>'."\n"; |
|
|
my ($string,$contents,$matches) = ('','',0); |
my ($string,$contents,$matches) = ('','',0); |
Line 281 sub verifyreceipt {
|
Line 299 sub verifyreceipt {
|
if ($matches == 0) { |
if ($matches == 0) { |
$string = $title.'No match found for the above receipt.'; |
$string = $title.'No match found for the above receipt.'; |
} else { |
} else { |
$string = $jscript.$title. |
$string = &jscriptNform($url,$symb).$title. |
'The above receipt matches the following student'. |
'The above receipt matches the following student'. |
($matches <= 1 ? '.' : 's.')."\n". |
($matches <= 1 ? '.' : 's.')."\n". |
'<table border="0"><tr><td bgcolor="#777777">'."\n". |
'<table border="0"><tr><td bgcolor="#777777">'."\n". |
Line 301 sub verifyreceipt {
|
Line 319 sub verifyreceipt {
|
# on the problem page. |
# on the problem page. |
sub listStudents { |
sub listStudents { |
my ($request) = shift; |
my ($request) = shift; |
|
$request->print(<<LISTJAVASCRIPT); |
|
<script type="text/javascript" language="javascript"> |
|
function checkSelect(checkBox) { |
|
var ctr=0; |
|
if (checkBox.length > 1) { |
|
for (var i=0; i<checkBox.length; i++) { |
|
if (checkBox[i].checked) { |
|
ctr++; |
|
} |
|
} |
|
} else { |
|
if (checkBox.checked) { |
|
ctr = 1; |
|
} |
|
} |
|
if (ctr == 0) { |
|
alert("You did not select any student."); |
|
return false; |
|
} |
|
document.gradesub.submit(); |
|
} |
|
</script> |
|
LISTJAVASCRIPT |
|
|
my $cdom = $ENV{"course.$ENV{'request.course.id'}.domain"}; |
my $cdom = $ENV{"course.$ENV{'request.course.id'}.domain"}; |
my $cnum = $ENV{"course.$ENV{'request.course.id'}.num"}; |
my $cnum = $ENV{"course.$ENV{'request.course.id'}.num"}; |
my $getsec = $ENV{'form.section'} eq '' ? 'all' : $ENV{'form.section'}; |
my $getsec = $ENV{'form.section'} eq '' ? 'all' : $ENV{'form.section'}; |
my $submitonly= $ENV{'form.submitonly'} eq '' ? 'all' : $ENV{'form.submitonly'}; |
my $submitonly= $ENV{'form.submitonly'} eq '' ? 'all' : $ENV{'form.submitonly'}; |
|
|
my $result='<h2><font color="#339933"> '. |
my $result='<h3><font color="#339933"> '. |
'View Submissions for a Student or a Group of Students</font></h2>'; |
'View/Grade Submissions for a Student or a Group of Students</font></h3>'; |
$result.='<table border="0">'; |
$result.='<table border="0">'; |
$result.='<tr><td colspan=3><font size=+1>'. |
$result.='<tr><td colspan=3><font size=+1>'. |
'<b>Resource: </b>'.$ENV{'form.url'}.'</font></td></tr>'; |
'<b>Resource: </b>'.$ENV{'form.url'}.'</font></td></tr>'; |
Line 322 sub listStudents {
|
Line 364 sub listStudents {
|
$result.='</table>'; |
$result.='</table>'; |
$request->print($result); |
$request->print($result); |
|
|
$request->print(<<ENDTABLEST); |
my $checkhdgrade = $ENV{'form.handgrade'} eq 'yes' ? 'checked' : ''; |
<form action="/adm/grades" method="post"> |
my $checklastsub = $ENV{'form.handgrade'} eq 'yes' ? '' : 'checked'; |
<b>View Problem: </b><input type="radio" name="vProb" value="no" checked> no |
|
<input type="radio" name="vProb" value="yes"> yes <br /> |
|
<b>Submissions: </b> |
|
<input type="radio" name="lastSub" value="hdgrade" checked /> handgrade only |
|
<input type="radio" name="lastSub" value="lastonly" /> last sub only |
|
<input type="radio" name="lastSub" value="last" /> last sub & parts info |
|
<input type="radio" name="lastSub" value="all" /> all details |
|
<input type="hidden" name="section" value="$getsec" /> |
|
<input type="hidden" name="submitonly" value="$submitonly" /> |
|
<input type="hidden" name="response" value="$ENV{'form.response'}" /> |
|
<input type="hidden" name="handgrade" value="$ENV{'form.handgrade'}" /><br /> |
|
<input type="hidden" name="showgrading" value="$ENV{'form.showgrading'}" /><br /> |
|
<input type="submit" name="submit" value="View/Grade" /> |
|
ENDTABLEST |
|
if ($ENV{'form.url'}) { |
|
$request->print('<input type="hidden" name="url" value="'.$ENV{'form.url'}.'" />'."\n"); |
|
} |
|
if ($ENV{'form.symb'}) { |
|
$request->print('<input type="hidden" name="symb" value="'.$ENV{'form.symb'}.'" />'."\n"); |
|
} |
|
$request->print('<input type="hidden" name="command" value="processGroup" />'."\n"); |
|
|
|
|
my $gradeTable='<form action="/adm/grades" method="post" name="gradesub">'."\n". |
|
' <b>View Problem: </b><input type="radio" name="vProb" value="no" checked> no '."\n". |
|
'<input type="radio" name="vProb" value="yes"> yes <br />'."\n". |
|
' <b>Submissions: </b>'."\n". |
|
'<input type="radio" name="lastSub" value="hdgrade" '.$checkhdgrade.' /> handgrade only'."\n". |
|
'<input type="radio" name="lastSub" value="lastonly" '.$checklastsub.' /> last sub only'."\n". |
|
'<input type="radio" name="lastSub" value="last" /> last sub & parts info'."\n". |
|
'<input type="radio" name="lastSub" value="all" /> all details'."\n". |
|
'<input type="hidden" name="section" value="'.$getsec.'" />'."\n". |
|
'<input type="hidden" name="submitonly" value="'.$submitonly.'" />'."\n". |
|
'<input type="hidden" name="response" value="'.$ENV{'form.response'}.'" />'."\n". |
|
'<input type="hidden" name="handgrade" value="'.$ENV{'form.handgrade'}.'" /><br />'."\n". |
|
'<input type="hidden" name="showgrading" value="'.$ENV{'form.showgrading'}.'" /><br />'."\n". |
|
'<input type="hidden" name="url" value="'.$ENV{'form.url'}.'" />'."\n". |
|
'<input type="hidden" name="symb" value="'.$ENV{'form.symb'}.'" />'."\n". |
|
'To view/grade a submission, click on the check box next to the student\'s name. Then '."\n". |
|
'click on the View/Grade button. To view the submissions for a group of students, click'."\n". |
|
' on the check boxes for the group of students.<br />'."\n". |
|
'<input type="hidden" name="command" value="processGroup" />'."\n". |
|
'<input type="button" '."\n". |
|
'onClick="javascript:checkSelect(this.form.stuinfo);" '."\n". |
|
'value="View/Grade" />'."\n"; |
|
|
my ($classlist,$seclist,$ids,$stusec,$fullname) = &getclasslist($getsec,'0'); |
my ($classlist,$seclist,$ids,$stusec,$fullname) = &getclasslist($getsec,'0'); |
|
|
$result='<table border="0"><tr><td bgcolor="#777777">'. |
$gradeTable.='<table border="0"><tr><td bgcolor="#777777">'. |
'<table border="0"><tr bgcolor="#e6ffff">'. |
'<table border="0"><tr bgcolor="#e6ffff">'. |
'<td><b> Select </b></td><td><b> Fullname </b></td>'. |
'<td><b> Select </b></td><td><b> Fullname </b></td>'. |
'<td><b> Username </b></td><td><b> Domain </b></td>'; |
'<td><b> Username </b></td><td><b> Domain </b></td>'; |
foreach (sort(@$partlist)) { |
foreach (sort(@$partlist)) { |
$result.='<td><b> Part '.(split(/_/))[0].' Status </b></td>'; |
$gradeTable.='<td><b> Part '.(split(/_/))[0].' Status </b></td>'; |
} |
} |
$request->print($result.'</tr>'."\n"); |
$gradeTable.='</tr>'."\n"; |
|
|
|
my $ctr = 0; |
foreach my $student (sort {$$fullname{$a} cmp $$fullname{$b} } keys %$fullname) { |
foreach my $student (sort {$$fullname{$a} cmp $$fullname{$b} } keys %$fullname) { |
my ($uname,$udom) = split(/:/,$student); |
my ($uname,$udom) = split(/:/,$student); |
my (%status) = &student_gradeStatus($ENV{'form.url'}, |
my (%status) = &student_gradeStatus($ENV{'form.url'}, |
Line 367 ENDTABLEST
|
Line 412 ENDTABLEST
|
my ($foo,$partid,$foo1) = split(/\./,$_); |
my ($foo,$partid,$foo1) = split(/\./,$_); |
if ($status{'resource.'.$partid.'.submitted_by'} ne '') { |
if ($status{'resource.'.$partid.'.submitted_by'} ne '') { |
$statusflg = ''; |
$statusflg = ''; |
$request->print('<input type="hidden" name="'. |
$gradeTable.='<input type="hidden" name="'. |
$student.':submitted_by" value="'. |
$student.':submitted_by" value="'. |
$status{'resource.'.$partid.'.submitted_by'}.'" />'); |
$status{'resource.'.$partid.'.submitted_by'}.'" />'; |
} |
} |
} |
} |
next if ($statusflg eq '' && $submitonly eq 'yes'); |
next if ($statusflg eq '' && $submitonly eq 'yes'); |
|
|
|
$ctr++; |
if ( $Apache::grades::viewgrades eq 'F' ) { |
if ( $Apache::grades::viewgrades eq 'F' ) { |
$result='<tr bgcolor="#ffffe6">'. |
$gradeTable.='<tr bgcolor="#ffffe6">'. |
'<td align="center"><input type=checkbox name="stuinfo" value="'. |
'<td align="center"><input type=checkbox name="stuinfo" value="'. |
$student.':'.$$fullname{$student}.'"></td>'."\n". |
$student.':'.$$fullname{$student}.'"></td>'."\n". |
'<td> '.$$fullname{$student}.' </td>'."\n". |
'<td> '.$$fullname{$student}.' </td>'."\n". |
Line 384 ENDTABLEST
|
Line 430 ENDTABLEST
|
|
|
foreach (sort keys(%status)) { |
foreach (sort keys(%status)) { |
next if (/^resource.*?submitted_by$/); |
next if (/^resource.*?submitted_by$/); |
$result.='<td align="middle"> '.$status{$_}.' </td>'."\n"; |
$gradeTable.='<td align="middle"> '.$status{$_}.' </td>'."\n"; |
} |
} |
$request->print($result.'</tr>'."\n"); |
$gradeTable.='</tr>'."\n"; |
} |
} |
} |
} |
$request->print('</table></td></tr></table>'); |
$gradeTable.='</table></td></tr></table>'. |
$request->print('<input type="submit" name="submit" value="View/Grade" /><form />'); |
'<input type="button" '. |
|
'onClick="javascript:checkSelect(this.form.stuinfo);" '. |
|
'value="View/Grade" /><form />'."\n"; |
|
if ($ctr == 0) { |
|
$gradeTable='<br /> <font color="red">'. |
|
'No submission found for this resource.</font><br />'; |
|
$gradeTable.=&show_grading_menu_form ($ENV{'form.symb'},$ENV{'form.url'}); |
|
} |
|
$request->print($gradeTable); |
return ''; |
return ''; |
} |
} |
|
|
Line 402 sub processGroup {
|
Line 456 sub processGroup {
|
my @stuchecked = (ref($ENV{'form.stuinfo'}) ? @{$ENV{'form.stuinfo'}} |
my @stuchecked = (ref($ENV{'form.stuinfo'}) ? @{$ENV{'form.stuinfo'}} |
: ($ENV{'form.stuinfo'})); |
: ($ENV{'form.stuinfo'})); |
my $total = scalar(@stuchecked)-1; |
my $total = scalar(@stuchecked)-1; |
if ($stuchecked[0] eq '') { |
|
&userError($request,'No student was selected for viewing/grading.'); |
|
return; |
|
} |
|
foreach (@stuchecked) { |
foreach (@stuchecked) { |
my ($uname,$udom,$fullname) = split(/:/); |
my ($uname,$udom,$fullname) = split(/:/); |
$ENV{'form.student'} = $uname; |
$ENV{'form.student'} = $uname; |
Line 489 sub sub_page_js {
|
Line 540 sub sub_page_js {
|
return; |
return; |
} |
} |
|
|
|
//=================== Check that a point is assigned for all the parts ============== |
|
function checksubmit(val,total,parttot) { |
|
document.SCORE.gradeOpt.value = val; |
|
if (val == "Save & Next") { |
|
for (i=0;i<=total;i++) { |
|
for (j=0;j<parttot;j++) { |
|
var partid = eval("document.SCORE.partid"+i+"_"+j+".value"); |
|
var selopt = eval("document.SCORE.GD_SEL"+i+"_"+partid); |
|
if (selopt[0].selected) { |
|
var points = eval("document.SCORE.GD_BOX"+i+"_"+partid+".value"); |
|
if (points == "") { |
|
var name = eval("document.SCORE.name"+i+".value"); |
|
alert("You did not assign any point for "+name+", part "+partid+"."); |
|
return false; |
|
} |
|
} |
|
|
|
} |
|
} |
|
|
|
} |
|
document.SCORE.submit(); |
|
} |
|
|
//===================== Show list of keywords ==================== |
//===================== Show list of keywords ==================== |
function keywords(keyform) { |
function keywords(keyform) { |
var keywds = keyform.value; |
var keywds = keyform.value; |
Line 766 sub submission {
|
Line 841 sub submission {
|
# header info |
# header info |
if ($counter == 0) { |
if ($counter == 0) { |
&sub_page_js($request); |
&sub_page_js($request); |
$request->print('<h2> <font color="#339933">Submission Record</font></h2>'. |
$request->print('<h3> <font color="#339933">Submission Record</font></h3>'."\n". |
'<font size=+1> <b>Resource: </b>'.$url.'</font>'); |
'<font size=+1> <b>Resource: </b>'.$url.'</font>'."\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 778 sub submission {
|
Line 853 sub submission {
|
$ENV{'request.course.id'}); |
$ENV{'request.course.id'}); |
my $result.='<table border="0" width="100%"><tr><td bgcolor="#777777">'; |
my $result.='<table border="0" width="100%"><tr><td bgcolor="#777777">'; |
$result.='<table border="0" width="100%"><tr><td bgcolor="#e6ffff">'; |
$result.='<table border="0" width="100%"><tr><td bgcolor="#e6ffff">'; |
$result.='<b> View of the problem for '.$ENV{'form.fullname'}. |
$result.='<b> View of the problem - '.$ENV{'form.fullname'}. |
'</b></td></tr><tr><td bgcolor="#ffffff">'.$rendered.'<br />'; |
'</b></td></tr><tr><td bgcolor="#ffffff">'.$rendered.'<br />'; |
$result.='<b>Correct answer:</b><br />'.$companswer; |
$result.='<b>Correct answer:</b><br />'.$companswer; |
$result.='</td></tr></table>'; |
$result.='</td></tr></table>'; |
Line 851 KEYWORDS
|
Line 926 KEYWORDS
|
|
|
# Display student info |
# Display student info |
$request->print(($counter == 0 ? '' : '<br />')); |
$request->print(($counter == 0 ? '' : '<br />')); |
my $result='<table border="0" width=100%><tr><td bgcolor="#777777">'. |
my $result='<table border="0" width=100%><tr><td bgcolor="#777777">'."\n". |
'<table border="0" width=100%><tr bgcolor="#edffff"><td>'; |
'<table border="0" width=100%><tr bgcolor="#edffff"><td>'."\n"; |
|
|
# $result.='<table border="0"><tr bgcolor="#ffffff"><td><b>Fullname: </b>'.$ENV{'form.fullname'}. |
# $result.='<table border="0"><tr bgcolor="#ffffff"><td><b>Fullname: </b>'.$ENV{'form.fullname'}. |
$result.='<b>Fullname: </b>'.$ENV{'form.fullname'}. |
$result.='<b>Fullname: </b>'.$ENV{'form.fullname'}. |
'<font color="#999999"> Username: '.$uname.'</font>'. |
'<font color="#999999"> Username: '.$uname.'</font>'. |
'<font color="#999999"> Domain: '.$udom.'</font><br />'; |
'<font color="#999999"> Domain: '.$udom.'</font><br />'."\n"; |
|
$result.='<input type="hidden" name="name'.$counter. |
|
'" value="'.$ENV{'form.fullname'}.'" />'."\n"; |
|
|
# If this is handgraded, then check for collaborators |
# If this is handgraded, then check for collaborators |
my $col_flag = 0; |
my @col_fullnames; |
if ($ENV{'form.handgrade'} eq 'yes') { |
if ($ENV{'form.handgrade'} eq 'yes') { |
my @col_list; |
my @col_list; |
($classlist,$seclist,$ids,$stusec,$fullname) = &getclasslist('all','0'); |
($classlist,$seclist,$ids,$stusec,$fullname) = &getclasslist('all','0'); |
Line 883 KEYWORDS
|
Line 960 KEYWORDS
|
push @badcollaborators,$collaborator; |
push @badcollaborators,$collaborator; |
next; |
next; |
} |
} |
$col_flag++; |
|
push @col_list, $collaborator; |
push @col_list, $collaborator; |
|
my ($lastname,$givenn) = split(/,/,$$fullname{$collaborator.':'.$udom}); |
|
push @col_fullnames, $givenn.' '.$lastname; |
$result.=$$fullname{$collaborator.':'.$udom}.' '; |
$result.=$$fullname{$collaborator.':'.$udom}.' '; |
} |
} |
$result.='<br />'."\n"; |
$result.='<br />'."\n"; |
Line 929 KEYWORDS
|
Line 1007 KEYWORDS
|
($$timestamp eq '' ? '' : '<b>Date Submitted:</b> '. |
($$timestamp eq '' ? '' : '<b>Date Submitted:</b> '. |
$$timestamp).''; |
$$timestamp).''; |
if ($$timestamp eq '') { |
if ($$timestamp eq '') { |
$lastsubonly.='<tr><td bgcolor="#ffffe6">'.$$string[0].'</td></tr>'; |
$lastsubonly.='<tr><td bgcolor="#ffffe6">'.$$string[0].'</td></tr>'."\n"; |
} else { |
} else { |
for my $part (sort keys(%$handgrade)) { |
for my $part (sort keys(%$handgrade)) { |
foreach (@$string) { |
foreach (@$string) { |
Line 939 KEYWORDS
|
Line 1017 KEYWORDS
|
$lastsubonly.='<tr><td bgcolor="#ffffe6"><b>Part '. |
$lastsubonly.='<tr><td bgcolor="#ffffe6"><b>Part '. |
$partid.'</b> <font color="#999999">( ID '.$respid. |
$partid.'</b> <font color="#999999">( ID '.$respid. |
' )</font> <b>Answer: </b>'. |
' )</font> <b>Answer: </b>'. |
&keywords_highlight($subval).'</td></tr>' |
&keywords_highlight($subval).'</td></tr>'."\n" |
if ($ENV{'form.lastSub'} eq 'lastonly' || |
if ($ENV{'form.lastSub'} eq 'lastonly' || |
($ENV{'form.lastSub'} eq 'hdgrade' && |
($ENV{'form.lastSub'} eq 'hdgrade' && |
$$handgrade{$part} =~ /:yes$/)); |
$$handgrade{$part} =~ /:yes$/)); |
Line 947 KEYWORDS
|
Line 1025 KEYWORDS
|
} |
} |
} |
} |
} |
} |
$lastsubonly.='</td></tr><tr><td bgcolor="#ffffff">'."\n"; |
$lastsubonly.='</td></tr>'."\n"; |
$request->print($lastsubonly); |
$request->print($lastsubonly); |
} |
} |
} else { |
} else { |
Line 959 KEYWORDS
|
Line 1037 KEYWORDS
|
|
|
# return if view submission with no grading option |
# return if view submission with no grading option |
if ($ENV{'form.showgrading'} eq '') { |
if ($ENV{'form.showgrading'} eq '') { |
$request->print('</td></tr></table></td></tr></table></form>'); |
$request->print('</td></tr></table></td></tr></table></form>'."\n"); |
return; |
return; |
} |
} |
|
|
# Grading options |
# Grading options |
$result='<input type="hidden" name="newmsg'.$counter.'" value="" />'."\n". |
$result='<input type="hidden" name="newmsg'.$counter.'" value="" />'."\n". |
'<input type="hidden" name="includemsg'.$counter.'" value="" />'."\n". |
'<input type="hidden" name="includemsg'.$counter.'" value="" />'."\n". |
'<input type="hidden" name="unamedom'.$counter.'" value="'.$uname.':'.$udom.'" />'."\n"; |
'<input type="hidden" name="unamedom'.$counter.'" value="'.$uname.':' |
$result.=' <a href="javascript:msgCenter(document.SCORE,'.$counter. |
.$udom.'" />'."\n"; |
',\''.$ENV{'form.fullname'}.'\')"; TARGET=_self>'. |
my ($lastname,$givenn) = split(/,/,$ENV{'form.fullname'}); |
'Compose Message to student'.($col_flag > 1 ? 's' : '').'</a>'. |
my $msgfor = $givenn.' '.$lastname; |
|
if (scalar(@col_fullnames) > 0) { |
|
my $lastone = pop @col_fullnames; |
|
$msgfor .= ', '.(join ', ',@col_fullnames).' and '.$lastone.'.'; |
|
} |
|
$result.='<tr><td bgcolor="#ffffff">'."\n". |
|
' <a href="javascript:msgCenter(document.SCORE,'.$counter. |
|
',\''.$msgfor.'\')"; TARGET=_self>'. |
|
'Compose Message to student'.(scalar(@col_fullnames) >= 1 ? 's' : '').'</a>'. |
'<br /> (Message will be sent when you click on Save & Next below.)'."\n" |
'<br /> (Message will be sent when you click on Save & Next below.)'."\n" |
if ($ENV{'form.handgrade'} eq 'yes'); |
if ($ENV{'form.handgrade'} eq 'yes'); |
$request->print($result); |
$request->print($result); |
Line 1022 KEYWORDS
|
Line 1108 KEYWORDS
|
'<option selected="on"> </option>'. |
'<option selected="on"> </option>'. |
'<option>excused</option></select>'."  \n"; |
'<option>excused</option></select>'."  \n"; |
$result.='<input type="hidden" name="stores'.$counter.'_'.$partid.'" value="0" />'; |
$result.='<input type="hidden" name="stores'.$counter.'_'.$partid.'" value="0" />'; |
$result.='</td></tr></table>'; |
$result.='</td></tr></table>'."\n"; |
$request->print($result); |
$request->print($result); |
} |
} |
$request->print('<input type="hidden" name="partlist'.$counter.'" value="'.(join ":",@partlist).'" />'."\n"); |
$result='<input type="hidden" name="partlist'.$counter. |
$request->print('</td></tr></table></td></tr></table>'."\n"); |
'" value="'.(join ":",@partlist).'" />'."\n"; |
|
my $ctr = 0; |
|
while ($ctr < scalar(@partlist)) { |
|
$result.='<input type="hidden" name="partid'.$counter.'_'.$ctr.'" value="'. |
|
$partlist[$ctr].'" />'."\n"; |
|
$ctr++; |
|
} |
|
$request->print($result.'</td></tr></table></td></tr></table>'."\n"); |
|
|
# print end of form |
# print end of form |
if ($counter == $total) { |
if ($counter == $total) { |
my $endform.='<table border="0"><tr><td><input type="submit" name="gradeOpt" value="Save & Next" />'; |
my $endform='<table border="0"><tr><td>'. |
my $ntstu ='<select name="NTSTU">'. |
'<input type="hidden" name="gradeOpt" value="" />'."\n"; |
'<option>1</option><option>2</option>'. |
if ($ENV{'form.handgrade'} eq 'yes') { |
'<option>3</option><option>5</option>'. |
$endform.='<input type="button" value="Save & Next" '. |
'<option>7</option><option>10</option></select>'."\n"; |
'onClick="javascript:checksubmit(\'Save & Next\','. |
my $nsel = ($ENV{'form.NTSTU'} ne '' ? $ENV{'form.NTSTU'} : '1'); |
$total.','.scalar(@partlist).');" TARGET=_self> '."\n"; |
$ntstu =~ s/<option>$nsel</<option selected="on">$nsel</; |
my $ntstu ='<select name="NTSTU">'. |
$endform.=$ntstu.'student(s) '. |
'<option>1</option><option>2</option>'. |
'<input type="submit" name="gradeOpt" value="Next" /> '. |
'<option>3</option><option>5</option>'. |
'<input type="submit" name="gradeOpt" value="Previous" /> '. |
'<option>7</option><option>10</option></select>'."\n"; |
'(Next and Previous do not save the scores.)'. |
my $nsel = ($ENV{'form.NTSTU'} ne '' ? $ENV{'form.NTSTU'} : '1'); |
'</td><tr></table></form>'; |
$ntstu =~ s/<option>$nsel</<option selected="on">$nsel</; |
|
$endform.=$ntstu.'student(s) '; |
|
} else { |
|
$endform.='<input type="hidden" name="NTSTU" value="1" />'."\n"; |
|
} |
|
$endform.='<input type="button" value="Next" '. |
|
'onClick="javascript:checksubmit(\'Next\');" TARGET=_self> '."\n". |
|
'<input type="button" value="Previous" '. |
|
'onClick="javascript:checksubmit(\'Previous\');" TARGET=_self> '; |
|
$endform.='(Next and Previous do not save the scores.)'."\n" |
|
if ($ENV{'form.handgrade'} eq 'yes'); |
|
$endform.='</td><tr></table></form>'; |
$request->print($endform); |
$request->print($endform); |
} |
} |
return ''; |
return ''; |
Line 1102 sub processHandGrade {
|
Line 1206 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 ($errorflg) = &saveHandGrade($request,$url,$symb,$uname,$udom,$ctr); |
my ($errorflag) = &saveHandGrade($request,$url,$symb,$uname,$udom,$ctr); |
return '' if ($errorflg eq 'error'); |
|
|
|
my $includemsg = $ENV{'form.includemsg'.$ctr}; |
my $includemsg = $ENV{'form.includemsg'.$ctr}; |
my ($subject,$message,$msgstatus) = ('','',''); |
my ($subject,$message,$msgstatus) = ('','',''); |
Line 1263 sub saveHandGrade {
|
Line 1366 sub saveHandGrade {
|
my $pts = ($ENV{'form.GD_BOX'.$newflg.'_'.$_} ne '' ? |
my $pts = ($ENV{'form.GD_BOX'.$newflg.'_'.$_} ne '' ? |
$ENV{'form.GD_BOX'.$newflg.'_'.$_} : |
$ENV{'form.GD_BOX'.$newflg.'_'.$_} : |
$ENV{'form.RADVAL'.$newflg.'_'.$_}); |
$ENV{'form.RADVAL'.$newflg.'_'.$_}); |
if ($pts eq '') { |
|
&userError($request,'No point was assigned for part '.$_. |
|
' and for username '.$stuname.'.'); |
|
return 'error'; |
|
} |
|
my $wgt = $ENV{'form.WGT'.$newflg.'_'.$_} eq '' ? 1 : |
my $wgt = $ENV{'form.WGT'.$newflg.'_'.$_} eq '' ? 1 : |
$ENV{'form.WGT'.$newflg.'_'.$_}; |
$ENV{'form.WGT'.$newflg.'_'.$_}; |
my $partial= $pts/$wgt; |
my $partial= $pts/$wgt; |
Line 1304 sub viewgrades_js {
|
Line 1402 sub viewgrades_js {
|
|
|
$request->print(<<VIEWJAVASCRIPT); |
$request->print(<<VIEWJAVASCRIPT); |
<script type="text/javascript" language="javascript"> |
<script type="text/javascript" language="javascript"> |
function viewOneStudent(user,domain) { |
function writePoint(partid,weight,point) { |
document.onestudent.student.value = user; |
|
document.onestudent.userdom.value = domain; |
|
document.onestudent.submit(); |
|
} |
|
|
|
function writePoint(partid,weight,point) { |
|
var radioButton = eval("document.classgrade.RADVAL_"+partid); |
var radioButton = eval("document.classgrade.RADVAL_"+partid); |
var textbox = eval("document.classgrade.TEXTVAL_"+partid); |
var textbox = eval("document.classgrade.TEXTVAL_"+partid); |
if (point == "textval") { |
if (point == "textval") { |
Line 1480 sub viewgrades {
|
Line 1572 sub viewgrades {
|
&viewgrades_js($request); |
&viewgrades_js($request); |
|
|
my ($symb,$url) = ($ENV{'form.symb'},$ENV{'form.url'}); |
my ($symb,$url) = ($ENV{'form.symb'},$ENV{'form.url'}); |
my $result='<h2><font color="#339933">Manual Grading</font></h2>'; |
my $result='<h3><font color="#339933">Manual Grading</font></h3>'; |
|
|
$result.='<font size=+1><b>Resource: </b>'.$ENV{'form.url'}.'</font>'."\n"; |
$result.='<font size=+1><b>Resource: </b>'.$ENV{'form.url'}.'</font>'."\n"; |
|
|
#view individual student submission form - called using Javascript viewOneStudent |
#view individual student submission form - called using Javascript viewOneStudent |
$result.= '<form action="/adm/grades" method="post" name="onestudent">'."\n". |
$result.=&jscriptNform($url,$symb); |
'<input type="hidden" name="symb" value="'.$symb.'" />'."\n". |
|
'<input type="hidden" name="url" value="'.$url.'" />'."\n". |
|
'<input type="hidden" name="command" value="submission" />'."\n". |
|
'<input type="hidden" name="student" value="" />'."\n". |
|
'<input type="hidden" name="userdom" value="" />'."\n". |
|
'</form>'."\n"; |
|
|
|
#beginning of class grading form |
#beginning of class grading form |
$result.= '<form action="/adm/grades" method="post" name="classgrade">'."\n". |
$result.= '<form action="/adm/grades" method="post" name="classgrade">'."\n". |
Line 1499 sub viewgrades {
|
Line 1585 sub viewgrades {
|
'<input type="hidden" name="url" value="'.$url.'" />'."\n". |
'<input type="hidden" name="url" value="'.$url.'" />'."\n". |
'<input type="hidden" name="command" value="editgrades" />'."\n". |
'<input type="hidden" name="command" value="editgrades" />'."\n". |
'<input type="hidden" name="section" value="'.$ENV{'form.section'}.'" />'."\n"; |
'<input type="hidden" name="section" value="'.$ENV{'form.section'}.'" />'."\n"; |
|
|
$result.='To assign the same score for all the students use the radio buttons or '. |
$result.='To assign the same score for all the students use the radio buttons or '. |
'text box below. To assign scores individually fill in the score boxes for '. |
'text box below. To assign scores individually fill in the score boxes for '. |
'each student in the table below. <font color="red">A part that has already '. |
'each student in the table below. <font color="red">A part that has already '. |
Line 1512 sub viewgrades {
|
Line 1597 sub viewgrades {
|
my %weight = (); |
my %weight = (); |
my $ctsparts = 0; |
my $ctsparts = 0; |
$result.='<table border="0">'; |
$result.='<table border="0">'; |
|
my %seen = (); |
for (sort keys(%$handgrade)) { |
for (sort keys(%$handgrade)) { |
my ($responsetype,$handgrade)=split(/:/,$$handgrade{$_}); |
|
my ($partid,$respid) = split (/_/); |
my ($partid,$respid) = split (/_/); |
|
next if $seen{$partid}; |
|
$seen{$partid}++; |
|
my ($responsetype,$handgrade)=split(/:/,$$handgrade{$_}); |
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 1547 sub viewgrades {
|
Line 1635 sub viewgrades {
|
$result.='</table><input type="hidden" name="totalparts" value="'.$ctsparts.'" />'; |
$result.='</table><input type="hidden" name="totalparts" value="'.$ctsparts.'" />'; |
$result.='<input type="button" value="Reset" '. |
$result.='<input type="button" value="Reset" '. |
'onClick="javascript:resetEntry('.$ctsparts.');" TARGET=_self> '; |
'onClick="javascript:resetEntry('.$ctsparts.');" TARGET=_self> '; |
# $result.='<input type="button" value="Submit Changes" '. |
$result.='<input type="button" value="Submit Changes" '. |
# 'onClick="submit();" TARGET=_self />'."\n"; |
'onClick="javascript:submit();" TARGET=_self />'."\n"; |
$result.= '<input type="submit" name="submit" value="Submit Changes" />'."\n"; |
|
|
|
#table listing all the students in a section/class |
#table listing all the students in a section/class |
#header of table |
#header of table |
Line 1586 sub viewgrades {
|
Line 1673 sub viewgrades {
|
} |
} |
$result.='</table></td></tr></table>'; |
$result.='</table></td></tr></table>'; |
$result.='<input type="hidden" name="total" value="'.$ctr.'" />'."\n"; |
$result.='<input type="hidden" name="total" value="'.$ctr.'" />'."\n"; |
$result.='<input type="submit" name="submit" value="Submit Changes" /></form>'; |
$result.='<input type="button" value="Submit Changes" '. |
|
'onClick="javascript:submit();" TARGET=_self /></form>'."\n"; |
$result.=&show_grading_menu_form($symb,$url); |
$result.=&show_grading_menu_form($symb,$url); |
return $result; |
return $result; |
} |
} |
Line 1638 sub editgrades {
|
Line 1726 sub editgrades {
|
|
|
my $symb=$ENV{'form.symb'}; |
my $symb=$ENV{'form.symb'}; |
my $url =$ENV{'form.url'}; |
my $url =$ENV{'form.url'}; |
my $title='<h2><font color="#339933">Current Grade Status</font></h2>'; |
my $title='<h3><font color="#339933">Current Grade Status</font></h3>'; |
$title.='<font size=+1><b>Resource: </b>'.$ENV{'form.url'}.'</font><br />'."\n"; |
$title.='<font size=+1><b>Resource: </b>'.$ENV{'form.url'}.'</font><br />'."\n"; |
$title.='<font size=+1><b>Section: </b>'.$ENV{'form.section'}.'</font>'."\n"; |
$title.='<font size=+1><b>Section: </b>'.$ENV{'form.section'}.'</font>'."\n"; |
$title.= &show_grading_menu_form ($symb,$url); |
$title.= &show_grading_menu_form ($symb,$url); |
Line 1810 ENDPICK
|
Line 1898 ENDPICK
|
|
|
sub csvuploadmap_header { |
sub csvuploadmap_header { |
my ($request,$symb,$url,$datatoken,$distotal)= @_; |
my ($request,$symb,$url,$datatoken,$distotal)= @_; |
my $result; |
|
my $javascript; |
my $javascript; |
if ($ENV{'form.upfile_associate'} eq 'reverse') { |
if ($ENV{'form.upfile_associate'} eq 'reverse') { |
$javascript=&csvupload_javascript_reverse_associate(); |
$javascript=&csvupload_javascript_reverse_associate(); |
} else { |
} else { |
$javascript=&csvupload_javascript_forward_associate(); |
$javascript=&csvupload_javascript_forward_associate(); |
} |
} |
|
|
|
my $result='<table border="0">'; |
|
$result.='<tr><td colspan=3><font size=+1><b>Resource: </b>'.$url.'</font></td></tr>'; |
|
my ($partlist,$handgrade) = &response_type($url); |
|
my ($resptype,$hdgrade)=('','no'); |
|
for (sort keys(%$handgrade)) { |
|
my ($responsetype,$handgrade)=split(/:/,$$handgrade{$_}); |
|
$resptype = $responsetype; |
|
$hdgrade = $handgrade if ($handgrade eq 'yes'); |
|
$result.='<tr><td><b>Part </b>'.(split(/_/))[0].'</td>'. |
|
'<td><b>Type: </b>'.$responsetype.'</td>'. |
|
'<td><b>Handgrade: </b>'.$handgrade.'</font></td></tr>'; |
|
} |
|
$result.='</table>'; |
$request->print(<<ENDPICK); |
$request->print(<<ENDPICK); |
<form method="post" enctype="multipart/form-data" action="/adm/grades" name="gradesupload"> |
<form method="post" enctype="multipart/form-data" action="/adm/grades" name="gradesupload"> |
<h3>Uploading Class Grades for resource $url</h3> |
<h3><font color="#339933">Uploading Class Grades</font></h3> |
|
$result |
<hr> |
<hr> |
<h3>Identify fields</h3> |
<h3>Identify fields</h3> |
Total number of records found in file: $distotal <hr /> |
Total number of records found in file: $distotal <hr /> |
Line 1887 sub csvuploadmap {
|
Line 1989 sub csvuploadmap {
|
my ($i,$keyfields); |
my ($i,$keyfields); |
if (@records) { |
if (@records) { |
my @fields=&csvupload_fields($url); |
my @fields=&csvupload_fields($url); |
|
|
if ($ENV{'form.upfile_associate'} eq 'reverse') { |
if ($ENV{'form.upfile_associate'} eq 'reverse') { |
&Apache::loncommon::csv_print_samples($request,\@records); |
&Apache::loncommon::csv_print_samples($request,\@records); |
$i=&Apache::loncommon::csv_print_select_table($request,\@records, |
$i=&Apache::loncommon::csv_print_select_table($request,\@records, |
Line 1987 sub gradingmenu {
|
Line 2090 sub gradingmenu {
|
my ($request) = @_; |
my ($request) = @_; |
my ($symb,$url)=&get_symb_and_url($request); |
my ($symb,$url)=&get_symb_and_url($request); |
if (!$symb) {return '';} |
if (!$symb) {return '';} |
my $result='<h2> <font color="#339933">Select a Grading Method</font></h2>'; |
my $result='<h3> <font color="#339933">Select a Grading Method</font></h3>'; |
$result.='<table border="0">'; |
$result.='<table border="0">'; |
$result.='<tr><td colspan=3><font size=+1><b>Resource: </b>'.$url.'</font></td></tr>'; |
$result.='<tr><td colspan=3><font size=+1><b>Resource: </b>'.$url.'</font></td></tr>'; |
my ($partlist,$handgrade) = &response_type($url); |
my ($partlist,$handgrade) = &response_type($url); |
Line 2155 sub handler {
|
Line 2258 sub handler {
|
'grade_courseid' => $tcrsid, |
'grade_courseid' => $tcrsid, |
'grade_symb' => $tsymb))); |
'grade_symb' => $tsymb))); |
} else { |
} else { |
$request->print('<h2>Not authorized: '.$token.'</h2>'); |
$request->print('<h3>Not authorized: '.$token.'</h3>'); |
} |
} |
} else { |
} else { |
$request->print('<h2>Not a valid DocID: '.$token.'</h2>'); |
$request->print('<h3>Not a valid DocID: '.$token.'</h3>'); |
} |
} |
} else { |
} else { |
$request->print(&Apache::lonxml::tokeninputfield()); |
$request->print(&Apache::lonxml::tokeninputfield()); |