[LON-CAPA-cvs] cvs: doc /loncapafiles removenolongerused.piml loncom/auth lonacc.pm loncom/interface courseprefs.pm loncommon.pm lonpreferences.pm lonsyllabus.pm loncom/xml lontexconvert.pm lonxml.pm

raeburn raeburn at source.lon-capa.org
Fri Feb 19 19:12:55 EST 2016


raeburn		Sat Feb 20 00:12:55 2016 EDT

  Modified files:              
    /loncom/interface	courseprefs.pm loncommon.pm lonpreferences.pm 
                     	lonsyllabus.pm 
    /loncom/xml	lonxml.pm lontexconvert.pm 
    /loncom/auth	lonacc.pm 
    /doc/loncapafiles	removenolongerused.piml 
  Log:
  - Eliminate jsMath.
    Use MathJax instead in cases where jsMath use is indicated in a resource, 
    ina user's preferences, or in course preferences.
  
  
-------------- next part --------------
Index: loncom/interface/courseprefs.pm
diff -u loncom/interface/courseprefs.pm:1.74 loncom/interface/courseprefs.pm:1.75
--- loncom/interface/courseprefs.pm:1.74	Sun Sep 13 21:48:05 2015
+++ loncom/interface/courseprefs.pm	Sat Feb 20 00:12:39 2016
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Handler to set configuration settings for a course
 #
-# $Id: courseprefs.pm,v 1.74 2015/09/13 21:48:05 raeburn Exp $
+# $Id: courseprefs.pm,v 1.75 2016/02/20 00:12:39 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -3959,11 +3959,10 @@
                    input => 'selectbox',
                    options => {
                                 MathJax  => 'MathJax',
-                                jsMath   => 'jsMath',
                                 mimetex => &mt('Convert to Images'),
                                 tth      => &mt('TeX to HTML'),
                               },
-                   order  => ['MathJax','jsMath','mimetex','tth'],
+                   order  => ['MathJax','mimetex','tth'],
                    nullval => $mathdef,
                  },
         'tthoptions' => {
Index: loncom/interface/loncommon.pm
diff -u loncom/interface/loncommon.pm:1.1234 loncom/interface/loncommon.pm:1.1235
--- loncom/interface/loncommon.pm:1.1234	Fri Feb 19 02:39:07 2016
+++ loncom/interface/loncommon.pm	Sat Feb 20 00:12:39 2016
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # a pile of common routines
 #
-# $Id: loncommon.pm,v 1.1234 2016/02/19 02:39:07 raeburn Exp $
+# $Id: loncommon.pm,v 1.1235 2016/02/20 00:12:39 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -5482,9 +5482,6 @@
 
 =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
 
 =item * $advtoolsref, optional argument, ref to an array containing
             inlineremote items to be added in "Functions" menu below
@@ -5552,7 +5549,7 @@
 
 # construct main body tag
     my $bodytag = "<body $extra_body_attr>".
-	&Apache::lontexconvert::init_math_support($args->{'inherit_jsmath'});
+	&Apache::lontexconvert::init_math_support();
 
     &get_unprocessed_cgi($ENV{'QUERY_STRING'}, ['inhibitmenu']);
 
@@ -5705,7 +5702,6 @@
     unless ((ref($args) eq 'HASH') && ($args->{'notbody'})) {
         $endbodytag='</body>';
     }
-    $endbodytag=&Apache::lontexconvert::jsMath_process()."\n".$endbodytag;
     if ( exists( $env{'internal.head.redirect'} ) ) {
         if (!(ref($args) eq 'HASH' && $args->{'noredirectlink'})) {
 	    $endbodytag=
@@ -8126,9 +8122,6 @@
                                     head -> skip the <html><head> generation
                                     body -> skip all <body> generation
              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
              bread_crumbs ->             Array containing breadcrumbs
              bread_crumbs_component ->  if exists show it as headline else show only the breadcrumbs
              group          -> includes the current group, if page is for a 
Index: loncom/interface/lonpreferences.pm
diff -u loncom/interface/lonpreferences.pm:1.219 loncom/interface/lonpreferences.pm:1.220
--- loncom/interface/lonpreferences.pm:1.219	Wed Feb 17 19:15:48 2016
+++ loncom/interface/lonpreferences.pm	Sat Feb 20 00:12:39 2016
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Preferences
 #
-# $Id: lonpreferences.pm,v 1.219 2016/02/17 19:15:48 raeburn Exp $
+# $Id: lonpreferences.pm,v 1.220 2016/02/20 00:12:39 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -160,11 +160,13 @@
     my $domain     = $env{'user.domain'};
     my %userenv = &Apache::lonnet::get('environment',['texengine']);
     my $texengine=$userenv{'texengine'};
+    if (lc($texengine) eq 'jsmath') {
+        $texengine = 'MathJax';
+    }
 
     my %mathchoices=('' => 'Default',
 		     'tth' => 'tth (TeX to HTML)',
 		     #'ttm' => 'TeX to MathML',
-		     'jsMath' => 'jsMath',
 		     'MathJax' => 'MathJax',
 		     'mimetex' => 'mimetex (Convert to Images)',
                      'raw' => 'Raw (Screen Reader)'
@@ -176,7 +178,6 @@
                'texengine',
                \%mathchoices);
     my $MathJax_start=&Apache::lontexconvert::MathJax_header();
-    my $jsMath_start=&Apache::lontexconvert::jsMath_header();
     my %lt=&Apache::lonlocal::texthash(
       'headline' => 'Change how math is displayed',
       'preftxt'  => 'Preferred method to display math',
@@ -184,26 +185,10 @@
       'exmpl'    => 'Examples',
       'mathjax'  => 'MathJax:',
       'mathjaxinfo' => 'MathJax provides rendered equations whose source code can be extracted in TeX and MathML formats by right clicking the equation.',
-      'jsmath'   => 'jsMath:',
       'tth'      => 'tth (TeX to HTML):',
       'mimetex'  => 'mimetex (Convert to Images):',
     );
 
-    my $jsMathWarning='<p>'
-                     .'<div class="LC_warning">'
-                     .&mt("It looks like you don't have the TeX math fonts installed.")
-                     .'</div>'
-                     .'<div>'
-                     .&mt('The jsMath example on this page may not look right without them. '
-                         .'The [_1]jsMath Home Page[_2] has information on how to download the '
-                         .'needed fonts. In the meantime, jsMath will do the best it can '
-                         .'with the fonts you have, but it may not be pretty and some equations '
-                         .'may not be rendered correctly.'
-                         ,'<a href="http://www.math.union.edu/locate/jsMath/" target="_blank">'
-                         ,'</a>')
-                     .'</div>'
-                     .'</p>';
-
     $r->print(<<ENDLSCREEN);
 <h2>$lt{'headline'}</h2>
 <form name="prefs" action="/adm/preferences" method="post">
@@ -226,18 +211,6 @@
 $lt{'mathjaxinfo'}
 </p>
 
-<h3>$lt{'jsmath'}</h3> 
-<p>
-$jsMath_start
-<script type="text/javascript" language="JavaScript">
-if (jsMath.nofonts == 1) {
-    document.writeln($jsMathWarning);
-}
-
-</script>
-<iframe src="/res/adm/pages/math_example.tex?inhibitmenu=yes&texengine=jsMath" width="400" height="150"></iframe>
-</p>
-
 <h3>$lt{'mimetex'}</h3>
 <p>
 <iframe src="/res/adm/pages/math_example.tex?inhibitmenu=yes&texengine=mimetex" width="400" height="150"></iframe>
@@ -248,9 +221,6 @@
 <iframe src="/res/adm/pages/math_example.tex?inhibitmenu=yes&texengine=tth" width="400" height="150"></iframe>
 </p>
 ENDLSCREEN
-    if ($env{'environment.texengine'} ne 'jsMath') {
-	$r->print('<script type="text/javascript" language="JavaScript">jsMath.Process()</script>');
-    }
 }
 
 
@@ -261,6 +231,9 @@
 # Screenname
     my $newtexengine  = $env{'form.texengine'};
     $newtexengine=~s/[^\-\w]//g;
+    if (lc($newtexengine) eq 'jsmath') {
+        $newtexengine = 'MathJax';
+    }
     if ($newtexengine eq 'ttm') {
 	&Apache::lonnet::appenv({'browser.mathml' => 1});
     } else {
Index: loncom/interface/lonsyllabus.pm
diff -u loncom/interface/lonsyllabus.pm:1.139 loncom/interface/lonsyllabus.pm:1.140
--- loncom/interface/lonsyllabus.pm:1.139	Tue Jan 26 14:30:25 2016
+++ loncom/interface/lonsyllabus.pm	Sat Feb 20 00:12:40 2016
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Syllabus
 #
-# $Id: lonsyllabus.pm,v 1.139 2016/01/26 14:30:25 raeburn Exp $
+# $Id: lonsyllabus.pm,v 1.140 2016/02/20 00:12:40 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -125,8 +125,13 @@
                     if ($target eq 'tex') {
                         $r->print($filecontents);
                     } else {
-                        my $result = &Apache::lontexconvert::converted(\$filecontents,
-                                                                       $env{'form.texengine'});
+                        my $texengine = $env{'form.texengine'};
+                        if ($texengine eq '') {
+                            $texengine = 'tth';
+                        } elsif (lc($texengine) eq 'jsmath') {
+                            $texengine = 'MathJax';
+                        }
+                        my $result = &Apache::lontexconvert::converted(\$filecontents,$texengine);
                         my %args;
                         &get_breadcrumbs($cdom,$cnum,$crstype,\%args);
                         if ($env{'form.only_body'}) {
Index: loncom/xml/lonxml.pm
diff -u loncom/xml/lonxml.pm:1.554 loncom/xml/lonxml.pm:1.555
--- loncom/xml/lonxml.pm:1.554	Fri Apr 17 12:34:12 2015
+++ loncom/xml/lonxml.pm	Sat Feb 20 00:12:45 2016
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # XML Parser Module 
 #
-# $Id: lonxml.pm,v 1.554 2015/04/17 12:34:12 droeschl Exp $
+# $Id: lonxml.pm,v 1.555 2016/02/20 00:12:45 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1528,7 +1528,6 @@
                (''        => '',
                 'tth'     => 'tth (TeX to HTML)',
                 'MathJax' => 'MathJax',
-  		'jsMath'  => 'jsMath',
                 'mimetex' => 'mimetex (Convert to Images)')}).
      '</span>';
     return $output;
Index: loncom/xml/lontexconvert.pm
diff -u loncom/xml/lontexconvert.pm:1.117 loncom/xml/lontexconvert.pm:1.118
--- loncom/xml/lontexconvert.pm:1.117	Fri Jan 22 22:31:51 2016
+++ loncom/xml/lontexconvert.pm	Sat Feb 20 00:12:45 2016
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # TeX Conversion Module
 #
-# $Id: lontexconvert.pm,v 1.117 2016/01/22 22:31:51 damieng Exp $
+# $Id: lontexconvert.pm,v 1.118 2016/02/20 00:12:45 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -309,77 +309,35 @@
     #}
 }
 
-
-sub jsMath_converted {
-    my $texstring=shift;
-    my $tag='span';
-    if (&displaystyle($texstring)) { $tag='div'; }
-    &clean_out_math_mode($texstring);
-    return &jsMath_header().
-	'<'.$tag.' class="math">'.$$texstring.'</'.$tag.'>';
-}
-
-{
-    my @jsMath_sent_header;
-    sub jsMath_reset {
-	undef(@jsMath_sent_header);
-    }
-    sub jsMath_push {
-	push(@jsMath_sent_header,0);
-    }
-    sub jsMath_header {
-	if (!@jsMath_sent_header) {
-	    &Apache::lonnet::logthis("mismatched calls of jsMath_header and jsMath_process");
-	    return '';
-	}
-	return '' if $jsMath_sent_header[-1];
-	$jsMath_sent_header[-1]=1;
-	return
-            '<script type="text/javascript">
-                     function NoFontMessage () {}
-                     jsMath = {Parser: {prototype: {environments: {\'eqnarray*\' :[\'Array\',null,null,\'rcl\',[5/18,5/18],3,\'D\']}}}};
-                   </script>'."\n".
-	    '<script type="text/javascript" src="/adm/jsMath/jsMath.js"></script>'."\n";
-    }
-    sub jsMath_process {
-	my $state = pop(@jsMath_sent_header);
-	return '' if !$state;
-	return "\n".
-	    '<script type="text/javascript">jsMath.Process()</script>'."\n";
-    }
-    sub jsMath_state {
-	my ($level) = @_;
-	return $jsMath_sent_header[$level];
-    }
-}
-
 sub tex_engine {
     if (exists($env{'form.texengine'})) {
 	if ($env{'form.texengine'} ne '') {
+            if (lc($env{'form.texengine'}) eq 'jsmath') {
+                return 'MathJax'; 
+            }
             return $env{'form.texengine'};
         }
     }    
     if ($env{'request.course.id'}
 	&& exists($env{'course.'.$env{'request.course.id'}.'.texengine'})) {
+        if (lc($env{'course.'.$env{'request.course.id'}.'.texengine'}) eq 'jsmath') {
+            return 'MathJax';
+        }
 	return $env{'course.'.$env{'request.course.id'}.'.texengine'};
     }
     if (exists($env{'environment.texengine'})) {
+        if (lc($env{'environment.texengine'}) eq 'jsmath') {
+            return 'MathJax';
+        }
 	return $env{'environment.texengine'};
     }
     return 'tth';
 }
 
 sub init_math_support {
-    my ($inherit_jsmath) = @_;
     &init_tth();
-    &Apache::lontexconvert::jsMath_push();
-    if (lc(&tex_engine()) eq 'jsmath' ||
-	($inherit_jsmath && &jsMath_state(-2))) {
-	return &Apache::lontexconvert::jsMath_header();
-    }
     &Apache::lontexconvert::MathJax_push();
-    if (lc(&tex_engine()) eq 'mathjax') { # ||
-        #($inherit_jsmath && &jsMath_state(-2))) {
+    if (lc(&tex_engine()) eq 'mathjax') {
         return &Apache::lontexconvert::MathJax_header();
     }
     return;
@@ -441,7 +399,7 @@
     if ($mode =~ /tth/i) {
 	return &tth_converted($string);
     } elsif ($mode =~ /jsmath/i) {
-	return &jsMath_converted($string);
+        return &MathJax_converted($string);
     } elsif ($mode =~ /mathjax/i) {
 	return &MathJax_converted($string);
     } elsif ($mode =~ /mimetex/i) {
@@ -652,14 +610,10 @@
 =item displaystyle()
 
 
-=item jsMath_converted()
-
 =item MathJax_converted()
-	- Mimics the jsMath functionality
 
 =item tex_engine()
 
-
 =item init_math_support()
 
 =item mimetex_valign()
Index: loncom/auth/lonacc.pm
diff -u loncom/auth/lonacc.pm:1.162 loncom/auth/lonacc.pm:1.163
--- loncom/auth/lonacc.pm:1.162	Thu Dec  3 20:40:21 2015
+++ loncom/auth/lonacc.pm	Sat Feb 20 00:12:49 2016
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Cookie Based Access Handler
 #
-# $Id: lonacc.pm,v 1.162 2015/12/03 20:40:21 damieng Exp $
+# $Id: lonacc.pm,v 1.163 2016/02/20 00:12:49 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -109,7 +109,6 @@
     my ($r)=@_;
     if (! $r->is_initial_req()) { return DECLINED; }
     &Apache::lonnet::save_cache();
-    &Apache::lontexconvert::jsMath_reset();
     return OK;
 }
 
Index: doc/loncapafiles/removenolongerused.piml
diff -u doc/loncapafiles/removenolongerused.piml:1.12 doc/loncapafiles/removenolongerused.piml:1.13
--- doc/loncapafiles/removenolongerused.piml:1.12	Mon Sep 21 14:24:34 2015
+++ doc/loncapafiles/removenolongerused.piml	Sat Feb 20 00:12:54 2016
@@ -35,7 +35,8 @@
               'londocroot' => ['adm/lonLCDfont',
                                   'htmlarea',
                                   'res/adm/pages/bookmarkmenu',
-                                  'res/adm/pages/reactionresponse'],
+                                  'res/adm/pages/reactionresponse',
+                                  'adm/jsMath'],
            );
 
 my %multis = (


More information about the LON-CAPA-cvs mailing list