--- loncom/homework/edit.pm	2001/07/13 16:15:01	1.18
+++ loncom/homework/edit.pm	2001/07/23 22:40:59	1.20
@@ -253,7 +253,8 @@ sub get_new_args {
   my ($token,$parstack,$safeeval,@args)=@_;
   my $rebuild=0;
   foreach my $arg (@args) {
-    my $value=&Apache::lonxml::get_param($arg,$parstack,$safeeval);
+    #just want the string that it was set to
+    my $value=$token->[2]->{$arg};
     my $newvalue=$ENV{"form.$Apache::lonxml::curdepth.$arg"};
     &Apache::lonxml::debug(" for:$arg: cur is :$value: new is :$newvalue:");
     if ($value ne $newvalue) {
@@ -271,7 +272,7 @@ sub rebuild_tag {
   if ($token->[0] eq 'S') {
     $result = '<'.$token->[1];
     while (my ($key,$val)= each(%{$token->[2]})) {
-      $val=~s:^\s|\s$::g;
+      $val=~s:^\s+|\s+$::g;
       $val=~s:"::g; #"
       &Apache::lonxml::debug("setting :$key: to  :$val:");
       $result.=' '.$key.'="'.$val.'"';
@@ -315,5 +316,29 @@ sub select_arg {
   return $result;
 }
 
+sub select_or_text_arg {
+  my ($description,$name,$list,$token,$size) = @_;
+  my $result;
+  my $optionlist="";
+  my $found=0;
+  my $selected=$token->[2]{$name};
+  foreach my $option (@$list) {
+    if ( $selected eq $option ) {
+      $optionlist.="<option selected=\"on\">$option</option>\n";
+      $found=1;
+    } else {
+      $optionlist.="<option>$option</option>\n";
+    }
+  }
+  $optionlist.="<option value=\"TYPEDINVALUE\">Type in value</option>\n";
+  if ($found) {
+    $result.=$description.'<select name="'."$Apache::lonxml::curdepth.$name".'">
+       '.$optionlist.'
+      </select></td></tr><tr><td colspan="3">';
+  } else {
+    $result.=&text_arg($description,$name,$token,$size);
+  }
+  return $result;
+}
 1;
 __END__