[LON-CAPA-cvs] cvs: loncom /homework edit.pm

matthew lon-capa-cvs@mail.lon-capa.org
Fri, 22 Mar 2002 14:45:11 -0000


matthew		Fri Mar 22 09:45:11 2002 EDT

  Modified files:              
    /loncom/homework	edit.pm 
  Log:
  Added textfield() as an alternative to editfield().  textfield serves up an
  <input type="text" .. /> form instead of a <textarea> form.  This means we
  can limit the user to a single line of text within a <tag> </tag> pair.
  
  
Index: loncom/homework/edit.pm
diff -u loncom/homework/edit.pm:1.30 loncom/homework/edit.pm:1.31
--- loncom/homework/edit.pm:1.30	Fri Mar  8 13:30:33 2002
+++ loncom/homework/edit.pm	Fri Mar 22 09:45:11 2002
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA 
 # edit mode helpers
 #
-# $Id: edit.pm,v 1.30 2002/03/08 18:30:33 matthew Exp $
+# $Id: edit.pm,v 1.31 2002/03/22 14:45:11 matthew Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -301,6 +301,17 @@
   return ($rows,$cols);
 }
 
+sub textfield {
+    my ($tag,$data,$description,$size)=@_;
+    if ($description) { $description="<br />".$description."<br />"; }
+    my $result = <<"END";
+$description
+<input type="text" name="homework_edit_$Apache::lonxml::curdepth" 
+       value="$data" size="$size" />
+END
+    return $result;
+}
+
 sub editfield {
   my ($tag,$data,$description,$minwidth,$minheight)=@_;
 
@@ -551,6 +562,11 @@
 search($elementname) : provide a link which will open up the filesystem
 searcher (lonsearchcat) and, once a file is selected, place the result in
 the form element $elementname.
+
+= item *
+textfield(tag,data,description,size): Provide a <input type="text" ../> for
+single-line text entry.  This is to be used for text enclosed by tags, not
+arguements/parameters associated with a tag.
 
 =back