[LON-CAPA-cvs] cvs: loncom /homework inputtags.pm /interface loncommon.pm /xml lontexconvert.pm

albertel lon-capa-cvs-allow@mail.lon-capa.org
Tue, 14 Aug 2007 19:32:45 -0000


albertel		Tue Aug 14 15:32:45 2007 EDT

  Modified files:              
    /loncom/interface	loncommon.pm 
    /loncom/xml	lontexconvert.pm 
    /loncom/homework	inputtags.pm 
  Log:
  - BUG#5370, need the popup previous tries window to use jamath if the the problem needed jsmath, so created a means to convey that
  
  
Index: loncom/interface/loncommon.pm
diff -u loncom/interface/loncommon.pm:1.561 loncom/interface/loncommon.pm:1.562
--- loncom/interface/loncommon.pm:1.561	Sat Aug 11 11:18:24 2007
+++ loncom/interface/loncommon.pm	Tue Aug 14 15:32:27 2007
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # a pile of common routines
 #
-# $Id: loncommon.pm,v 1.561 2007/08/11 15:18:24 www Exp $
+# $Id: loncommon.pm,v 1.562 2007/08/14 19:32:27 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -3397,6 +3397,9 @@
 
 =item * $args, optional argument valid values are
             no_auto_mt_title -> prevents &mt()ing the title arg
+            inherit_jsmath -> when creating popup window in a page,
+                              should it have jsmath forced on by the
+                              current page
 
 =back
 
@@ -3453,7 +3456,7 @@
 
 # construct main body tag
     my $bodytag = "<body $extra_body_attr>".
-	&Apache::lontexconvert::init_math_support();
+	&Apache::lontexconvert::init_math_support($args->{'inherit_jsmath'});
 
     if ($bodyonly) {
         return $bodytag;
@@ -4711,6 +4714,10 @@
 
                   no_auto_mt_title -> prevent &mt()ing the title arg
 
+                  inherit_jsmath -> when creating popup window in a page,
+                                    should it have jsmath forced on by the
+                                    current page
+
 =cut
 
 sub start_page {
Index: loncom/xml/lontexconvert.pm
diff -u loncom/xml/lontexconvert.pm:1.83 loncom/xml/lontexconvert.pm:1.84
--- loncom/xml/lontexconvert.pm:1.83	Tue Jun 19 16:10:55 2007
+++ loncom/xml/lontexconvert.pm	Tue Aug 14 15:32:35 2007
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # TeX Conversion Module
 #
-# $Id: lontexconvert.pm,v 1.83 2007/06/19 20:10:55 albertel Exp $
+# $Id: lontexconvert.pm,v 1.84 2007/08/14 19:32:35 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -203,6 +203,10 @@
 	return "\n".
 	    '<script type="text/javascript">jsMath.Process()</script>'."\n";
     }
+    sub jsMath_state {
+	my ($level) = @_;
+	return $jsMath_sent_header[$level];
+    }
 }
 
 sub tex_engine {
@@ -220,9 +224,11 @@
 }
 
 sub init_math_support {
+    my ($inherit_jsmath) = @_;
     &init_tth();
     &Apache::lontexconvert::jsMath_push();
-    if (lc(&tex_engine()) eq 'jsmath') {
+    if (lc(&tex_engine()) eq 'jsmath' ||
+	($inherit_jsmath && &jsMath_state(-2))) {
 	return &Apache::lontexconvert::jsMath_header();
     }
     return;
Index: loncom/homework/inputtags.pm
diff -u loncom/homework/inputtags.pm:1.228 loncom/homework/inputtags.pm:1.229
--- loncom/homework/inputtags.pm:1.228	Fri Aug  3 19:29:57 2007
+++ loncom/homework/inputtags.pm	Tue Aug 14 15:32:42 2007
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # input  definitons
 #
-# $Id: inputtags.pm,v 1.228 2007/08/03 23:29:57 albertel Exp $
+# $Id: inputtags.pm,v 1.229 2007/08/14 19:32:42 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1223,17 +1223,16 @@
 	&mt('Submitted Answer').'</th>';
     $output ='<table class="LC_prior_tries">'.$headers.$output.'</table>';
     #return $output;
-    $output=~s/\\/\\\\/g;
-    $output=~s/\'/\\\'/g;
-    $output=~s/\s+/ /g;
+    $output = &Apache::loncommon::js_ready($output); 
     $output.='<br /><form action=""><center><input type="button" name="close" value="'.&mt('Close Window').'" onClick="window.close()" /></center></form>';
 
     my $windowopen=&Apache::lonhtmlcommon::javascript_docopen();
     my $start_page =
 	&Apache::loncommon::start_page('Previous Tries', undef,
-				       {'only_body' => 1,
-					'bgcolor'   => '#FFFFFF',
-					'js_ready'  => 1,});
+				       {'only_body'      => 1,
+					'bgcolor'        => '#FFFFFF',
+					'js_ready'       => 1,
+				        'inherit_jsmath' => 1, });
     my $end_page =
 	&Apache::loncommon::end_page({'js_ready' => 1,});