[LON-CAPA-cvs] cvs: loncom /homework structuretags.pm
foxr
lon-capa-cvs-allow@mail.lon-capa.org
Mon, 10 Nov 2008 11:44:54 -0000
foxr Mon Nov 10 11:44:54 2008 EDT
Modified files:
/loncom/homework structuretags.pm
Log:
BZ5548 - remove \\ from <tex> tag if it is issued inside a table.
Index: loncom/homework/structuretags.pm
diff -u loncom/homework/structuretags.pm:1.433 loncom/homework/structuretags.pm:1.434
--- loncom/homework/structuretags.pm:1.433 Fri Oct 24 16:22:54 2008
+++ loncom/homework/structuretags.pm Mon Nov 10 11:44:54 2008
@@ -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.434 2008/11/10 11:44:54 foxr Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -36,6 +36,7 @@
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 +75,13 @@
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 +156,10 @@
$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;
@@ -1896,20 +1906,21 @@
if ($target eq 'edit') {
my $areaid = 'homework_edit_'.$Apache::lonxml::curdepth;
$text=&Apache::lonxml::get_all_text("endouttext",$parser,$style);
- $result.=&Apache::edit::start_table($token)."<tr><td>".&mt('Text Block')."</td>"
- .'<td><span clas="LC_nobreak">'.&mt('Delete?').' '
- .&Apache::edit::deletelist($target,$token)
- .'</span></td>';
+
+ $result.=&Apache::edit::start_table($token)."<tr><td>".&mt('Text Block')."</td>
+<td>".&mt('Delete:').
+ &Apache::edit::deletelist($target,$token)
+ ."</td>";
unless ($env{'environment.wysiwygeditor'} eq 'on') {
- $result.='<td align="left">'
- .&Apache::lonhtmlcommon::dragmath_button($areaid,1)
- .'</td>'
- .'<td>'
- .&Apache::edit::insertlist($target,$token)
- .'</td>';
- }
+ $result .= '<td align="left">'
+ .&Apache::lonhtmlcommon::dragmath_button($areaid,1)
+ .'</td>'
+ .'<td>'
+ .&Apache::edit::insertlist($target,$token)
+ .'</td>';
+ }
$result.='<td align="right" valign="top">' .
- &Apache::loncommon::helpLatexCheatsheet().
+ &Apache::loncommon::helpLatexCheatsheet().
&Apache::edit::end_row().
&Apache::edit::start_spanning_row()."\n".
&Apache::edit::editfield($token->[1],$text,"",80,8,1);