--- rat/lonpage.pm 2000/10/31 19:31:42 1.15 +++ rat/lonpage.pm 2001/08/13 17:36:32 1.24 @@ -5,13 +5,15 @@ # # 05/29/00,05/30 Gerd Kortemeyer) # 08/30,08/31,09/06,09/14,09/15,09/16,09/19,09/20,09/21,09/23, -# 10/02,10/10,10/14,10/16,10/18,10/19,10/31 Gerd Kortemeyer +# 10/02,10/10,10/14,10/16,10/18,10/19,10/31,11/6,11/14,11/16, +# 08/13/01 Gerd Kortemeyer package Apache::lonpage; use strict; use Apache::Constants qw(:common :http); use Apache::lonnet(); +use Apache::lonxml(); use HTML::TokeParser; use GDBM_File; @@ -180,8 +182,6 @@ sub handler { my $xmlheader=''; my $xmlbody=''; - my %httpref=(); - # --------------------------------------------- Get SSI output, post parameters for ($i=0;$i<=$#rows;$i++) { @@ -215,7 +215,6 @@ sub handler { my $bodydef=0; my $thisxml=0; my @rlinks=(); - my @alinks=(); if ($output=~/\?xml/) { $isxml=1; $thisxml=1; @@ -233,23 +232,9 @@ sub handler { } elsif ($token->[1] eq 'img') { $rlinks[$#rlinks+1]= $token->[2]->{'src'}; - $alinks[$#alinks+1]= - $token->[2]->{'src'}; } elsif ($token->[1] eq 'embed') { $rlinks[$#rlinks+1]= $token->[2]->{'src'}; - $alinks[$#alinks+1]= - $token->[2]->{'src'}; - } elsif ($token->[1] eq 'applet') { - $alinks[$#alinks+1]= - $token->[2]->{'code'}; - $alinks[$#alinks+1]= - $token->[2]->{'archive'}; - } elsif ($token->[1] eq 'param') { - if ($token->[2]->{'name'} eq 'cabbase') { - $alinks[$#alinks+1]= - $token->[2]->{'value'}; - } } elsif ($token->[1] eq 'base') { $thisdir=$token->[2]->{'href'}; } elsif ($token->[1] eq 'body') { @@ -279,6 +264,8 @@ sub handler { $nforms++; $output=~s/\]*\>//gsi; $output=~s/\<\/form[^\>]*\>//gsi; + $output=~ + s/\<((?:input|select|button|textarea)[^\>]+)name\s*\=\s*[\'\"]*([\w\.\:]+)[\'\"]*([^\>]*)\>/\<$1 name="$prefix$2" $3\>/gsi; } $thisdir=~s/\/[^\/]*$//; map { @@ -289,12 +276,8 @@ sub handler { $output=~s/(\"|\'|\=\s*)$_(\"|\'|\s|\>)/$1$newlocation$2/; } } @rlinks; - map { - $httpref{'httpref.'. - &Apache::lonnet::hreflocation($thisdir,$_)}= - $r->uri; - } @alinks; - $output=~s/\<\s*applet/\]+)(codebase\=[^\S\>]+)*([^\>]*)\>/$1.($2?$2:' codebase="'.$thisdir.'"').$3.'>'/gei; $ssibody{$_}=$output; # ---------------------------------------------------------------- End SSI cell } @@ -308,8 +291,6 @@ sub handler { } else { # ------------------------------------------------------------------ Build page -# ------------------------------------------------------------- Mark references - &Apache::lonnet::appenv(%httpref); # ---------------------------------------------------------------- Send headers if ($isxml) { $r->content_type('text/xml'); @@ -322,15 +303,21 @@ sub handler { } # ------------------------------------------------------------------------ Head $r->print("\n\n".$allmeta); + $allscript=~ + s/\/\/ BEGIN LON\-CAPA Internal.+\/\/ END LON\-CAPA Internal\s//gs; if ($allscript) { - $r->print("\n\n"); + $r->print("\n\n"); } + $r->print(&Apache::lonxml::registerurl); $r->print("\n\n"); # ------------------------------------------------------------------ Start body if ($isxml) { $r->print($xmlbody); } else { - $r->print(''); + $r->print( + ''); } # ------------------------------------------------------------------ Start form if ($nforms) {