--- loncom/homework/edit.pm 2003/09/08 21:22:15 1.63 +++ loncom/homework/edit.pm 2003/10/30 20:52:54 1.70 @@ -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.70 2003/10/30 20:52:54 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -67,7 +67,7 @@ sub tag_start { #". # &movebuttons($target,$token). # "\n"; - my @help;# = Apache::lonxml::helpinfo($token); + my @help = Apache::lonxml::helpinfo($token); if ($help[0]) { $result .= '' . Apache::loncommon::help_open_topic(@help) . @@ -273,6 +273,11 @@ sub handle_insertafter { return $result; } +sub insert_img { + return ' + '; +} + sub insert_responseparam { return ' '; @@ -283,6 +288,8 @@ sub insert_formularesponse { + + '; } @@ -292,6 +299,8 @@ sub insert_numericalresponse { + + '; } @@ -301,6 +310,8 @@ sub insert_stringresponse { + + '; } @@ -318,6 +329,8 @@ sub insert_imageresponse { + + '; } @@ -328,6 +341,8 @@ sub insert_optionresponse { + + '; } @@ -338,6 +353,8 @@ sub insert_radiobuttonresponse { + + '; } @@ -348,6 +365,8 @@ sub insert_rankresponse { + + '; } @@ -360,6 +379,8 @@ sub insert_matchresponse { + + '; } @@ -374,6 +395,14 @@ sub insert_hintpart { '; } +sub insert_hintgroup { + return ' + + + +'; +} + sub insert_numericalhint { return ' @@ -453,7 +482,7 @@ sub editfield { } sub modifiedfield { - my ($token) = @_; + my ($endtag,$parser) = @_; my $result; # foreach my $envkey (sort keys %ENV) { # &Apache::lonxml::debug("$envkey ---- $ENV{$envkey}"); @@ -461,6 +490,9 @@ sub modifiedfield { # &Apache::lonxml::debug("I want homework_edit_$Apache::lonxml::curdepth"); # &Apache::lonxml::debug($ENV{"form.homework_edit_$Apache::lonxml::curdepth"}); $result=$ENV{"form.homework_edit_$Apache::lonxml::curdepth"}; + my $bodytext=&Apache::lonxml::get_all_text($endtag,$parser); + # textareas throw away intial \n + if ($bodytext=~/^\n/) { $result="\n".$result; } return $result; } @@ -569,17 +601,19 @@ sub select_arg { my $optionlist=""; 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.="\n"; + $optionlist.="\n"; } else { - $optionlist.="\n"; + $optionlist.="\n"; } } $result.=''.$description.'