--- loncom/homework/structuretags.pm 2000/11/28 19:15:48 1.14 +++ loncom/homework/structuretags.pm 2009/11/27 21:20:44 1.444.4.2.2.1 @@ -1,165 +1,2073 @@ -# The LearningOnline Network with CAPA # +JS +} + +sub setmode_javascript { + return <<"ENDSCRIPT"; + +ENDSCRIPT +} + +sub page_start { + my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$name, + $extra_head)=@_; + my %found; + foreach my $taginside (@$tagstack) { + foreach my $taglookedfor ('html','body','form') { + if ($taginside =~ /^$taglookedfor$/i) {$found{$taglookedfor} = 1;} + } + } + + if ($target eq 'tex') { + return + &Apache::londefdef::start_html($target,$token,$tagstack, + $parstack,$parser,$safeeval); + } + + $extra_head .= &homework_js(); + + if ($env{'environment.wysiwygeditor'} eq 'on') { + $extra_head .= &Apache::lonhtmlcommon::dragmath_js("FCKEditMathPopup"); + } else { + $extra_head .= &Apache::lonhtmlcommon::dragmath_js("EditMathPopup"); + } + + my %body_args; + if (defined($found{'html'})) { + $body_args{'skip_phases'}{'head'}=1; + } else { + + $extra_head .= &Apache::lonhtmlcommon::spellheader(); + + $extra_head .= &Apache::londefdef::generate_css_links(); + + if ($env{'request.state'} eq 'construct') { + $extra_head.=&Apache::edit::js_change_detection(). + "\n"; + } + } + + 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') { + if ($env{'environment.remote'} ne 'off') { + $body_args{'only_body'} = 1; + } + } + } 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); + 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; + if ($env{'environment.remote'} eq 'off' + && $env{'request.state'} eq 'construct') { + $body_args{'only_body'} = 1; + } + } + $body_args{'no_auto_mt_title'} = 1; + 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::lonnet::whichuser(); +# if ($symb eq '' && !$publicuser) { +# $page_start .= '
' +# .&mt('Browsing resource, all submissions are temporary.') +# .'
'; +# } +# } + + if (!defined($found{'body'}) && $env{'request.state'} ne 'construct') { + $page_start .= &Apache::lonxml::message_location(); + } + + my $form_tag_start; + if (!defined($found{'form'})) { + $form_tag_start='\n".&Apache::loncommon::end_page(); +} + +sub option { + my ($value,$name) = @_; + my $result ="