--- loncom/homework/structuretags.pm 2008/10/24 16:22:54 1.433 +++ loncom/homework/structuretags.pm 2009/06/09 12:56:27 1.449 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # definition of tags that give a structure to a document # -# $Id: structuretags.pm,v 1.433 2008/10/24 16:22:54 bisitz Exp $ +# $Id: structuretags.pm,v 1.449 2009/06/09 12:56:27 bisitz Exp $ # # Copyright Michigan State University Board of Trustees # @@ -27,6 +27,29 @@ # ### +=pod + +=head1 NAME + +Apache::structuretags + +=head1 SYNOPSIS + + +This is part of the LearningOnline Network with CAPA project +described at http://www.lon-capa.org. + + +=head1 NOTABLE SUBROUTINES + +=over + +=item + +=back + +=cut + package Apache::structuretags; @@ -36,6 +59,7 @@ use Apache::File(); use Apache::lonmenu; use Apache::lonlocal; use Apache::lonxml; +use Apache::londefdef; use Apache::lonenc(); use Time::HiRes qw( gettimeofday tv_interval ); use lib '/home/httpd/lib/perl/'; @@ -74,6 +98,13 @@ sub start_tex { if ($target ne 'edit' && $target ne 'modified') { my $bodytext=&Apache::lonxml::get_all_text("/tex",$parser,$style); if ($target eq 'tex') { + + # If inside a table, occurrences of \\ must be removed; + # else the table blows up. + + if (&Apache::londefdef::is_inside_of($tagstack, "table")) { + $bodytext =~ s/\\\\//g; + } return $bodytext.'{}'; } } elsif ($target eq "edit" ) { @@ -148,8 +179,10 @@ sub page_start { $extra_head .= &homework_js(); - unless ($env{'environment.wysiwygeditor'} eq 'on') { - $extra_head .= &Apache::lonhtmlcommon::dragmath_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; @@ -170,6 +203,7 @@ sub page_start { } } + my $pageheader = ''; if (defined($found{'body'})) { $body_args{'skip_phases'}{'body'}=1; } elsif (!defined($found{'body'}) @@ -178,6 +212,9 @@ sub page_start { if ($env{'environment.remote'} ne 'off') { $body_args{'only_body'} = 1; } + $pageheader = &Apache::lonhtmlcommon::breadcrumbs() # FIXME add breadcrumbs + .&Apache::loncommon::head_subbox( + &Apache::loncommon::CSTR_pageheader()); } } elsif (!defined($found{'body'})) { my %add_entries; @@ -189,21 +226,21 @@ sub page_start { my $bgcolor=&Apache::lonxml::get_param('bgcolor',$parstack, $safeeval); - if ($bgcolor eq '' ) { $bgcolor = '#FFFFFF'; } + 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{'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); - + $page_start .= $pageheader; if (!defined($found{'body'}) && $env{'request.state'} ne 'construct' && ($target eq 'web' || $target eq 'webgrade')) { @@ -390,8 +427,8 @@ sub problem_web_to_edit_header { &mt(' Show All Instances') : &mt(' Show All Foils'); - my $show_all= ''; @@ -489,7 +526,8 @@ $show_all $result.=' -
'; +
+
'; $result.=''; $result .= ''; @@ -497,6 +535,7 @@ $show_all 'onclick="javascript:setmode(this.form,'."'editxml'".')" />'; $result.='
+
'.&Apache::lonxml::message_location().'
'; return $result; @@ -541,12 +580,19 @@ sub initialize_storage { if ($temp =~ m/^error:.*/) { %Apache::lonhomework::history=(); } } -# -------------------------------------------------------------finalize_storage -# Stores away the result has to a student's environment -# checks form.grade_ for specific values, other wises stores -# to the running users environment -# Will increment totals for attempts, students, and corrects -# if running user has student role. +=pod + +=item finalize_storage() + + Stores away the result has to a student's environment + checks form.grade_ for specific values, other wises stores + to the running users environment + Will increment totals for attempts, students, and corrects + if running user has student role. + +=cut + + sub finalize_storage { my ($given_symb) = @_; my $result; @@ -577,10 +623,16 @@ sub finalize_storage { return $result; } -# -------------------------------------------------------------store_aggregates -# Sends hash of values to be incremented in nohist_resourcetracker.db -# for the course. Increments total number of attempts, unique students -# and corrects for each part for an instance of a problem, as appropriate. +=pod + +item store_aggregates() + + Sends hash of values to be incremented in nohist_resourcetracker.db + for the course. Increments total number of attempts, unique students + and corrects for each part for an instance of a problem, as appropriate. + +=cut + sub store_aggregates { my ($symb,$courseid) = @_; my %aggregate; @@ -628,10 +680,8 @@ sub checkout_msg { return (<$lt{'resource'}

$lt{'id_expln'}

- -

$lt{'warning'}

-
-
+

$lt{'warning'}

+
@@ -665,7 +715,7 @@ sub firstaccess_msg { my $buttontext = &mt('Show Resource'); my $timertext = &mt('Start Timer?'); $result .= (< +
@@ -858,9 +908,9 @@ sub start_problem { } if ($env{'request.role.adv'}) { $form_tag_start.= - '