[LON-CAPA-cvs] cvs: loncom /homework imageresponse.pm matchresponse.pm optionresponse.pm radiobuttonresponse.pm rankresponse.pm

albertel lon-capa-cvs@mail.lon-capa.org
Mon, 10 Jan 2005 19:21:58 -0000


albertel		Mon Jan 10 14:21:58 2005 EDT

  Modified files:              
    /loncom/homework	imageresponse.pm matchresponse.pm 
                    	optionresponse.pm radiobuttonresponse.pm 
                    	rankresponse.pm 
  Log:
  - BUG#3757, <foil>s without names throw errors
  
  
Index: loncom/homework/imageresponse.pm
diff -u loncom/homework/imageresponse.pm:1.58 loncom/homework/imageresponse.pm:1.59
--- loncom/homework/imageresponse.pm:1.58	Tue Dec  7 20:00:41 2004
+++ loncom/homework/imageresponse.pm	Mon Jan 10 14:21:57 2005
@@ -2,7 +2,7 @@
 # The LearningOnline Network with CAPA
 # image click response style
 #
-# $Id: imageresponse.pm,v 1.58 2004/12/08 01:00:41 albertel Exp $
+# $Id: imageresponse.pm,v 1.59 2005/01/10 19:21:57 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -340,7 +340,10 @@
     if ($target eq 'web' || $target eq 'grade' || $target eq 'tex' ||
 	$target eq 'analyze') {
 	my $name = &Apache::lonxml::get_param('name',$parstack,$safeeval);
-	if ($name eq '') { $name=$Apache::lonxml::curdepth; }
+	if (!$name) {
+	    &Apache::lonxml::error("Foils without names exist. This can cause problems to malfunction.");
+	    $name=$Apache::lonxml::curdepth;
+	}
 	if (defined($Apache::response::foilnames{$name})) {
 	    &Apache::lonxml::error(&mt("Foil name <b><tt>[_1]</tt></b> appears more than once. Foil names need to be unique.",$name));
 	}
Index: loncom/homework/matchresponse.pm
diff -u loncom/homework/matchresponse.pm:1.48 loncom/homework/matchresponse.pm:1.49
--- loncom/homework/matchresponse.pm:1.48	Fri Dec  3 19:41:26 2004
+++ loncom/homework/matchresponse.pm	Mon Jan 10 14:21:57 2005
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Full matching style response
 #
-# $Id: matchresponse.pm,v 1.48 2004/12/04 00:41:26 albertel Exp $
+# $Id: matchresponse.pm,v 1.49 2005/01/10 19:21:57 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -646,7 +646,10 @@
 	if ($value ne 'unused') {
 	    my $name = &Apache::lonxml::get_param('name',$parstack,$safeeval);
 	    &Apache::lonxml::debug("Got a name of :$name:");
-	    if (!$name) { $name=$Apache::lonxml::curdepth; }
+	    if (!$name) {
+		&Apache::lonxml::error("Foils without names exist. This can cause problems to malfunction.");
+		$name=$Apache::lonxml::curdepth;
+	    }
 	    &Apache::lonxml::debug("Using a name of :$name:");
 	    if (defined($Apache::response::foilnames{$name})) {
 		&Apache::lonxml::error(&mt("Foil name <b><tt>[_1]</tt></b> appears more than once. Foil names need to be unique.",$name));
Index: loncom/homework/optionresponse.pm
diff -u loncom/homework/optionresponse.pm:1.122 loncom/homework/optionresponse.pm:1.123
--- loncom/homework/optionresponse.pm:1.122	Fri Dec  3 19:41:26 2004
+++ loncom/homework/optionresponse.pm	Mon Jan 10 14:21:57 2005
@@ -1,7 +1,7 @@
 # LearningOnline Network with CAPA
 # option list style responses
 #
-# $Id: optionresponse.pm,v 1.122 2004/12/04 00:41:26 albertel Exp $
+# $Id: optionresponse.pm,v 1.123 2005/01/10 19:21:57 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -629,7 +629,10 @@
     if ($value ne 'unused') {
       my $name = &Apache::lonxml::get_param('name',$parstack,$safeeval);
       &Apache::lonxml::debug("Got a name of :$name:");
-      if (!$name) { $name=$Apache::lonxml::curdepth; }
+      if (!$name) {
+	  &Apache::lonxml::error("Foils without names exist. This can cause problems to malfunction.");
+	  $name=$Apache::lonxml::curdepth;
+      }
       &Apache::lonxml::debug("Using a name of :$name:");
       if (defined($Apache::response::foilnames{$name})) {
 	  &Apache::lonxml::error(&mt("Foil name <b><tt>[_1]</tt></b> appears more than once. Foil names need to be unique.",$name));
Index: loncom/homework/radiobuttonresponse.pm
diff -u loncom/homework/radiobuttonresponse.pm:1.97 loncom/homework/radiobuttonresponse.pm:1.98
--- loncom/homework/radiobuttonresponse.pm:1.97	Thu Dec 23 12:08:22 2004
+++ loncom/homework/radiobuttonresponse.pm	Mon Jan 10 14:21:57 2005
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # mutliple choice style responses
 #
-# $Id: radiobuttonresponse.pm,v 1.97 2004/12/23 17:08:22 albertel Exp $
+# $Id: radiobuttonresponse.pm,v 1.98 2005/01/10 19:21:57 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -606,7 +606,10 @@
 	my $value = &Apache::lonxml::get_param('value',$parstack,$safeeval);
 	if ($value ne 'unused') {
 	    my $name = &Apache::lonxml::get_param('name',$parstack,$safeeval);
-	    if (!$name) { $name=$Apache::lonxml::curdepth; }
+	    if (!$name) {
+		&Apache::lonxml::error("Foils without names exist. This can cause problems to malfunction.");
+		$name=$Apache::lonxml::curdepth;
+	    }
 	    if (defined($Apache::response::foilnames{$name})) {
 		&Apache::lonxml::error(&mt("Foil name <b><tt>[_1]</tt></b> appears more than once. Foil names need to be unique.",$name));
 	    }
Index: loncom/homework/rankresponse.pm
diff -u loncom/homework/rankresponse.pm:1.42 loncom/homework/rankresponse.pm:1.43
--- loncom/homework/rankresponse.pm:1.42	Fri Dec  3 19:41:26 2004
+++ loncom/homework/rankresponse.pm	Mon Jan 10 14:21:57 2005
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # rank style response
 #
-# $Id: rankresponse.pm,v 1.42 2004/12/04 00:41:26 albertel Exp $
+# $Id: rankresponse.pm,v 1.43 2005/01/10 19:21:57 albertel Exp $
 # Copyright Michigan State University Board of Trustees
 #
 # This file is part of the LearningOnline Network with CAPA (LON-CAPA).
@@ -425,7 +425,10 @@
 	if ($value ne 'unused') {
 	    my $name = &Apache::lonxml::get_param('name',$parstack,$safeeval);
 	    &Apache::lonxml::debug("Got a name of :$name:");
-	    if (!$name) { $name=$Apache::lonxml::curdepth; }
+	    if (!$name) {
+		&Apache::lonxml::error("Foils without names exist. This can cause problems to malfunction.");
+		$name=$Apache::lonxml::curdepth;
+	    }
 	    &Apache::lonxml::debug("Using a name of :$name:");
 	    if (defined($Apache::response::foilnames{$name})) {
 		&Apache::lonxml::error(&mt("Foil name <b><tt>[_1]</tt></b> appears more than once. Foil names need to be unique.",$name));