--- loncom/homework/edit.pm 2001/06/27 18:51:12 1.15 +++ loncom/homework/edit.pm 2001/07/23 22:40:59 1.20 @@ -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 ' @@ -241,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) { @@ -259,6 +272,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 +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\n"; + $found=1; + } else { + $optionlist.="$option\n"; + } + } + $optionlist.="Type in value\n"; + if ($found) { + $result.=$description.' + '.$optionlist.' + '; + } else { + $result.=&text_arg($description,$name,$token,$size); + } + return $result; +} 1; __END__