version 1.45, 2002/08/05 20:49:54
|
version 1.46, 2002/08/06 20:46:30
|
Line 45 use Apache::Constants qw(:common);
|
Line 45 use Apache::Constants qw(:common);
|
|
|
# ----- These first few routines are general use routines.----- |
# ----- These first few routines are general use routines.----- |
# |
# |
|
|
sub print_hash { |
|
my ($request, $hash) = @_; |
|
$request->print('<table border=1><tr><td>Key</td><td>Value</td></tr>'); |
|
for (sort keys (%$hash)) { |
|
$request->print('<tr><td>'.$_.'</td><td>'.$$hash{$_}.' </td></tr>'); |
|
} |
|
$request->print('</table>'); |
|
return ''; |
|
} |
|
|
|
# --- Retrieve the parts that matches stores_\d+ from the metadata file.--- |
# --- Retrieve the parts that matches stores_\d+ from the metadata file.--- |
sub getpartlist { |
sub getpartlist { |
my ($url) = @_; |
my ($url) = @_; |
Line 114 sub response_type {
|
Line 103 sub response_type {
|
return \@partlist,\%handgrade; |
return \@partlist,\%handgrade; |
} |
} |
|
|
#--- Prints a message on screen if a user did something wrong |
|
#--- Operator error --- |
|
sub userError { |
|
my ($request, $reason, $step) = @_; |
|
$request->print('<h3><font color="red">LON-CAPA User Error</font></h3><br />'."\n"); |
|
$request->print('<b>Reason: </b>'.$reason.'<br /><br />'."\n"); |
|
$request->print('<b>Step: </b>'.($step ne '' ? $step : 'Use your browser back button to correct') |
|
.'<br /><br />'."\n"); |
|
return ''; |
|
} |
|
|
|
#--- 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 { |
Line 323 sub listStudents {
|
Line 301 sub listStudents {
|
<script type="text/javascript" language="javascript"> |
<script type="text/javascript" language="javascript"> |
function checkSelect(checkBox) { |
function checkSelect(checkBox) { |
var ctr=0; |
var ctr=0; |
|
var sense=""; |
if (checkBox.length > 1) { |
if (checkBox.length > 1) { |
for (var i=0; i<checkBox.length; i++) { |
for (var i=0; i<checkBox.length; i++) { |
if (checkBox[i].checked) { |
if (checkBox[i].checked) { |
ctr++; |
ctr++; |
} |
} |
} |
} |
|
sense = "a student or group of students"; |
} else { |
} else { |
if (checkBox.checked) { |
if (checkBox.checked) { |
ctr = 1; |
ctr = 1; |
} |
} |
|
sense = "the student"; |
} |
} |
if (ctr == 0) { |
if (ctr == 0) { |
alert("You did not select any student."); |
alert("Please select "+sense+" before clicking on the View/Grade button."); |
return false; |
return false; |
} |
} |
document.gradesub.submit(); |
document.gradesub.submit(); |
Line 443 LISTJAVASCRIPT
|
Line 424 LISTJAVASCRIPT
|
$gradeTable='<br /> <font color="red">'. |
$gradeTable='<br /> <font color="red">'. |
'No submission found for this resource.</font><br />'; |
'No submission found for this resource.</font><br />'; |
$gradeTable.=&show_grading_menu_form ($ENV{'form.symb'},$ENV{'form.url'}); |
$gradeTable.=&show_grading_menu_form ($ENV{'form.symb'},$ENV{'form.url'}); |
|
} elsif ($ctr == 1) { |
|
$gradeTable =~ s/type=checkbox/type=checkbox checked/; |
} |
} |
$request->print($gradeTable); |
$request->print($gradeTable); |
return ''; |
return ''; |
Line 552 sub sub_page_js {
|
Line 535 sub sub_page_js {
|
var points = eval("document.SCORE.GD_BOX"+i+"_"+partid+".value"); |
var points = eval("document.SCORE.GD_BOX"+i+"_"+partid+".value"); |
if (points == "") { |
if (points == "") { |
var name = eval("document.SCORE.name"+i+".value"); |
var name = eval("document.SCORE.name"+i+".value"); |
alert("You did not assign any point for "+name+", part "+partid+"."); |
alert("Please assign a score for "+name+", part "+partid+"."); |
return false; |
return false; |
} |
} |
} |
} |
Line 594 sub sub_page_js {
|
Line 577 sub sub_page_js {
|
else return; |
else return; |
var cleantxt = txt.replace(new RegExp('([\\f\\n\\r\\t\\v ])+', 'g')," "); |
var cleantxt = txt.replace(new RegExp('([\\f\\n\\r\\t\\v ])+', 'g')," "); |
if (cleantxt=="") { |
if (cleantxt=="") { |
alert("Select a word or group of words from document and then click this link."); |
alert("Please select a word or group of words from document and then click this link."); |
return; |
return; |
} |
} |
var nret = prompt("Add selection to keyword list? Edit if desired.",cleantxt); |
var nret = prompt("Add selection to keyword list? Edit if desired.",cleantxt); |
Line 929 KEYWORDS
|
Line 912 KEYWORDS
|
my $result='<table border="0" width=100%><tr><td bgcolor="#777777">'."\n". |
my $result='<table border="0" width=100%><tr><td bgcolor="#777777">'."\n". |
'<table border="0" width=100%><tr bgcolor="#edffff"><td>'."\n"; |
'<table border="0" width=100%><tr bgcolor="#edffff"><td>'."\n"; |
|
|
# $result.='<table border="0"><tr bgcolor="#ffffff"><td><b>Fullname: </b>'.$ENV{'form.fullname'}. |
|
$result.='<b>Fullname: </b>'.$ENV{'form.fullname'}. |
$result.='<b>Fullname: </b>'.$ENV{'form.fullname'}. |
'<font color="#999999"> Username: '.$uname.'</font>'. |
'<font color="#999999"> Username: '.$uname.'</font>'. |
'<font color="#999999"> Domain: '.$udom.'</font><br />'."\n"; |
'<font color="#999999"> Domain: '.$udom.'</font><br />'."\n"; |
Line 1002 KEYWORDS
|
Line 984 KEYWORDS
|
$request->print($submitby); |
$request->print($submitby); |
} else { |
} else { |
my ($string,$timestamp)= |
my ($string,$timestamp)= |
&get_last_submission ($symb,$uname,$udom,$ENV{'request.course.id'}); |
&get_last_submission (%record); |
my $lastsubonly.=''. |
my $lastsubonly.=''. |
($$timestamp eq '' ? '' : '<b>Date Submitted:</b> '. |
($$timestamp eq '' ? '' : '<b>Date Submitted:</b> '. |
$$timestamp).''; |
$$timestamp).''; |
Line 1153 KEYWORDS
|
Line 1135 KEYWORDS
|
|
|
#--- Retrieve the last submission for all the parts |
#--- Retrieve the last submission for all the parts |
sub get_last_submission { |
sub get_last_submission { |
my ($symb,$username,$domain,$course)=@_; |
my (%returnhash)=@_; |
if ($symb) { |
my (@string,$timestamp); |
my (@string,$timestamp); |
if ($returnhash{'version'}) { |
my (%returnhash)=&Apache::lonnet::restore($symb,$course,$domain,$username); |
my %lasthash=(); |
if ($returnhash{'version'}) { |
my ($version); |
my %lasthash=(); |
for ($version=1;$version<=$returnhash{'version'};$version++) { |
my ($version); |
foreach (sort(split(/\:/,$returnhash{$version.':keys'}))) { |
for ($version=1;$version<=$returnhash{'version'};$version++) { |
$lasthash{$_}=$returnhash{$version.':'.$_}; |
foreach (sort(split(/\:/,$returnhash{$version.':keys'}))) { |
if ($returnhash{$version.':'.$_} =~ /(SUBMITTED|DRAFT)$/) { |
$lasthash{$_}=$returnhash{$version.':'.$_}; |
$timestamp = scalar(localtime($returnhash{$version.':timestamp'})); |
} |
} |
} |
} |
foreach ((keys %lasthash)) { |
} |
if ($_ =~ /\.submission$/) { |
foreach ((keys %lasthash)) { |
my ($partid,$foo) = split(/submission$/,$_); |
if ($_ =~ /\.submission$/) { |
my $draft = $lasthash{$partid.'awarddetail'} eq 'DRAFT' ? |
my ($partid,$foo) = split(/submission$/,$_); |
'<font color="red">Draft Copy</font> ' : ''; |
my $draft = $lasthash{$partid.'awarddetail'} eq 'DRAFT' ? |
push @string, (join(':',$_,$draft.$lasthash{$_})); |
'<font color="red">Draft Copy</font> ' : ''; |
} |
push @string, (join(':',$_,$draft.$lasthash{$_})); |
if ($_ =~ /timestamp/) {$timestamp = scalar(localtime($lasthash{$_}))}; |
|
} |
} |
} |
} |
@string = $string[0] eq '' ? 'Nothing submitted - no attempts.' : @string; |
|
return \@string,\$timestamp; |
|
} |
} |
|
@string = $string[0] eq '' ? 'Nothing submitted - no attempts.' : @string; |
|
return \@string,\$timestamp; |
} |
} |
|
|
#--- High light keywords, with style choosen by user. |
#--- High light keywords, with style choosen by user. |
Line 2029 sub csvuploadassign {
|
Line 2010 sub csvuploadassign {
|
} |
} |
$request->print('<h3>Assigning Grades</h3>'); |
$request->print('<h3>Assigning Grades</h3>'); |
my $courseid=$ENV{'request.course.id'}; |
my $courseid=$ENV{'request.course.id'}; |
# my $cdom=$ENV{"course.$courseid.domain"}; |
|
# my $cnum=$ENV{"course.$courseid.num"}; |
|
my ($classlist) = &getclasslist('all','1'); |
my ($classlist) = &getclasslist('all','1'); |
my @skipped; |
my @skipped; |
my $countdone=0; |
my $countdone=0; |
Line 2130 sub view_edit_entire_class_form {
|
Line 2109 sub view_edit_entire_class_form {
|
$result.= '<option>'.$_.'</option>'."\n"; |
$result.= '<option>'.$_.'</option>'."\n"; |
} |
} |
$result.='<option selected="on">all</select>'."<br />\n"; |
$result.='<option selected="on">all</select>'."<br />\n"; |
$result.=' <input type="submit" name="submit" value="View/Grade" /></form>'."\n"; |
$result.=' <input type="button" onClick="submit();" value="View/Grade" /></form>'."\n"; |
$result.='</td></tr></table>'."\n"; |
$result.='</td></tr></table>'."\n"; |
$result.='</td></tr></table>'."\n"; |
$result.='</td></tr></table>'."\n"; |
return $result; |
return $result; |
Line 2140 sub view_edit_entire_class_form {
|
Line 2119 sub view_edit_entire_class_form {
|
sub upcsvScores_form { |
sub upcsvScores_form { |
my ($symb,$url) = @_; |
my ($symb,$url) = @_; |
if (!$symb) {return '';} |
if (!$symb) {return '';} |
my $result.='<table width=100% border=0><tr><td bgcolor=#777777>'."\n"; |
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.='<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.=' <b>Specify a file containing the class scores for above resource</b></td></tr>'."\n"; |
$result.='<tr bgcolor=#ffffe6><td>'."\n"; |
$result.='<tr bgcolor=#ffffe6><td>'."\n"; |
Line 2151 sub upcsvScores_form {
|
Line 2140 sub upcsvScores_form {
|
<input type="hidden" name="url" value="$url" /> |
<input type="hidden" name="url" value="$url" /> |
<input type="hidden" name="command" value="csvuploadmap" /> |
<input type="hidden" name="command" value="csvuploadmap" /> |
$upfile_select |
$upfile_select |
<br /> <input type="submit" name="submit" value="Upload Grades" /> |
<br /> <input type="button" onClick="javascript:checkUpload(this.form);" value="Upload Grades" /> |
</form> |
</form> |
ENDUPFORM |
ENDUPFORM |
$result.='</td></tr></table>'."\n"; |
$result.='</td></tr></table>'."\n"; |
Line 2185 sub viewGradeaStu_form {
|
Line 2174 sub viewGradeaStu_form {
|
'<input type="radio" name="submitonly" value="all"> everybody <br />'; |
'<input type="radio" name="submitonly" value="all"> everybody <br />'; |
$result.=' (Section "no" implies the students were not assigned a section.)<br />' |
$result.=' (Section "no" implies the students were not assigned a section.)<br />' |
if (grep /no/,@$sections); |
if (grep /no/,@$sections); |
|
|
$result.='<br /> <input type="submit" name="submit" value="View/Grade" />'."\n". |
$result.='<br /> <input type="button" onClick="submit();" value="View/Grade" />'."\n". |
'</form>'."\n"; |
'</form>'."\n"; |
$result.='</td></tr></table>'."\n"; |
$result.='</td></tr></table>'."\n"; |
$result.='</td></tr></table>'."\n"; |
$result.='</td></tr></table>'."\n"; |
Line 2196 sub viewGradeaStu_form {
|
Line 2185 sub viewGradeaStu_form {
|
#--- Form to input a receipt number --- |
#--- Form to input a receipt number --- |
sub verifyReceipt_form { |
sub verifyReceipt_form { |
my ($symb,$url) = @_; |
my ($symb,$url) = @_; |
my $cdom=$ENV{"course.$ENV{'request.course.id'}.domain"}; |
my $result = '<script type="text/javascript" language="javascript">'."\n". |
my $cnum=$ENV{"course.$ENV{'request.course.id'}.num"}; |
' function checkEntry(formname) {'."\n". |
|
' var receipt = formname.receipt.value;'."\n". |
|
' if (isNaN(receipt) || receipt == "") {'."\n". |
|
' alert("Please enter a receipt number given by a student in the box.");'."\n". |
|
' return false;'."\n". |
|
' }'."\n". |
|
' formname.submit();'."\n". |
|
' }'."\n". |
|
'</script>'."\n"; |
|
|
my $hostver=unpack("%32C*",$Apache::lonnet::perlvar{'lonHostID'}); |
my $hostver=unpack("%32C*",$Apache::lonnet::perlvar{'lonHostID'}); |
|
|
my $result.='<table width=100% border=0><tr><td bgcolor=#777777>'."\n"; |
$result.='<table width=100% border=0><tr><td bgcolor=#777777>'."\n"; |
$result.='<table width=100% border=0><tr><td bgcolor=#e6ffff>'."\n"; |
$result.='<table width=100% border=0><tr><td bgcolor=#e6ffff>'."\n"; |
$result.=' <b>Verify a Submission Receipt Issued by this Server</td></tr>'."\n"; |
$result.=' <b>Verify a Submission Receipt Issued by this Server</td></tr>'."\n"; |
$result.='<tr bgcolor=#ffffe6><td>'."\n"; |
$result.='<tr bgcolor=#ffffe6><td>'."\n"; |
$result.='<form action="/adm/grades" method="post">'."\n"; |
$result.='<form action="/adm/grades" method="post" name="verifyform">'."\n"; |
$result.=' <tt>'.$hostver.'-<input type="text" name="receipt" size="4"></tt><br />'."\n"; |
$result.=' <tt>'.$hostver.'-<input type="text" name="receipt" size="4"></tt><br />'."\n"; |
$result.=' <input type="submit" name="submit" value="Verify Receipt">'."\n"; |
$result.=' <input type="button" onClick="javascript:checkEntry(this.form);"'. |
|
' value="Verify Receipt">'."\n"; |
$result.='<input type="hidden" name="command" value="verify">'."\n"; |
$result.='<input type="hidden" name="command" value="verify">'."\n"; |
if ($ENV{'form.url'}) { |
if ($ENV{'form.url'}) { |
$result.='<input type="hidden" name="url" value="'.$ENV{'form.url'}.'" />'; |
$result.='<input type="hidden" name="url" value="'.$ENV{'form.url'}.'" />'; |
Line 2268 sub handler {
|
Line 2267 sub handler {
|
} |
} |
} |
} |
} else { |
} else { |
#&Apache::lonhomework::showhashsubset(\%ENV,'^form'); |
|
$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') { |
&listStudents($request) if ($ENV{'form.student'} eq ''); |
&listStudents($request) if ($ENV{'form.student'} eq ''); |