--- rat/lonpage.pm 2000/09/16 17:42:01 1.6 +++ rat/lonpage.pm 2000/09/22 10:28:41 1.7 @@ -4,7 +4,7 @@ # (TeX Content Handler # # 05/29/00,05/30 Gerd Kortemeyer) -# 08/30,08/31,09/06,09/14,09/15,09/16 Gerd Kortemeyer +# 08/30,08/31,09/06,09/14,09/15,09/16,09/19,09/20,09/21 Gerd Kortemeyer package Apache::lonpage; @@ -104,7 +104,7 @@ sub handler { if ($ENV{'request.course.fn'}) { my $fn=$ENV{'request.course.fn'}; if (-e "$fn.db") { - if (tie(%hash,'GDBM_File',"$fn.db",&GDBM_WRCREAT,0640)) { + if (tie(%hash,'GDBM_File',"$fn.db",&GDBM_READER,0640)) { # ------------------------------------------------------------------- Hash tied my $firstres=$hash{'map_start_'.$requrl}; my $lastres=$hash{'map_finish_'.$requrl}; @@ -126,6 +126,7 @@ sub handler { my $j; my $lcm=1; my $contents=0; + my $nforms=0; my %ssibody=(); my %ssibgcolor=(); @@ -135,6 +136,13 @@ sub handler { my %ssialink=(); my %cellemb=(); + my $allscript=''; + my $allmeta=''; + + my $isxml=0; + my $xmlheader=''; + my $xmlbody=''; + # --------------------------------------------- Get SSI output, post parameters for ($i=0;$i<=$#rows;$i++) { @@ -150,33 +158,58 @@ sub handler { # --------------------------------------------------------- This is an SSI cell my $prefix=$_.'_'; my %posthash=('request.prefix' => $prefix); - map { + if (($ENV{'$form.'.$prefix.'submit'}) + || ($ENV{'form.all_submit'})) { + map { if ($_=~/^form.$prefix/) { my $name=$_; $name=~s/^form.$prefix//; $posthash{$name}=$ENV{$_}; } - } keys %ENV; + } keys %ENV; + } my $output=Apache::lonnet::ssi($src,%posthash); my $parser=HTML::TokeParser->new(\$output); my $token; my $bodydef=0; + my $thisxml=0; + if ($output=~/\?xml/) { + $isxml=1; + $thisxml=1; + $output=~ + /((?:\<(?:\?xml|\!DOC|html)[^\>]*(?:\>|\>\]\>)\s*)+)\
]*\>/si; + $xmlheader=$1; + } while (($bodydef==0) && ($token=$parser->get_token)) { if ($token->[1] eq 'body') { - $bodydef=1 + $bodydef=1; + $ssibgcolor{$_}=$token->[2]->{'bgcolor'}; + $ssitext{$_}=$token->[2]->{'text'}; + $ssilink{$_}=$token->[2]->{'link'}; + $ssivlink{$_}=$token->[2]->{'vlink'}; + $ssialink{$_}=$token->[2]->{'alink'}; + if ($thisxml) { + $xmlbody=$token->[4]; + } } if ($token->[1] eq 'meta') { + $allmeta.="\n".$token->[4].''; } if ($token->[1] eq 'script') { - } - if ($token->[1] eq 'basefont') { + $allscript.="\n\n" + .$parser->get_text('/script'); } } if ($output=~/\]*\>(.*)/si) { $output=$1; } $output=~s/\<\/body\>.*//si; + if ($output=~/\