--- loncom/homework/edit.pm	2003/05/13 20:48:12	1.52
+++ loncom/homework/edit.pm	2003/06/30 20:41:35	1.57
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA 
 # edit mode helpers
 #
-# $Id: edit.pm,v 1.52 2003/05/13 20:48:12 albertel Exp $
+# $Id: edit.pm,v 1.57 2003/06/30 20:41:35 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -75,13 +75,7 @@ sub tag_end {
   my ($target,$token,$description) = @_;
   my $result='';
   if ($target eq 'edit') {
-    my $tag=$token->[1];
-    if (!defined($description)) {
-      $result.="</td></tr><tr><td>&lt;/$tag&gt;</td><td colspan=\"2\">&nbsp;</td>";
-    } else {
-      if ($description ne '') { $result.="</td></tr><tr><td>$description</td><td colspan=\"2\">&nbsp;</td>"; }
-    }
-    $result.="</tr>".&end_table()."\n";
+    $result.="</td></tr>".&end_table()."\n";
   }
   return $result;
 }
@@ -310,6 +304,16 @@ sub insert_essayresponse {
 </essayresponse>';
 }
 
+sub insert_imageresponse {
+  return '
+<imageresponse max="1">
+    <foilgroup>
+    </foilgroup>
+    <hintgroup>
+    </hintgroup>
+</imageresponse>';
+}
+
 sub insert_optionresponse {
   return '
 <optionresponse max="10">
@@ -404,9 +408,11 @@ sub textarea_sizes {
   my ($data)=@_;
   my $count=0;
   my $maxlength=-1;
-  foreach (split ("\n", $$data)) { $count++;
-	if (length($_) > $maxlength) { $maxlength = length($_); }
-      }
+  foreach (split ("\n", $$data)) {
+      $count+=int(length($_)/79);
+      $count++;
+      if (length($_) > $maxlength) { $maxlength = length($_); }
+  }
   my $rows = $count;
   my $cols = $maxlength;
   return ($rows,$cols);
@@ -512,7 +518,7 @@ sub text_arg {
   my $arg=$token->[2]{$name};
   $result=$description.'&nbsp;<input name="'.&html_element_name($name).
     '" type="text" value="'.$arg.'" size="'.$size.'" />';
-  return $result;
+  return '<nobr>'.$result.'</nobr>';
 }
 
 sub select_arg {
@@ -534,10 +540,10 @@ sub select_arg {
 	    $optionlist.="<option $value >$option</option>\n";
 	}
     }
-    $result.=$description.'&nbsp;<select name="'.&html_element_name($name).
-        '">
+    $result.='<nobr>'.$description.'&nbsp;<select name="'.
+	&html_element_name($name).'">
        '.$optionlist.'
-      </select>';
+      </select></nobr>';
     return $result;
 }
 
@@ -571,7 +577,7 @@ sub select_or_text_arg {
     } else {
 	$result.=&text_arg($description,$name,$token,$size);
     }
-    return $result;
+    return '<nobr>'.$result.'</nobr>';
 }
 
 #----------------------------------------------------- image coordinates
@@ -645,7 +651,7 @@ sub browse {
                                            $Apache::lonxml::curdepth);
     }
     my $result = <<"ENDBUTTON";
-<a href=\"javascript:openbrowser('$form','$element')\"\>Browse</a>
+<a href=\"javascript:openbrowser('$form','$element')\"\>Select</a>
 ENDBUTTON
     return $result;
 }