--- loncom/interface/loncommon.pm 2006/04/13 19:07:11 1.333 +++ loncom/interface/loncommon.pm 2006/04/14 21:09:51 1.338 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # a pile of common routines # -# $Id: loncommon.pm,v 1.333 2006/04/13 19:07:11 albertel Exp $ +# $Id: loncommon.pm,v 1.338 2006/04/14 21:09:51 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -61,6 +61,8 @@ use POSIX qw(strftime mktime); use Apache::lonmenu(); use Apache::lonlocal; use HTML::Entities; +use Apache::lonhtmlcommon(); +use Apache::loncoursedata(); my $readit; @@ -2751,7 +2753,10 @@ Inputs: =item * $notopbar, if true, keep the 'what is this' info but remove the navigational links -=item * $bgcolor, used to override the bg coor on a webpage to a specific value +=item * $bgcolor, used to override the bgcolor on a webpage to a specific value + +=item * $notitle, if true keep the nav controls, but remove the title bar + =back @@ -2764,7 +2769,7 @@ other decorations will be returned. sub bodytag { my ($title,$function,$addentries,$bodyonly,$domain,$forcereg,$customtitle, - $notopbar,$bgcolor)=@_; + $notopbar,$bgcolor,$notitle)=@_; $title=&mt($title); $function = &get_users_function() if (!$function); my $img=&designparm($function.'.img',$domain); @@ -2823,9 +2828,11 @@ END } elsif ($env{'browser.interface'} eq 'textual') { # Accessibility - return $bodytag.&Apache::lonmenu::menubuttons($forcereg,'web', - $forcereg). - '

LON-CAPA: '.$title.'

'; + $bodytag.=&Apache::lonmenu::menubuttons($forcereg,$forcereg); + if (!$notitle) { + $bodytag.='

LON-CAPA: '.$title.'

'; + } + return $bodytag; } elsif ($env{'environment.remote'} eq 'off') { # No Remote my $roleinfo=(<'. ''. $titleinfo.''.$roleinfo.''; - if ($env{'request.state'} eq 'construct') { + } + if ($env{'request.state'} eq 'construct') { if ($notopbar) { $bodytag .= $titletable; } else { - $bodytag .= &Apache::lonmenu::menubuttons($forcereg,'web',$forcereg,$titletable); + $bodytag .= &Apache::lonmenu::menubuttons($forcereg,$forcereg, + $titletable); } } else { if ($notopbar) { $bodytag .= $titletable; } else { - $bodytag .= &Apache::lonmenu::menubuttons($forcereg,'web',$forcereg). + $bodytag .= &Apache::lonmenu::menubuttons($forcereg,$forcereg). $titletable; } } @@ -2915,6 +2927,9 @@ ENDROLE # Explicit link to get inline menu my $menu='
 '.&mt('Switch to Inline Menu Mode').''; # + if ($notitle) { + return $bodytag; + } return(< @@ -3012,7 +3027,6 @@ Inputs: $title - optional title for the $args - optional arguments force_register - if is true call registerurl so the remote is informed - redirect - array ref of seconds before redirect occurs url to redirect to (side effect of setting @@ -3120,6 +3134,11 @@ Inputs: $title - optional title for the is not auto translated like the $title is frameset -> if true will start with a rather than + no_title -> if true the title bar won't be shown + skip_phases -> hash ref of + head -> skip the generation + body -> skip all generation + =back =cut @@ -3135,21 +3154,29 @@ sub start_page { } $env{'internal.start_page'}++; - my $result = - &Apache::lonxml::xmlbegin(). - &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'}); + my $result; + if (! exists($args->{'skip_phases'}{'head'}) ) { + $result.= + &Apache::lonxml::xmlbegin(). + &headtag($title,$head_extra,\%head_args).&endheadtag(); } + + if (! exists($args->{'skip_phases'}{'body'}) ) { + 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'}, + $args->{'no_title'}); + } + } + if ($args->{'js_ready'}) { $result = &js_ready($result); } @@ -3184,6 +3211,15 @@ sub end_page { #&Apache::lonnet::logthis("end_page ".join(':',caller(0))); $env{'internal.end_page'}++; my $result; + if ($args->{'discussion'}) { + my ($target,$parser); + if (ref($args->{'discussion'})) { + ($target,$parser) =($args->{'discussion'}{'target'}, + $args->{'discussion'}{'parser'}); + } + $result .= &Apache::lonxml::xmlend($target,$parser); + } + if ($args->{'frameset'}) { $result .= ''; } else { @@ -3194,9 +3230,11 @@ sub end_page { if ($args->{'js_ready'}) { $result = &js_ready($result); } + if ($args->{'html_encode'}) { $result = &html_encode($result); } + return $result; }