Diff for /loncom/homework/edit.pm between versions 1.31 and 1.34

version 1.31, 2002/03/22 14:45:11 version 1.34, 2002/04/26 13:30:08
Line 31 Line 31
 package Apache::edit;   package Apache::edit; 
   
 use strict;  use strict;
 use Apache::lonnet;  use Apache::lonnet();
   use HTML::Entities();
   
 # Global Vars  # Global Vars
 # default list of colors to use in editing  # default list of colors to use in editing
Line 164  sub get_insert_list { Line 165  sub get_insert_list {
     }      }
   }    }
   if (@tagnums) {    if (@tagnums) {
       my %options;
     foreach my $tagnum (@tagnums) {      foreach my $tagnum (@tagnums) {
       $result.='<option value="'.$tagnum.'">'.$Apache::lonxml::insertlist{"$tagnum.description"}."</option>\n";        my $descrip=$Apache::lonxml::insertlist{"$tagnum.description"};
         $options{$descrip} ="<option value=\"$tagnum\">".$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="on"></option>'.$result; }
   }    }
   return $result;    return $result;
Line 301  sub textarea_sizes { Line 305  sub textarea_sizes {
   return ($rows,$cols);    return ($rows,$cols);
 }  }
   
 sub textfield {  sub editline {
     my ($tag,$data,$description,$size)=@_;      my ($tag,$data,$description,$size)=@_;
       $data=&HTML::Entities::encode($data);
     if ($description) { $description="<br />".$description."<br />"; }      if ($description) { $description="<br />".$description."<br />"; }
     my $result = <<"END";      my $result = <<"END";
 $description  $description
Line 320  sub editfield { Line 325  sub editfield {
   if ($cols < $minwidth ) { $cols = $minwidth; }    if ($cols < $minwidth ) { $cols = $minwidth; }
   if ($rows < $minheight) { $rows = $minheight; }    if ($rows < $minheight) { $rows = $minheight; }
   if ($description) { $description="<br />".$description."<br />"; }    if ($description) { $description="<br />".$description."<br />"; }
   return "$description\n&nbsp;&nbsp;&nbsp;<textarea rows=\"$rows\" cols=\"$cols\" name=\"homework_edit_".$Apache::lonxml::curdepth."\">$data</textarea>\n";    return $description."\n".'&nbsp;&nbsp;&nbsp;<textarea rows="'.$rows.
       '" cols="'.$cols.'" name="homework_edit_'.$Apache::lonxml::curdepth.'">'.
         &HTML::Entities::encode($data).'</textarea>'."\n";
 }  }
   
 sub modifiedfield {  sub modifiedfield {
Line 563  search($elementname) : provide a link wh Line 570  search($elementname) : provide a link wh
 searcher (lonsearchcat) and, once a file is selected, place the result in  searcher (lonsearchcat) and, once a file is selected, place the result in
 the form element $elementname.  the form element $elementname.
   
 = item *  =item *
 textfield(tag,data,description,size): Provide a <input type="text" ../> for  editline(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  single-line text entry.  This is to be used for text enclosed by tags, not
 arguements/parameters associated with a tag.  arguements/parameters associated with a tag.
   

Removed from v.1.31  
changed lines
  Added in v.1.34


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>