version 1.71, 2003/03/11 19:32:02
|
version 1.72, 2003/03/14 17:46:31
|
Line 209 sub jscriptNform {
|
Line 209 sub jscriptNform {
|
$jscript.= '<form action="/adm/grades" method="post" name="onestudent">'."\n". |
$jscript.= '<form action="/adm/grades" method="post" name="onestudent">'."\n". |
'<input type="hidden" name="symb" value="'.$symb.'" />'."\n". |
'<input type="hidden" name="symb" value="'.$symb.'" />'."\n". |
'<input type="hidden" name="url" value="'.$url.'" />'."\n". |
'<input type="hidden" name="url" value="'.$url.'" />'."\n". |
|
'<input type="hidden" name="lastCmd" value="'.$ENV{'form.lastCmd'}.'" />'."\n". |
|
'<input type="hidden" name="lastSec" value="'.$ENV{'form.lastSec'}.'" />'."\n". |
|
'<input type="hidden" name="probTitle" value="'.$ENV{'form.probTitle'}.'" />'."\n". |
'<input type="hidden" name="command" value="submission" />'."\n". |
'<input type="hidden" name="command" value="submission" />'."\n". |
'<input type="hidden" name="student" value="" />'."\n". |
'<input type="hidden" name="student" value="" />'."\n". |
'<input type="hidden" name="userdom" value="" />'."\n". |
'<input type="hidden" name="userdom" value="" />'."\n". |
Line 237 sub verifyreceipt {
|
Line 240 sub verifyreceipt {
|
|
|
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". |
'<font size=+1><b>Problem: </b>'. |
'<font size=+1><b>Problem: </b>'.$ENV{'form.probTitle'}.'</font><br><br>'."\n"; |
&Apache::lonnet::metadata($ENV{'form.url'},'title').'</font><br><br>'."\n"; |
|
|
|
my ($string,$contents,$matches) = ('','',0); |
my ($string,$contents,$matches) = ('','',0); |
my (undef,undef,$fullname) = &getclasslist('all','0'); |
my (undef,undef,$fullname) = &getclasslist('all','0'); |
Line 273 sub verifyreceipt {
|
Line 275 sub verifyreceipt {
|
return $string.&show_grading_menu_form($symb,$url); |
return $string.&show_grading_menu_form($symb,$url); |
} |
} |
|
|
# |
|
# Pick student and page/sequence for manual grading |
|
|
|
|
|
#--- This is called by a number of programs. |
#--- This is called by a number of programs. |
#--- Called from the Grading Menu - View/Grade an individual student |
#--- Called from the Grading Menu - View/Grade an individual student |
#--- Also called directly when one clicks on the subm button |
#--- Also called directly when one clicks on the subm button |
Line 284 sub verifyreceipt {
|
Line 282 sub verifyreceipt {
|
sub listStudents { |
sub listStudents { |
my ($request) = shift; |
my ($request) = shift; |
|
|
my ($symb,$url) = &get_symb_and_url(); |
my ($symb,$url) = &get_symb_and_url($request); |
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'}; |
Line 306 sub listStudents {
|
Line 304 sub listStudents {
|
$result='<h3><font color="#339933"> '. |
$result='<h3><font color="#339933"> '. |
$viewgrade. |
$viewgrade. |
' Submissions for a Student or a Group of Students</font></h3>'. |
' Submissions for a Student or a Group of Students</font></h3>'. |
'<table border="0"><tr><td colspan=3><font size=+1>'. |
'<table border="0"><tr><td colspan=3><font size=+1>'. |
'<b>Problem: </b>'.&Apache::lonnet::metadata($url,'title').'</font></td></tr>'.$result; |
'<b>Problem: </b>'.$ENV{'form.probTitle'}.'</font></td></tr>'.$result; |
|
|
$request->print(<<LISTJAVASCRIPT); |
$request->print(<<LISTJAVASCRIPT); |
<script type="text/javascript" language="javascript"> |
<script type="text/javascript" language="javascript"> |
Line 357 LISTJAVASCRIPT
|
Line 355 LISTJAVASCRIPT
|
'<input type="hidden" name="response" value="'.$ENV{'form.response'}.'" />'."\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="handgrade" value="'.$ENV{'form.handgrade'}.'" /><br />'."\n". |
'<input type="hidden" name="showgrading" value="'.$ENV{'form.showgrading'}.'" /><br />'."\n". |
'<input type="hidden" name="showgrading" value="'.$ENV{'form.showgrading'}.'" /><br />'."\n". |
|
'<input type="hidden" name="lastCmd" value="'.$ENV{'form.lastCmd'}.'" />'."\n". |
|
'<input type="hidden" name="lastSec" value="'.$ENV{'form.lastSec'}.'" />'."\n". |
|
'<input type="hidden" name="probTitle" value="'.$ENV{'form.probTitle'}.'" />'."\n". |
'<input type="hidden" name="url" value="'.$url.'" />'."\n". |
'<input type="hidden" name="url" value="'.$url.'" />'."\n". |
'<input type="hidden" name="symb" value="'.$symb.'" />'."\n". |
'<input type="hidden" name="symb" value="'.$symb.'" />'."\n". |
'To '.lc($viewgrade).' a submission, click on the check box next to the student\'s name. Then '."\n". |
'To '.lc($viewgrade).' a submission, click on the check box next to the student\'s name. Then '."\n". |
Line 459 sub sub_page_js {
|
Line 460 sub sub_page_js {
|
function updateRadio(formname,id,weight) { |
function updateRadio(formname,id,weight) { |
var gradeBox = eval("formname.GD_BOX"+id); |
var gradeBox = eval("formname.GD_BOX"+id); |
var radioButton = eval("formname.RADVAL"+id); |
var radioButton = eval("formname.RADVAL"+id); |
var pts = checkSolved(formname,id) == 'update' ? gradeBox.value : weight; |
var oldpts = eval("formname.oldpts"+id+".value"); |
|
var pts = checkSolved(formname,id) == 'update' ? gradeBox.value : oldpts; |
gradeBox.value = pts; |
gradeBox.value = pts; |
var resetbox = false; |
var resetbox = false; |
if (isNaN(pts) || pts < 0) { |
if (isNaN(pts) || pts < 0) { |
Line 496 sub sub_page_js {
|
Line 498 sub sub_page_js {
|
stores.value = "0"; |
stores.value = "0"; |
} |
} |
|
|
function writeBox(formname,id,pts,weight) { |
function writeBox(formname,id,pts) { |
var gradeBox = eval("formname.GD_BOX"+id); |
var gradeBox = eval("formname.GD_BOX"+id); |
if (checkSolved(formname,id) == 'update') { |
if (checkSolved(formname,id) == 'update') { |
gradeBox.value = pts; |
gradeBox.value = pts; |
} else { |
} else { |
gradeBox.value = weight; |
var oldpts = eval("formname.oldpts"+id+".value"); |
|
gradeBox.value = oldpts; |
var radioButton = eval("formname.RADVAL"+id); |
var radioButton = eval("formname.RADVAL"+id); |
for (var i=0; i<radioButton.length; i++) { |
for (var i=0; i<radioButton.length; i++) { |
radioButton[i].checked=false; |
radioButton[i].checked=false; |
if (i == weight) { |
if (i == oldpts) { |
radioButton[i].checked=true; |
radioButton[i].checked=true; |
} |
} |
} |
} |
Line 699 sub sub_page_kw_js {
|
Line 702 sub sub_page_kw_js {
|
} |
} |
|
|
function savedMsgHeader(Nmsg,usrctr,fullname) { |
function savedMsgHeader(Nmsg,usrctr,fullname) { |
var height = 30*Nmsg+250; |
var height = 50*Nmsg+250; |
var scrollbar = "no"; |
var scrollbar = "no"; |
if (height > 600) { |
if (height > 600) { |
height = 600; |
height = 600; |
Line 762 sub sub_page_kw_js {
|
Line 765 sub sub_page_kw_js {
|
pWin.document.write("<td><input name=\\"msgsub\\" type=\\"text\\" value=\\""+msg+"\\"size=\\"60\\" maxlength=\\"80\\"></td></tr>"); |
pWin.document.write("<td><input name=\\"msgsub\\" type=\\"text\\" value=\\""+msg+"\\"size=\\"60\\" maxlength=\\"80\\"></td></tr>"); |
} |
} |
|
|
function displaySavedMsg(ctr,msg,shwsel) { |
function displaySavedMsg(ctr,msg,shwsel) { |
pWin.document.write("<tr bgcolor=\\"#ffffdd\\">"); |
pWin.document.write("<tr bgcolor=\\"#ffffdd\\">"); |
pWin.document.write("<td align=\\"center\\">"+ctr+"</td>"); |
pWin.document.write("<td align=\\"center\\">"+ctr+"</td>"); |
pWin.document.write("<td align=\\"center\\"><input name=\\"msgn"+ctr+"\\" type=\\"checkbox\\"" +shwsel+"></td>"); |
pWin.document.write("<td align=\\"center\\"><input name=\\"msgn"+ctr+"\\" type=\\"checkbox\\"" +shwsel+"></td>"); |
pWin.document.write("<td><input name=\\"msg"+ctr+"\\" type=\\"text\\" value=\\""+msg+"\\" size=\\"60\\" maxlength=\\"80\\"></td></tr>"); |
pWin.document.write("<td><textarea name=\\"msg"+ctr+"\\" cols=\\"60\\" rows=\\"3\\">"+msg+"</textarea></td></tr>"); |
} |
} |
|
|
function newMsg(newmsg,shwsel) { |
function newMsg(newmsg,shwsel) { |
pWin.document.write("<tr bgcolor=\\"#ffffdd\\">"); |
pWin.document.write("<tr bgcolor=\\"#ffffdd\\">"); |
pWin.document.write("<td align=\\"center\\">New</td>"); |
pWin.document.write("<td align=\\"center\\">New</td>"); |
pWin.document.write("<td align=\\"center\\"><input name=\\"newmsgchk\\" type=\\"checkbox\\"" +shwsel+"></td>"); |
pWin.document.write("<td align=\\"center\\"><input name=\\"newmsgchk\\" type=\\"checkbox\\"" +shwsel+"></td>"); |
pWin.document.write("<td><input name=\\"newmsg\\" type=\\"text\\" onchange=\\"javascript:this.form.newmsgchk.checked=true\\" value=\\""+newmsg+"\\" size=\\"60\\" maxlength=\\"80\\"></td></tr>"); |
pWin.document.write("<td><textarea name=\\"newmsg\\" cols=\\"60\\" rows=\\"3\\" onchange=\\"javascript:this.form.newmsgchk.checked=true\\" >"+newmsg+"</textarea></td></tr>"); |
} |
} |
|
|
function msgTail() { |
function msgTail() { |
Line 871 function displaySavedMsg(ctr,msg,shwsel)
|
Line 874 function displaySavedMsg(ctr,msg,shwsel)
|
function highlightend() { |
function highlightend() { |
hwdWin.document.write("</table>"); |
hwdWin.document.write("</table>"); |
hwdWin.document.write("</td></tr></table> "); |
hwdWin.document.write("</td></tr></table> "); |
// hwdWin.document.write("<input type=\\"button\\" value=\\"Save\\" onClick=\\"javascript:updateChoice(0)\\"> "); |
|
hwdWin.document.write("<input type=\\"button\\" value=\\"Save\\" onClick=\\"javascript:updateChoice(1)\\"> "); |
hwdWin.document.write("<input type=\\"button\\" value=\\"Save\\" onClick=\\"javascript:updateChoice(1)\\"> "); |
hwdWin.document.write("<input type=\\"button\\" value=\\"Cancel\\" onClick=\\"self.close()\\"><br><br>"); |
hwdWin.document.write("<input type=\\"button\\" value=\\"Cancel\\" onClick=\\"self.close()\\"><br><br>"); |
hwdWin.document.write("</form>"); |
hwdWin.document.write("</form>"); |
Line 905 sub gradeBox {
|
Line 907 sub gradeBox {
|
while ($ctr<=$wgt) { |
while ($ctr<=$wgt) { |
$result.= '<td><input type="radio" name="RADVAL'.$counter.'_'.$partid.'" '. |
$result.= '<td><input type="radio" name="RADVAL'.$counter.'_'.$partid.'" '. |
'onclick="javascript:writeBox(this.form,\''.$counter.'_'.$partid.'\','. |
'onclick="javascript:writeBox(this.form,\''.$counter.'_'.$partid.'\','. |
$ctr.','.$wgt.')" value="'.$ctr.'" '. |
$ctr.')" value="'.$ctr.'" '. |
($score eq $ctr ? 'checked':'').' /> '.$ctr."</td>\n"; |
($score eq $ctr ? 'checked':'').' /> '.$ctr."</td>\n"; |
$result.=(($ctr+1)%10 == 0 ? '</tr><tr>' : ''); |
$result.=(($ctr+1)%10 == 0 ? '</tr><tr>' : ''); |
$ctr++; |
$ctr++; |
Line 964 sub show_problem {
|
Line 966 sub show_problem {
|
$result.='</td></tr></table>'; |
$result.='</td></tr></table>'; |
$result.='</td></tr></table><br />'; |
$result.='</td></tr></table><br />'; |
return $result; |
return $result; |
# $request->print($result); |
|
} |
} |
|
|
# --------------------------- show submissions of a student, option to grade |
# --------------------------- show submissions of a student, option to grade |
Line 972 sub submission {
|
Line 973 sub submission {
|
my ($request,$counter,$total) = @_; |
my ($request,$counter,$total) = @_; |
|
|
(my $url=$ENV{'form.url'})=~s-^http://($ENV{'SERVER_NAME'}|$ENV{'HTTP_HOST'})--; |
(my $url=$ENV{'form.url'})=~s-^http://($ENV{'SERVER_NAME'}|$ENV{'HTTP_HOST'})--; |
# if ($ENV{'form.student'} eq '') { &moreinfo($request,'Need student login id'); return ''; } |
|
my ($uname,$udom) = ($ENV{'form.student'},$ENV{'form.userdom'}); |
my ($uname,$udom) = ($ENV{'form.student'},$ENV{'form.userdom'}); |
($uname,$udom) = &finduser($uname) if $udom eq ''; |
($uname,$udom) = &finduser($uname) if $udom eq ''; |
$ENV{'form.fullname'} = &get_fullname ($uname,$udom) if $ENV{'form.fullname'} eq ''; |
$ENV{'form.fullname'} = &get_fullname ($uname,$udom) if $ENV{'form.fullname'} eq ''; |
# if ($uname eq '') { &moreinfo($request,'Unable to find student'); return ''; } |
|
|
|
my $symb=($ENV{'form.symb'} ne '' ? $ENV{'form.symb'} : (&Apache::lonnet::symbread($url))); |
my $symb=($ENV{'form.symb'} ne '' ? $ENV{'form.symb'} : (&Apache::lonnet::symbread($url))); |
if ($symb eq '') { $request->print("Unable to handle ambiguous references:$url:."); return ''; } |
if ($symb eq '') { $request->print("Unable to handle ambiguous references:$url:."); return ''; } |
my $last = ($ENV{'form.lastSub'} eq 'last' ? 'last' : ''); |
my $last = ($ENV{'form.lastSub'} eq 'last' ? 'last' : ''); |
# $ENV{'form.vProb'} = $ENV{'form.vProb'} ne '' ? $ENV{'form.vProb'} : 'yes'; |
|
|
|
# header info |
# header info |
if ($counter == 0) { |
if ($counter == 0) { |
&sub_page_js($request); |
&sub_page_js($request); |
&sub_page_kw_js($request); |
&sub_page_kw_js($request); |
$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>Problem: </b>'. |
'<font size=+1> <b>Problem: </b>'.$ENV{'form.probTitle'}.'</font>'."\n"); |
&Apache::lonnet::metadata($url,'title').'</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 1011 sub submission {
|
Line 1008 sub submission {
|
$ENV{'form.kwsize'} = $keyhash{$loginuser.'_kwsize'} ne '' ? $keyhash{$loginuser.'_kwsize'} : '0'; |
$ENV{'form.kwsize'} = $keyhash{$loginuser.'_kwsize'} ne '' ? $keyhash{$loginuser.'_kwsize'} : '0'; |
$ENV{'form.kwstyle'} = $keyhash{$loginuser.'_kwstyle'} ne '' ? $keyhash{$loginuser.'_kwstyle'} : ''; |
$ENV{'form.kwstyle'} = $keyhash{$loginuser.'_kwstyle'} ne '' ? $keyhash{$loginuser.'_kwstyle'} : ''; |
$ENV{'form.msgsub'} = $keyhash{$symb.'_subject'} ne '' ? |
$ENV{'form.msgsub'} = $keyhash{$symb.'_subject'} ne '' ? |
$keyhash{$symb.'_subject'} : &Apache::lonnet::metadata($url,'title'); |
$keyhash{$symb.'_subject'} : $ENV{'form.probTitle'}; |
$ENV{'form.savemsgN'} = $keyhash{$symb.'_savemsgN'} ne '' ? $keyhash{$symb.'_savemsgN'} : '0'; |
$ENV{'form.savemsgN'} = $keyhash{$symb.'_savemsgN'} ne '' ? $keyhash{$symb.'_savemsgN'} : '0'; |
|
|
} |
} |
|
|
$request->print('<form action="/adm/grades" method="post" name="SCORE">'."\n". |
$request->print('<form action="/adm/grades" method="post" name="SCORE">'."\n". |
'<input type="hidden" name="command" value="handgrade" />'."\n". |
'<input type="hidden" name="command" value="handgrade" />'."\n". |
|
'<input type="hidden" name="lastCmd" value="'.$ENV{'form.lastCmd'}.'" />'."\n". |
|
'<input type="hidden" name="lastSec" value="'.$ENV{'form.lastSec'}.'" />'."\n". |
|
'<input type="hidden" name="probTitle" value="'.$ENV{'form.probTitle'}.'" />'."\n". |
'<input type="hidden" name="refresh" value="off" />'."\n". |
'<input type="hidden" name="refresh" value="off" />'."\n". |
'<input type="hidden" name="symb" value="'.$symb.'" />'."\n". |
'<input type="hidden" name="symb" value="'.$symb.'" />'."\n". |
'<input type="hidden" name="url" value="'.$url.'" />'."\n". |
'<input type="hidden" name="url" value="'.$url.'" />'."\n". |
Line 1195 KEYWORDS
|
Line 1195 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>'."\n"); |
$request->print('</td></tr></table></td></tr></table></form>'."\n"); |
|
$request->print(&show_grading_menu_form($symb,$url)) |
|
if (($ENV{'form.command'} eq 'submission') || |
|
($ENV{'form.command'} eq 'processGroup' && $counter == $total)); |
return; |
return; |
} |
} |
|
|
Line 1227 KEYWORDS
|
Line 1230 KEYWORDS
|
push @partlist,$partid; |
push @partlist,$partid; |
|
|
$request->print(&gradeBox($request,$symb,$uname,$udom,$counter,$partid,\%record)); |
$request->print(&gradeBox($request,$symb,$uname,$udom,$counter,$partid,\%record)); |
|
|
# $request->print($result); |
|
} |
} |
$result='<input type="hidden" name="partlist'.$counter. |
$result='<input type="hidden" name="partlist'.$counter. |
'" value="'.(join ":",@partlist).'" />'."\n"; |
'" value="'.(join ":",@partlist).'" />'."\n"; |
Line 1281 sub get_last_submission {
|
Line 1282 sub get_last_submission {
|
for ($version=1;$version<=$returnhash{'version'};$version++) { |
for ($version=1;$version<=$returnhash{'version'};$version++) { |
foreach (sort(split(/\:/,$returnhash{$version.':keys'}))) { |
foreach (sort(split(/\:/,$returnhash{$version.':keys'}))) { |
$lasthash{$_}=$returnhash{$version.':'.$_}; |
$lasthash{$_}=$returnhash{$version.':'.$_}; |
# if ($returnhash{$version.':'.$_} =~ /(SUBMITTED|DRAFT)$/) { |
|
$timestamp = scalar(localtime($returnhash{$version.':timestamp'})); |
$timestamp = scalar(localtime($returnhash{$version.':timestamp'})); |
# } |
|
} |
} |
} |
} |
foreach ((keys %lasthash)) { |
foreach ((keys %lasthash)) { |
Line 1466 sub processHandGrade {
|
Line 1465 sub processHandGrade {
|
$ENV{'form.student'} = $uname; |
$ENV{'form.student'} = $uname; |
$ENV{'form.userdom'} = $udom; |
$ENV{'form.userdom'} = $udom; |
$ENV{'form.fullname'} = $$fullname{$_}; |
$ENV{'form.fullname'} = $$fullname{$_}; |
# $ENV{'form.'.$_.':submitted_by'} = $submitter; |
|
# print "submitter=$ENV{'form.'.$_.':submitted_by'}= $submitter:<br>"; |
|
&submission($request,$ctr,$total); |
&submission($request,$ctr,$total); |
$ctr++; |
$ctr++; |
} |
} |
Line 1514 sub saveHandGrade {
|
Line 1511 sub saveHandGrade {
|
} |
} |
$newrecord{'resource.'.$_.'.submitted_by'} = $submitter |
$newrecord{'resource.'.$_.'.submitted_by'} = $submitter |
if ($submitter && ($record{'resource.'.$_.'.submitted_by'} ne $submitter)); |
if ($submitter && ($record{'resource.'.$_.'.submitted_by'} ne $submitter)); |
|
$newrecord{'resource.'.$_.'regrader'}="$ENV{'user.name'}:$ENV{'user.domain'}"; |
} |
} |
} |
} |
|
|
if (scalar(keys(%newrecord)) > 0) { |
if (scalar(keys(%newrecord)) > 0) { |
$newrecord{'resource.regrader'}="$ENV{'user.name'}:$ENV{'user.domain'}"; |
|
&Apache::lonnet::cstore(\%newrecord,$symb, |
&Apache::lonnet::cstore(\%newrecord,$symb, |
$ENV{'request.course.id'},$domain,$stuname); |
$ENV{'request.course.id'},$domain,$stuname); |
} |
} |
Line 1707 sub viewgrades {
|
Line 1704 sub viewgrades {
|
my ($symb,$url) = ($ENV{'form.symb'},$ENV{'form.url'}); |
my ($symb,$url) = ($ENV{'form.symb'},$ENV{'form.url'}); |
my $result='<h3><font color="#339933">Manual Grading</font></h3>'; |
my $result='<h3><font color="#339933">Manual Grading</font></h3>'; |
|
|
$result.='<font size=+1><b>Problem: </b>'.&Apache::lonnet::metadata($ENV{'form.url'},'title') |
$result.='<font size=+1><b>Problem: </b>'.$ENV{'form.probTitle'}.'</font>'."\n"; |
.'</font>'."\n"; |
|
|
|
#view individual student submission form - called using Javascript viewOneStudent |
#view individual student submission form - called using Javascript viewOneStudent |
$result.=&jscriptNform($url,$symb); |
$result.=&jscriptNform($url,$symb); |
Line 1718 sub viewgrades {
|
Line 1714 sub viewgrades {
|
'<input type="hidden" name="symb" value="'.$symb.'" />'."\n". |
'<input type="hidden" name="symb" value="'.$symb.'" />'."\n". |
'<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". |
|
'<input type="hidden" name="lastCmd" value="'.$ENV{'form.lastCmd'}.'" />'."\n". |
|
'<input type="hidden" name="lastSec" value="'.$ENV{'form.lastSec'}.'" />'."\n". |
|
'<input type="hidden" name="probTitle" value="'.$ENV{'form.probTitle'}.'" />'."\n"; |
|
|
$result.='<h3>Assign Common Grade To '; |
$result.='<h3>Assign Common Grade To '; |
if ($ENV{'form.section'} eq 'all') { |
if ($ENV{'form.section'} eq 'all') { |
$result.='Class </h3>'; |
$result.='Class </h3>'; |
Line 1729 sub viewgrades {
|
Line 1729 sub viewgrades {
|
} |
} |
$result.= '<table border=0><tr><td bgcolor="#777777">'."\n". |
$result.= '<table border=0><tr><td bgcolor="#777777">'."\n". |
'<table border=0><tr bgcolor="#ffffdd"><td>'; |
'<table border=0><tr bgcolor="#ffffdd"><td>'; |
# $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 '. |
|
# 'each student in the table below. <font color="red">A part that has already '. |
|
# 'been graded does not get changed using the radio buttons or text box. '. |
|
# 'If needed, it has to be changed individually.</font>'; |
|
# $result.='</td></tr><tr><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($ENV{'form.url'}); |
my ($partlist,$handgrade) = &response_type($ENV{'form.url'}); |
Line 1884 sub editgrades {
|
Line 1878 sub editgrades {
|
my $symb=$ENV{'form.symb'}; |
my $symb=$ENV{'form.symb'}; |
my $url =$ENV{'form.url'}; |
my $url =$ENV{'form.url'}; |
my $title='<h3><font color="#339933">Current Grade Status</font></h3>'; |
my $title='<h3><font color="#339933">Current Grade Status</font></h3>'; |
$title.='<font size=+1><b>Problem: </b>'. |
$title.='<font size=+1><b>Problem: </b>'.$ENV{'form.probTitle'}.'</font><br />'."\n"; |
&Apache::lonnet::metadata($ENV{'form.url'},'title').'</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); |
|
my $result= '<table border="0"><tr><td bgcolor="#777777">'."\n"; |
my $result= '<table border="0"><tr><td bgcolor="#777777">'."\n"; |
$result.= '<table border="0"><tr bgcolor="#deffff">'. |
$result.= '<table border="0"><tr bgcolor="#deffff">'. |
'<td rowspan=2><b>Username</b></td><td rowspan=2><b>Fullname</b></td>'."\n"; |
'<td rowspan=2><b>Username</b></td><td rowspan=2><b>Fullname</b></td>'."\n"; |
Line 1987 sub editgrades {
|
Line 1979 sub editgrades {
|
my $awarded = $ENV{'form.GD_'.$user.'_'.$part.'_'.$type}; |
my $awarded = $ENV{'form.GD_'.$user.'_'.$part.'_'.$type}; |
if ($awarded ne '' && $awarded ne $old_aw) { |
if ($awarded ne '' && $awarded ne $old_aw) { |
$newrecord{'resource.'.$part.'.'.$type}= $awarded; |
$newrecord{'resource.'.$part.'.'.$type}= $awarded; |
|
$newrecord{'resource.'.$part.'regrader'}="$ENV{'user.name'}:$ENV{'user.domain'}"; |
$updateflag=1; |
$updateflag=1; |
} |
} |
$result .= '<td align="center">'.$old_aw.' </td>'. |
$result .= '<td align="center">'.$old_aw.' </td>'. |
Line 1996 sub editgrades {
|
Line 1989 sub editgrades {
|
$result .= '</tr>'."\n"; |
$result .= '</tr>'."\n"; |
if ($updateflag) { |
if ($updateflag) { |
$count++; |
$count++; |
$newrecord{'resource.regrader'}="$ENV{'user.name'}:$ENV{'user.domain'}"; |
|
&Apache::lonnet::cstore(\%newrecord,$symb,$ENV{'request.course.id'}, |
&Apache::lonnet::cstore(\%newrecord,$symb,$ENV{'request.course.id'}, |
$udom,$user); |
$udom,$user); |
} |
} |
} |
} |
$result .= '</table></td></tr></table>'."\n"; |
$result .= '</table></td></tr></table>'."\n". |
|
&show_grading_menu_form ($symb,$url); |
my $msg = '<b>Number of records updated = '.$rec_update. |
my $msg = '<b>Number of records updated = '.$rec_update. |
' for '.$count.' student'.($count <= 1 ? '' : 's').'.</b><br />'. |
' for '.$count.' student'.($count <= 1 ? '' : 's').'.</b><br />'. |
'<b>Total number of students = '.$ENV{'form.total'}.'</b><br />'; |
'<b>Total number of students = '.$ENV{'form.total'}.'</b><br />'; |
Line 2025 sub split_part_type {
|
Line 2018 sub split_part_type {
|
# |
# |
#-------------------------- Next few routines handles grading by csv upload |
#-------------------------- Next few routines handles grading by csv upload |
# |
# |
|
#--- Menu to upload a csv scores --- |
|
sub upcsvScores_form { |
|
my ($request) = shift; |
|
my ($symb,$url)=&get_symb_and_url($request); |
|
if (!$symb) {return '';} |
|
my $result =<<CSVFORMJS; |
|
<script type="text/javascript" language="javascript"> |
|
function checkUpload(formname) { |
|
if (formname.upfile.value == "") { |
|
alert("Please use the browse button to select a file from your local directory."); |
|
return false; |
|
} |
|
formname.submit(); |
|
if (navigator.appName !="Netscape") {self.close()}; //if netscape if appears to close before submit!!! |
|
// any suggestion how to get around this?? |
|
} |
|
</script> |
|
CSVFORMJS |
|
$ENV{'form.probTitle'} = &Apache::lonnet::metadata($url,'title'); |
|
$result.='<table width=100% border=0><tr><td bgcolor=#777777>'."\n"; |
|
$result.='<table width=100% border=0><tr bgcolor="#e6ffff"><td>'."\n"; |
|
$result.=' <b>Specify a file containing the class scores for problem - '.$ENV{'form.probTitle'}. |
|
'.</b></td></tr>'."\n"; |
|
$result.='<tr bgcolor=#ffffe6><td>'."\n"; |
|
my $upfile_select=&Apache::loncommon::upfile_select_html(); |
|
$result.=<<ENDUPFORM; |
|
<form method="post" enctype="multipart/form-data" action="/adm/grades" name="gradesupload" target="LONcatInfo"> |
|
<input type="hidden" name="symb" value="$symb" /> |
|
<input type="hidden" name="url" value="$url" /> |
|
<input type="hidden" name="command" value="csvuploadmap" /> |
|
<input type="hidden" name="probTitle" value="$ENV{'form.probTitle'}" /> |
|
$upfile_select |
|
<br /><input type="button" onClick="javascript:checkUpload(this.form);" value="Upload Scores" /> |
|
<input type="button" value="Cancel" onClick="self.close()"> |
|
|
|
</form> |
|
ENDUPFORM |
|
$result.='</td></tr></table>'."\n"; |
|
$result.='</td></tr></table>'."\n"; |
|
return $result; |
|
} |
|
|
#--- Javascript to handle csv upload |
#--- Javascript to handle csv upload |
sub csvupload_javascript_reverse_associate { |
sub csvupload_javascript_reverse_associate { |
return(<<ENDPICK); |
return(<<ENDPICK); |
Line 2109 sub csvuploadmap_header {
|
Line 2144 sub csvuploadmap_header {
|
} |
} |
|
|
my $result='<table border="0">'; |
my $result='<table border="0">'; |
$result.='<tr><td colspan=3><font size=+1><b>Problem: </b>'.&Apache::lonnet::metadata($url,'title') |
$result.='<tr><td colspan=3><font size=+1><b>Problem: </b>'.$ENV{'form.probTitle'}.'</font></td></tr>'; |
.'</font></td></tr>'; |
|
my ($partlist,$handgrade) = &response_type($url); |
my ($partlist,$handgrade) = &response_type($url); |
my ($resptype,$hdgrade)=('','no'); |
my ($resptype,$hdgrade)=('','no'); |
for (sort keys(%$handgrade)) { |
for (sort keys(%$handgrade)) { |
Line 2141 to this page if the data selected is ins
|
Line 2175 to this page if the data selected is ins
|
value="$ENV{'form.upfile_associate'}" /> |
value="$ENV{'form.upfile_associate'}" /> |
<input type="hidden" name="symb" value="$symb" /> |
<input type="hidden" name="symb" value="$symb" /> |
<input type="hidden" name="url" value="$url" /> |
<input type="hidden" name="url" value="$url" /> |
|
<input type="hidden" name="lastCmd" value="$ENV{'form.lastCmd'}" /> |
|
<input type="hidden" name="lastSec" value="$ENV{'form.lastSec'}" /> |
|
<input type="hidden" name="probTitle" value="$ENV{'form.probTitle'}" /> |
<input type="hidden" name="command" value="csvuploadassign" /> |
<input type="hidden" name="command" value="csvuploadassign" /> |
<hr /> |
<hr /> |
<script type="text/javascript" language="Javascript"> |
<script type="text/javascript" language="Javascript"> |
Line 2181 sub csvuploadmap {
|
Line 2218 sub csvuploadmap {
|
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 $datatoken; |
my $datatoken; |
if (!$ENV{'form.datatoken'}) { |
if (!$ENV{'form.datatoken'}) { |
$datatoken=&Apache::loncommon::upfile_store($request); |
$datatoken=&Apache::loncommon::upfile_store($request); |
Line 2209 sub csvuploadmap {
|
Line 2247 sub csvuploadmap {
|
} |
} |
} |
} |
&csvuploadmap_footer($request,$i,$keyfields); |
&csvuploadmap_footer($request,$i,$keyfields); |
|
$request->print(&show_grading_menu_form($symb,$url)); |
|
|
return ''; |
return ''; |
} |
} |
|
|
Line 2272 sub csvuploadassign {
|
Line 2312 sub csvuploadassign {
|
#------------- end of section for handling csv file upload --------- |
#------------- end of section for handling csv file upload --------- |
# |
# |
#------------------------------------------------------------------- |
#------------------------------------------------------------------- |
|
|
#-------------------------- Menu interface ------------------------- |
|
# |
# |
#--- Show a Grading Menu button - Calls the next routine --- |
#-------------- Next few routines handles grading by page/sequence |
sub show_grading_menu_form { |
# |
my ($symb,$url)=@_; |
#--- Select a page/sequence and a student to grade |
my $result.='<form action="/adm/grades" method="post">'."\n". |
|
'<input type="hidden" name="symb" value="'.$symb.'" />'."\n". |
|
'<input type="hidden" name="url" value="'.$url.'" />'."\n". |
|
'<input type="hidden" name="command" value="gradingmenu" />'."\n". |
|
'<input type="submit" name="submit" value="Grading Menu" />'."\n". |
|
'</form>'."\n"; |
|
return $result; |
|
} |
|
|
|
#--- Displays the main menu page ------- |
|
sub gradingmenu { |
|
my ($request) = @_; |
|
my ($symb,$url)=&get_symb_and_url($request); |
|
if (!$symb) {return '';} |
|
my $result='<h3> <font color="#339933">Select a Grading Method</font></h3>'; |
|
$result.='<table border="0">'; |
|
$result.='<tr><td colspan=3><font size=+1><b>Problem: </b>'. |
|
&Apache::lonnet::metadata($ENV{'form.url'},'title').'</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>'; |
|
$result.=&view_edit_entire_class_form($symb,$url).'<br />'; |
|
$result.=&upcsvScores_form($symb,$url).'<br />'; |
|
$result.=&viewGradeaStu_form($symb,$url,$resptype,$hdgrade).'<br />'; |
|
$result.=&gradeByPage_form($symb,$url,$resptype,$hdgrade).'<br />'; |
|
$result.=&verifyReceipt_form($symb,$url) |
|
if ((&Apache::lonnet::allowed('mgr',$ENV{'request.course.id'})) && ($symb)); |
|
|
|
return $result; |
|
} |
|
|
|
#--- Menu for grading a section or the whole class --- |
|
sub view_edit_entire_class_form { |
|
my ($symb,$url)=@_; |
|
my ($classlist,$sections,undef) = &getclasslist('all','0'); |
|
my $result.='<table width=100% border=0><tr><td bgcolor=#777777>'."\n"; |
|
$result.='<table width=100% border=0><tr bgcolor="#e6ffff"><td>'."\n"; |
|
$result.=' <b>Grade Entire Section or Class</b></td></tr>'."\n"; |
|
$result.='<tr bgcolor=#ffffe6><td>'."\n"; |
|
$result.='<form action="/adm/grades" method="post">'."\n". |
|
'<input type="hidden" name="symb" value="'.$symb.'" />'."\n". |
|
'<input type="hidden" name="url" value="'.$url.'" />'."\n". |
|
'<input type="hidden" name="command" value="viewgrades" />'."\n"; |
|
$result.=' <b>Select section:</b> <select name="section">'."\n"; |
|
if (ref($sections)) { |
|
foreach (sort (@$sections)) { |
|
$result.= '<option>'.$_.'</option>'."\n"; |
|
} |
|
} |
|
$result.='<option selected="on">all</select>'."<br />\n"; |
|
$result.=' <input type="button" onClick="submit();" value="Grade" /></form>'."\n"; |
|
$result.='</td></tr></table>'."\n"; |
|
$result.='</td></tr></table>'."\n"; |
|
return $result; |
|
} |
|
|
|
#--- Menu to upload a csv scores --- |
|
sub upcsvScores_form { |
|
my ($symb,$url) = @_; |
|
if (!$symb) {return '';} |
|
my $result = '<script type="text/javascript" language="javascript">'."\n". |
|
' function checkUpload(formname) {'."\n". |
|
' if (formname.upfile.value == "") {'."\n". |
|
' alert("Please use the browse button to select a file from your local directory.");'."\n". |
|
' return false;'."\n". |
|
' }'."\n". |
|
' formname.submit();'."\n". |
|
' }'."\n". |
|
'</script>'."\n"; |
|
|
|
$result.='<table width=100% border=0><tr><td bgcolor=#777777>'."\n"; |
|
$result.='<table width=100% border=0><tr bgcolor="#e6ffff"><td>'."\n"; |
|
$result.=' <b>Specify a file containing the class scores for above resource</b></td></tr>'."\n"; |
|
$result.='<tr bgcolor=#ffffe6><td>'."\n"; |
|
my $upfile_select=&Apache::loncommon::upfile_select_html(); |
|
$result.=<<ENDUPFORM; |
|
<form method="post" enctype="multipart/form-data" action="/adm/grades" name="gradesupload"> |
|
<input type="hidden" name="symb" value="$symb" /> |
|
<input type="hidden" name="url" value="$url" /> |
|
<input type="hidden" name="command" value="csvuploadmap" /> |
|
$upfile_select |
|
<br /> <input type="button" onClick="javascript:checkUpload(this.form);" value="Upload Grades" /> |
|
</form> |
|
ENDUPFORM |
|
$result.='</td></tr></table>'."\n"; |
|
$result.='</td></tr></table>'."\n"; |
|
return $result; |
|
} |
|
|
|
#--- Handgrading problems --- |
|
sub viewGradeaStu_form { |
|
my ($symb,$url,$response,$handgrade) = @_; |
|
my ($classlist,$sections) = &getclasslist('all','0'); |
|
my $result.='<table width=100% border=0><tr><td bgcolor=#777777>'."\n"; |
|
$result.='<table width=100% border=0><tr bgcolor="#e6ffff"><td>'."\n"; |
|
$result.=' <b>'; |
|
$result.=($handgrade eq 'yes' ? 'View/Grade' : 'View').' an Individual Student\'s Submission</b></td></tr>'."\n"; |
|
$result.='<tr bgcolor=#ffffe6><td>'."\n"; |
|
$result.='<form action="/adm/grades" method="post">'."\n". |
|
'<input type="hidden" name="symb" value="'.$symb.'" />'."\n". |
|
'<input type="hidden" name="url" value="'.$url.'" />'."\n". |
|
'<input type="hidden" name="response" value="'.$response.'" />'."\n". |
|
'<input type="hidden" name="handgrade" value="'.$handgrade.'" />'."\n". |
|
'<input type="hidden" name="showgrading" value="yes" />'."\n". |
|
'<input type="hidden" name="command" value="submission" />'."\n"; |
|
|
|
$result.=' <b>Select section:</b> <select name="section">'."\n"; |
|
if (ref($sections)) { |
|
foreach (sort (@$sections)) {$result.='<option>'.$_.'</option>'."\n";} |
|
} |
|
$result.= '<option selected="on">all</select>'."\n"; |
|
$result.=' <b>Display students who has: </b>'. |
|
'<input type="radio" name="submitonly" value="yes" checked> submitted'. |
|
'<input type="radio" name="submitonly" value="all"> everybody <br />'; |
|
if (ref($sections)) { |
|
$result.=' (Section "no" implies the students were not assigned a section.)<br />' |
|
if (grep /no/,@$sections); |
|
} |
|
|
|
|
|
$result.='<br /> <input type="button" onClick="submit();" value="'; |
|
if ($handgrade eq 'yes') { |
|
$result.="View/Grade"; |
|
} else { |
|
$result.="View"; |
|
} |
|
$result.='" />'."\n".'</form>'."\n"; |
|
$result.='</td></tr></table>'."\n"; |
|
$result.='</td></tr></table>'."\n"; |
|
return $result; |
|
} |
|
|
|
#--- Handgrading problems by page/sequence for each student --- |
|
sub gradeByPage_form { |
|
my ($symb,$url,$response,$handgrade) = @_; |
|
my ($classlist,$sections) = &getclasslist('all','0'); |
|
my $result.='<table width=100% border=0><tr><td bgcolor=#777777>'."\n"; |
|
$result.='<table width=100% border=0><tr bgcolor="#e6ffff"><td>'."\n"; |
|
$result.=' <b>'; |
|
$result.='Handgrade an Individual Student\'s by Page/Sequence</b></td></tr>'."\n"; |
|
$result.='<tr bgcolor=#ffffe6><td>'."\n"; |
|
$result.='<form action="/adm/grades" method="post">'."\n". |
|
'<input type="hidden" name="symb" value="'.$symb.'" />'."\n". |
|
'<input type="hidden" name="url" value="'.$url.'" />'."\n". |
|
'<input type="hidden" name="response" value="'.$response.'" />'."\n". |
|
'<input type="hidden" name="handgrade" value="'.$handgrade.'" />'."\n". |
|
'<input type="hidden" name="showgrading" value="yes" />'."\n". |
|
'<input type="hidden" name="command" value="pickStudentPage" />'."\n"; |
|
|
|
$result.=' <b>Select section:</b> <select name="section">'."\n"; |
|
if (ref($sections)) { |
|
foreach (sort (@$sections)) {$result.='<option>'.$_.'</option>'."\n";} |
|
} |
|
$result.= '<option selected="on">all</select>'."\n"; |
|
|
|
$result.='<br /> <input type="button" onClick="submit();" value="'; |
|
$result.='View/Grade'.'" />'."\n".'</form>'."\n"; |
|
$result.='</td></tr></table>'."\n"; |
|
$result.='</td></tr></table>'."\n"; |
|
return $result; |
|
} |
|
|
|
sub pickStudentPage { |
sub pickStudentPage { |
my ($request) = shift; |
my ($request) = shift; |
|
|
Line 2470 function radioSelection(radioButton) {
|
Line 2338 function radioSelection(radioButton) {
|
var selection=null; |
var selection=null; |
for (var i=0; i<radioButton.length; i++) { |
for (var i=0; i<radioButton.length; i++) { |
if (radioButton[i].checked) { |
if (radioButton[i].checked) { |
selection=radioButton[i].value; |
return radioButton[i].value; |
return selection; |
|
} |
} |
} |
} |
return selection; |
return selection; |
Line 2481 function pullDownSelection(selectOne) {
|
Line 2348 function pullDownSelection(selectOne) {
|
var selection=null; |
var selection=null; |
for (var i=0; i<selectOne.length; i++) { |
for (var i=0; i<selectOne.length; i++) { |
if (selectOne[i].selected) { |
if (selectOne[i].selected) { |
selection=selectOne[i].value; |
return selectOne[i].value; |
return selection; |
|
} |
} |
} |
} |
} |
} |
</script> |
</script> |
LISTJAVASCRIPT |
LISTJAVASCRIPT |
|
|
my ($symb,$url) = &get_symb_and_url(); |
my ($symb,$url) = &get_symb_and_url($request); |
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'}; |
Line 2517 LISTJAVASCRIPT
|
Line 2383 LISTJAVASCRIPT
|
$result.='<input type="hidden" name="title'.$ctr.'" value="'.$showtitle.'" />'."\n"; |
$result.='<input type="hidden" name="title'.$ctr.'" value="'.$showtitle.'" />'."\n"; |
$ctr++; |
$ctr++; |
} |
} |
$result.='<input type="hidden" name="page" />'."\n"; |
$result.='<input type="hidden" name="page" />'."\n". |
$result.='<input type="hidden" name="title" />'."\n"; |
'<input type="hidden" name="title" />'."\n"; |
|
|
$result.=' <b>View Problems: </b><input type="radio" name="vProb" value="no" checked /> no '."\n". |
$result.=' <b>View Problems: </b><input type="radio" name="vProb" value="no" checked /> no '."\n". |
'<input type="radio" name="vProb" value="yes" /> yes '."<br>\n"; |
'<input type="radio" name="vProb" value="yes" /> yes '."<br>\n"; |
|
|
$result.=' <b>Submission Details: </b>'. |
$result.=' <b>Submission Details: </b>'. |
'<input type="radio" name="lastSub" value="none" /> none'."\n". |
'<input type="radio" name="lastSub" value="none" /> none'."\n". |
'<input type="radio" name="lastSub" value="datesub" checked /> dates and submissions'."\n". |
'<input type="radio" name="lastSub" value="datesub" checked /> dates and submissions'."\n". |
'<input type="radio" name="lastSub" value="all" /> all details'."\n"; |
'<input type="radio" name="lastSub" value="all" /> all details'."\n"; |
|
|
$result.='<input type="hidden" name="section" value="'.$getsec.'" />'."\n". |
$result.='<input type="hidden" name="section" value="'.$getsec.'" />'."\n". |
'<input type="hidden" name="command" value="displayPage" />'."\n". |
'<input type="hidden" name="command" value="displayPage" />'."\n". |
'<input type="hidden" name="url" value="'.$url.'" />'."\n". |
'<input type="hidden" name="url" value="'.$url.'" />'."\n". |
'<input type="hidden" name="symb" value="'.$symb.'" />'."<br><br>\n"; |
'<input type="hidden" name="symb" value="'.$symb.'" />'."<br><br>\n". |
|
'<input type="hidden" name="lastCmd" value="'.$ENV{'form.lastCmd'}.'" />'."\n". |
|
'<input type="hidden" name="lastSec" value="'.$ENV{'form.lastSec'}.'" />'."\n"; |
|
|
|
$result.='<br /> <input type="button" '. |
|
'onClick="javascript:checkPickOne(this.form);"value="Submit" /><br />'."\n"; |
|
|
$request->print($result); |
$request->print($result); |
|
|
my $studentTable.=' <b>Select a Student you wish to grade</b><br>'. |
my $studentTable.=' <b>Select a Student you wish to grade</b><br>'. |
Line 2620 sub getSymbMap {
|
Line 2494 sub getSymbMap {
|
return \@titles,\%symbx; |
return \@titles,\%symbx; |
} |
} |
|
|
|
# |
|
#--- Displays a page/sequence w/wo problems, w/wo submissions |
sub displayPage { |
sub displayPage { |
my ($request) = shift; |
my ($request) = shift; |
|
|
my ($symb,$url) = &get_symb_and_url(); |
my ($symb,$url) = &get_symb_and_url($request); |
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'}; |
Line 2648 sub displayPage {
|
Line 2524 sub displayPage {
|
$map->map_finish()); |
$map->map_finish()); |
|
|
my $studentTable='<form action="/adm/grades" method="post" name="gradePage">'."\n". |
my $studentTable='<form action="/adm/grades" method="post" name="gradePage">'."\n". |
'<input type="hidden" name="command" value="gradeByPage" />'."\n". |
'<input type="hidden" name="command" value="gradeByPage" />'."\n". |
'<input type="hidden" name="student" value="'.$ENV{'form.student'}.'" />'."\n". |
'<input type="hidden" name="student" value="'.$ENV{'form.student'}.'" />'."\n". |
'<input type="hidden" name="page" value="'.$pageTitle.'" />'."\n". |
'<input type="hidden" name="page" value="'.$pageTitle.'" />'."\n". |
'<input type="hidden" name="title" value="'.$ENV{'form.title'}.'" />'."\n". |
'<input type="hidden" name="title" value="'.$ENV{'form.title'}.'" />'."\n". |
'<input type="hidden" name="url" value="'.$url.'" />'."\n". |
'<input type="hidden" name="url" value="'.$url.'" />'."\n". |
'<input type="hidden" name="symb" value="'.$symb.'" />'."\n"; |
'<input type="hidden" name="symb" value="'.$symb.'" />'."\n". |
|
'<input type="hidden" name="lastCmd" value="'.$ENV{'form.lastCmd'}.'" />'."\n". |
|
'<input type="hidden" name="lastSec" value="'.$ENV{'form.lastSec'}.'" />'."\n"; |
|
|
my $checkIcon = '<img src="'.$request->dir_config('lonIconsURL'). |
my $checkIcon = '<img src="'.$request->dir_config('lonIconsURL'). |
'/check.gif" height="16" border="0" />'; |
'/check.gif" height="16" border="0" />'; |
Line 2674 sub displayPage {
|
Line 2552 sub displayPage {
|
|
|
if (ref($curRes) && $curRes->is_problem() && !$curRes->randomout) { |
if (ref($curRes) && $curRes->is_problem() && !$curRes->randomout) { |
my $parts = $curRes->parts(); |
my $parts = $curRes->parts(); |
if (scalar(@{$parts}) > 1) { shift @{$parts}; } |
$parts = &temp_parts_fix($parts); # remove line when lonnavmap is fixed |
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" >'.$question. |
$studentTable.='<tr bgcolor="#ffffe6"><td align="center" valign="top" >'.$question. |
Line 2722 sub displayPage {
|
Line 2600 sub displayPage {
|
'<b>Part:</b> '.$partid.' '. |
'<b>Part:</b> '.$partid.' '. |
$record{"$version:resource.$partid.award"}.'/'. |
$record{"$version:resource.$partid.award"}.'/'. |
$record{"$version:resource.$partid.solved"}.'<br />' : ''; |
$record{"$version:resource.$partid.solved"}.'<br />' : ''; |
|
$displaySub[2].=(exists $record{"$version:resource.$partid.regrader"}) ? |
|
$record{"$version:resource.$partid.regrader"}.' (<b>Part:</b> '.$partid.')' : ''; |
} |
} |
$displaySub[1].=(exists $record{"$version:resource.regrader"}) ? |
$displaySub[2].=(exists $record{"$version:resource.regrader"}) ? |
'Manually graded by '.$record{"$version:resource.regrader"} : ''; |
$record{"$version:resource.regrader"} : ''; |
$studentTable.='<td>'.$displaySub[0].' </td><td>'.$displaySub[1].' </td></tr>'; |
$studentTable.='<td>'.$displaySub[0].' </td><td>'.$displaySub[1]. |
|
($displaySub[2] eq '' ? '' : 'Manually graded by '.$displaySub[2]).' </td></tr>'; |
} |
} |
$studentTable.='</table></td></tr></table>'; |
$studentTable.='</table></td></tr></table>'; |
} |
} |
Line 2748 sub displayPage {
|
Line 2629 sub displayPage {
|
$curRes = $iterator->next(); |
$curRes = $iterator->next(); |
$ctr++; |
$ctr++; |
} |
} |
$navmap->init(); |
|
|
|
$studentTable.='</td></tr></table></td></tr></table>'."\n". |
$studentTable.='</td></tr></table></td></tr></table>'."\n". |
' <input type="button" value="Save" '. |
' <input type="button" value="Save" '. |
Line 2760 sub displayPage {
|
Line 2640 sub displayPage {
|
return ''; |
return ''; |
} |
} |
|
|
|
sub temp_parts_fix { #remove sub once lonnavmap is fixed |
|
my $parts = shift; |
|
my %seen = (); |
|
my @correctParts = (); |
|
foreach (@{$parts}) { |
|
next if ($seen{$_} > 0); |
|
$seen{$_}++; |
|
push @correctParts,$_; |
|
} |
|
return \@correctParts; |
|
} |
|
|
sub updateGradeByPage { |
sub updateGradeByPage { |
my ($request) = shift; |
my ($request) = shift; |
|
|
Line 2801 sub updateGradeByPage {
|
Line 2693 sub updateGradeByPage {
|
|
|
if (ref($curRes) && $curRes->is_problem() && !$curRes->randomout) { |
if (ref($curRes) && $curRes->is_problem() && !$curRes->randomout) { |
my $parts = $curRes->parts(); |
my $parts = $curRes->parts(); |
if (scalar(@{$parts}) > 1) { shift @{$parts}; } |
$parts = &temp_parts_fix($parts); # remove line when lonnavmap is fixed |
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" >'.$question. |
$studentTable.='<tr bgcolor="#ffffe6"><td align="center" valign="top" >'.$question. |
Line 2844 sub updateGradeByPage {
|
Line 2736 sub updateGradeByPage {
|
} |
} |
$newrecord{'resource.'.$partid.'.awarded'} = $partial if $partial ne ''; |
$newrecord{'resource.'.$partid.'.awarded'} = $partial if $partial ne ''; |
$newrecord{'resource.'.$partid.'.solved'} = $score; |
$newrecord{'resource.'.$partid.'.solved'} = $score; |
|
$newrecord{'resource.'.$partid.'.regrader'}="$ENV{'user.name'}:$ENV{'user.domain'}"; |
|
|
$changeflag++; |
$changeflag++; |
} |
} |
if (scalar(keys(%newrecord)) > 0) { |
if (scalar(keys(%newrecord)) > 0) { |
$newrecord{'resource.regrader'}="$ENV{'user.name'}:$ENV{'user.domain'}"; |
|
&Apache::lonnet::cstore(\%newrecord,$symbx,$ENV{'request.course.id'}, |
&Apache::lonnet::cstore(\%newrecord,$symbx,$ENV{'request.course.id'}, |
$udom,$uname); |
$udom,$uname); |
} |
} |
Line 2860 sub updateGradeByPage {
|
Line 2752 sub updateGradeByPage {
|
$curRes = $iterator->next(); |
$curRes = $iterator->next(); |
$ctr++; |
$ctr++; |
} |
} |
$navmap->init(); |
|
|
|
$studentTable.='</td></tr></table></td></tr></table>'; |
$studentTable.='</td></tr></table></td></tr></table>'; |
$studentTable.=($changeflag == 0 ? 'No score was changed or updated.' : |
$studentTable.=($changeflag == 0 ? 'No score was changed or updated.' : |
Line 2872 sub updateGradeByPage {
|
Line 2763 sub updateGradeByPage {
|
return ''; |
return ''; |
} |
} |
|
|
|
#-------- end of section for handling grading by page/sequence --------- |
|
# |
|
#------------------------------------------------------------------- |
|
|
|
#-------------------------- Menu interface ------------------------- |
|
# |
|
#--- Show a Grading Menu button - Calls the next routine --- |
|
sub show_grading_menu_form { |
|
my ($symb,$url)=@_; |
|
my $result.='<form action="/adm/grades" method="post">'."\n". |
|
'<input type="hidden" name="symb" value="'.$symb.'" />'."\n". |
|
'<input type="hidden" name="url" value="'.$url.'" />'."\n". |
|
'<input type="hidden" name="lastCmd" value="'.$ENV{'form.lastCmd'}.'" />'."\n". |
|
'<input type="hidden" name="lastSec" value="'.$ENV{'form.lastSec'}.'" />'."\n". |
|
'<input type="hidden" name="command" value="gradingmenu" />'."\n". |
|
'<input type="submit" name="submit" value="Grading Menu" />'."\n". |
|
'</form>'."\n"; |
|
return $result; |
|
} |
|
|
|
#--- Displays the main menu page ------- |
|
sub gradingmenu { |
|
my ($request) = @_; |
|
my ($symb,$url)=&get_symb_and_url($request); |
|
if (!$symb) {return '';} |
|
|
#--- Form to input a receipt number --- |
$request->print(<<GRADINGMENUJS); |
sub verifyReceipt_form { |
<script type="text/javascript" language="javascript"> |
my ($symb,$url) = @_; |
function checkChoice(formname) { |
my $result = '<script type="text/javascript" language="javascript">'."\n". |
var cmd = formname.command; |
' function checkEntry(formname) {'."\n". |
formname.lastCmd.value = radioSelection(formname.command); |
' var receipt = formname.receipt.value;'."\n". |
formname.lastSec.value = pullDownSelection(formname.section); |
' if (isNaN(receipt) || receipt == "") {'."\n". |
if (cmd[0].checked || cmd[1].checked || cmd[2].checked) { |
' alert("Please enter a receipt number given by a student in the box.");'."\n". |
formname.submit(); |
' return false;'."\n". |
} |
' }'."\n". |
|
' formname.submit();'."\n". |
if (cmd[3].checked) { |
' }'."\n". |
var url = "/adm/grades?command=csvform&symb="+formname.symb.value+"&url="+formname.url.value; |
'</script>'."\n"; |
var options = "width=620,height=340,screenx=70,screeny=75,"; |
|
options += "resizable=no,scrollbars=no,status=no,"; |
|
options += "menubar=no,toolbar=no,location=no,directories=no"; |
|
var newWin = window.open(url, "CSVFile", options); |
|
newWin.focus(); |
|
} |
|
|
|
if (cmd[4].checked) { |
|
if (!checkReceiptNo(formname,'notOK')) { return false;} |
|
formname.submit(); |
|
} |
|
} |
|
|
my $hostver=unpack("%32C*",$Apache::lonnet::perlvar{'lonHostID'}); |
function checkReceiptNo(formname,nospace) { |
|
var receiptNo = formname.receipt.value; |
|
var checkOpt = false; |
|
if (nospace == "OK" && isNaN(receiptNo)) {checkOpt = true;} |
|
if (nospace == "notOK" && (isNaN(receiptNo) || receiptNo == "")) {checkOpt = true;} |
|
if (checkOpt) { |
|
alert("Please enter a receipt number given by a student in the receipt box."); |
|
formname.receipt.value = ""; |
|
formname.receipt.focus(); |
|
return false; |
|
} |
|
formname.command[4].checked = true; |
|
return true; |
|
} |
|
|
$result.='<table width=100% border=0><tr><td bgcolor=#777777>'."\n"; |
function radioSelection(radioButton) { |
$result.='<table width=100% border=0><tr><td bgcolor=#e6ffff>'."\n"; |
var selection=null; |
$result.=' <b>Verify a Submission Receipt Issued by this Server</td></tr>'."\n"; |
for (var i=0; i<radioButton.length; i++) { |
$result.='<tr bgcolor=#ffffe6><td>'."\n"; |
if (radioButton[i].checked) { |
$result.='<form action="/adm/grades" method="post" name="verifyform">'."\n"; |
return radioButton[i].value; |
$result.=' <tt>'.$hostver.'-<input type="text" name="receipt" size="4"></tt><br />'."\n"; |
} |
$result.=' <input type="button" onClick="javascript:checkEntry(this.form);"'. |
} |
' value="Verify Receipt">'."\n"; |
return selection; |
$result.='<input type="hidden" name="command" value="verify">'."\n"; |
|
if ($ENV{'form.url'}) { |
|
$result.='<input type="hidden" name="url" value="'.$ENV{'form.url'}.'" />'; |
|
} |
} |
if ($ENV{'form.symb'}) { |
|
$result.='<input type="hidden" name="symb" value="'.$ENV{'form.symb'}.'" />'; |
function pullDownSelection(selectOne) { |
|
var selection=""; |
|
for (var i=0; i<selectOne.length; i++) { |
|
if (selectOne[i].selected) { |
|
return selectOne[i].value; |
|
} |
|
} |
} |
} |
$result.='</form>'; |
</script> |
$result.='</td></tr></table>'."\n"; |
GRADINGMENUJS |
$result.='</td></tr></table>'."\n"; |
|
|
my $probTitle = &Apache::lonnet::metadata($ENV{'form.url'},'title'); |
|
my $result='<h3> <font color="#339933">Manual Grading/View Submission</font></h3>'. |
|
'<table border="0">'. |
|
'<tr><td colspan=3><font size=+1><b>Problem: </b>'.$probTitle.'</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>'; |
|
|
|
my ($classlist,$sections) = &getclasslist('all','0'); |
|
my $lastCmd = ($ENV{'form.lastCmd'} eq '' ? 'pickStudentPage' : $ENV{'form.lastCmd'}); |
|
my $lastSec = ($ENV{'form.lastSec'} eq '' ? 'all' : $ENV{'form.lastSec'}); |
|
|
|
$result.='<form action="/adm/grades" method="post" name="gradingMenu">'."\n". |
|
'<input type="hidden" name="symb" value="'.$symb.'" />'."\n". |
|
'<input type="hidden" name="url" value="'.$url.'" />'."\n". |
|
'<input type="hidden" name="response" value="'.$resptype.'" />'."\n". |
|
'<input type="hidden" name="handgrade" value="'.$hdgrade.'" />'."\n". |
|
'<input type="hidden" name="probTitle" value="'.$probTitle.'" />'."\n". |
|
'<input type="hidden" name="lastCmd" value="" />'."\n". |
|
'<input type="hidden" name="lastSec" value="" />'."\n". |
|
'<input type="hidden" name="showgrading" value="yes" />'."\n"; |
|
|
|
$result.='<table width=100% border=0><tr><td bgcolor=#777777>'."\n". |
|
'<table width=100% border=0><tr bgcolor="#e6ffff"><td>'."\n". |
|
' <b>Select a Grading/Viewing Option</b></td></tr>'."\n". |
|
'<tr bgcolor=#ffffe6><td>'."\n"; |
|
|
|
$result.='<table width=100% border=0>'. |
|
'<tr bgcolor="#ffffe6" valign="top"><td colspan="2">'. |
|
'<input type="radio" name="command" value="pickStudentPage" '. |
|
($lastCmd eq 'pickStudentPage' ? 'checked' : '').'> '. |
|
'Handgrade/View Submission for a student by page/sequence</td></tr>'."\n". |
|
|
|
'<tr bgcolor="#ffffe6"valign="top"><td colspan="2">'. |
|
'<input type="radio" name="command" value="viewgrades" '. |
|
($lastCmd eq 'viewgrades' ? 'checked' : '').'> '. |
|
'Grade by section or class</td></tr>'."\n". |
|
|
|
'<tr bgcolor="#ffffe6"valign="top"><td><input type="radio" name="command" value="submission" '. |
|
($lastCmd eq 'submission' ? 'checked' : '').'> '. |
|
($hdgrade eq 'yes' ? 'View/Grade essay response of' : 'View'). |
|
' an individual student </td>'."\n". |
|
'<td>--> For students who has: '. |
|
'<input type="radio" name="submitonly" value="yes" checked> submitted'. |
|
'<input type="radio" name="submitonly" value="all"> everybody</td></tr>'."\n". |
|
|
|
'<tr bgcolor="#ffffe6"valign="top"><td colspan="2">'. |
|
'<input type="radio" name="command" value="csvupload" '. |
|
($lastCmd eq 'csvupload' ? 'checked' : '').'> '. |
|
'Upload scores from file</td></tr>'."\n"; |
|
|
|
if ((&Apache::lonnet::allowed('mgr',$ENV{'request.course.id'})) && ($symb)) { |
|
$result.='<tr bgcolor="#ffffe6"valign="top"><td>'. |
|
'<input type="radio" name="command" value="verify" onSelect="javascript:this.form.receipt.focus()" '. |
|
($lastCmd eq 'verify' ? 'checked' : '').'> '. |
|
'Verify a submission receipt issued by this server</td>'. |
|
'<td>--> Receipt no: '.unpack("%32C*",$Apache::lonnet::perlvar{'lonHostID'}). |
|
'-<input type="text" name="receipt" size="4" onChange="javascript:checkReceiptNo(this.form,\'OK\')">'. |
|
'</td></tr>'."\n"; |
|
} |
|
|
|
$result.='<tr bgcolor="#ffffe6"valign="top"><td colspan="2"><br />'."\n". |
|
' Select section:</b> <select name="section">'."\n"; |
|
if (ref($sections)) { |
|
foreach (sort (@$sections)) {$result.='<option value="'.$_.'" '. |
|
($lastSec eq $_ ? 'selected="on"' : '').'>'.$_.'</option>'."\n";} |
|
} |
|
$result.= '<option value="all" '.($lastSec eq 'all' ? 'selected="on"' : ''). '>all</select> '. |
|
'<font color="red">(Applies to the first three options only.)</font>'."\n"; |
|
if (ref($sections)) { |
|
$result.=' (Section "no" implies the students were not assigned a section.)<br />' |
|
if (grep /no/,@$sections); |
|
} |
|
$result.='</td></tr>'; |
|
|
|
$result.='<tr bgcolor="#ffffe6"><td colspan="2"><br />'. |
|
'<input type="button" onClick="javascript:checkChoice(this.form);" value="View/Grade" />'."\n". |
|
'</form></td></tr></table>'."\n". |
|
'</td></tr></table>'."\n". |
|
'</td></tr></table>'."\n"; |
return $result; |
return $result; |
} |
} |
|
|
Line 2961 sub handler {
|
Line 2992 sub handler {
|
$Apache::grades::viewgrades=&Apache::lonnet::allowed('vgr',$ENV{'request.course.id'}); |
$Apache::grades::viewgrades=&Apache::lonnet::allowed('vgr',$ENV{'request.course.id'}); |
if ($command eq 'submission') { |
if ($command eq 'submission') { |
($ENV{'form.student'} eq '' ? &listStudents($request) : &submission($request,0,0)); |
($ENV{'form.student'} eq '' ? &listStudents($request) : &submission($request,0,0)); |
# if ($command eq 'submission') { |
|
# &listStudents($request) if ($ENV{'form.student'} eq ''); |
|
# &submission($request,0,0) if ($ENV{'form.student'} ne ''); |
|
} elsif ($command eq 'pickStudentPage') { |
} elsif ($command eq 'pickStudentPage') { |
&pickStudentPage($request); |
&pickStudentPage($request); |
} elsif ($command eq 'displayPage') { |
} elsif ($command eq 'displayPage') { |
Line 2982 sub handler {
|
Line 3010 sub handler {
|
$request->print(&editgrades($request)); |
$request->print(&editgrades($request)); |
} elsif ($command eq 'verify') { |
} elsif ($command eq 'verify') { |
$request->print(&verifyreceipt($request)); |
$request->print(&verifyreceipt($request)); |
|
} elsif ($command eq 'csvform') { |
|
$request->print(&upcsvScores_form($request)); |
} elsif ($command eq 'csvupload') { |
} elsif ($command eq 'csvupload') { |
$request->print(&csvupload($request)); |
$request->print(&csvupload($request)); |
} elsif ($command eq 'viewclasslist') { |
} elsif ($command eq 'viewclasslist') { |