--- loncom/homework/structuretags.pm 2006/04/14 20:16:23 1.343 +++ loncom/homework/structuretags.pm 2006/04/18 22:36:23 1.347 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # definition of tags that give a structure to a document # -# $Id: structuretags.pm,v 1.343 2006/04/14 20:16:23 albertel Exp $ +# $Id: structuretags.pm,v 1.347 2006/04/18 22:36:23 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -70,7 +70,8 @@ sub end_tex { } sub page_start { - my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$name)=@_; + my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$name, + $extra_head)=@_; my %found; foreach my $taginside (@$tagstack) { foreach my $taglookedfor ('html','body','form') { @@ -85,10 +86,12 @@ sub page_start { $parstack,$parser,$safeeval); } - my $page_start; - if (!defined($found{'html'})) { + my %body_args; + if (defined($found{'html'})) { + $body_args{'skip_phases'}{'head'}=1; + } else { - my $extra_head = &Apache::lonhtmlcommon::spellheader(); + $extra_head .= &Apache::lonhtmlcommon::spellheader(); my $css_href = &Apache::lonnet::EXT('resource.0.cssfile'); if ($css_href =~ /\S/) { @@ -102,18 +105,15 @@ sub page_start { "if (typeof swmenu != 'undefined') {swmenu.currentURL=null;}\n". &Apache::loncommon::browser_and_searcher_javascript(). "\n\n"; - } - $page_start .= - &Apache::loncommon::head($name,$extra_head, - {'force_register' => - ($target ne 'edit') }); } - if (!defined($found{'body'}) && $env{'request.state'} eq 'construct') { + if (defined($found{'body'})) { + $body_args{'skip_phases'}{'body'}=1; + } elsif (!defined($found{'body'}) + && $env{'request.state'} eq 'construct') { if ($target eq 'web' || $target eq 'edit') { - $page_start.=&Apache::loncommon::bodytag(); - $page_start.=&Apache::lonxml::message_location(); + # no extra args to bodytag } } elsif (!defined($found{'body'})) { my %add_entries; @@ -122,27 +122,36 @@ sub page_start { if ($background ne '' ) { $add_entries{'background'} = $background; } + my $bgcolor=&Apache::lonxml::get_param('bgcolor',$parstack, $safeeval); - - 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)= - &Apache::lonxml::whichuser(); - if ($symb eq '' && !$publicuser) { - my $help = &Apache::loncommon::help_open_topic("Ambiguous_Reference"); - $help=&mt("Browsing resource, all submissions are temporary.")."
"; - $page_start .= $help; - } + if ($bgcolor eq '' ) { $bgcolor = '#FFFFFF'; } + + $body_args{'bgcolor'} = $bgcolor; + $body_args{'no_title'} = 1; + $body_args{'force_register'} = 1; + $body_args{'add_entries'} = \%add_entries; + } + + my $page_start = &Apache::loncommon::start_page($name,$extra_head, + \%body_args); + + if (!defined($found{'body'}) + && $env{'request.state'} ne 'construct' + && ($target eq 'web' || $target eq 'webgrade')) { + + my ($symb,undef,undef,undef,$publicuser)= &Apache::lonxml::whichuser(); + if ($symb eq '' && !$publicuser) { + my $help = &Apache::loncommon::help_open_topic("Ambiguous_Reference"); + $help=&mt("Browsing resource, all submissions are temporary.")."
"; + $page_start .= $help; } - $page_start .= &Apache::lonxml::message_location(); } + if (!defined($found{'body'})) { + $page_start .= &Apache::lonxml::message_location(); + } + my $form_tag_start; if (!defined($found{'form'})) { $form_tag_start='
'. - &Apache::lonhtmlcommon::htmlareaselectactive(@Apache::lonxml::htmlareafields). + &Apache::lonhtmlcommon::htmlareaselectactive(&Apache::lonhtmcommon::get_htmlareafields()). "\n
\n".&Apache::loncommon::end_page(); } @@ -586,7 +596,6 @@ sub start_problem { my $status; my $accessmsg; - #should get back a or the neccesary stuff to start XML/MathML my $name= &get_resource_name($parstack,$safeeval); my ($result,$form_tag_start)= &page_start($target,$token,$tagstack,$parstack,$parser,$safeeval, @@ -852,10 +861,10 @@ sub end_problem { if ($target ne 'tex' && $env{'form.answer_output_mode'} ne 'tex') { $result.=""; - $result.=&Apache::lonhtmlcommon::htmlareaselectactive(@Apache::lonxml::htmlareafields); + $result.= &Apache::lonhtmlcommon::htmlareaselectactive(&Apache::lonhtmcommon::get_htmlareafields()); } if ($target eq 'web') { - $result.=&Apache::lonxml::xmlend().''; + $result.= &Apache::loncommon::end_page({'discussion' => 1}); } elsif ($target eq 'tex') { my $endminipage = ''; if (not $env{'form.problem_split'}=~/yes/) { @@ -880,7 +889,7 @@ sub end_problem { } if ($target eq 'answer' && ($env{'request.state'} eq 'construct') && $env{'form.answer_output_mode'} ne 'tex') { - $result.=&Apache::lonxml::xmlend().''; + $result.=&Apache::loncommon::end_page({'discussion' => 1}); # normally we get it from above, but in CSTR # we always show answer mode too. }