--- loncom/homework/structuretags.pm 2006/04/13 18:35:06 1.342 +++ loncom/homework/structuretags.pm 2006/04/14 20:16:23 1.343 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # definition of tags that give a structure to a document # -# $Id: structuretags.pm,v 1.342 2006/04/13 18:35:06 albertel Exp $ +# $Id: structuretags.pm,v 1.343 2006/04/14 20:16:23 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -69,33 +69,8 @@ sub end_tex { return ''; } -sub body_tag_start { - my ($target,$background,$bgcolor)=@_; - my $body_tag_start='
'.&Apache::lonmenu::menubuttons(undef,$target,1); - - $body_tag_start.=&Apache::lontexconvert::init_math_support(); - - return $body_tag_start; -} - sub page_start { - my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_; + my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$name)=@_; my %found; foreach my $taginside (@$tagstack) { foreach my $taglookedfor ('html','body','form') { @@ -103,44 +78,58 @@ sub page_start { } } - my $result; - my $head_tag_start; + + if ($target eq 'tex') { + return + &Apache::londefdef::start_html($target,$token,$tagstack, + $parstack,$parser,$safeeval); + } + + my $page_start; if (!defined($found{'html'})) { - $result=&Apache::londefdef::start_html($target,$token,$tagstack, - $parstack,$parser,$safeeval); - $head_tag_start=''.&Apache::lonmenu::registerurl(undef,$target). - &Apache::lonhtmlcommon::htmlareaheaders(). - &Apache::lonhtmlcommon::spellheader(). - &Apache::lonxml::fontsettings(); + + my $extra_head = &Apache::lonhtmlcommon::spellheader(); + my $css_href = &Apache::lonnet::EXT('resource.0.cssfile'); if ($css_href =~ /\S/) { &Apache::lonxml::extlink($css_href); - $head_tag_start = + $extra_head .= ''; } if ($target eq 'edit') { - $head_tag_start.=&Apache::edit::js_change_detection(); - } + $extra_head.=&Apache::edit::js_change_detection(). + "\n"; + + } + $page_start .= + &Apache::loncommon::head($name,$extra_head, + {'force_register' => + ($target ne 'edit') }); } - my $body_tag_start; + if (!defined($found{'body'}) && $env{'request.state'} eq 'construct') { - if ($env{'environment.remote'} eq 'off') { - if ($target eq 'web' || $target eq 'edit') { - $body_tag_start=&Apache::loncommon::bodytag(); - $body_tag_start.=&Apache::lonxml::message_location(); - } - } else { - if ($target eq 'web' || $target eq 'edit') { - $body_tag_start=&Apache::loncommon::bodytag(undef,undef,undef,1); - $body_tag_start.=&Apache::lonxml::message_location(); - } + if ($target eq 'web' || $target eq 'edit') { + $page_start.=&Apache::loncommon::bodytag(); + $page_start.=&Apache::lonxml::message_location(); } } elsif (!defined($found{'body'})) { + my %add_entries; my $background=&Apache::lonxml::get_param('background',$parstack, $safeeval); + if ($background ne '' ) { + $add_entries{'background'} = $background; + } my $bgcolor=&Apache::lonxml::get_param('bgcolor',$parstack, $safeeval); - $body_tag_start=&body_tag_start($target,$background,$bgcolor); + + if ($bgcolor eq '' ) { $bgcolor = '#FFFFFF'; } + $page_start .= + &Apache::loncommon::bodytag(undef,undef,\%add_entries,undef,undef, + 1,undef,undef,$bgcolor,$target,1); + if ( ($target eq 'web' || $target eq 'webgrade') && $env{'request.state'} ne 'construct') { my ($symb,undef,undef,undef,$publicuser)= @@ -148,11 +137,12 @@ sub page_start { if ($symb eq '' && !$publicuser) { my $help = &Apache::loncommon::help_open_topic("Ambiguous_Reference"); $help=&mt("Browsing resource, all submissions are temporary.")."