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

albertel lon-capa-cvs@mail.lon-capa.org
Wed, 10 Sep 2003 21:59:45 -0000


albertel		Wed Sep 10 17:59:45 2003 EDT

  Modified files:              
    /loncom/homework	edit.pm 
  Log:
  - BUG#2164, was resetting back to cs mode
  
  
Index: loncom/homework/edit.pm
diff -u loncom/homework/edit.pm:1.63 loncom/homework/edit.pm:1.64
--- loncom/homework/edit.pm:1.63	Mon Sep  8 17:22:15 2003
+++ loncom/homework/edit.pm	Wed Sep 10 17:59:44 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA 
 # edit mode helpers
 #
-# $Id: edit.pm,v 1.63 2003/09/08 21:22:15 albertel Exp $
+# $Id: edit.pm,v 1.64 2003/09/10 21:59:44 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -568,18 +568,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="'.
@@ -596,18 +599,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\"".