Skip to content

Commit

Permalink
SAK-25979 - MathJax can not be rendered in Home synoptic tools (sakai…
Browse files Browse the repository at this point in the history
  • Loading branch information
jonespm authored and buckett committed May 16, 2017
1 parent 7cc6c23 commit e472a54
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 14 deletions.
4 changes: 4 additions & 0 deletions portal/portal-tool/tool/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
</dependency>
</dependencies>

<build>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import org.apache.commons.lang3.StringUtils;

import org.sakaiproject.component.cover.ServerConfigurationService;
import org.sakaiproject.exception.IdUnusedException;
import org.sakaiproject.exception.PermissionException;
Expand Down Expand Up @@ -308,21 +311,15 @@ protected void setupForward(HttpServletRequest req, HttpServletResponse res,

if (site != null)
{
String strMathJaxEnabled = site.getProperties().getProperty(MATHJAX_ENABLED);
if (strMathJaxEnabled != null)
{
String [] strMathJaxTools = strMathJaxEnabled.split(",");
List<String> mathJaxTools = Arrays.asList(strMathJaxTools);
if (mathJaxTools != null)
String strMathJaxEnabledForSite = site.getProperties().getProperty(MATHJAX_ENABLED);
if (!StringUtils.isBlank(strMathJaxEnabledForSite))
{
if (Boolean.valueOf(strMathJaxEnabledForSite))
{
String toolId = toolConfig.getTool().getId();
if (toolId != null && mathJaxTools.contains(toolId))
{
// this call to MathJax.Hub.Config seems to be needed for MathJax to work in IE
headJs += "<script type=\"text/x-mathjax-config\">\nMathJax.Hub.Config({\ntex2jax: { inlineMath: [['\\\\(','\\\\)']] }\n});\n</script>\n";
headJs += "<script src=\"" + MATHJAX_SRC_PATH + "\" language=\"JavaScript\" type=\"text/javascript\"></script>\n";
}
}
// this call to MathJax.Hub.Config seems to be needed for MathJax to work in IE
headJs += "<script type=\"text/x-mathjax-config\">\nMathJax.Hub.Config({\ntex2jax: { inlineMath: [['\\\\(','\\\\)']] }\n});\n</script>\n";
headJs += "<script src=\"" + MATHJAX_SRC_PATH + "\" language=\"JavaScript\" type=\"text/javascript\"></script>\n";
}
}
}
}
Expand Down

0 comments on commit e472a54

Please sign in to comment.