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

albertel lon-capa-cvs@mail.lon-capa.org
Sat, 24 Apr 2004 09:01:53 -0000


albertel		Sat Apr 24 05:01:53 2004 EDT

  Modified files:              
    /loncom/interface	lonpickcode.pm 
    /loncom/homework	grades.pm 
  Log:
  - fixup some form element names
  - preserve new form parameters between screens
  - gets the selected value from the correct field on the screen
  (Correctioning works for all cases except when forcing through a dupicated ID)
  
  
Index: loncom/interface/lonpickcode.pm
diff -u loncom/interface/lonpickcode.pm:1.2 loncom/interface/lonpickcode.pm:1.3
--- loncom/interface/lonpickcode.pm:1.2	Sat Apr 24 04:31:57 2004
+++ loncom/interface/lonpickcode.pm	Sat Apr 24 05:01:52 2004
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Pick a CODE from the list of possible CODEs
 #
-# $Id: lonpickcode.pm,v 1.2 2004/04/24 08:31:57 albertel Exp $
+# $Id: lonpickcode.pm,v 1.3 2004/04/24 09:01:52 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -104,8 +104,8 @@
     $r->print(<<ENDSCRIPT);
 <script>
 function gochoose(newcode) {
-    opener.document.$ENV{'form.form'}.scan_CODE_selectedvalue.value=newcode;
-    var slct=opener.document.$ENV{'form.form'}.scan_CODE_resolution;
+    opener.document.$ENV{'form.form'}.scantron_CODE_selectedvalue.value=newcode;
+    var slct=opener.document.$ENV{'form.form'}.scantron_CODE_resolution;
     var i;
     for (i=0;i<slct.length;i++) {
         if (slct[i].value=='use_found') { slct[i].checked=true; }
Index: loncom/homework/grades.pm
diff -u loncom/homework/grades.pm:1.189 loncom/homework/grades.pm:1.190
--- loncom/homework/grades.pm:1.189	Sat Apr 24 04:35:10 2004
+++ loncom/homework/grades.pm	Sat Apr 24 05:01:52 2004
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # The LON-CAPA Grading handler
 #
-# $Id: grades.pm,v 1.189 2004/04/24 08:35:10 albertel Exp $
+# $Id: grades.pm,v 1.190 2004/04/24 09:01:52 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -3521,8 +3521,8 @@
           <tr bgcolor="#ffffe6">
 	    <td> Options: </td>
             <td>
-                <input type="checkbox" name="scantron_options" value="redo_skipped"/> Redo skipped records <br />
-                <input type="checkbox" name="scantron_options" value="ignore_corrections"/> Ignore Original Corrections
+                <input type="checkbox" name="scantron_options_redo" value="redo_skipped"/> Redo skipped records <br />
+                <input type="checkbox" name="scantron_options_ignore" value="ignore_corrections"/> Ignore Original Corrections
 	    </td>
           </tr>
           <tr bgcolor="#ffffe6">
@@ -3836,7 +3836,15 @@
 				    'username'=>$ENV{'form.scantron_username'},
 				    'domain'=>$ENV{'form.scantron_domain'}});
     } elsif ($ENV{'form.scantron_corrections'} =~ /^(duplicate|incorrect)CODE$/) {
-	my $newCODE=$ENV{'form.scantron_CODE'};
+	my $resolution=$ENV{'form.scantron_CODE_resolution'};
+	my $newCODE;
+	if      ($resolution eq 'use_unfound') {
+	    &FIXME_blow_up();
+	} elsif ($resolution eq 'use_found') {
+	    $newCODE=$ENV{'form.scantron_CODE_selectedvalue'};
+	} elsif ($resolution eq 'use_typed') {
+	    $newCODE=$ENV{'form.scantron_CODE_newvalue'};
+	}
 	($line,$err,$errmsg)=
 	    &scantron_fixup_scanline(\%scantron_config,$scan_data,$line,$which,
 				     'CODE',{'CODE'=>$newCODE});
@@ -3876,6 +3884,10 @@
   <input type="hidden" name="scantron_format" value="$ENV{'form.scantron_format'}" />
   <input type="hidden" name="scantron_selectfile" value="$ENV{'form.scantron_selectfile'}" />
   <input type="hidden" name="scantron_maxbubble" value="$ENV{'form.scantron_maxbubble'}" />
+  <input type="hidden" name="scantron_CODElist" value="$ENV{'form.scantron_CODElist'}" />
+  <input type="hidden" name="scantron_CODEunique" value="$ENV{'form.scantron_CODEunique'}" />
+  <input type="hidden" name="scantron_options_redo" value="$ENV{'form.scantron_optiond_redo'}" />
+  <input type="hidden" name="scantron_options_ignore" value="$ENV{'form.scantron_optiond_ignore'}" />
   $default_form_data
 SCANTRONFORM
     $r->print($result);
@@ -4116,12 +4128,12 @@
 		  $$scan_record{'scantron.FirstName'}."</p>");
 	$r->print("<p>How should I handle this? <br /> \n");
 	$r->print("\n<br /> ");
-	$r->print("<input type='radio' name='scan_CODE_resolution' value='use_unfound' checked='on' /> Use the CODE <b><tt>".$$scan_record{'scantron.CODE'}."</tt></b> that is was on the paper, ignoring the error.");
+	$r->print("<input type='radio' name='scantron_CODE_resolution' value='use_unfound' checked='on' /> Use the CODE <b><tt>".$$scan_record{'scantron.CODE'}."</tt></b> that is was on the paper, ignoring the error.");
 	$r->print("\n<br />");
 	$r->print(<<ENDSCRIPT);
 <script type="text/javascript">
 function change_radio(field) {
-    var slct=document.scantronupload.scan_CODE_resolution;
+    var slct=document.scantronupload.scantron_CODE_resolution;
     var i;
     for (i=0;i<slct.length;i++) {
         if (slct[i].value==field) { slct[i].checked=true; }
@@ -4135,9 +4147,9 @@
 	   "&scantron_CODElist=".&Apache::lonnet::escape($ENV{'form.scantron_CODElist'}).
 	   "&curCODE=".&Apache::lonnet::escape($$scan_record{'scantron.CODE'}).
 	   "&scantron_selectfile=".&Apache::lonnet::escape($ENV{'form.scantron_selectfile'});
-	$r->print("<input type='radio' name='scan_CODE_resolution' value='use_found' /> <a target='_blank' href='$href'>Select</a> a CODE from the list of all CODEs and use it. Selected CODE is <input readonly='true' type='text' size='8' name='scan_CODE_selectedvalue' onfocus=\"javascript:change_radio('use_found')\" onchange=\"javascript:change_radio('use_found')\" />");
+	$r->print("<input type='radio' name='scantron_CODE_resolution' value='use_found' /> <a target='_blank' href='$href'>Select</a> a CODE from the list of all CODEs and use it. Selected CODE is <input readonly='true' type='text' size='8' name='scantron_CODE_selectedvalue' onfocus=\"javascript:change_radio('use_found')\" onchange=\"javascript:change_radio('use_found')\" />");
 	$r->print("\n<br />");
-	$r->print("<input type='radio' name='scan_CODE_resolution' value='use_typed' /> Use <input type='text' size='8' name='scan_CODE_newvalue' onfocus=\"javascript:change_radio('use_typed')\" onkeypress=\"javascript:change_radio('use_typed')\" /> as the CODE.");
+	$r->print("<input type='radio' name='scantron_CODE_resolution' value='use_typed' /> Use <input type='text' size='8' name='scantron_CODE_newvalue' onfocus=\"javascript:change_radio('use_typed')\" onkeypress=\"javascript:change_radio('use_typed')\" /> as the CODE.");
 	$r->print("\n<br /><br />");
     } elsif ($error eq 'doublebubble') {
 #FIXME Need to print out who this is along with the paper info
@@ -4198,7 +4210,6 @@
 	    &FIXME_blow_up()
 	}
     } else {
-	&Apache::lonnet::logthis(" CODE stuf $scantron_config{'CODElocation'}:$scantron_config{'CODEstart'}:$scantron_config{'CODElength'}");
 	return (0,$currentphase+1);
     }