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

raeburn raeburn at source.lon-capa.org
Wed Jul 27 22:53:38 EDT 2011


raeburn		Thu Jul 28 02:53:38 2011 EDT

  Modified files:              
    /rat	lonpage.pm 
    /loncom/homework	structuretags.pm 
  Log:
  - Eliminate javascript error when submit pressed in .page.
  
  
Index: rat/lonpage.pm
diff -u rat/lonpage.pm:1.94 rat/lonpage.pm:1.95
--- rat/lonpage.pm:1.94	Tue Jul 13 00:16:23 2010
+++ rat/lonpage.pm	Thu Jul 28 02:53:33 2011
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Page Handler
 #
-# $Id: lonpage.pm,v 1.94 2010/07/13 00:16:23 raeburn Exp $
+# $Id: lonpage.pm,v 1.95 2011/07/28 02:53:33 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -354,6 +354,8 @@
                                   $output=~s/\<\/form[^\>]*\>//gsi;
                                   $output=~
 				      s/\<((?:input|select|button|textarea)[^\>]+)name\s*\=\s*[\'\"]*([^\'\"]+)[\'\"]*([^\>]*)\>/\<$1 name="$prefix$2" $3\>/gsi;
+                                  $output=~
+                                      s/\<((?:input|select)[^\>]+\Qjavascript:setSubmittedPart\E)\(\s*[\'\"]([^\'\"]+)[\'\"]*\s*\)/\<$1('$2','$prefix')/gsi;
                               }
                               $thisdir=~s/\/[^\/]*$//;
 			      foreach (@rlinks) {
Index: loncom/homework/structuretags.pm
diff -u loncom/homework/structuretags.pm:1.493 loncom/homework/structuretags.pm:1.494
--- loncom/homework/structuretags.pm:1.493	Tue Jul 26 17:14:51 2011
+++ loncom/homework/structuretags.pm	Thu Jul 28 02:53:38 2011
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA 
 # definition of tags that give a structure to a document
 #
-# $Id: structuretags.pm,v 1.493 2011/07/26 17:14:51 raeburn Exp $
+# $Id: structuretags.pm,v 1.494 2011/07/28 02:53:38 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -129,8 +129,16 @@
 	<<'JS';
 <script type="text/javascript">
 // <![CDATA[
-function setSubmittedPart (part) {
-   this.document.lonhomework.submitted.value="part_"+part;
+function setSubmittedPart (part,prefix) {
+    if (typeof(prefix) == 'undefined') {
+        this.document.lonhomework.submitted.value="part_"+part;
+    } else {
+        for (var i=0;i<this.document.lonhomework.elements.length;i++) {
+            if (this.document.lonhomework.elements[i].name == prefix+'submitted') {
+                this.document.lonhomework.elements[i].value="part_"+part;
+            }
+        }
+    }
 }
 
 function image_response_click (which, e) {




More information about the LON-CAPA-cvs mailing list