Diff for /loncom/interface/loncommon.pm between versions 1.329 and 1.330

version 1.329, 2006/04/10 19:54:54 version 1.330, 2006/04/11 18:43:46
Line 2786  sub bodytag { Line 2786  sub bodytag {
 # Port for miniserver  # Port for miniserver
     my $lonhttpdPort=$Apache::lonnet::perlvar{'lonhttpdPort'};      my $lonhttpdPort=$Apache::lonnet::perlvar{'lonhttpdPort'};
     if (!defined($lonhttpdPort)) { $lonhttpdPort='8080'; }      if (!defined($lonhttpdPort)) { $lonhttpdPort='8080'; }
     my $extra_body_attr;  
     if ($forcereg) {      my $extra_body_attr = &make_attr_string($forcereg,$addentries);
  if (ref($addentries)) {  
     $addentries->{'onload'}   = &Apache::lonmenu::loadevents().  
  $addentries->{'onload'};  
     $addentries->{'onunload'} = &Apache::lonmenu::unloadevents().  
  $addentries->{'onunload'};  
  } else {  
     $extra_body_attr.=' onload="'.&Apache::lonmenu::loadevents().  
  '" onunload="'.&Apache::lonmenu::unloadevents().'"';  
  }  
     }  
     if (!ref($addentries)) {  
  $extra_body_attr .= $addentries;  
     } else {  
  foreach my $attr (keys(%$addentries)) {  
     $extra_body_attr .= " $attr=\"".$addentries->{$attr}.'" ';  
  }  
     }  
   
 # construct main body tag  # construct main body tag
     my $bodytag = <<END;      my $bodytag = <<END;
Line 2820  form, .inline { display: inline; } Line 2803  form, .inline { display: inline; }
 <body bgcolor="$pgbg" text="$font" alink="$alink" vlink="$vlink" link="$link"  <body bgcolor="$pgbg" text="$font" alink="$alink" vlink="$vlink" link="$link"
 style="margin-top: 0px;$addstyle" $extra_body_attr>  style="margin-top: 0px;$addstyle" $extra_body_attr>
 END  END
     &Apache::lontexconvert::jsMath_reset();  
     if ($env{'environment.texengine'} eq 'jsMath' ||      $bodytag .= &Apache::lontexconvert::init_math_support();
  $env{'form.texengine'}        eq 'jsMath' ) {  
  $bodytag.=&Apache::lontexconvert::jsMath_header();  
     }  
   
     my $upperleft='<img src="http://'.$ENV{'HTTP_HOST'}.':'.      my $upperleft='<img src="http://'.$ENV{'HTTP_HOST'}.':'.
                    $lonhttpdPort.$img.'" alt="'.$function.'" />';                     $lonhttpdPort.$img.'" alt="'.$function.'" />';
Line 2953  $titleinfo $dc_info $menu Line 2933  $titleinfo $dc_info $menu
 ENDBODY  ENDBODY
 }  }
   
   sub make_attr_string {
       my ($register,$attr_ref) = @_;
   
       if ($attr_ref && !ref($attr_ref)) {
    die("addentries Must be a hash ref ".
       join(':',caller(1))." ".
       join(':',caller(0))." ");
       }
   
       if ($register) {
    $attr_ref->{'onload'}   = &Apache::lonmenu::loadevents().
       $attr_ref->{'onload'};
    $attr_ref->{'onunload'} = &Apache::lonmenu::unloadevents().
       $attr_ref->{'onunload'};
       }
       my $attr_string;
       foreach my $attr (keys(%$attr_ref)) {
    $attr_string .= " $attr=\"".$attr_ref->{$attr}.'" ';
       }
       return $attr_string;
   }
   
   
 ###############################################  ###############################################
 ###############################################  ###############################################
   
Line 3105  Inputs: $title - optional title for the Line 3108  Inputs: $title - optional title for the
                   body_title     -> alternate text to use instead of $title                    body_title     -> alternate text to use instead of $title
                                     in the title box that appears, this text                                      in the title box that appears, this text
                                     is not auto translated like the $title is                                      is not auto translated like the $title is
                     frameset       -> if true will start with a <frameset>
                                       rather than <body>
 =back  =back
   
 =cut  =cut
Line 3123  sub start_page { Line 3127  sub start_page {
     $env{'internal.start_page'}++;      $env{'internal.start_page'}++;
     my $result =       my $result = 
  &Apache::lonxml::xmlbegin().   &Apache::lonxml::xmlbegin().
  &headtag($title,$head_extra,\%head_args).&endheadtag().   &headtag($title,$head_extra,\%head_args).&endheadtag();
  &bodytag($title,       if ($args->{'frameset'}) {
  $args->{'function'},       $args->{'add_entries'},   my $attr_string = &make_attr_string($args->{'force_register'},
  $args->{'only_body'},      $args->{'domain'},      $args->{'add_entries'});
  $args->{'force_register'}, $args->{'body_title'},   $result .= "\n<frameset $attr_string>\n";
  $args->{'no_nav_bar'},     $args->{'bgcolor'});      } else {
    $result .=
       &bodytag($title, 
        $args->{'function'},       $args->{'add_entries'},
        $args->{'only_body'},      $args->{'domain'},
        $args->{'force_register'}, $args->{'body_title'},
        $args->{'no_nav_bar'},     $args->{'bgcolor'});
       }
     if ($args->{'js_ready'}) {      if ($args->{'js_ready'}) {
  $result = &js_ready($result);   $result = &js_ready($result);
     }      }
Line 3138  sub start_page { Line 3149  sub start_page {
     return $result;      return $result;
 }  }
   
   
 =pod  =pod
   
 =over 4  =over 4
Line 3151  Inputs:         $args - additional optio Line 3163  Inputs:         $args - additional optio
                                  a javascript writeln                                   a javascript writeln
                  html_encode  -> return a string ready for being used in                    html_encode  -> return a string ready for being used in 
                                  a html attribute                                   a html attribute
                    frameset     -> if true will start with a <frameset>
                                    rather than <body>
 =back  =back
   
 =cut  =cut
Line 3159  sub end_page { Line 3173  sub end_page {
     my ($args) = @_;      my ($args) = @_;
     #&Apache::lonnet::logthis("end_page ".join(':',caller(0)));      #&Apache::lonnet::logthis("end_page ".join(':',caller(0)));
     $env{'internal.end_page'}++;      $env{'internal.end_page'}++;
     my $result = &endbodytag()."\n</html>";      my $result;
       if ($args->{'frameset'}) {
    $result .= '</frameset>';
       } else {
    $result .= &endbodytag();
       }
       $result .= "\n</html>";
   
     if ($args->{'js_ready'}) {      if ($args->{'js_ready'}) {
  $result = &js_ready($result);   $result = &js_ready($result);
     }      }

Removed from v.1.329  
changed lines
  Added in v.1.330


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