[LON-CAPA-cvs] cvs: loncom /homework response.pm rat lonpage.pm

albertel lon-capa-cvs@mail.lon-capa.org
Wed, 29 Jun 2005 19:20:12 -0000


albertel		Wed Jun 29 15:20:12 2005 EDT

  Modified files:              
    /rat	lonpage.pm 
    /loncom/homework	response.pm 
  Log:
  BUG#4185, the submit buttons on .page broke due to the part by part submission change
  
  
Index: rat/lonpage.pm
diff -u rat/lonpage.pm:1.71 rat/lonpage.pm:1.72
--- rat/lonpage.pm:1.71	Wed Jun 29 15:02:14 2005
+++ rat/lonpage.pm	Wed Jun 29 15:20:10 2005
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Page Handler
 #
-# $Id: lonpage.pm,v 1.71 2005/06/29 19:02:14 albertel Exp $
+# $Id: lonpage.pm,v 1.72 2005/06/29 19:20:10 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -244,15 +244,25 @@
 				  $posthash{'latex_type'}=$env{'form.latex_type'};
 				  $posthash{'rndseed'}=$env{'form.rndseed'};
 			      }
-                              if (($env{'form.'.$prefix.'submit'}) 
-                               || ($env{'form.all_submit'})) {
-                               foreach (keys %env) {
-				  if ($_=~/^form.$prefix/) {
-				      my $name=$_;
-                                      $name=~s/^form.$prefix//;
-                                      $posthash{$name}=$env{$_};
-                                  }
-                               }
+			      my $submitted=exists($env{'form.all_submit'});
+			      if (!$submitted) {
+				  foreach my $key (keys(%env)) {
+				      if ($key=~/^form.\Q$prefix\Esubmit_/) {
+					  $submitted=1;last;
+				      }
+				  }
+			      }
+                              if ($submitted) {
+				  foreach my $key (keys(%env)) {
+				      if ($key=~/^form.\Q$prefix\E/) {
+					  my $name=$key;
+					  $name=~s/^form.\Q$prefix\E//;
+					  $posthash{$name}=$env{$key};
+				      }
+				  }
+				  if (exists($env{'form.all_submit'})) {
+				      $posthash{'all_submit'}='yes';
+				  }
 			      }
                               my $output=Apache::lonnet::ssi($src,%posthash);
 			      $output=~s|//(\s*<!--)? BEGIN LON-CAPA Internal.+// END LON-CAPA Internal\s*(-->)?\s||gs;
Index: loncom/homework/response.pm
diff -u loncom/homework/response.pm:1.121 loncom/homework/response.pm:1.122
--- loncom/homework/response.pm:1.121	Fri Jun 17 16:17:02 2005
+++ loncom/homework/response.pm	Wed Jun 29 15:20:10 2005
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # various response type definitons response definition
 #
-# $Id: response.pm,v 1.121 2005/06/17 20:17:02 albertel Exp $
+# $Id: response.pm,v 1.122 2005/06/29 19:20:10 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -739,6 +739,8 @@
     # if the Submit Answer button for this particular part was pressed
     my $partid=$Apache::inputtags::part;
     if (defined($env{'form.submit_'.$partid})) { return 1; }
+    # Submit All button on a .page was pressed
+    if (defined($env{'form.all_submit'})) { return 1; }
     # otherwise no submission occured
     return 0;
 }