[LON-CAPA-cvs] cvs: loncom /homework grades.pm
albertel
lon-capa-cvs@mail.lon-capa.org
Fri, 28 Mar 2003 23:44:31 -0000
albertel Fri Mar 28 18:44:31 2003 EDT
Modified files:
/loncom/homework grades.pm
Log:
- more scantron stuff
Index: loncom/homework/grades.pm
diff -u loncom/homework/grades.pm:1.80 loncom/homework/grades.pm:1.81
--- loncom/homework/grades.pm:1.80 Fri Mar 28 15:49:55 2003
+++ loncom/homework/grades.pm Fri Mar 28 18:44:31 2003
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# The LON-CAPA Grading handler
#
-# $Id: grades.pm,v 1.80 2003/03/28 20:49:55 ng Exp $
+# $Id: grades.pm,v 1.81 2003/03/28 23:44:31 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -2779,6 +2779,15 @@
#
#------ start of section for handling grading by page/sequence ---------
+sub defaultFormData {
+ my ($symb,$url)=@_;
+ return '
+ <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="probTitle" value="'.$ENV{'form.probTitle'}.'" />'."\n";
+}
+
sub getSequenceDropDown {
my ($request,$symb)=@_;
my $result='<select name="selectpage">'."\n";
@@ -2796,17 +2805,33 @@
return $result;
}
+sub scantron_uploads {
+ if (!-e $Apache::lonnet::perlvar{'lonScansDir'}) { return ''};
+ my $result= '<select name="scantron_selectfile">';
+ opendir(DIR,$Apache::lonnet::perlvar{'lonScansDir'});
+ my @files=sort(readdir(DIR));
+ foreach my $filename (@files) {
+ if ($filename eq '.' or $filename eq '..') { next; }
+ $result.="<option>$filename</option>\n";
+ }
+ closedir(DIR);
+ $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 $default_form_data=&defaultFormData($symb,$url);
+ my $grading_menu_button=&show_grading_menu_form($symb,$url);
+ my $file_selector=&scantron_uploads();
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" />
+ $default_form_data
<table width="100%" border="0">
<tr>
<td bgcolor="#777777">
@@ -2823,12 +2848,7 @@
</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>
+ Filename of scoring office file: $file_selector
</td>
</tr>
</table>
@@ -2837,6 +2857,7 @@
</table>
<input type="submit" value="Submit" />
</form>
+$grading_menu_button
SCANTRONFORM
return $result;
@@ -2844,12 +2865,44 @@
sub scantron_configphase {
my ($r) = @_;
- my $sequence=$ENV{'form.selectpage'};
+ my (undef,undef,$sequence)=split(/___/,$ENV{'form.selectpage'});
my $result;
- $result.="got page $sequence";
- $Apache::lonxml::debug=1;
- &Apache::lonhomework::showhash(%ENV);
- $Apache::lonxml::debug=0;
+ my ($symb,$url)=&get_symb_and_url($r);
+ if (!$symb) {return '';}
+ my $default_form_data=&defaultFormData($symb,$url);
+ my $grading_menu_button=&show_grading_menu_form($symb,$url);
+ my $file_selector;
+ $result.= <<SCANTRONFORM;
+<form method="post" enctype="multipart/form-data" action="/adm/grades" name="scantronupload">
+ <input type="hidden" name="command" value="scantron_configphase" />
+ $default_form_data
+ <table width="100%" border="0">
+ <tr>
+ <td bgcolor="#777777">
+ <table width="100%" border="0">
+ <tr bgcolor="#e6ffff">
+ <td>
+ <b>Select a format for the data file.</b>
+ </td>
+ </tr>
+ <tr bgcolor="#ffffe6">
+ <td>
+ Format of data file:
+ </td>
+ </tr>
+ <tr bgcolor="#ffffe6">
+ <td>
+ Filename of scoring office file: $file_selector
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ </table>
+ <input type="submit" value="Submit" />
+</form>
+$grading_menu_button
+SCANTRONFORM
#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;
}
@@ -3088,7 +3141,8 @@
'Upload scores from file</td></tr>'."\n";
$result.='<tr bgcolor="#ffffe6"valign="top"><td colspan="2">'.
- '<input type="radio" name="command" value="scantron_selectphase" /> '.
+ '<input type="radio" name="command" value="scantron_selectphase" '.
+ ($saveCmd eq 'scantron_selectphase' ? 'checked="on"' : '').' /> '.
'Grade scantron forms</td></tr>'."\n";
if ((&Apache::lonnet::allowed('mgr',$ENV{'request.course.id'})) && ($symb)) {