[LON-CAPA-cvs] cvs: loncom(version_1_0_2) /homework edit.pm

albertel lon-capa-cvs@mail.lon-capa.org
Wed, 10 Sep 2003 22:03:40 -0000


albertel		Wed Sep 10 18:03:40 2003 EDT

  Modified files:              (Branch: version_1_0_2)
    /loncom/homework	edit.pm 
  Log:
  - backport 1.64
  
  
Index: loncom/homework/edit.pm
diff -u loncom/homework/edit.pm:1.57 loncom/homework/edit.pm:1.57.2.1
--- loncom/homework/edit.pm:1.57	Mon Jun 30 16:41:35 2003
+++ loncom/homework/edit.pm	Wed Sep 10 18:03:40 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA 
 # edit mode helpers
 #
-# $Id: edit.pm,v 1.57 2003/06/30 20:41:35 albertel Exp $
+# $Id: edit.pm,v 1.57.2.1 2003/09/10 22:03:40 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -526,18 +526,21 @@
     my $result;
     my $optionlist="";
     my $selected=$token->[2]{$name};
+    &Apache::lonxml::error("Wha $selected");
     foreach my $option (@$list) {
-	my $value;
+	my ($text,$value);
 	if ( ref($option) eq 'ARRAY') {
 	    $value='value="'.$$option[0].'"';
-	    $option=$$option[1];
+	    $text=$$option[1];
+	    $option=$$option[0];
 	} else {
+	    $text=$option;
 	    $value='value="'.$option.'"';
 	}
 	if ( $selected eq $option ) {
-	    $optionlist.="<option $value selected=\"on\">$option</option>\n";
+	    $optionlist.="<option $value selected=\"on\">$text</option>\n";
 	} else {
-	    $optionlist.="<option $value >$option</option>\n";
+	    $optionlist.="<option $value >$text</option>\n";
 	}
     }
     $result.='<nobr>'.$description.'&nbsp;<select name="'.
@@ -554,18 +557,20 @@
     my $found=0;
     my $selected=$token->[2]{$name};
     foreach my $option (@$list) {
-	my $value;
+	my ($text,$value);
 	if ( ref($option) eq 'ARRAY') {
 	    $value='value="'.$$option[0].'"';
-	    $option=$$option[1];
+	    $text=$$option[1];
+	    $option=$$option[0];
 	} else {
+	    $text=$option;
 	    $value='value="'.$option.'"';
 	}
 	if ( $selected eq $option ) {
-	    $optionlist.="<option $value selected=\"on\">$option</option>\n";
+	    $optionlist.="<option $value selected=\"on\">$text</option>\n";
 	    $found=1;
 	} else {
-	    $optionlist.="<option $value>$option</option>\n";
+	    $optionlist.="<option $value>$text</option>\n";
 	}
     }
     $optionlist.="<option value=\"TYPEDINVALUE\">Type in value</option>\n";