--- loncom/homework/edit.pm	2001/06/27 18:51:12	1.15
+++ loncom/homework/edit.pm	2001/08/13 21:43:48	1.21
@@ -146,12 +146,10 @@ $optionlist
 }
 
 sub handle_insert {
-  &Apache::lonxml::debug("Er handle insert called");
   if ($ENV{"form.insert_$Apache::lonxml::curdepth"} eq '') { return ''; }
   my $result;
   my $tagnum = $ENV{"form.insert_$Apache::lonxml::curdepth"};
   my $func=$Apache::lonxml::insertlist{"$tagnum.function"};
-  &Apache::lonxml::debug("Looking for :$func:");
   if ($func eq 'default') {
     my $newtag=$Apache::lonxml::insertlist{"$tagnum.tag"};
     my $namespace;
@@ -171,6 +169,11 @@ sub handle_insert {
   return $result;
 }
 
+sub insert_responseparam {
+  return '
+    <responseparam />';
+}
+
 sub insert_numericalresponse {
   return '
 <numericalresponse answer="">
@@ -180,6 +183,15 @@ sub insert_numericalresponse {
 </numericalresponse>';
 }
 
+sub insert_stringresponse {
+  return '
+<stringresponse answer="" type="">
+    <textline />
+    <hintgroup>
+    </hintgroup>
+</stringresponse>';
+}
+
 sub insert_optionresponse {
   return '
 <optionresponse max="10">
@@ -190,6 +202,9 @@ sub insert_optionresponse {
 </optionresponse>';
 }
 
+sub insert_displayduedate { return '<displayduedate />'; }
+sub insert_displaytitle   { return '<displaytitle />'; }
+
 sub editfield {
   my ($tag,$data,$description,$minwidth,$minheight)=@_;
   
@@ -241,7 +256,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) {
@@ -259,6 +275,8 @@ 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:"::g; #"
       &Apache::lonxml::debug("setting :$key: to  :$val:");
       $result.=' '.$key.'="'.$val.'"';
     }
@@ -301,5 +319,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__