--- loncom/homework/edit.pm 2007/06/19 19:41:52 1.107
+++ loncom/homework/edit.pm 2007/10/03 00:24:48 1.112
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# edit mode helpers
#
-# $Id: edit.pm,v 1.107 2007/06/19 19:41:52 banghart Exp $
+# $Id: edit.pm,v 1.112 2007/10/03 00:24:48 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -597,7 +597,7 @@ sub textarea_sizes {
sub editline {
my ($tag,$data,$description,$size)=@_;
$data=&HTML::Entities::encode($data,'<>&"');
- if ($description) { $description="
".$description."
"; }
+ if ($description) { $description=$description."
"; }
my $change_code = &element_change_detection();
my $result = <<"END";
$description
@@ -619,7 +619,7 @@ sub editfield {
if ($cols > 80) { $cols = 80; }
if ($cols < $minwidth ) { $cols = $minwidth; }
if ($rows < $minheight) { $rows = $minheight; }
- if ($description) { $description="
".$description."
"; }
+ if ($description) { $description=$description."
"; }
if ($usehtmlarea) {
&Apache::lonhtmlcommon::add_htmlareafields('homework_edit_'.
$Apache::lonxml::curdepth);
@@ -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.=' />';
@@ -932,6 +938,8 @@ sub browse {
my $titleelement;
if ($titleid) {
$titleelement=",'$only','','".&escape("$titleid\_$Apache::lonxml::curdepth")."'";
+ } else {
+ $titleelement=",'$only'";
}
my $result = <<"ENDBUTTON";
Select