--- loncom/homework/edit.pm 2007/06/19 20:24:42 1.108 +++ loncom/homework/edit.pm 2007/09/10 23:00:05 1.111 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # edit mode helpers # -# $Id: edit.pm,v 1.108 2007/06/19 20:24:42 banghart Exp $ +# $Id: edit.pm,v 1.111 2007/09/10 23:00:05 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -672,6 +672,10 @@ sub get_new_args { $token->[2]->{$arg}=$newvalue; } $rebuild=1; + # add new attributes to the of the attribute seq + if (!grep { $arg eq $_ } (@{ $token->[3] })) { + push(@{ $token->[3] },$arg); + } } elsif (!defined($newvalue) && defined($value)) { delete($token->[2]->{$arg}); $rebuild=1; @@ -686,11 +690,13 @@ sub rebuild_tag { my $result; 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.'"'; + foreach my $attribute (@{ $token->[3] }) { + my $value = $token->[2]{$attribute}; + next if ($value eq ''); + $value =~s/^\s+|\s+$//g; + $value =~s/\"//g; + &Apache::lonxml::debug("setting :$attribute: to :$value:"); + $result.=' '.$attribute.'="'.$value.'"'; } if ($token->[4] =~ m:/>$:) { $result.=' />';