--- loncom/homework/edit.pm 2001/06/27 18:51:12 1.15 +++ loncom/homework/edit.pm 2001/07/18 20:27:22 1.19 @@ -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 ' + '; +} + sub insert_numericalresponse { return ' @@ -180,6 +183,15 @@ sub insert_numericalresponse { '; } +sub insert_stringresponse { + return ' + + + + +'; +} + sub insert_optionresponse { return ' @@ -259,6 +271,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 +315,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.="\n"; + $found=1; + } else { + $optionlist.="\n"; + } + } + $optionlist.="\n"; + if ($found) { + $result.=$description.''; + } else { + $result.=&text_arg($description,$name,$token,$size); + } + return $result; +} 1; __END__