version 1.71, 2003/03/11 19:32:02
|
version 1.77, 2003/03/27 20:36:01
|
Line 113 sub response_type {
|
Line 113 sub response_type {
|
#--- Dumps the class list with usernames,list of sections, |
#--- Dumps the class list with usernames,list of sections, |
#--- section, ids and fullnames for each user. |
#--- section, ids and fullnames for each user. |
sub getclasslist { |
sub getclasslist { |
my ($getsec,$hideexpired) = @_; |
my ($getsec,$filterlist) = @_; |
my $classlist=&Apache::loncoursedata::get_classlist(); |
my $classlist=&Apache::loncoursedata::get_classlist(); |
# Bail out if we were unable to get the classlist |
# Bail out if we were unable to get the classlist |
return if (! defined($classlist)); |
return if (! defined($classlist)); |
Line 124 sub getclasslist {
|
Line 124 sub getclasslist {
|
# the following undefs are for 'domain', and 'username' respectively. |
# the following undefs are for 'domain', and 'username' respectively. |
my (undef,undef,$end,$start,$id,$section,$fullname,$status)= |
my (undef,undef,$end,$start,$id,$section,$fullname,$status)= |
@{$classlist->{$_}}; |
@{$classlist->{$_}}; |
# still a student? |
# filter students according to status selected |
if (($hideexpired) && ($status ne 'Active')) { |
if ($filterlist && $ENV{'form.status'} ne 'Any') { |
delete ($classlist->{$_}); |
if ($ENV{'form.status'} ne $status) { |
next; |
delete ($classlist->{$_}); |
} |
next; |
|
} |
|
} |
$section = ($section ne '' ? $section : 'no'); |
$section = ($section ne '' ? $section : 'no'); |
if ($getsec eq 'all' || $getsec eq $section) { |
if ($getsec eq 'all' || $getsec eq $section) { |
$sections{$section}++; |
$sections{$section}++; |
Line 209 sub jscriptNform {
|
Line 211 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="saveState" value="'.$ENV{'form.saveState'}.'" />'."\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 241 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 276 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 283 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 299 sub listStudents {
|
Line 298 sub listStudents {
|
'<td><b>Type: </b>'.$responsetype.'</td>'. |
'<td><b>Type: </b>'.$responsetype.'</td>'. |
'<td><b>Handgrade: </b>'.$handgrade.'</font></td></tr>'; |
'<td><b>Handgrade: </b>'.$handgrade.'</font></td></tr>'; |
} |
} |
$result.='</table>'; |
$result.='</table>'."\n"; |
|
|
my $viewgrade = $ENV{'form.handgrade'} eq 'yes' ? 'View/Grade' : 'View'; |
my $viewgrade = $ENV{'form.handgrade'} eq 'yes' ? 'View/Grade' : 'View'; |
|
$ENV{'form.probTitle'} = $ENV{'form.probTitle'} eq '' ? |
|
&Apache::lonnet::gettitle($symb) : $ENV{'form.probTitle'}; |
|
|
$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 358 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="saveState" value="'.$ENV{'form.saveState'}.'" />'."\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 367 LISTJAVASCRIPT
|
Line 370 LISTJAVASCRIPT
|
'onClick="javascript:checkSelect(this.form.stuinfo);" '."\n". |
'onClick="javascript:checkSelect(this.form.stuinfo);" '."\n". |
'value="'.$viewgrade.'" />'."\n"; |
'value="'.$viewgrade.'" />'."\n"; |
|
|
my (undef,undef,$fullname) = &getclasslist($getsec,'0'); |
my (undef,undef,$fullname) = &getclasslist($getsec,$ENV{'form.showgrading'} eq 'yes' ? '1' : '0'); |
|
|
$gradeTable.='<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">'. |
Line 459 sub sub_page_js {
|
Line 462 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 500 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 628 sub sub_page_kw_js {
|
Line 633 sub sub_page_kw_js {
|
|
|
//===================== Show list of keywords ==================== |
//===================== Show list of keywords ==================== |
function keywords(keyform) { |
function keywords(keyform) { |
var keywds = keyform.value; |
var nret = prompt("Keywords list, separated by a space. Add/delete to list if desired.",keyform.value); |
var nret = prompt("Keywords list, separated by a space. Add/delete to list if desired.",keywds); |
|
if (nret==null) return; |
if (nret==null) return; |
keyform.value = nret; |
keyform.value = nret; |
|
|
Line 698 sub sub_page_kw_js {
|
Line 702 sub sub_page_kw_js {
|
return; |
return; |
} |
} |
|
|
|
// var pWin = null; |
function savedMsgHeader(Nmsg,usrctr,fullname) { |
function savedMsgHeader(Nmsg,usrctr,fullname) { |
var height = 30*Nmsg+250; |
var height = 70*Nmsg+250; |
var scrollbar = "no"; |
var scrollbar = "no"; |
if (height > 600) { |
if (height > 600) { |
height = 600; |
height = 600; |
scrollbar = "yes"; |
scrollbar = "yes"; |
} |
} |
/* if (window.pWin) |
// if (window.pWin) window.pWin.close(); |
window.pWin.close(); */ |
|
pWin = window.open('', 'MessageCenter', 'toolbar=no,location=no,scrollbars='+scrollbar+',screenx=70,screeny=75,width=600,height='+height); |
pWin = window.open('', 'MessageCenter', 'toolbar=no,location=no,scrollbars='+scrollbar+',screenx=70,screeny=75,width=600,height='+height); |
pWin.document.write("<html><head>"); |
pWin.focus(); |
pWin.document.write("<title>Message Central</title>"); |
pDoc = pWin.document; |
|
pDoc.write("<html><head>"); |
pWin.document.write("<script language=javascript>"); |
pDoc.write("<title>Message Central</title>"); |
pWin.document.write("function checkInput() {"); |
|
pWin.document.write(" opener.document.SCORE.msgsub.value = document.msgcenter.msgsub.value;"); |
pDoc.write("<script language=javascript>"); |
pWin.document.write(" var nmsg = opener.document.SCORE.savemsgN.value;"); |
pDoc.write("function checkInput() {"); |
pWin.document.write(" var usrctr = document.msgcenter.usrctr.value;"); |
pDoc.write(" opener.document.SCORE.msgsub.value = document.msgcenter.msgsub.value;"); |
pWin.document.write(" var newval = eval(\\"opener.document.SCORE.newmsg\\"+usrctr);"); |
pDoc.write(" var nmsg = opener.document.SCORE.savemsgN.value;"); |
pWin.document.write(" newval.value = document.msgcenter.newmsg.value;"); |
pDoc.write(" var usrctr = document.msgcenter.usrctr.value;"); |
|
pDoc.write(" var newval = eval(\\"opener.document.SCORE.newmsg\\"+usrctr);"); |
pWin.document.write(" var msgchk = \\"\\";"); |
pDoc.write(" newval.value = document.msgcenter.newmsg.value;"); |
pWin.document.write(" if (document.msgcenter.subchk.checked) {"); |
|
pWin.document.write(" msgchk = \\"msgsub,\\";"); |
pDoc.write(" var msgchk = \\"\\";"); |
pWin.document.write(" }"); |
pDoc.write(" if (document.msgcenter.subchk.checked) {"); |
pWin.document.write( "for (var i=1; i<=nmsg; i++) {"); |
pDoc.write(" msgchk = \\"msgsub,\\";"); |
pWin.document.write(" var opnmsg = eval(\\"opener.document.SCORE.savemsg\\"+i);"); |
pDoc.write(" }"); |
pWin.document.write(" var frmmsg = eval(\\"document.msgcenter.msg\\"+i);"); |
pDoc.write( "for (var i=1; i<=nmsg; i++) {"); |
pWin.document.write(" opnmsg.value = frmmsg.value;"); |
pDoc.write(" var opnmsg = eval(\\"opener.document.SCORE.savemsg\\"+i);"); |
pWin.document.write(" var chkbox = eval(\\"document.msgcenter.msgn\\"+i);"); |
pDoc.write(" var frmmsg = eval(\\"document.msgcenter.msg\\"+i);"); |
pWin.document.write(" if (chkbox.checked) {"); |
pDoc.write(" opnmsg.value = frmmsg.value;"); |
pWin.document.write(" msgchk += \\"savemsg\\"+i+\\",\\";"); |
pDoc.write(" var chkbox = eval(\\"document.msgcenter.msgn\\"+i);"); |
pWin.document.write(" }"); |
pDoc.write(" if (chkbox.checked) {"); |
pWin.document.write(" }"); |
pDoc.write(" msgchk += \\"savemsg\\"+i+\\",\\";"); |
pWin.document.write(" if (document.msgcenter.newmsgchk.checked) {"); |
pDoc.write(" }"); |
pWin.document.write(" msgchk += \\"newmsg\\"+usrctr;"); |
pDoc.write(" }"); |
pWin.document.write(" }"); |
pDoc.write(" if (document.msgcenter.newmsgchk.checked) {"); |
pWin.document.write(" var includemsg = eval(\\"opener.document.SCORE.includemsg\\"+usrctr);"); |
pDoc.write(" msgchk += \\"newmsg\\"+usrctr;"); |
pWin.document.write(" includemsg.value = msgchk;"); |
pDoc.write(" }"); |
|
pDoc.write(" var includemsg = eval(\\"opener.document.SCORE.includemsg\\"+usrctr);"); |
pWin.document.write(" self.close()"); |
pDoc.write(" includemsg.value = msgchk;"); |
|
|
pWin.document.write("}"); |
pDoc.write(" self.close()"); |
|
|
pWin.document.write("<"); |
pDoc.write("}"); |
pWin.document.write("/script>"); |
|
|
pDoc.write("<"); |
pWin.document.write("</head><body bgcolor=white>"); |
pDoc.write("/script>"); |
|
|
pWin.document.write("<form action=\\"inactive\\" name=\\"msgcenter\\">"); |
pDoc.write("</head><body bgcolor=white>"); |
pWin.document.write("<input value=\\""+usrctr+"\\" name=\\"usrctr\\" type=\\"hidden\\">"); |
|
pWin.document.write("<font color=\\"green\\" size=+1> Compose Message for \"+fullname+\"</font><br><br>"); |
pDoc.write("<form action=\\"inactive\\" name=\\"msgcenter\\">"); |
|
pDoc.write("<input value=\\""+usrctr+"\\" name=\\"usrctr\\" type=\\"hidden\\">"); |
pWin.document.write("<table border=0 width=100%><tr><td bgcolor=\\"#777777\\">"); |
pDoc.write("<font color=\\"green\\" size=+1> Compose Message for \"+fullname+\"</font><br><br>"); |
pWin.document.write("<table border=0 width=100%><tr bgcolor=\\"#ddffff\\">"); |
|
pWin.document.write("<td><b>Type</b></td><td><b>Include</b></td><td><b>Message</td></tr>"); |
pDoc.write("<table border=0 width=100%><tr><td bgcolor=\\"#777777\\">"); |
|
pDoc.write("<table border=0 width=100%><tr bgcolor=\\"#ddffff\\">"); |
|
pDoc.write("<td><b>Type</b></td><td><b>Include</b></td><td><b>Message</td></tr>"); |
} |
} |
function displaySubject(msg,shwsel) { |
function displaySubject(msg,shwsel) { |
pWin.document.write("<tr bgcolor=\\"#ffffdd\\">"); |
pDoc = pWin.document; |
pWin.document.write("<td>Subject</td>"); |
pDoc.write("<tr bgcolor=\\"#ffffdd\\">"); |
pWin.document.write("<td align=\\"center\\"><input name=\\"subchk\\" type=\\"checkbox\\"" +shwsel+"></td>"); |
pDoc.write("<td>Subject</td>"); |
pWin.document.write("<td><input name=\\"msgsub\\" type=\\"text\\" value=\\""+msg+"\\"size=\\"60\\" maxlength=\\"80\\"></td></tr>"); |
pDoc.write("<td align=\\"center\\"><input name=\\"subchk\\" type=\\"checkbox\\"" +shwsel+"></td>"); |
|
pDoc.write("<td><input name=\\"msgsub\\" type=\\"text\\" value=\\""+msg+"\\"size=\\"60\\" maxlength=\\"80\\"></td></tr>"); |
} |
} |
|
|
function displaySavedMsg(ctr,msg,shwsel) { |
function displaySavedMsg(ctr,msg,shwsel) { |
pWin.document.write("<tr bgcolor=\\"#ffffdd\\">"); |
pDoc = pWin.document; |
pWin.document.write("<td align=\\"center\\">"+ctr+"</td>"); |
pDoc.write("<tr bgcolor=\\"#ffffdd\\">"); |
pWin.document.write("<td align=\\"center\\"><input name=\\"msgn"+ctr+"\\" type=\\"checkbox\\"" +shwsel+"></td>"); |
pDoc.write("<td align=\\"center\\">"+ctr+"</td>"); |
pWin.document.write("<td><input name=\\"msg"+ctr+"\\" type=\\"text\\" value=\\""+msg+"\\" size=\\"60\\" maxlength=\\"80\\"></td></tr>"); |
pDoc.write("<td align=\\"center\\"><input name=\\"msgn"+ctr+"\\" type=\\"checkbox\\"" +shwsel+"></td>"); |
|
pDoc.write("<td><textarea name=\\"msg"+ctr+"\\" cols=\\"60\\" rows=\\"3\\">"+msg+"</textarea></td></tr>"); |
} |
} |
|
|
function newMsg(newmsg,shwsel) { |
function newMsg(newmsg,shwsel) { |
pWin.document.write("<tr bgcolor=\\"#ffffdd\\">"); |
pDoc = pWin.document; |
pWin.document.write("<td align=\\"center\\">New</td>"); |
pDoc.write("<tr bgcolor=\\"#ffffdd\\">"); |
pWin.document.write("<td align=\\"center\\"><input name=\\"newmsgchk\\" type=\\"checkbox\\"" +shwsel+"></td>"); |
pDoc.write("<td align=\\"center\\">New</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>"); |
pDoc.write("<td align=\\"center\\"><input name=\\"newmsgchk\\" type=\\"checkbox\\"" +shwsel+"></td>"); |
|
pDoc.write("<td><textarea name=\\"newmsg\\" cols=\\"60\\" rows=\\"3\\" onchange=\\"javascript:this.form.newmsgchk.checked=true\\" >"+newmsg+"</textarea></td></tr>"); |
} |
} |
|
|
function msgTail() { |
function msgTail() { |
pWin.document.write("</table>"); |
pDoc = pWin.document; |
pWin.document.write("</td></tr></table> "); |
pDoc.write("</table>"); |
pWin.document.write("<input type=\\"button\\" value=\\"Save\\" onClick=\\"javascript:checkInput()\\"> "); |
pDoc.write("</td></tr></table> "); |
pWin.document.write("<input type=\\"button\\" value=\\"Cancel\\" onClick=\\"self.close()\\"><br><br>"); |
pDoc.write("<input type=\\"button\\" value=\\"Save\\" onClick=\\"javascript:checkInput()\\"> "); |
pWin.document.write("</form>"); |
pDoc.write("<input type=\\"button\\" value=\\"Cancel\\" onClick=\\"self.close()\\"><br><br>"); |
pWin.document.write("</body></html>"); |
pDoc.write("</form>"); |
|
pDoc.write("</body></html>"); |
} |
} |
|
|
//====================== Script for keyword highlight options ============== |
//====================== Script for keyword highlight options ============== |
Line 816 function displaySavedMsg(ctr,msg,shwsel)
|
Line 826 function displaySavedMsg(ctr,msg,shwsel)
|
return; |
return; |
} |
} |
|
|
|
// var hwdWin = null; |
function highlightCentral() { |
function highlightCentral() { |
|
// if (window.hwdWin) window.hwdWin.close(); |
hwdWin = window.open('', 'KeywordHighlightCentral', 'toolbar=no,location=no,scrollbars=no,width=400,height=300,screenx=100,screeny=75'); |
hwdWin = window.open('', 'KeywordHighlightCentral', 'toolbar=no,location=no,scrollbars=no,width=400,height=300,screenx=100,screeny=75'); |
hwdWin.document.write("<html><head>"); |
hwdWin.focus(); |
hwdWin.document.write("<title>Highlight Central</title>"); |
var hDoc = hwdWin.document; |
|
hDoc.write("<html><head>"); |
hwdWin.document.write("<script language=javascript>"); |
hDoc.write("<title>Highlight Central</title>"); |
hwdWin.document.write("function updateChoice(flag) {"); |
|
hwdWin.document.write(" opener.document.SCORE.kwclr.value = radioSelection(document.hlCenter.kwdclr);"); |
hDoc.write("<script language=javascript>"); |
hwdWin.document.write(" opener.document.SCORE.kwsize.value = radioSelection(document.hlCenter.kwdsize);"); |
hDoc.write("function updateChoice(flag) {"); |
hwdWin.document.write(" opener.document.SCORE.kwstyle.value = radioSelection(document.hlCenter.kwdstyle);"); |
hDoc.write(" opener.document.SCORE.kwclr.value = radioSelection(document.hlCenter.kwdclr);"); |
hwdWin.document.write(" opener.document.SCORE.refresh.value = \\"on\\";"); |
hDoc.write(" opener.document.SCORE.kwsize.value = radioSelection(document.hlCenter.kwdsize);"); |
hwdWin.document.write(" if (opener.document.SCORE.keywords.value!=\\"\\"){"); |
hDoc.write(" opener.document.SCORE.kwstyle.value = radioSelection(document.hlCenter.kwdstyle);"); |
hwdWin.document.write(" opener.document.SCORE.submit();"); |
hDoc.write(" opener.document.SCORE.refresh.value = \\"on\\";"); |
hwdWin.document.write(" }"); |
hDoc.write(" if (opener.document.SCORE.keywords.value!=\\"\\"){"); |
hwdWin.document.write(" self.close()"); |
hDoc.write(" opener.document.SCORE.submit();"); |
hwdWin.document.write("}"); |
hDoc.write(" }"); |
|
hDoc.write(" self.close()"); |
hwdWin.document.write("function radioSelection(radioButton) {"); |
hDoc.write("}"); |
hwdWin.document.write(" var selection=null;"); |
|
hwdWin.document.write(" for (var i=0; i<radioButton.length; i++) {"); |
hDoc.write("function radioSelection(radioButton) {"); |
hwdWin.document.write(" if (radioButton[i].checked) {"); |
hDoc.write(" var selection=null;"); |
hwdWin.document.write(" selection=radioButton[i].value;"); |
hDoc.write(" for (var i=0; i<radioButton.length; i++) {"); |
hwdWin.document.write(" return selection;"); |
hDoc.write(" if (radioButton[i].checked) {"); |
hwdWin.document.write(" }"); |
hDoc.write(" selection=radioButton[i].value;"); |
hwdWin.document.write(" }"); |
hDoc.write(" return selection;"); |
hwdWin.document.write("}"); |
hDoc.write(" }"); |
|
hDoc.write(" }"); |
hwdWin.document.write("<"); |
hDoc.write("}"); |
hwdWin.document.write("/script>"); |
|
|
hDoc.write("<"); |
hwdWin.document.write("</head><body bgcolor=white>"); |
hDoc.write("/script>"); |
|
|
hwdWin.document.write("<form action=\\"inactive\\" name=\\"hlCenter\\">"); |
hDoc.write("</head><body bgcolor=white>"); |
hwdWin.document.write("<font color=\\"green\\" size=+1> Keyword Highlight Options</font><br><br>"); |
|
|
hDoc.write("<form action=\\"inactive\\" name=\\"hlCenter\\">"); |
hwdWin.document.write("<table border=0 width=100%><tr><td bgcolor=\\"#777777\\">"); |
hDoc.write("<font color=\\"green\\" size=+1> Keyword Highlight Options</font><br><br>"); |
hwdWin.document.write("<table border=0 width=100%><tr bgcolor=\\"#ddffff\\">"); |
|
hwdWin.document.write("<td><b>Text Color</b></td><td><b>Font Size</b></td><td><b>Font Style</td></tr>"); |
hDoc.write("<table border=0 width=100%><tr><td bgcolor=\\"#777777\\">"); |
|
hDoc.write("<table border=0 width=100%><tr bgcolor=\\"#ddffff\\">"); |
|
hDoc.write("<td><b>Text Color</b></td><td><b>Font Size</b></td><td><b>Font Style</td></tr>"); |
} |
} |
|
|
function highlightbody(clrval,clrtxt,clrsel,szval,sztxt,szsel,syval,sytxt,sysel) { |
function highlightbody(clrval,clrtxt,clrsel,szval,sztxt,szsel,syval,sytxt,sysel) { |
hwdWin.document.write("<tr bgcolor=\\"#ffffdd\\">"); |
var hDoc = hwdWin.document; |
hwdWin.document.write("<td align=\\"left\\">"); |
hDoc.write("<tr bgcolor=\\"#ffffdd\\">"); |
hwdWin.document.write("<input name=\\"kwdclr\\" type=\\"radio\\" value=\\""+clrval+"\\" "+clrsel+"> "+clrtxt+"</td>"); |
hDoc.write("<td align=\\"left\\">"); |
hwdWin.document.write("<td align=\\"left\\">"); |
hDoc.write("<input name=\\"kwdclr\\" type=\\"radio\\" value=\\""+clrval+"\\" "+clrsel+"> "+clrtxt+"</td>"); |
hwdWin.document.write("<input name=\\"kwdsize\\" type=\\"radio\\" value=\\""+szval+"\\" "+szsel+"> "+sztxt+"</td>"); |
hDoc.write("<td align=\\"left\\">"); |
hwdWin.document.write("<td align=\\"left\\">"); |
hDoc.write("<input name=\\"kwdsize\\" type=\\"radio\\" value=\\""+szval+"\\" "+szsel+"> "+sztxt+"</td>"); |
hwdWin.document.write("<input name=\\"kwdstyle\\" type=\\"radio\\" value=\\""+syval+"\\" "+sysel+"> "+sytxt+"</td>"); |
hDoc.write("<td align=\\"left\\">"); |
hwdWin.document.write("</tr>"); |
hDoc.write("<input name=\\"kwdstyle\\" type=\\"radio\\" value=\\""+syval+"\\" "+sysel+"> "+sytxt+"</td>"); |
|
hDoc.write("</tr>"); |
} |
} |
|
|
function highlightend() { |
function highlightend() { |
hwdWin.document.write("</table>"); |
var hDoc = hwdWin.document; |
hwdWin.document.write("</td></tr></table> "); |
hDoc.write("</table>"); |
// hwdWin.document.write("<input type=\\"button\\" value=\\"Save\\" onClick=\\"javascript:updateChoice(0)\\"> "); |
hDoc.write("</td></tr></table> "); |
hwdWin.document.write("<input type=\\"button\\" value=\\"Save\\" onClick=\\"javascript:updateChoice(1)\\"> "); |
hDoc.write("<input type=\\"button\\" value=\\"Save\\" onClick=\\"javascript:updateChoice(1)\\"> "); |
hwdWin.document.write("<input type=\\"button\\" value=\\"Cancel\\" onClick=\\"self.close()\\"><br><br>"); |
hDoc.write("<input type=\\"button\\" value=\\"Cancel\\" onClick=\\"self.close()\\"><br><br>"); |
hwdWin.document.write("</form>"); |
hDoc.write("</form>"); |
hwdWin.document.write("</body></html>"); |
hDoc.write("</body></html>"); |
} |
} |
|
|
</script> |
</script> |
Line 905 sub gradeBox {
|
Line 919 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 978 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 985 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); |
|
$ENV{'form.probTitle'} = $ENV{'form.probTitle'} eq '' ? |
|
&Apache::lonnet::gettitle($symb) : $ENV{'form.probTitle'}; |
|
|
$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 1023 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="saveState" value="'.$ENV{'form.saveState'}.'" />'."\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 1081 KEYWORDS
|
Line 1095 KEYWORDS
|
my ($classlist,$fullname); |
my ($classlist,$fullname); |
if ($ENV{'form.handgrade'} eq 'yes') { |
if ($ENV{'form.handgrade'} eq 'yes') { |
my @col_list; |
my @col_list; |
($classlist,undef,$fullname) = &getclasslist('all','0'); |
($classlist,undef,$fullname) = &getclasslist('all',$ENV{'form.showgrading'} eq 'yes' ? '1' : '0'); |
for (keys (%$handgrade)) { |
for (keys (%$handgrade)) { |
my $ncol = &Apache::lonnet::EXT('resource.'.$_. |
my $ncol = &Apache::lonnet::EXT('resource.'.$_. |
'.maxcollaborators', |
'.maxcollaborators', |
Line 1122 KEYWORDS
|
Line 1136 KEYWORDS
|
$result .= 'invalid collaborators'; |
$result .= 'invalid collaborators'; |
} |
} |
$result .= ': '.join(', ',@badcollaborators); |
$result .= ': '.join(', ',@badcollaborators); |
|
$result .= '</td></tr></table>'; |
} |
} |
if (scalar(@collaborators > $ncol)) { |
if (scalar(@collaborators > $ncol)) { |
$result .= '<table border="0"><tr bgcolor="#ffbbbb"><td>'; |
$result .= '<table border="0"><tr bgcolor="#ffbbbb"><td>'; |
$result .= 'This student has sumbitted too many '. |
$result .= 'This student has submitted too many '. |
'collaborators. Maximum is '.$ncol; |
'collaborators. Maximum is '.$ncol; |
$result .= '</td></tr></table>'; |
$result .= '</td></tr></table>'; |
} |
} |
Line 1195 KEYWORDS
|
Line 1209 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 1244 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 1296 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 1330 sub processHandGrade {
|
Line 1343 sub processHandGrade {
|
my $ctr = 0; |
my $ctr = 0; |
while ($ctr < $ngrade) { |
while ($ctr < $ngrade) { |
my ($uname,$udom) = split(/:/,$ENV{'form.unamedom'.$ctr}); |
my ($uname,$udom) = split(/:/,$ENV{'form.unamedom'.$ctr}); |
my ($errorflag) = &saveHandGrade($request,$url,$symb,$uname,$udom,$ctr); |
my ($errorflag,$pts,$wgt) = &saveHandGrade($request,$url,$symb,$uname,$udom,$ctr); |
if ($errorflag eq 'no_score') { |
if ($errorflag eq 'no_score') { |
$ctr++; |
$ctr++; |
next; |
next; |
Line 1344 sub processHandGrade {
|
Line 1357 sub processHandGrade {
|
foreach (@msgnum) { |
foreach (@msgnum) { |
$message.=$ENV{'form.'.$_} if ($_ =~ /savemsg|newmsg/ && $_ ne ''); |
$message.=$ENV{'form.'.$_} if ($_ =~ /savemsg|newmsg/ && $_ ne ''); |
} |
} |
$message =~ s/\s+/ /g; |
$message =~ s/<([^>]|\n)*>//g; # removes html codes Or should this be lonnet::escape ?? |
|
$message.="\n\nPoint".($pts > 1 ? 's':'').' awarded = '.$pts.' out of '.$wgt; |
|
$message.=" for <a href=\"/res/$url\">$ENV{'form.probTitle'}</a>"; |
$msgstatus = &Apache::lonmsg::user_normal_msg ($uname,$udom, |
$msgstatus = &Apache::lonmsg::user_normal_msg ($uname,$udom, |
$ENV{'form.msgsub'},$message); |
$ENV{'form.msgsub'},$message); |
} |
} |
Line 1466 sub processHandGrade {
|
Line 1481 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 1484 sub processHandGrade {
|
Line 1497 sub processHandGrade {
|
#---- Save the score and award for each student, if changed |
#---- Save the score and award for each student, if changed |
sub saveHandGrade { |
sub saveHandGrade { |
my ($request,$url,$symb,$stuname,$domain,$newflg,$submitter) = @_; |
my ($request,$url,$symb,$stuname,$domain,$newflg,$submitter) = @_; |
my %record=&Apache::lonnet::restore($symb,$ENV{'request.course.id'},$domain,$stuname); |
my %record = &Apache::lonnet::restore($symb,$ENV{'request.course.id'},$domain,$stuname); |
my %newrecord; |
my %newrecord = (); |
|
my ($pts,$wgt) = ('',''); |
foreach (split(/:/,$ENV{'form.partlist'.$newflg})) { |
foreach (split(/:/,$ENV{'form.partlist'.$newflg})) { |
if ($ENV{'form.GD_SEL'.$newflg.'_'.$_} eq 'excused') { |
if ($ENV{'form.GD_SEL'.$newflg.'_'.$_} eq 'excused') { |
if ($record{'resource.'.$_.'.solved'} ne 'excused') { |
if ($record{'resource.'.$_.'.solved'} ne 'excused') { |
Line 1495 sub saveHandGrade {
|
Line 1509 sub saveHandGrade {
|
} |
} |
} |
} |
} else { |
} else { |
my $pts = ($ENV{'form.GD_BOX'.$newflg.'_'.$_} ne '' ? |
$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.'_'.$_}); |
return 'no_score' if ($pts eq '' && $ENV{'form.GD_SEL'.$newflg.'_'.$_} eq ''); |
return 'no_score' if ($pts eq '' && $ENV{'form.GD_SEL'.$newflg.'_'.$_} eq ''); |
my $wgt = $ENV{'form.WGT'.$newflg.'_'.$_} eq '' ? 1 : |
$wgt = $ENV{'form.WGT'.$newflg.'_'.$_} eq '' ? 1 : |
$ENV{'form.WGT'.$newflg.'_'.$_}; |
$ENV{'form.WGT'.$newflg.'_'.$_}; |
my $partial= $pts/$wgt; |
my $partial= $pts/$wgt; |
$newrecord{'resource.'.$_.'.awarded'} = $partial |
$newrecord{'resource.'.$_.'.awarded'} = $partial |
Line 1514 sub saveHandGrade {
|
Line 1528 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); |
} |
} |
return ''; |
return '',$pts,$wgt; |
} |
} |
|
|
#-------------------------------------------------------------------------------------- |
#-------------------------------------------------------------------------------------- |
Line 1707 sub viewgrades {
|
Line 1721 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 1731 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="saveState" value="'.$ENV{'form.saveState'}.'" />'."\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 1745 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 1813 sub viewgrades {
|
Line 1823 sub viewgrades {
|
|
|
#get info for each student |
#get info for each student |
#list all the students - with points and grade status |
#list all the students - with points and grade status |
my (undef,undef,$fullname) = &getclasslist($ENV{'form.section'},'0'); |
my (undef,undef,$fullname) = &getclasslist($ENV{'form.section'},'1'); |
my $ctr = 0; |
my $ctr = 0; |
foreach (sort {lc($$fullname{$a}) cmp lc($$fullname{$b}) } keys %$fullname) { |
foreach (sort {lc($$fullname{$a}) cmp lc($$fullname{$b}) } keys %$fullname) { |
my ($uname,$udom) = split(/:/); |
my ($uname,$udom) = split(/:/); |
Line 1884 sub editgrades {
|
Line 1894 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 1995 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 2005 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 2109 sub csvuploadmap_header {
|
Line 2118 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 2149 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="saveState" value="$ENV{'form.saveState'}" /> |
|
<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 2191 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 2220 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 2285 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 2455 sub pickStudentPage {
|
Line 2296 sub pickStudentPage {
|
<script type="text/javascript" language="javascript"> |
<script type="text/javascript" language="javascript"> |
|
|
function checkPickOne(formname) { |
function checkPickOne(formname) { |
var user = radioSelection(formname.student); |
if (radioSelection(formname.student) == null) { |
if (user == null) { |
|
alert("Please select the student you wish to grade."); |
alert("Please select the student you wish to grade."); |
return; |
return; |
} |
} |
Line 2468 function checkPickOne(formname) {
|
Line 2308 function checkPickOne(formname) {
|
|
|
function radioSelection(radioButton) { |
function radioSelection(radioButton) { |
var selection=null; |
var selection=null; |
for (var i=0; i<radioButton.length; i++) { |
if (radioButton.length > 1) { |
if (radioButton[i].checked) { |
for (var i=0; i<radioButton.length; i++) { |
selection=radioButton[i].value; |
if (radioButton[i].checked) { |
return selection; |
return radioButton[i].value; |
} |
} |
|
} |
|
} else { |
|
if (radioButton.checked) return radioButton.value; |
} |
} |
return selection; |
return selection; |
} |
} |
|
|
function pullDownSelection(selectOne) { |
function pullDownSelection(selectOne) { |
var selection=null; |
var selection=""; |
for (var i=0; i<selectOne.length; i++) { |
if (selectOne.length > 1) { |
if (selectOne[i].selected) { |
for (var i=0; i<selectOne.length; i++) { |
selection=selectOne[i].value; |
if (selectOne[i].selected) { |
return selection; |
return selectOne[i].value; |
} |
} |
|
} |
|
} else { |
|
if (selectOne.selected) return selectOne.value; |
} |
} |
} |
} |
</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 2499 LISTJAVASCRIPT
|
Line 2345 LISTJAVASCRIPT
|
|
|
$result.='<form action="/adm/grades" method="post" name="displayPage">'."<br>\n"; |
$result.='<form action="/adm/grades" method="post" name="displayPage">'."<br>\n"; |
$result.=' <b>Problems from:</b> <select name="selectpage">'."\n"; |
$result.=' <b>Problems from:</b> <select name="selectpage">'."\n"; |
my ($titles,$symbx) = &getSymbMap(); |
my ($titles,$symbx) = &getSymbMap($request); |
my ($curpage,$type,$mapId) = ($symb =~ /(.*?\.(page|sequence))___(\d+)___/); |
my ($curpage,$type,$mapId) = ($symb =~ /(.*?\.(page|sequence))___(\d+)___/); |
my $ctr=0; |
my $ctr=0; |
foreach (@$titles) { |
foreach (@$titles) { |
Line 2517 LISTJAVASCRIPT
|
Line 2363 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="saveState" value="'.$ENV{'form.saveState'}.'" />'."\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>'. |
'<table border="0"><tr><td bgcolor="#777777">'. |
'<table border="0"><tr><td bgcolor="#777777">'. |
'<table border="0"><tr bgcolor="#e6ffff">'. |
'<table border="0"><tr bgcolor="#e6ffff">'. |
'<td><b> Fullname <font color="#999999">(username)</font></b></td>'. |
'<td><b> Fullname <font color="#999999">(username)</font></b></td>'. |
Line 2540 LISTJAVASCRIPT
|
Line 2393 LISTJAVASCRIPT
|
'<td><b> Fullname <font color="#999999">(username)</font></b></td>'. |
'<td><b> Fullname <font color="#999999">(username)</font></b></td>'. |
'<td><b> Fullname <font color="#999999">(username)</font></b></td></tr>'; |
'<td><b> Fullname <font color="#999999">(username)</font></b></td></tr>'; |
|
|
my (undef,undef,$fullname) = &getclasslist($getsec,'0'); |
my (undef,undef,$fullname) = &getclasslist($getsec,'1'); |
my $ptr = 1; |
my $ptr = 1; |
foreach my $student (sort {lc($$fullname{$a}) cmp lc($$fullname{$b}) } keys %$fullname) { |
foreach my $student (sort {lc($$fullname{$a}) cmp lc($$fullname{$b}) } keys %$fullname) { |
my ($uname,$udom) = split(/:/,$student); |
my ($uname,$udom) = split(/:/,$student); |
Line 2564 LISTJAVASCRIPT
|
Line 2417 LISTJAVASCRIPT
|
} |
} |
|
|
sub getSymbMap { |
sub getSymbMap { |
my $navmap = Apache::lonnavmaps::navmap-> new( |
my ($request) = @_; |
|
my $navmap = Apache::lonnavmaps::navmap-> new($request, |
$ENV{'request.course.fn'}.'.db', |
$ENV{'request.course.fn'}.'.db', |
$ENV{'request.course.fn'}.'_parms.db',1, 1); |
$ENV{'request.course.fn'}.'_parms.db',1, 1); |
|
|
Line 2620 sub getSymbMap {
|
Line 2474 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'}; |
my $pageTitle = $ENV{'form.page'}; |
my $pageTitle = $ENV{'form.page'}; |
my (undef,undef,$fullname) = &getclasslist($getsec,'0'); |
my (undef,undef,$fullname) = &getclasslist($getsec,'1'); |
my ($uname,$udom) = split(/:/,$ENV{'form.student'}); |
my ($uname,$udom) = split(/:/,$ENV{'form.student'}); |
|
|
my $result='<h3><font color="#339933"> '.$ENV{'form.title'}.'</font></h3>'; |
my $result='<h3><font color="#339933"> '.$ENV{'form.title'}.'</font></h3>'; |
Line 2638 sub displayPage {
|
Line 2494 sub displayPage {
|
&sub_page_js($request); |
&sub_page_js($request); |
$request->print($result); |
$request->print($result); |
|
|
my $navmap = Apache::lonnavmaps::navmap-> new( |
my $navmap = Apache::lonnavmaps::navmap-> new($request, |
$ENV{'request.course.fn'}.'.db', |
$ENV{'request.course.fn'}.'.db', |
$ENV{'request.course.fn'}.'_parms.db',1, 1); |
$ENV{'request.course.fn'}.'_parms.db',1, 1); |
my ($mapUrl, $id, $resUrl) = split(/___/, $ENV{'form.page'}); |
my ($mapUrl, $id, $resUrl) = split(/___/, $ENV{'form.page'}); |
Line 2648 sub displayPage {
|
Line 2504 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="saveState" value="'.$ENV{'form.saveState'}.'" />'."\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 2531 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 2715 sub displayPage {
|
Line 2572 sub displayPage {
|
my @displaySub = (); |
my @displaySub = (); |
foreach my $partid (@{$parts}) { |
foreach my $partid (@{$parts}) { |
my @matchKey = grep /^resource\.$partid\..*?\.submission$/,@versionKeys; |
my @matchKey = grep /^resource\.$partid\..*?\.submission$/,@versionKeys; |
|
next if ($record{"$version:resource.$partid.solved"} eq ''); |
|
# next if ($record{"$version:resource.$partid.award"} eq 'APPROX_ANS' && |
|
# $record{"$version:resource.$partid.solved"} eq ''); |
$displaySub[0].=(exists $record{$version.':'.$matchKey[0]}) ? |
$displaySub[0].=(exists $record{$version.':'.$matchKey[0]}) ? |
'<b>Part:</b> '.$partid.' <b>Submission:</b> ' |
'<b>Trial '.$version.' Part '.$partid.'</b> ' |
.$record{$version.':'.$matchKey[0]}.'<br />' : ''; |
.$record{$version.':'.$matchKey[0]}.'<br />' : ''; |
$displaySub[1].=(exists $record{"$version:resource.$partid.award"}) ? |
$displaySub[1].=(exists $record{"$version:resource.$partid.award"}) ? |
'<b>Part:</b> '.$partid.' '. |
'<b>Part '.$partid.'</b> '. |
$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 2611 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 2622 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 2767 sub updateGradeByPage {
|
Line 2641 sub updateGradeByPage {
|
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 $pageTitle = $ENV{'form.page'}; |
my $pageTitle = $ENV{'form.page'}; |
my (undef,undef,$fullname) = &getclasslist($getsec,'0'); |
my (undef,undef,$fullname) = &getclasslist($getsec,'1'); |
my ($uname,$udom) = split(/:/,$ENV{'form.student'}); |
my ($uname,$udom) = split(/:/,$ENV{'form.student'}); |
|
|
my $result='<h3><font color="#339933"> '.$ENV{'form.title'}.'</font></h3>'; |
my $result='<h3><font color="#339933"> '.$ENV{'form.title'}.'</font></h3>'; |
Line 2776 sub updateGradeByPage {
|
Line 2650 sub updateGradeByPage {
|
|
|
$request->print($result); |
$request->print($result); |
|
|
my $navmap = Apache::lonnavmaps::navmap-> new( |
my $navmap = Apache::lonnavmaps::navmap-> new($request, |
$ENV{'request.course.fn'}.'.db', |
$ENV{'request.course.fn'}.'.db', |
$ENV{'request.course.fn'}.'_parms.db',1, 1); |
$ENV{'request.course.fn'}.'_parms.db',1, 1); |
my ($mapUrl, $id, $resUrl) = split(/___/, $ENV{'form.page'}); |
my ($mapUrl, $id, $resUrl) = split(/___/, $ENV{'form.page'}); |
Line 2801 sub updateGradeByPage {
|
Line 2675 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 2718 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 2734 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.' : |
|
'The scores were changed for '. |
|
$changeflag.' problem'.($changeflag == 1 ? '.' : 's.')); |
|
$studentTable.=&show_grading_menu_form($ENV{'form.symb'},$ENV{'form.url'}); |
$studentTable.=&show_grading_menu_form($ENV{'form.symb'},$ENV{'form.url'}); |
$request->print($studentTable); |
my $grademsg=($changeflag == 0 ? 'No score was changed or updated.' : |
|
'The scores were changed for '. |
|
$changeflag.' problem'.($changeflag == 1 ? '.' : 's.')); |
|
$request->print($grademsg.$studentTable); |
|
|
return ''; |
return ''; |
} |
} |
|
|
|
#-------- end of section for handling grading by page/sequence --------- |
|
# |
|
#------------------------------------------------------------------- |
|
|
|
#--------------------Scantron Grading----------------------------------- |
|
# |
|
#------ start of section for handling grading by page/sequence --------- |
|
|
#--- Form to input a receipt number --- |
sub getSequenceDropDown { |
sub verifyReceipt_form { |
my ($request,$symb)=@_; |
my ($symb,$url) = @_; |
my $result='<select name="selectpage">'."\n"; |
my $result = '<script type="text/javascript" language="javascript">'."\n". |
my ($titles,$symbx) = &getSymbMap($request); |
' function checkEntry(formname) {'."\n". |
my ($curpage,$type,$mapId) = ($symb =~ /(.*?\.(page|sequence))___(\d+)___/); |
' var receipt = formname.receipt.value;'."\n". |
my $ctr=0; |
' if (isNaN(receipt) || receipt == "") {'."\n". |
foreach (@$titles) { |
' alert("Please enter a receipt number given by a student in the box.");'."\n". |
my ($minder,$showtitle) = ($_ =~ /(\d+)\.(.*)/); |
' return false;'."\n". |
$result.='<option value="'.$$symbx{$_}.'" '. |
' }'."\n". |
($$symbx{$_} =~ /$curpage$/ ? 'selected="on"' : ''). |
' formname.submit();'."\n". |
'>'.$showtitle.'</option>'."\n"; |
' }'."\n". |
$ctr++; |
'</script>'."\n"; |
} |
|
$result.= '</select>'; |
|
return $result; |
|
} |
|
|
|
sub scantron_selectphase { |
|
my ($r) = @_; |
|
my ($symb,$url)=&get_symb_and_url($r); |
|
if (!$symb) {return '';} |
|
my $sequence_selector=&getSequenceDropDown($r,$symb); |
|
my $result; |
|
$result.= <<SCANTRONFORM; |
|
<form method="post" enctype="multipart/form-data" action="/adm/grades" name="scantronupload"> |
|
<input type="hidden" name="symb" value="$symb" /> |
|
<input type="hidden" name="url" value="$url" /> |
|
<input type="hidden" name="command" value="scantron_configphase" /> |
|
<table width="100%" border="0"> |
|
<tr> |
|
<td bgcolor="#777777"> |
|
<table width="100%" border="0"> |
|
<tr bgcolor="#e6ffff"> |
|
<td> |
|
<b>Specify file location and which Folder/Sequence to grade</b> |
|
</td> |
|
</tr> |
|
<tr bgcolor="#ffffe6"> |
|
<td> |
|
Sequence to grade: $sequence_selector |
|
</td> |
|
</tr> |
|
<tr bgcolor="#ffffe6"> |
|
<td> |
|
<!-- FIXME I need to present a list of files from a specfic directory that has been configured, or any existing delay queues --> |
|
Filename of scoring office file: |
|
<select name="selectfile"> |
|
<option value="filname1">filename1</option> |
|
<option value="filname2">filename2</option> |
|
</select> |
|
</td> |
|
</tr> |
|
</table> |
|
</td> |
|
</tr> |
|
</table> |
|
<input type="submit" value="Submit" /> |
|
</form> |
|
SCANTRONFORM |
|
|
|
return $result; |
|
} |
|
|
|
sub scantron_configphase { |
|
my ($r) = @_; |
|
my $sequence=$ENV{'form.selectpage'}; |
|
my $result; |
|
$result.="got page $sequence"; |
|
$Apache::lonxml::debug=1; |
|
&Apache::lonhomework::showhash(%ENV); |
|
$Apache::lonxml::debug=0; |
|
#FIXME Needs to present some lines from the file and allow the instructor to specify which columns represent what data, possibly have some nice defaults setup, probably should do a pass through all problems for a student to get an idea of how many questions there are, and homw many lines we'll have, |
|
return $result; |
|
} |
|
|
|
sub scantron_process_students { |
|
#FIXME |
|
# loop through students, { |
|
# Check if studnet info valid, if not add line to delay queue |
|
# foreach question 'submit' the students answer to the server |
|
# through grade target { |
|
# generate data to pass back that includes grade recevied |
|
# } |
|
# } |
|
# loop through delay queue { |
|
# print out each delayed student with interface to select how |
|
# to repair student provided info |
|
# Expected errors include |
|
# 1 bad/no stuid/username |
|
# 2 invalid bubblings |
|
# } |
|
# if delay queue exists 2 submits one to process delayed students one |
|
# to ignore delayed students, possibly saving the delay queue for later |
|
|
|
} |
|
#-------- end of section for handling grading scantron forms ------- |
|
# |
|
#------------------------------------------------------------------- |
|
|
|
|
|
#-------------------------- 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="saveState" value="'.$ENV{'form.saveState'}.'" />'."\n". |
|
'<input type="hidden" name="command" value="gradingmenu" />'."\n". |
|
'<input type="submit" name="submit" value="Grading Menu" />'."\n". |
|
'</form>'."\n"; |
|
return $result; |
|
} |
|
|
my $hostver=unpack("%32C*",$Apache::lonnet::perlvar{'lonHostID'}); |
# -- Retrieve choices for grading form |
|
sub savedState { |
|
my %savedState = (); |
|
if ($ENV{'form.saveState'}) { |
|
foreach (split(/:/,$ENV{'form.saveState'})) { |
|
my ($key,$value) = split(/=/,$_,2); |
|
$savedState{$key} = $value; |
|
} |
|
} |
|
return \%savedState; |
|
} |
|
|
$result.='<table width=100% border=0><tr><td bgcolor=#777777>'."\n"; |
#--- Displays the main menu page ------- |
$result.='<table width=100% border=0><tr><td bgcolor=#e6ffff>'."\n"; |
sub gradingmenu { |
$result.=' <b>Verify a Submission Receipt Issued by this Server</td></tr>'."\n"; |
my ($request) = @_; |
$result.='<tr bgcolor=#ffffe6><td>'."\n"; |
my ($symb,$url)=&get_symb_and_url($request); |
$result.='<form action="/adm/grades" method="post" name="verifyform">'."\n"; |
if (!$symb) {return '';} |
$result.=' <tt>'.$hostver.'-<input type="text" name="receipt" size="4"></tt><br />'."\n"; |
my $probTitle = &Apache::lonnet::gettitle($symb); |
$result.=' <input type="button" onClick="javascript:checkEntry(this.form);"'. |
|
' value="Verify Receipt">'."\n"; |
$request->print(<<GRADINGMENUJS); |
$result.='<input type="hidden" name="command" value="verify">'."\n"; |
<script type="text/javascript" language="javascript"> |
if ($ENV{'form.url'}) { |
function checkChoice(formname) { |
$result.='<input type="hidden" name="url" value="'.$ENV{'form.url'}.'" />'; |
var cmd = formname.command; |
|
formname.saveState.value = "saveCmd="+radioSelection(cmd)+":saveSec="+pullDownSelection(formname.section)+ |
|
":saveSub="+radioSelection(formname.submitonly)+":saveStatus="+pullDownSelection(formname.status); |
|
if (cmd[0].checked || cmd[1].checked || cmd[2].checked || cmd[4].checked) formname.submit(); |
|
|
|
if (cmd[3].checked) browseAndUpload(); |
|
|
|
if (cmd[5].checked) { |
|
if (!checkReceiptNo(formname,'notOK')) { return false;} |
|
formname.submit(); |
|
} |
} |
} |
if ($ENV{'form.symb'}) { |
|
$result.='<input type="hidden" name="symb" value="'.$ENV{'form.symb'}.'" />'; |
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[5].checked = true; |
|
return true; |
|
} |
|
|
|
function radioSelection(radioButton) { |
|
var selection=null; |
|
if (radioButton.length > 1) { |
|
for (var i=0; i<radioButton.length; i++) { |
|
if (radioButton[i].checked) { |
|
return radioButton[i].value; |
|
} |
|
} |
|
} else { |
|
if (radioButton.checked) return radioButton.value; |
|
} |
|
return selection; |
} |
} |
$result.='</form>'; |
|
$result.='</td></tr></table>'."\n"; |
function pullDownSelection(selectOne) { |
$result.='</td></tr></table>'."\n"; |
var selection=""; |
|
if (selectOne.length > 1) { |
|
for (var i=0; i<selectOne.length; i++) { |
|
if (selectOne[i].selected) { |
|
return selectOne[i].value; |
|
} |
|
} |
|
} else { |
|
if (selectOne.selected) return selectOne.value; |
|
} |
|
} |
|
|
|
function browseAndUpload() { |
|
bNLoad = window.open('', 'BrowseAndUpload', 'toolbar=no,location=no,scrollbars=no,width=550,height=200,screenx=100,screeny=75'); |
|
bNLoad.focus(); |
|
var lDoc = bNLoad.document; |
|
lDoc.write("<html><head>"); |
|
lDoc.write("<title>Browse And Upload</title>"); |
|
|
|
lDoc.write("<script language=javascript>"); |
|
lDoc.write("function checkUpload(formname) {"); |
|
|
|
lDoc.write(" if (formname.upfile.value == \\"\\") {"); |
|
lDoc.write(" alert(\\"Please use the browse button to select a file from your local directory.\\");"); |
|
lDoc.write(" return false;"); |
|
lDoc.write(" }"); |
|
lDoc.write(" var openformname = opener.document.gradingMenu;"); |
|
lDoc.write(" formname.saveState.value = \\"saveCmd=\\"+opener.radioSelection(openformname.command)+\\":saveSec=\\"+opener.pullDownSelection(openformname.section)+\\":saveSub=\\"+opener.radioSelection(openformname.submitonly)+\\":saveStatus=\\"+opener.pullDownSelection(openformname.status);"); |
|
lDoc.write(" document.gradesupload.submit();"); |
|
lDoc.write(" if (navigator.appName !=\\"Netscape\\") {self.close()};"); |
|
lDoc.write(" setTimeout('self.close()',750)"); |
|
lDoc.write("}"); |
|
|
|
lDoc.write("<"); |
|
lDoc.write("/script>"); |
|
|
|
lDoc.write("</head><body bgcolor=white>"); |
|
lDoc.write("<form method=\\"post\\" enctype=\\"multipart/form-data\\" action=\\"/adm/grades\\" name=\\"gradesupload\\" target=\\"LONcatInfo\\">"); |
|
lDoc.write("<input type=\\"hidden\\" name=\\"symb\\" value=\\"$symb\\">"); |
|
lDoc.write("<input type=\\"hidden\\" name=\\"url\\" value=\\"$url\\">"); |
|
lDoc.write("<input type=\\"hidden\\" name=\\"probTitle\\" value=\\"$probTitle\\">"); |
|
lDoc.write("<input type=\\"hidden\\" name=\\"saveState\\" value=\\"\\">"); |
|
lDoc.write("<input type=\\"hidden\\" name=\\"command\\" value=\\"csvuploadmap\\">"); |
|
|
|
lDoc.write("<font color=\\"green\\" size=+1> <b>Specify a file containing the class scores for problem - $probTitle</b></font><br><br>"); |
|
|
|
lDoc.write("<table border=0 width=100%><tr><td bgcolor=\\"#777777\\">"); |
|
lDoc.write("<table border=0 width=100%><tr bgcolor=\\"#ddffff\\">"); |
|
lDoc.write("<td>"); |
|
lDoc.write("<input type=\\"file\\" name=\\"upfile\\" size=\\"50\\" />"); |
|
lDoc.write("<br />Type: <select name=\\"upfiletype\\">"); |
|
lDoc.write("<option value=\\"csv\\">CSV (comma separated values, spreadsheet)</option>"); |
|
lDoc.write("<option value=\\"space\\">Space separated</option>"); |
|
lDoc.write("<option value=\\"tab\\">Tabulator separated</option>"); |
|
lDoc.write("<option value=\\"xml\\">HTML/XML</option>"); |
|
lDoc.write("</select>"); |
|
lDoc.write("</td></tr></table>"); |
|
lDoc.write("</td></tr></table> "); |
|
lDoc.write("<input type=\\"button\\" value=\\"Upload Scores\\" onClick=\\"javascript:checkUpload(this.form)\\"> "); |
|
lDoc.write("<input type=\\"button\\" value=\\"Cancel\\" onClick=\\"self.close()\\"><br><br>"); |
|
lDoc.write("</form>"); |
|
lDoc.write("</body></html>"); |
|
} |
|
</script> |
|
GRADINGMENUJS |
|
|
|
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>'."\n"; |
|
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>'."\n"; |
|
|
|
my (undef,$sections) = &getclasslist('all','0'); |
|
my $savedState = &savedState(); |
|
my $saveCmd = ($$savedState{'saveCmd'} eq '' ? 'pickStudentPage' : $$savedState{'saveCmd'}); |
|
my $saveSec = ($$savedState{'saveSec'} eq '' ? 'all' : $$savedState{'saveSec'}); |
|
my $saveSub = ($$savedState{'saveSub'} eq '' ? 'yes' : $$savedState{'saveSub'}); |
|
my $saveStatus = ($$savedState{'saveStatus'} eq '' ? 'Active' : $$savedState{'saveStatus'}); |
|
|
|
$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="saveState" 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" '. |
|
($saveCmd 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" '. |
|
($saveCmd eq 'viewgrades' ? 'checked' : '').'> '. |
|
'Grade by section or class</td></tr>'."\n". |
|
|
|
'<tr bgcolor="#ffffe6"valign="top"><td><input type="radio" name="command" value="submission" '. |
|
($saveCmd 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" '. |
|
($saveSub eq 'yes' ? 'checked' : '').' /> submitted'. |
|
'<input type="radio" name="submitonly" value="all" '. |
|
($saveSub eq 'all' ? 'checked' : '').' /> everybody</td></tr>'."\n". |
|
|
|
'<tr bgcolor="#ffffe6"valign="top"><td colspan="2">'. |
|
'<input type="radio" name="command" value="csvupload" '. |
|
($saveCmd eq 'csvupload' ? 'checked' : '').'> '. |
|
'Upload scores from file</td></tr>'."\n"; |
|
|
|
$result.='<tr bgcolor="#ffffe6"valign="top"><td colspan="2">'. |
|
'<input type="radio" name="command" value="scantron_selectphase" /> '. |
|
'Grade scantron forms</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" onChecked="javascript:this.form.receipt.focus()" '. |
|
($saveCmd 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: <select name="section">'."\n"; |
|
if (ref($sections)) { |
|
foreach (sort (@$sections)) {$result.='<option value="'.$_.'" '. |
|
($saveSec eq $_ ? 'selected="on"' : '').'>'.$_.'</option>'."\n";} |
|
} |
|
$result.= '<option value="all" '.($saveSec eq 'all' ? 'selected="on"' : ''). '>all</select> '; |
|
|
|
$result.='Student Status:</b><select name="status">'. |
|
'<option value="Active" '.($saveStatus eq 'Active' ? 'selected' : '').'>Active</option>'. |
|
'<option value="Expired" '.($saveStatus eq 'Expired' ? 'selected' : '').'>Expired</option>'. |
|
'<option value="Any" '.($saveStatus eq 'Any' ? 'selected' : '').'>Any</option>'. |
|
'</select>'; |
|
|
|
$result.=' <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 3156 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 3174 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') { |
Line 2999 sub handler {
|
Line 3193 sub handler {
|
} |
} |
$request->print(&csvuploadmap($request)); |
$request->print(&csvuploadmap($request)); |
} |
} |
|
} elsif ($command eq 'scantron_selectphase') { |
|
$request->print(&scantron_selectphase($request)); |
|
} elsif ($command eq 'scantron_configphase') { |
|
$request->print(&scantron_configphase($request)); |
} else { |
} else { |
$request->print("Unknown action: $command:"); |
$request->print("Unknown action: $command:"); |
} |
} |