--- loncom/homework/edit.pm	2004/06/03 16:42:02	1.82
+++ loncom/homework/edit.pm	2005/01/05 21:20:13	1.89
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA 
 # edit mode helpers
 #
-# $Id: edit.pm,v 1.82 2004/06/03 16:42:02 www Exp $
+# $Id: edit.pm,v 1.89 2005/01/05 21:20:13 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -68,10 +68,9 @@ sub tag_start {
 #    "</tr><tr><td colspan=\"3\">\n";
 	my @help = Apache::lonxml::helpinfo($token);
 	if ($help[0]) {
-	    $result .= '<td align="right" valign="top">' .
-		Apache::loncommon::help_open_topic(@help) .
-		'</td>';
-	} else { $result .= "<td>&nbsp;</td>"; }
+	    $result .= '</td><td align="right" valign="top">' .
+		Apache::loncommon::help_open_topic(@help);
+	} else { $result .= "</td><td>&nbsp;"; }
 	$result .= &end_row().&start_spanning_row();
     }
     return $result;
@@ -191,7 +190,7 @@ sub get_insert_list {
 		$descrip."</option>\n";
 	}
 	foreach my $option (sort(keys(%options))) {$result.=$options{$option};}
-	if ($result) { $result='<option selected="on"></option>'.$result; }
+	if ($result) { $result='<option selected="selected"></option>'.$result; }
     }
     return $result;
 }
@@ -282,10 +281,16 @@ sub insert_responseparam {
     <responseparam />';
 }
 
+sub insert_parameter {
+    return '
+    <parameter />';
+}
+
 sub insert_formularesponse {
     return '
 <formularesponse answer="" samples="">
-    <textline />
+    <responseparam description="Numerical Tolerance" type="tolerance" default="0.00001" name="tol" />
+    <textline size="25"/>
     <hintgroup>
     <startouttext /><endouttext />
     </hintgroup>
@@ -323,6 +328,8 @@ sub insert_imageresponse {
     return '
 <imageresponse max="1">
     <foilgroup>
+      <foil>
+      </foil>
     </foilgroup>
     <hintgroup>
     <startouttext /><endouttext />
@@ -334,6 +341,9 @@ sub insert_optionresponse {
     return '
 <optionresponse max="10">
     <foilgroup options="">
+      <foil>
+         <startouttext /><endouttext />
+      </foil>
     </foilgroup>
     <hintgroup>
     <startouttext /><endouttext />
@@ -361,6 +371,9 @@ sub insert_radiobuttonresponse {
     return '
 <radiobuttonresponse max="10">
     <foilgroup>
+      <foil>
+         <startouttext /><endouttext />
+      </foil>
     </foilgroup>
     <hintgroup>
     <startouttext /><endouttext />
@@ -382,6 +395,9 @@ sub insert_rankresponse {
     return '
 <rankresponse max="10">
     <foilgroup options="">
+      <foil>
+         <startouttext /><endouttext />
+      </foil>
     </foilgroup>
     <hintgroup>
     <startouttext /><endouttext />
@@ -395,6 +411,9 @@ sub insert_matchresponse {
     <foilgroup options="">
       <itemgroup>
       </itemgroup>
+      <foil>
+         <startouttext /><endouttext />
+      </foil>
     </foilgroup>
     <hintgroup>
     <startouttext /><endouttext />
@@ -487,7 +506,11 @@ sub editfield {
     my ($tag,$data,$description,$minwidth,$minheight,$usehtmlarea)=@_;
 
     my ($rows,$cols)=&textarea_sizes(\$data);
-    $rows+=3; # make room for HTMLarea
+    if (&Apache::lonhtmlcommon::htmlareabrowser() &&
+	!&Apache::lonhtmlcommon::htmlareablocked()) {
+	$rows+=7;      # make room for HTMLarea
+	$minheight+=7; # make room for HTMLarea
+    }
     if ($cols > 80) { $cols = 80; }
     if ($cols < $minwidth ) { $cols = $minwidth; }
     if ($rows < $minheight) { $rows = $minheight; }
@@ -500,7 +523,9 @@ sub editfield {
 	'" cols="'.$cols.'" name="homework_edit_'.
 	$Apache::lonxml::curdepth.'" id="homework_edit_'.
 	$Apache::lonxml::curdepth.'">'.
-	&HTML::Entities::encode($data,'<>&"').'</textarea>'."\n";
+	&HTML::Entities::encode($data,'<>&"').'</textarea>'.
+	($usehtmlarea?&Apache::lonhtmlcommon::spelllink('lonhomework',
+			 'homework_edit_'.$Apache::lonxml::curdepth):'')."\n";
 }
 
 sub modifiedfield {
@@ -601,7 +626,7 @@ sub checked_arg {
 	    &html_element_name($name)."'";
 	foreach my $selected (split(/,/,$allselected)) {
 	    if ( $selected eq $option ) {
-		$result.=" checked='on' ";
+		$result.=" checked='checked' ";
 		last;
 	    }
 	}
@@ -636,7 +661,7 @@ sub select_arg {
 	    $value='value="'.$option.'"';
 	}
 	if ( $selected eq $option ) {
-	    $optionlist.="<option $value selected=\"on\">$text</option>\n";
+	    $optionlist.="<option $value selected=\"selected\">$text</option>\n";
 	} else {
 	    $optionlist.="<option $value >$text</option>\n";
 	}
@@ -665,14 +690,14 @@ sub select_or_text_arg {
 	    $value='value="'.$option.'"';
 	}
 	if ( $selected eq $option ) {
-	    $optionlist.="<option $value selected=\"on\">$text</option>\n";
+	    $optionlist.="<option $value selected=\"selected\">$text</option>\n";
 	    $found=1;
 	} else {
 	    $optionlist.="<option $value>$text</option>\n";
 	}
     }
     $optionlist.="<option value=\"TYPEDINVALUE\"".
- 	((!$found)?' selected="on"':'').
+ 	((!$found)?' selected="selected"':'').
  	">".&mt('Type-in value')."</option>\n";
 #
     my $element=&html_element_name($name);