Diff for /rat/lonpage.pm between versions 1.15 and 1.21

version 1.15, 2000/10/31 19:31:42 version 1.21, 2001/05/04 19:33:46
Line 5 Line 5
 #  #
 # 05/29/00,05/30 Gerd Kortemeyer)  # 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,  # 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 Gerd Kortemeyer
   
 package Apache::lonpage;  package Apache::lonpage;
   
 use strict;  use strict;
 use Apache::Constants qw(:common :http);  use Apache::Constants qw(:common :http);
 use Apache::lonnet();  use Apache::lonnet();
   use Apache::lonxml();
 use HTML::TokeParser;  use HTML::TokeParser;
 use GDBM_File;  use GDBM_File;
   
Line 180  sub handler { Line 181  sub handler {
                   my $xmlheader='';                    my $xmlheader='';
                   my $xmlbody='';                    my $xmlbody='';
   
                   my %httpref=();  
   
 # --------------------------------------------- Get SSI output, post parameters  # --------------------------------------------- Get SSI output, post parameters
   
                   for ($i=0;$i<=$#rows;$i++) {                    for ($i=0;$i<=$#rows;$i++) {
Line 215  sub handler { Line 214  sub handler {
                               my $bodydef=0;                                my $bodydef=0;
                               my $thisxml=0;                                my $thisxml=0;
                               my @rlinks=();                                my @rlinks=();
                               my @alinks=();  
                               if ($output=~/\?xml/) {                                if ($output=~/\?xml/) {
                                  $isxml=1;                                   $isxml=1;
                                  $thisxml=1;                                   $thisxml=1;
Line 233  sub handler { Line 231  sub handler {
   } elsif ($token->[1] eq 'img') {    } elsif ($token->[1] eq 'img') {
                                          $rlinks[$#rlinks+1]=                                           $rlinks[$#rlinks+1]=
      $token->[2]->{'src'};       $token->[2]->{'src'};
                                          $alinks[$#alinks+1]=  
      $token->[2]->{'src'};  
   } elsif ($token->[1] eq 'embed') {    } elsif ($token->[1] eq 'embed') {
                                          $rlinks[$#rlinks+1]=                                           $rlinks[$#rlinks+1]=
      $token->[2]->{'src'};       $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') {    } elsif ($token->[1] eq 'base') {
       $thisdir=$token->[2]->{'href'};        $thisdir=$token->[2]->{'href'};
   } elsif ($token->[1] eq 'body') {    } elsif ($token->[1] eq 'body') {
Line 279  sub handler { Line 263  sub handler {
   $nforms++;    $nforms++;
                                   $output=~s/\<form[^\>]*\>//gsi;                                    $output=~s/\<form[^\>]*\>//gsi;
                                   $output=~s/\<\/form[^\>]*\>//gsi;                                    $output=~s/\<\/form[^\>]*\>//gsi;
                                     $output=~
         s/\<((?:input|select|button|textarea)[^\>]+)name\s*\=\s*[\'\"]*([\w\.\:]+)[\'\"]*([^\>]*)\>/\<$1 name="$prefix$2" $3\>/gsi;
                               }                                }
                               $thisdir=~s/\/[^\/]*$//;                                $thisdir=~s/\/[^\/]*$//;
       map {        map {
Line 289  sub handler { Line 275  sub handler {
                      $output=~s/(\"|\'|\=\s*)$_(\"|\'|\s|\>)/$1$newlocation$2/;                       $output=~s/(\"|\'|\=\s*)$_(\"|\'|\s|\>)/$1$newlocation$2/;
   }    }
       } @rlinks;        } @rlinks;
                               map {  
                                   $httpref{'httpref.'.  
        &Apache::lonnet::hreflocation($thisdir,$_)}=  
    $r->uri;  
                               } @alinks;  
                      $output=~s/\<\s*applet/\<applet codebase=\"$thisdir\" /gi;                       $output=~s/\<\s*applet/\<applet codebase=\"$thisdir\" /gi;
       $ssibody{$_}=$output;        $ssibody{$_}=$output;
 # ---------------------------------------------------------------- End SSI cell  # ---------------------------------------------------------------- End SSI cell
Line 308  sub handler { Line 289  sub handler {
                   } else {                    } else {
 # ------------------------------------------------------------------ Build page  # ------------------------------------------------------------------ Build page
   
 # ------------------------------------------------------------- Mark references  
                       &Apache::lonnet::appenv(%httpref);  
 # ---------------------------------------------------------------- Send headers  # ---------------------------------------------------------------- Send headers
                       if ($isxml) {                        if ($isxml) {
   $r->content_type('text/xml');    $r->content_type('text/xml');
Line 322  sub handler { Line 301  sub handler {
       }        }
 # ------------------------------------------------------------------------ Head  # ------------------------------------------------------------------------ Head
                       $r->print("\n<head>\n".$allmeta);                        $r->print("\n<head>\n".$allmeta);
                         $allscript=~
          s/\/\/ BEGIN LON\-CAPA Internal.+\/\/ END LON\-CAPA Internal\s//gs;
                       if ($allscript) {                        if ($allscript) {
   $r->print("\n<script>\n".$allscript."\n</script>\n");    $r->print("\n<script language='JavaScript'>\n".
                                      $allscript."\n</script>\n");
                       }                        }
                         $r->print(&Apache::lonxml::registerurl);
                       $r->print("\n</head>\n");                        $r->print("\n</head>\n");
 # ------------------------------------------------------------------ Start body  # ------------------------------------------------------------------ Start body
                       if ($isxml) {                        if ($isxml) {
                           $r->print($xmlbody);                            $r->print($xmlbody);
                       } else {                        } else {
   $r->print('<body bgcolor="#FFFFFF">');    $r->print(
    '<body bgcolor="#FFFFFF" onLoad="'.&Apache::lonxml::loadevents.
                        '" onUnload="'.&Apache::lonxml::unloadevents.'">');
                       }                        }
 # ------------------------------------------------------------------ Start form  # ------------------------------------------------------------------ Start form
                       if ($nforms) {                        if ($nforms) {

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


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