[LON-CAPA-cvs] cvs: loncom /homework grades.pm

albertel lon-capa-cvs@mail.lon-capa.org
Mon, 09 Feb 2004 22:37:54 -0000


albertel		Mon Feb  9 17:37:54 2004 EDT

  Modified files:              
    /loncom/homework	grades.pm 
  Log:
  - cleans up the scantron interface some
  - instructors no longer need to spcify destination course when uploading a scroing office file
  
  
Index: loncom/homework/grades.pm
diff -u loncom/homework/grades.pm:1.173 loncom/homework/grades.pm:1.174
--- loncom/homework/grades.pm:1.173	Mon Feb  9 17:16:32 2004
+++ loncom/homework/grades.pm	Mon Feb  9 17:37:54 2004
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # The LON-CAPA Grading handler
 #
-# $Id: grades.pm,v 1.173 2004/02/09 22:16:32 albertel Exp $
+# $Id: grades.pm,v 1.174 2004/02/09 22:37:54 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -3452,34 +3452,28 @@
         $default_form_data
         <table width="100%" border="0">
           <tr bgcolor="#e6ffff">
-            <td>
-              &nbsp;<b>Specify file location and which Folder/Sequence to grade</b>
+            <td colspan="2">
+              &nbsp;<b>Specify file and which Folder/Sequence to grade</b>
             </td>
           </tr>
           <tr bgcolor="#ffffe6">
-            <td>
-               Sequence to grade: $sequence_selector
-	    </td>
+            <td> Sequence to grade: </td><td> $sequence_selector </td>
           </tr>
           <tr bgcolor="#ffffe6">
-            <td>
-		Filename of scoring office file: $file_selector
-	    </td>
+            <td> Filename of scoring office file: </td><td> $file_selector </td>
           </tr>
           <tr bgcolor="#ffffe6">
-            <td>
-              Format of data file: $format_selector
-	    </td>
+            <td> Format of data file: </td><td> $format_selector </td>
           </tr>
           <tr bgcolor="#ffffe6">
             <td>
 <!-- FIXME this is lazy, a single parse of the set should let me know what this is -->
-              Last line to expect an answer on: 
+              Last line to expect an answer on: </td><td>
                 <input type="text" name="scantron_maxbubble" />
 	    </td>
           </tr>
           <tr bgcolor="#ffffe6">
-            <td>
+            <td colspan="2">
               <input type="submit" value="Validate Scantron Records" />
             </td>
           </tr>
@@ -3500,13 +3494,36 @@
         <table width="100%" border="0">
           <tr bgcolor="#e6ffff">
             <td>
-              Specify a Scantron data file to upload.
+              &nbsp;<b>Specify a Scantron data file to upload.</b>
             </td>
           </tr>
           <tr bgcolor="#ffffe6">
             <td>
 SCANTRONFORM
-        &scantron_upload_scantron_data($r);
+    my $default_form_data=&defaultFormData(&get_symb_and_url($r,1));
+    my $cdom= $ENV{'course.'.$ENV{'request.course.id'}.'.domain'};
+    my $cnum= $ENV{'course.'.$ENV{'request.course.id'}.'.num'};
+    $r->print(<<UPLOAD);
+              <script type="text/javascript" language="javascript">
+    function checkUpload(formname) {
+	if (formname.upfile.value == "") {
+	    alert("Please use the browse button to select a file from your local directory.");
+	    return false;
+	}
+	formname.submit();
+    }
+              </script>
+
+              <form enctype='multipart/form-data' action='/adm/grades' name='rules' method='post'>
+                $default_form_data
+                <input name='courseid' type='hidden' value='$cnum' />
+                <input name='domainid' type='hidden' value='$cdom' />
+                <input name='command' value='scantronupload_save' type='hidden' />
+                File to upload:<input type="file" name="upfile" size="50" />
+                <br />
+                <input type="button" onClick="javascript:checkUpload(this.form);" value="Upload Scantron Data" />
+              </form>
+UPLOAD
 
         $r->print(<<SCANTRONFORM);
             </td>
@@ -4232,10 +4249,15 @@
     $r->print(&Apache::lonnet::finishuserfileupload($ENV{'form.courseid'},
 						    $ENV{'form.domainid'},
 						    $home,'upfile',$fname));
-    $r->print('<br /><form action="/adm/grades" method="post">'."\n".
-	'<input type="hidden" name="command" value="scantronupload" />'."\n".
-	'<input type="submit" name="submit" value="Do Another Upload" />'."\n".
-	'</form>'."\n");
+    my ($symb,$url)=&get_symb_and_url($r);
+    if ($symb) {
+	$r->print(&show_grading_menu_form(&get_symb_and_url($r)));
+    } else {
+	$r->print('<br /><form action="/adm/grades" method="post">'."\n".
+		  '<input type="hidden" name="command" value="scantronupload" />'."\n".
+		  '<input type="submit" name="submit" value="Do Another Upload" />'."\n".
+		  '</form>'."\n");
+    }
     return '';
 }