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

raeburn raeburn at source.lon-capa.org
Sun Aug 11 08:27:15 EDT 2019


raeburn		Sun Aug 11 12:27:15 2019 EDT

  Modified files:              
    /loncom/homework	structuretags.pm response.pm 
    /rat	lonpage.pm 
  Log:
  - Reinstate "Submit all" functionality in multi-part problems in composite page.
  
  
Index: loncom/homework/structuretags.pm
diff -u loncom/homework/structuretags.pm:1.562 loncom/homework/structuretags.pm:1.563
--- loncom/homework/structuretags.pm:1.562	Wed Dec 26 19:40:04 2018
+++ loncom/homework/structuretags.pm	Sun Aug 11 12:27:11 2019
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA 
 # definition of tags that give a structure to a document
 #
-# $Id: structuretags.pm,v 1.562 2018/12/26 19:40:04 raeburn Exp $
+# $Id: structuretags.pm,v 1.563 2019/08/11 12:27:11 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -366,12 +366,12 @@
                 submithandled = 1;
                 \$( "#msg_"+buttonId ).css({"display": "inline","background-color": "#87cefa",
                                            "color": "black","padding": "2px"}) ;
-                if (( \$(this.form).id == "LC_page" ) && (\$('input[name="all_submit"]').length )) {
+                if (( \$(this.form).attr("id") == "LC_page" ) && (\$('input[name="all_submit"]').length )) {
                     if (buttonId != "all_submit") {
                         \$( ".LC_status_"+buttonId ).hide();
-                        if (( "#"+buttonId+"_pressed" ).length) {
-                            \$( "#"+buttonId+"_pressed" ).val( "1" );
-                        }
+                    }
+                    if (( "#"+buttonId+"_pressed" ).length) {
+                        \$( "#"+buttonId+"_pressed" ).val( "1" );
                     }
                 } else {
                     \$( ".LC_status_"+buttonId ).hide();
@@ -384,11 +384,9 @@
                 if (timeout > 0) {
                     setTimeout(function(){
                                        \$( "#msg_"+buttonId ).css({"display": "none"});
-                                       if (( \$(this.form).id == "LC_page" ) && (\$('input[name="all_submit"]').length )) {
-                                           if (buttonId != "all_submit") {
-                                               if (( "#"+buttonId+"_pressed" ).length) {
-                                                   \$( "#"+buttonId+"_pressed" ).val( "" );
-                                               }
+                                       if (( \$(this.form).attr("id") == "LC_page" ) && (\$('input[name="all_submit"]').length )) {
+                                           if (( "#"+buttonId+"_pressed" ).length) {
+                                               \$( "#"+buttonId+"_pressed" ).val( "" );
                                            }
                                        }
                                        \$( ".LC_hwk_submit" ).prop( "disabled", false);
Index: loncom/homework/response.pm
diff -u loncom/homework/response.pm:1.246 loncom/homework/response.pm:1.247
--- loncom/homework/response.pm:1.246	Wed Jun  6 18:39:55 2018
+++ loncom/homework/response.pm	Sun Aug 11 12:27:11 2019
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # various response type definitons response definition
 #
-# $Id: response.pm,v 1.246 2018/06/06 18:39:55 raeburn Exp $
+# $Id: response.pm,v 1.247 2019/08/11 12:27:11 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1312,7 +1312,7 @@
 	return 1;
     }
     # Submit All button on a .page was pressed
-    if (defined($env{'form.all_submit'})) { return 1; }
+    if ($env{'form.all_submit'}) { return 1; }
     # otherwise no submission occurred
     return 0;
 }
Index: rat/lonpage.pm
diff -u rat/lonpage.pm:1.126 rat/lonpage.pm:1.127
--- rat/lonpage.pm:1.126	Wed Feb 28 14:41:47 2018
+++ rat/lonpage.pm	Sun Aug 11 12:27:15 2019
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Page Handler
 #
-# $Id: lonpage.pm,v 1.126 2018/02/28 14:41:47 raeburn Exp $
+# $Id: lonpage.pm,v 1.127 2019/08/11 12:27:15 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -338,23 +338,26 @@
 				  $posthash{'rndseed'}=$env{'form.rndseed'};
                                   $posthash{'answer_output_mode'} = $env{'form.answer_output_mode'};
 			      }
-			      my $submitted=exists($env{'form.all_submit'});
+			      my $submitted=$env{'form.all_submit_pressed'};
 			      if (!$submitted) {
 				  foreach my $key (keys(%env)) {
-				      if ($key=~/^form.\Q$prefix\Esubmit_/) {
-					  $submitted=1;last;
+				      if ($key=~/^\Qform.$prefix\Esubmit_(.+)_pressed$/) {
+                                          if ($env{$key}) {
+                                              $submitted=1;
+                                              last;
+                                          }
 				      }
-				  }
+                                  }
 			      }
                               if ($submitted) {
 				  foreach my $key (keys(%env)) {
-				      if ($key=~/^form.\Q$prefix\E/) {
+				      if ($key=~/^\Qform.$prefix\E/) {
 					  my $name=$key;
-					  $name=~s/^form.\Q$prefix\E//;
+					  $name=~s/^\Qform.$prefix\E//;
 					  $posthash{$name}=$env{$key};
-				      }
+                                      }
 				  }
-				  if (exists($env{'form.all_submit'})) {
+				  if ($env{'form.all_submit_pressed'}) {
 				      $posthash{'all_submit'}='yes';
 				  }
 			      }
@@ -465,8 +468,6 @@
                                   $output=~
                                       s/(\Q<td class="LC_status_\E)(\Qsubmit_\E)([^\"]*)(\s*[^\"]*"\>)/$1$idprefix$2$3$4/g;
                                   if ($nuploads) {
-                                      $output=~
-                                          s/\<(input[^\>]+name=\"\Q$prefix\EHWFILE[^\>]+)\s*id\s*\=\s*[\'\"]*([^\'\"]+)[\'\"]*([^\)]*)\>/\<$1 id="$prefix$2" $3\>/gsi;
                                        ($turninpaths{$prefix},$multiresps{$prefix}) = 
                                            &Apache::loncommon::get_turnedin_filepath($symb,$env{'user.name'},$env{'user.domain'});
                                        if ($turninparent eq '') {
@@ -840,6 +841,8 @@
                           $r->print(
 	                  '<input name="all_submit" value="'.&mt('Submit All').'" type="'.
 			  (($nforms>1)?'submit':'hidden').'"'.$class.' id="all_submit" />'.
+                          '<input type="hidden" name="all_submit_pressed" '.
+                          'id="all_submit_pressed" value="" />'.
                           '<div id="msg_all_submit" style="display:none">'.
                           &mt('Processing your submission ...').'</div></form>');
                       }




More information about the LON-CAPA-cvs mailing list