[Building Sakai] Skin Selector in Test and Quizzes

McCullick, Philip Contractor, GDIT pcmccull at nps.edu
Mon Jun 3 08:29:12 PDT 2013


Hi Paul,

For the math skin, we used the portal.xslt file to include MathJax only on the Tests  & Quizzes pages. The Sakai headscripts.js makes an optional call to postIframeResize() if the method exists in the parent. So we used that callback to put the MathJax script into the quiz iframe each time it loads a page. It does have to scan the entire page for Latex tokens, so only classes that use a lot of complex Math use this skin.

The area we changed in the portal.xslt is inside of
<xsl:template name="tool">
                ...
                <div class="portletMainWrap">
<xsl:choose>
                ...
</ xsl:choose>
                                                The following xslt/JavaScript code was put here.

Here is the code we added:
                <!- Check for the Test & Quizzes tool -->
                <xsl:if test="contains($tool/toolHelp, 'samigo')">
                <!- Add a hidden input for the mainframe's id so scripts can point at it -->
                <input type="hidden"   id="mainFrameId">
                                <xsl:attribute name="value">
                                                <xsl:value-of select="$tool/escapedId"/>
                                </xsl:attribute>
                </input>

                <script type="text/javascript">
                // <![CDATA[
                var mainFrameID = document.getElementById("mainFrameId").value;
                var mathJaxLocation = "/library/js";

                //headscripts.js calls the postIframeResize method after resizing finishes
                function postIframeResize() {
                                var script = document.getElementById(mainFrameID).contentWindow.document.createElement("script");
                                script.type = "text/javascript";
                                script.src = mathJaxLocation + "/MathJax/MathJax.js?config=default";   // use the location of your MathJax folder
                                var config = 'MathJax.Hub.Startup.onload();';

                                if (window.opera) {
                                                script.innerHTML = config;
                                } else {
                                                script.text = config;
                                }
                                                                                                document.getElementById(mainFrameID).contentWindow.document.getElementsByTagName("head")[0].appendChild(script);
                }
                //]]>

                </script>
                </xsl:if>


Hope that helps,
Phil

___________________________________
Philip McCullick, Media Development Manager
General Dynamics Information Technology
Supporting the Center for Educational Design, Development, and Distribution (CED3)
Naval Postgraduate School
(831) 656-2443





From: sakai-dev-bounces at collab.sakaiproject.org [mailto:sakai-dev-bounces at collab.sakaiproject.org] On Behalf Of Paul Lukasewych
Sent: Friday, May 31, 2013 7:45 AM
To: sakai-dev at collab.sakaiproject.org; Help Desk
Subject: Re: [Building Sakai] Skin Selector in Test and Quizzes


I'm interested in the NPS Mathjax solution, so if anyone from NPS can provide more details that would be great.



Paul Lukasewych

Applications Development Team

Information Technology Services

Support Services Building

Western University

(519) 661-2111 x80513

plukasew at uwo.ca<mailto:plukasew at uwo.ca>



On May 31, 2013 10:32:51 Matthew Jones wrote:

In 2.9 (or 2.8 if you enable manually add it to CKEditor and upgrade textarea) there is support for for the fMath plugin (SAK-23266) which allows a user to import a latex file or latex plain text. This would probably be the easiest for instructors.



And I agree with Steve, most likely that specific local skin does something special to load up mathjax only for those sites that manually enable it. We didn't ever add Mathjax system wide because by default it has to either parse everything (which slows down the browsing experience) or has to parse specific div classes (which instructors wouldn't know about and nobody ever wrote a WYSIWYG editor plugin for).



On Fri, May 31, 2013 at 10:15 AM, Steve Swinsburg <steve.swinsburg at gmail.com<mailto:steve.swinsburg at gmail.com>> wrote:

Hi Paul,



The Skin selector tool is here:

https://source.sakaiproject.org/contrib/edia/skin-manager/



Though I dont think you need that for what you want, that document is specific to NPS and presumably the naval_math skin has the config for the math editor. So what you really want is to install the math editor.



cheers,

Steve



On Fri, May 31, 2013 at 8:49 PM, Paul Wando Mungai <paulwando at gmail.com<mailto:paulwando at gmail.com>> wrote:

Hi All,



We are trying to incorporate the Skin Selector into the Tests and Quizzes so that users can use Latex Math equations. We found this document that outlines the steps to accomplish this:



http://faculty.nps.edu/dl/tools/math_tool/MathTool_tutorial.pdf



However, we cannot find the tool source code, or configuration steps for this.

--
Regards,
Paul Mungai

"Ability is what youre capable of doing. Motivation determines what you do. Attitude determines how well you do it" By Lou Holtz, Notre Dame Football Coach



_______________________________________________
sakai-dev mailing list
sakai-dev at collab.sakaiproject.org<mailto:sakai-dev at collab.sakaiproject.org>
http://collab.sakaiproject.org/mailman/listinfo/sakai-dev

TO UNSUBSCRIBE: send email to sakai-dev-unsubscribe at collab.sakaiproject.org<mailto:sakai-dev-unsubscribe at collab.sakaiproject.org> with a subject of "unsubscribe"

_______________________________________________
sakai-dev mailing list
sakai-dev at collab.sakaiproject.org<mailto:sakai-dev at collab.sakaiproject.org>
http://collab.sakaiproject.org/mailman/listinfo/sakai-dev

TO UNSUBSCRIBE: send email to sakai-dev-unsubscribe at collab.sakaiproject.org<mailto:sakai-dev-unsubscribe at collab.sakaiproject.org> with a subject of "unsubscribe"




-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://collab.sakaiproject.org/pipermail/sakai-dev/attachments/20130603/0f213ac0/attachment.html 


More information about the sakai-dev mailing list