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

albertel lon-capa-cvs@mail.lon-capa.org
Tue, 25 May 2004 05:27:09 -0000


albertel		Tue May 25 01:27:09 2004 EDT

  Modified files:              
    /loncom/homework	grades.pm 
  Log:
  - put in warning screen to double check scantron settings before continuing.
  
  
  
Index: loncom/homework/grades.pm
diff -u loncom/homework/grades.pm:1.202 loncom/homework/grades.pm:1.203
--- loncom/homework/grades.pm:1.202	Fri May 14 17:30:27 2004
+++ loncom/homework/grades.pm	Tue May 25 01:27:09 2004
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # The LON-CAPA Grading handler
 #
-# $Id: grades.pm,v 1.202 2004/05/14 21:30:27 albertel Exp $
+# $Id: grades.pm,v 1.203 2004/05/25 05:27:09 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -3503,7 +3503,7 @@
     <tr>
       <td bgcolor="#777777">
        <form method="post" enctype="multipart/form-data" action="/adm/grades" name="scantron_process">
-       <input type="hidden" name="command" value="scantron_validate" />
+       <input type="hidden" name="command" value="scantron_warning" />
         $default_form_data
         <table width="100%" border="0">
           <tr bgcolor="#e6ffff">
@@ -3925,6 +3925,60 @@
     }
 }
 
+sub scantron_warning_screen {
+    my ($button_text)=@_;
+    my $title=&Apache::lonnet::gettitle($ENV{'form.selectpage'});
+    return (<<STUFF);
+<p>
+<font color="red">Please double check the information
+                 below before clicking on '$button_text'</font>
+</p>
+<table>
+<tr><td><b>Sequence To be Graded:</b></td><td>$title</td></tr>
+<tr><td><b>Data File that will be used:</b></td><td><tt>$ENV{'form.scantron_selectfile'}</tt></td></tr>
+</table>
+</font>
+<br />
+<p> If this information is correct, please click on '$button_text'.</p>
+<p> If something is incorrect, please click the 'Grading Menu' button to start over.</p>
+
+<br />
+STUFF
+}
+
+sub scantron_do_warning {
+    my ($r)=@_;
+    my ($symb,$url)=&get_symb_and_url($r);
+    if (!$symb) {return '';}
+    my $default_form_data=&defaultFormData($symb,$url);
+    $r->print(&scantron_form_start().$default_form_data);
+    my $warning=&scantron_warning_screen('Validate Records');
+    $r->print(<<STUFF);
+$warning
+<input type="submit" name="submit" value="Validate Records" />
+<input type="hidden" name="command" value="scantron_validate" />
+</form>
+STUFF
+    $r->print("<br />".&show_grading_menu_form($symb,$url)."</body></html>");
+    return '';
+}
+
+sub scantron_form_start {
+    my ($max_bubble)=@_;
+    my $result= <<SCANTRONFORM;
+<form method="post" enctype="multipart/form-data" action="/adm/grades" name="scantronupload">
+  <input type="hidden" name="selectpage" value="$ENV{'form.selectpage'}" />
+  <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="$max_bubble'" />
+  <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_options_redo'}" />
+  <input type="hidden" name="scantron_options_ignore" value="$ENV{'form.scantron_options_ignore'}" />
+SCANTRONFORM
+    return $result;
+}
+
 sub scantron_validate_file {
     my ($r) = @_;
     my ($symb,$url)=&get_symb_and_url($r);
@@ -3953,21 +4007,10 @@
 	&scantron_process_corrections($r);
     }
     $r->print("<p>Gathering neccessary info.</p>");$r->rflush();
-    my $max_bubble=&scantron_get_maxbubble($r);
     #get the student pick code ready
     $r->print(&Apache::loncommon::studentbrowser_javascript());
-    my $result= <<SCANTRONFORM;
-<form method="post" enctype="multipart/form-data" action="/adm/grades" name="scantronupload">
-  <input type="hidden" name="selectpage" value="$ENV{'form.selectpage'}" />
-  <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="$max_bubble'" />
-  <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_options_redo'}" />
-  <input type="hidden" name="scantron_options_ignore" value="$ENV{'form.scantron_options_ignore'}" />
-  $default_form_data
-SCANTRONFORM
+    my $max_bubble=&scantron_get_maxbubble($r);
+    my $result=&scantron_form_start($max_bubble).$default_form_data;
     $r->print($result);
     
     my @validate_phases=( 'ID',
@@ -3990,9 +4033,14 @@
 	}
     }
     if (!$stop) {
-	$r->print("Validation process complete.<br />");
-	$r->print('<input type="submit" name="submit" value="Start Grading" />');
-	$r->print('<input type="hidden" name="command" value="scantron_process" />');
+	my $warning=&scantron_warning_screen('Start Grading');
+	$r->print(<<STUFF);
+Validation process complete.<br />
+$warning
+<input type="submit" name="submit" value="Start Grading" />
+<input type="hidden" name="command" value="scantron_process" />
+STUFF
+
     } else {
 	$r->print('<input type="hidden" name="command" value="scantron_validate" />');
 	$r->print("<input type='hidden' name='validatepass' value='".$currentphase."' />");
@@ -4991,8 +5039,8 @@
 	    }
 	} elsif ($command eq 'scantron_selectphase' && $perm{'mgr'}) {
 	    $request->print(&scantron_selectphase($request));
- 	} elsif ($command eq 'scantron_validate' && $perm{'mgr'}) {
- 	    $request->print(&scantron_validate_file($request));
+ 	} elsif ($command eq 'scantron_warning' && $perm{'mgr'}) {
+ 	    $request->print(&scantron_do_warning($request));
 	} elsif ($command eq 'scantron_validate' && $perm{'mgr'}) {
 	    $request->print(&scantron_validate_file($request));
 	} elsif ($command eq 'scantron_process' && $perm{'mgr'}) {