[LON-CAPA-cvs] cvs: loncom /interface loncommon.pm
albertel
lon-capa-cvs@mail.lon-capa.org
Tue, 11 Apr 2006 18:43:49 -0000
albertel Tue Apr 11 14:43:49 2006 EDT
Modified files:
/loncom/interface loncommon.pm
Log:
- adding support for <frameset> starts to start_page
Index: loncom/interface/loncommon.pm
diff -u loncom/interface/loncommon.pm:1.329 loncom/interface/loncommon.pm:1.330
--- loncom/interface/loncommon.pm:1.329 Mon Apr 10 15:54:54 2006
+++ loncom/interface/loncommon.pm Tue Apr 11 14:43:46 2006
@@ -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 @@
# 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;
@@ -2820,11 +2803,8 @@
<body bgcolor="$pgbg" text="$font" alink="$alink" vlink="$vlink" link="$link"
style="margin-top: 0px;$addstyle" $extra_body_attr>
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='<img src="http://'.$ENV{'HTTP_HOST'}.':'.
$lonhttpdPort.$img.'" alt="'.$function.'" />';
@@ -2953,6 +2933,29 @@
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 @@
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 <frameset>
+ rather than <body>
=back
=cut
@@ -3123,12 +3127,19 @@
$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<frameset $attr_string>\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 @@
return $result;
}
+
=pod
=over 4
@@ -3151,6 +3163,8 @@
a javascript writeln
html_encode -> return a string ready for being used in
a html attribute
+ frameset -> if true will start with a <frameset>
+ rather than <body>
=back
=cut
@@ -3159,7 +3173,14 @@
my ($args) = @_;
#&Apache::lonnet::logthis("end_page ".join(':',caller(0)));
$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'}) {
$result = &js_ready($result);
}