--- loncom/xml/lonxml.pm 2002/01/18 17:04:46 1.150 +++ loncom/xml/lonxml.pm 2002/01/30 16:04:04 1.151 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # XML Parser Module # -# $Id: lonxml.pm,v 1.150 2002/01/18 17:04:46 albertel Exp $ +# $Id: lonxml.pm,v 1.151 2002/01/30 16:04:04 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -897,10 +897,10 @@ sub get_all_text { } elsif ($token->[0] eq 'PI') { $result.=$token->[2]; } elsif ($token->[0] eq 'S') { - if ($token->[1] eq $tag) { $depth++; } + if ($token->[1] =~ /^$tag$/i) { $depth++; } $result.=$token->[4]; } elsif ($token->[0] eq 'E') { - if ( $token->[1] eq $tag) { $depth--; } + if ( $token->[1] =~ /^$tag$/i) { $depth--; } #skip sending back the last end tag if ($depth > -1) { $result.=$token->[2]; } else { $pars->unget_token($token); @@ -915,7 +915,7 @@ sub get_all_text { } elsif ($token->[0] eq 'PI') { $result.=$token->[2]; } elsif ($token->[0] eq 'S') { - if ( $token->[1] eq $tag) { + if ( $token->[1] =~ /^$tag$/i) { $pars->unget_token($token); last; } else { $result.=$token->[4]; @@ -1028,10 +1028,8 @@ sub storefile { } } -sub inserteditinfo { - my ($result,$filecontents)=@_; - unless ($filecontents) { - $filecontents=(< @@ -1045,8 +1043,12 @@ sub inserteditinfo { </body> </html> SIMPLECONTENT - } + return $filecontents; +} + +sub inserteditinfo { + my ($result,$filecontents)=@_; $filecontents =~ s:</textarea>:</textarea>:ig; # my $editheader='<a href="#editsection">Edit below</a><hr />'; my $editfooter=(<<ENDFOOTER); @@ -1109,6 +1111,10 @@ sub handler { </html> ENDNOTFOUND $filecontents=''; + if ($ENV{'request.state'} ne 'published') { + $filecontents=&createnewhtml(); + $ENV{'form.showmode'}='Edit'; #force edit mode + } } else { unless ($ENV{'request.state'} eq 'published') { if ($ENV{'form.attemptclean'}) {