Diff for /loncom/homework/edit.pm between versions 1.15 and 1.19

version 1.15, 2001/06/27 18:51:12 version 1.19, 2001/07/18 20:27:22
Line 146  $optionlist Line 146  $optionlist
 }  }
   
 sub handle_insert {  sub handle_insert {
   &Apache::lonxml::debug("Er handle insert called");  
   if ($ENV{"form.insert_$Apache::lonxml::curdepth"} eq '') { return ''; }    if ($ENV{"form.insert_$Apache::lonxml::curdepth"} eq '') { return ''; }
   my $result;    my $result;
   my $tagnum = $ENV{"form.insert_$Apache::lonxml::curdepth"};    my $tagnum = $ENV{"form.insert_$Apache::lonxml::curdepth"};
   my $func=$Apache::lonxml::insertlist{"$tagnum.function"};    my $func=$Apache::lonxml::insertlist{"$tagnum.function"};
   &Apache::lonxml::debug("Looking for :$func:");  
   if ($func eq 'default') {    if ($func eq 'default') {
     my $newtag=$Apache::lonxml::insertlist{"$tagnum.tag"};      my $newtag=$Apache::lonxml::insertlist{"$tagnum.tag"};
     my $namespace;      my $namespace;
Line 171  sub handle_insert { Line 169  sub handle_insert {
   return $result;    return $result;
 }  }
   
   sub insert_responseparam {
     return '
       <responseparam />';
   }
   
 sub insert_numericalresponse {  sub insert_numericalresponse {
   return '    return '
 <numericalresponse answer="">  <numericalresponse answer="">
Line 180  sub insert_numericalresponse { Line 183  sub insert_numericalresponse {
 </numericalresponse>';  </numericalresponse>';
 }  }
   
   sub insert_stringresponse {
     return '
   <stringresponse answer="" type="">
       <textline />
       <hintgroup>
       </hintgroup>
   </stringresponse>';
   }
   
 sub insert_optionresponse {  sub insert_optionresponse {
   return '    return '
 <optionresponse max="10">  <optionresponse max="10">
Line 259  sub rebuild_tag { Line 271  sub rebuild_tag {
   if ($token->[0] eq 'S') {    if ($token->[0] eq 'S') {
     $result = '<'.$token->[1];      $result = '<'.$token->[1];
     while (my ($key,$val)= each(%{$token->[2]})) {      while (my ($key,$val)= each(%{$token->[2]})) {
         $val=~s:^\s|\s$::g;
         $val=~s:"::g; #"
       &Apache::lonxml::debug("setting :$key: to  :$val:");        &Apache::lonxml::debug("setting :$key: to  :$val:");
       $result.=' '.$key.'="'.$val.'"';        $result.=' '.$key.'="'.$val.'"';
     }      }
Line 301  sub select_arg { Line 315  sub select_arg {
   return $result;    return $result;
 }  }
   
   sub select_or_text_arg {
     my ($description,$name,$list,$token,$size) = @_;
     my $result;
     my $optionlist="";
     my $found=0;
     my $selected=$token->[2]{$name};
     foreach my $option (@$list) {
       if ( $selected eq $option ) {
         $optionlist.="<option selected=\"on\">$option</option>\n";
         $found=1;
       } else {
         $optionlist.="<option>$option</option>\n";
       }
     }
     $optionlist.="<option value=\"TYPEDINVALUE\">Type in value</option>\n";
     if ($found) {
       $result.=$description.'<select name="'."$Apache::lonxml::curdepth.$name".'">
          '.$optionlist.'
         </select></td></tr><tr><td colspan="3">';
     } else {
       $result.=&text_arg($description,$name,$token,$size);
     }
     return $result;
   }
 1;  1;
 __END__  __END__

Removed from v.1.15  
changed lines
  Added in v.1.19


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