--- loncom/homework/edit.pm 2001/06/16 18:35:27 1.11 +++ loncom/homework/edit.pm 2001/06/16 20:33:33 1.12 @@ -44,7 +44,7 @@ sub tag_end { } else { if ($description ne '') { $result.="$description"; } } - $result.="  ".&end_table()."\n"; + $result.="".&end_table()."\n"; } return $result; } @@ -64,7 +64,7 @@ sub start_table { $color = $Apache::edit::colorlist[$Apache::edit::colordepth]; } $Apache::edit::colordepth++; - my $result=""; + my $result="
"; return $result; } @@ -191,5 +191,37 @@ sub insert_startouttext { return "\n\n"; } +# Returns a 1 if the toekn has been modified and you should rebuild the tag +# side-effects, will modify the $token if new values are found +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); + my $newvalue=$ENV{"form.$Apache::lonxml::curdepth.$arg"}; + &Apache::lonxml::debug(" for:$arg: cur is :$value: new is :$newvalue:"); + if ($value ne $newvalue) { + $token->[2]->{$arg}=$newvalue; + $rebuild=1; + } + } + return $rebuild; +} + +sub rebuild_tag { + my ($token) = @_; + my $result; + if ($token->[0] eq 'S') { + $result = '<'.$token->[1]; + while (my ($key,$val)= each(%{$token->[2]})) { + &Apache::lonxml::debug("setting :$key: to :$val:"); + $result.=' '.$key.'="'.$val.'"'; + } + $result.=">"; + } elsif ( $token->[0] eq 'E' ) { + $result = '[1].'>'; + } + return $result; +} 1; __END__