[LON-CAPA-cvs] cvs: loncom /homework inputtags.pm response.pm /localize/localize newphrases.txt

albertel lon-capa-cvs@mail.lon-capa.org
Fri, 27 Feb 2004 17:18:32 -0000


albertel		Fri Feb 27 12:18:32 2004 EDT

  Modified files:              
    /loncom/homework	inputtags.pm response.pm 
    /loncom/localize/localize	newphrases.txt 
  Log:
  - BUG#2340, throw errors on problems that are like
  <problem>
  
  <numericalresponse></numericalresponse>
  
  <part id="14">
  <numericalresponse></numericalresponse>
  </part>
  
  </problem>
  
  
Index: loncom/homework/inputtags.pm
diff -u loncom/homework/inputtags.pm:1.132 loncom/homework/inputtags.pm:1.133
--- loncom/homework/inputtags.pm:1.132	Tue Feb 24 18:22:24 2004
+++ loncom/homework/inputtags.pm	Fri Feb 27 12:18:32 2004
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # input  definitons
 #
-# $Id: inputtags.pm,v 1.132 2004/02/24 23:22:24 albertel Exp $
+# $Id: inputtags.pm,v 1.133 2004/02/27 17:18:32 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -62,6 +62,8 @@
   @Apache::inputtags::import=();
   # list of all import ids seen
   @Apache::inputtags::importlist=();
+  # just used to note whether we have seen a response that isn't in a part
+  $Apache::inputtags::response_with_no_part=0;
 }
 
 sub check_for_duplicate_ids {
Index: loncom/homework/response.pm
diff -u loncom/homework/response.pm:1.91 loncom/homework/response.pm:1.92
--- loncom/homework/response.pm:1.91	Mon Feb 16 15:09:51 2004
+++ loncom/homework/response.pm	Fri Feb 27 12:18:32 2004
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # various response type definitons response definition
 #
-# $Id: response.pm,v 1.91 2004/02/16 20:09:51 albertel Exp $
+# $Id: response.pm,v 1.92 2004/02/27 17:18:32 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -45,6 +45,16 @@
     push (@Apache::inputtags::response,$id);
     push (@Apache::inputtags::responselist,$id);
     @Apache::inputtags::inputlist=();
+    if ($Apache::inputtags::part eq '') {
+	&Apache::lonxml::error(&HTML::Entities::encode(&mt("Found a <*response> outside of a <part> in a <part>ed problem")));
+    }
+    if ($Apache::inputtags::response_with_no_part &&
+	$Apache::inputtags::part ne '0') {
+	&Apache::lonxml::error(&HTML::Entities::encode(&mt("<*response>s are both inside of <part> and outside of <part>, this is not a valid problem, errors in grading may occur.")).'<br />');
+    }
+    if ($Apache::inputtags::part eq '0') {
+	$Apache::inputtags::response_with_no_part=1;
+    }
     return $id;
 }
 
Index: loncom/localize/localize/newphrases.txt
diff -u loncom/localize/localize/newphrases.txt:1.36 loncom/localize/localize/newphrases.txt:1.37
--- loncom/localize/localize/newphrases.txt:1.36	Fri Feb 27 10:12:48 2004
+++ loncom/localize/localize/newphrases.txt	Fri Feb 27 12:18:32 2004
@@ -59,3 +59,5 @@
 Output Format: [_1]
 # [_1] is a drop-down selection box
 Student Status: [_1]
+Found a <*response> outside of a <part> in a <part>ed problem
+<*response>s are both inside of <part> and outside of <part>, this is not a valid problem, errors in grading may occur.