--- loncom/interface/loncommon.pm 2006/04/10 19:54:54 1.329 +++ loncom/interface/loncommon.pm 2006/04/11 18:43:46 1.330 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # a pile of common routines # -# $Id: loncommon.pm,v 1.329 2006/04/10 19:54:54 albertel Exp $ +# $Id: loncommon.pm,v 1.330 2006/04/11 18:43:46 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -2786,25 +2786,8 @@ sub bodytag { # Port for miniserver my $lonhttpdPort=$Apache::lonnet::perlvar{'lonhttpdPort'}; if (!defined($lonhttpdPort)) { $lonhttpdPort='8080'; } - my $extra_body_attr; - if ($forcereg) { - 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}.'" '; - } - } + + my $extra_body_attr = &make_attr_string($forcereg,$addentries); # construct main body tag my $bodytag = < END - &Apache::lontexconvert::jsMath_reset(); - if ($env{'environment.texengine'} eq 'jsMath' || - $env{'form.texengine'} eq 'jsMath' ) { - $bodytag.=&Apache::lontexconvert::jsMath_header(); - } + + $bodytag .= &Apache::lontexconvert::init_math_support(); my $upperleft=''.$function.''; @@ -2953,6 +2933,29 @@ $titleinfo $dc_info $menu 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; +} + + ############################################### ############################################### @@ -3105,7 +3108,8 @@ Inputs: $title - optional title for the body_title -> alternate text to use instead of $title in the title box that appears, this text is not auto translated like the $title is - + frameset -> if true will start with a + rather than =back =cut @@ -3123,12 +3127,19 @@ sub start_page { $env{'internal.start_page'}++; my $result = &Apache::lonxml::xmlbegin(). - &headtag($title,$head_extra,\%head_args).&endheadtag(). - &bodytag($title, - $args->{'function'}, $args->{'add_entries'}, - $args->{'only_body'}, $args->{'domain'}, - $args->{'force_register'}, $args->{'body_title'}, - $args->{'no_nav_bar'}, $args->{'bgcolor'}); + &headtag($title,$head_extra,\%head_args).&endheadtag(); + if ($args->{'frameset'}) { + my $attr_string = &make_attr_string($args->{'force_register'}, + $args->{'add_entries'}); + $result .= "\n\n"; + } 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'}) { $result = &js_ready($result); } @@ -3138,6 +3149,7 @@ sub start_page { return $result; } + =pod =over 4 @@ -3151,6 +3163,8 @@ Inputs: $args - additional optio a javascript writeln html_encode -> return a string ready for being used in a html attribute + frameset -> if true will start with a + rather than =back =cut @@ -3159,7 +3173,14 @@ sub end_page { my ($args) = @_; #&Apache::lonnet::logthis("end_page ".join(':',caller(0))); $env{'internal.end_page'}++; - my $result = &endbodytag()."\n"; + my $result; + if ($args->{'frameset'}) { + $result .= ''; + } else { + $result .= &endbodytag(); + } + $result .= "\n"; + if ($args->{'js_ready'}) { $result = &js_ready($result); }