--- loncom/homework/edit.pm	2007/06/19 19:41:52	1.107
+++ loncom/homework/edit.pm	2007/09/07 00:39:21	1.110
@@ -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.110 2007/09/07 00:39:21 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -686,11 +686,12 @@ 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};
+	    $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 +933,8 @@ sub browse {
     my $titleelement;
     if ($titleid) {
 	$titleelement=",'$only','','".&escape("$titleid\_$Apache::lonxml::curdepth")."'";
+    } else {
+        $titleelement=",'$only'";
     }
     my $result = <<"ENDBUTTON";
 <a href=\"javascript:openbrowser('$form','$element'$titleelement)\"\>Select</a>