[Building Sakai] Skin Selector in Test and Quizzes

Paul Lukasewych plukasew at uwo.ca
Mon Jul 15 09:47:00 PDT 2013


Hi Phil,

I'm just starting to work on this now and I'm having trouble locating the portal.xslt file 
you are referring to. Which project is it in? Is the NPS source code available anywhere I 
could look at?

Thanks,

Paul Lukasewych
Applications Development Team
Information Technology Services
Support Services Building
Western University
(519) 661-2111 x80513
plukasew at uwo.ca

On June 3, 2013 15:29:12 McCullick, Philip Contractor, GDIT wrote:


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.getElementsByT
agName("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[1]

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[2]> 
wrote:
Hi Paul,
 
The Skin selector tool is here:
https://source.sakaiproject.org/contrib/edia/skin-manager/[3]
 
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://collab.sakaiproject.org/pipermail/sakai-dev/attachments/20130715/b8bd86ca/attachment.html 


More information about the sakai-dev mailing list