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

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


albertel		Mon Feb  9 17:16:32 2004 EDT

  Modified files:              
    /loncom/homework	grades.pm 
  Log:
  - fixes BUG#2715, silly error printed when using scantron mode
  
  
Index: loncom/homework/grades.pm
diff -u loncom/homework/grades.pm:1.172 loncom/homework/grades.pm:1.173
--- loncom/homework/grades.pm:1.172	Mon Feb  9 16:13:50 2004
+++ loncom/homework/grades.pm	Mon Feb  9 17:16:32 2004
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # The LON-CAPA Grading handler
 #
-# $Id: grades.pm,v 1.172 2004/02/09 21:13:50 albertel Exp $
+# $Id: grades.pm,v 1.173 2004/02/09 22:16:32 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -89,10 +89,15 @@
 
 # --- Get the symbolic name of a problem and the url
 sub get_symb_and_url {
-    my ($request) = @_;
+    my ($request,$silent) = @_;
     (my $url=$ENV{'form.url'}) =~ s-^http://($ENV{'SERVER_NAME'}|$ENV{'HTTP_HOST'})--;
     my $symb=($ENV{'form.symb'} ne '' ? $ENV{'form.symb'} : (&Apache::lonnet::symbread($url)));
-    if ($symb eq '') { $request->print("Unable to handle ambiguous references:$url:."); return ''; }
+    if ($symb eq '') { 
+	if (!$silent) {
+	    $request->print("Unable to handle ambiguous references:$url:.");
+	    return ();
+	}
+    }
     return ($symb,$url);
 }
 
@@ -4171,7 +4176,7 @@
 							  'domainid');
     my $domsel=&Apache::loncommon::select_dom_form($ENV{'request.role.domain'},
 						   'domainid');
-    my $default_form_data=&defaultFormData(&get_symb_and_url($r));
+    my $default_form_data=&defaultFormData(&get_symb_and_url($r,1));
     $r->print(<<UPLOAD);
 <script type="text/javascript" language="javascript">
     function checkUpload(formname) {
@@ -4227,7 +4232,10 @@
     $r->print(&Apache::lonnet::finishuserfileupload($ENV{'form.courseid'},
 						    $ENV{'form.domainid'},
 						    $home,'upfile',$fname));
-    $r->print(&show_grading_menu_form(&get_symb_and_url($r)));
+    $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 '';
 }