--- loncom/homework/structuretags.pm 2008/07/28 05:26:00 1.425 +++ loncom/homework/structuretags.pm 2009/03/27 01:07:10 1.441 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # definition of tags that give a structure to a document # -# $Id: structuretags.pm,v 1.425 2008/07/28 05:26:00 raeburn Exp $ +# $Id: structuretags.pm,v 1.441 2009/03/27 01:07:10 raeburn 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,7 +98,14 @@ sub start_tex { if ($target ne 'edit' && $target ne 'modified') { my $bodytext=&Apache::lonxml::get_all_text("/tex",$parser,$style); if ($target eq 'tex') { - return $bodytext.' '; + + # 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" ) { my $bodytext = @@ -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; @@ -390,8 +423,8 @@ sub problem_web_to_edit_header { &mt(' Show All Instances') : &mt(' Show All Foils'); - my $show_all= ''; @@ -416,8 +449,9 @@ sub problem_web_to_edit_header { $show_all @@ -540,12 +574,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; @@ -576,10 +617,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; @@ -857,16 +904,15 @@ sub start_problem { } if ($env{'request.role.adv'}) { $form_tag_start.= - '