Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
- Several bugfixes for the cases where the SCORM player is in a popup…
… window. onunload is not called in that case but onbeforeunload is.

- Wrong manifest in case of rich scorm 1.2 manifest with more than 2 authors.
- Enables mcq for tracking
- changed button handling for quiz in flash and html5
- Added scorm tracking option to main LO (no tracking, minimal tracking and full tracking)
- Added optional weight parameter to enabled interactivities

git-svn-id: https://xerteonlinetoolkits.googlecode.com/svn/trunk@811 912cdd6b-5c7d-d5a7-a2ba-d0f0cdb91641
  • Loading branch information
torinfo committed Apr 19, 2013
1 parent c827599 commit f13ccf5
Show file tree
Hide file tree
Showing 10 changed files with 425 additions and 134 deletions.
2 changes: 1 addition & 1 deletion modules/xerte/parent_templates/Nottingham/Nottingham.rlt

Large diffs are not rendered by default.

Expand Up @@ -148,6 +148,10 @@ $(document).ready(function() {
x_getLangData(x_params.language);
// Setup nr of pages for tracking
XTSetOption('nrpages', x_pageInfo.length);
if (x_params.trackingMode != undefined)
{
XTSetOption('tracking-mode', x_params.trackingMode);
}
},
error: function() {
// can't have translation for this as if it fails to load we don't know what language file to use?
Expand Down
2 changes: 1 addition & 1 deletion modules/xerte/parent_templates/Nottingham/models/mcq.rlm
@@ -1 +1 @@
<PG title="Multiple Choice" name="mcq"> <SCR name="getPageID"><![CDATA[pageIcon = icon.parentNode.clip();if (rootIcon.projMode == "dev"){ // Page Wizard pageIcon.templateData = pageIcon.extXML.toObject(); pageIcon.templateData = pageIcon.templateData.pageWizard[0];} else { // Toolkits myXML = new XML(extXML.firstChild.childNodes[rootIcon.getPageIndex() - pgOffset]); pageIcon.templateData = myXML.toObject();} rootIcon.setTitleText(templateData.learningObject[0].name); // handle multiple page data definitions in a project if (rootIcon.projectPageIndex == undefined){ rootIcon.projectPageIndex = 0;}// check if this page has a definition for the current project index and default to 0 if notif (pageIcon.templateData.mcq[rootIcon.projectPageIndex].name == undefined){ projPI = 0;} else { projPI = rootIcon.projectPageIndex; } // set up text stringsif (pageIcon.templateData.mcq[projPI].checkBtnTxt != undefined){ checkBtnTxt = pageIcon.templateData.mcq[projPI].checkBtnTxt;} else { checkBtnTxt = "Check";}if (pageIcon.templateData.mcq[projPI].checkBtnTip != undefined){ checkBtnTip = pageIcon.templateData.mcq[projPI].checkBtnTip;} else { checkBtnTip = "Check Answer";}if (pageIcon.templateData.mcq[projPI].checkBtnWidth != undefined){ checkBtnWidth = pageIcon.templateData.mcq[projPI].checkBtnWidth;} else { checkBtnWidth = "100";}if (pageIcon.templateData.mcq[projPI].feedbackLabel != undefined){ feedbackLabel = pageIcon.templateData.mcq[projPI].feedbackLabel;} else { feedbackLabel = "Feedback";}align = pageIcon.templateData.mcq[projPI].align;panelWidth = pageIcon.templateData.mcq[projPI].panelWidth;if (panelWidth == "Small"){ panelW = 300; textW = 440;} else if (panelWidth == "Medium"){ panelW = 450; textW = 290;} else if (panelWidth == "Large"){ panelW = 600; textW = 140;} else { panelW = 760; textW = 0;}if (pageIcon.templateData.mcq[projPI].narration != undefined){ narration = pageIcon.templateData.mcq[projPI].narration; rootIcon.broadcast('showAudio');}]]></SCR> <DIS w="panelW" h="474" tabIndex="-1" id="panel" name="panel" x="align == 'Right' ? 20 : textW + 40" y="20" type="ext" url="templatePath + 'common/whitePanel.swf'"><![CDATA[]]></DIS> <DIS scrolling="auto" name="instruction" x="align == 'Right' ? panel._x + panelW + 20 : 20" y="panel._y" w="textW" h="474" type="text"><![CDATA[{pageIcon.templateData.mcq[projPI].instruction}]]></DIS> <DIS textColour="#000000" id="prpt" name="question" x="panel._x + 20" y="panel._y + 20" w="panelW - 40" h="10" type="text"><![CDATA[{pageIcon.templateData.mcq[projPI].prompt}]]></DIS> <SCR name="makeOptions"><![CDATA[ln = pageIcon.templateData.mcq[projPI].option.length;optionTracking = new Array();if (icon.attributes.built != "true"){ icon.nextSibling.childNodes[1].duplicate(pageIcon.templateData.mcq[projPI].option.length - 2); icon.attributes.built = "true";}//multi answer?if (pageIcon.templateData.mcq[projPI].type == 'Multiple Answer'){ for (i = 0; i < pageIcon.templateData.mcq[projPI].option.length; i++){ icon.nextSibling.childNodes[i].attributes.type="checkBox"; }}for (i = 0; i < ln; i++){ optionTracking[i] = 0; if (pageIcon.templateData.mcq[projPI].option[i].correct == 'true'){ icon.nextSibling.childNodes[i].attributes.correct = 1; } else { icon.nextSibling.childNodes[i].attributes.correct = 0; }}]]></SCR> <INT id="ques" name="buttonInteraction" perpetual="0"> <RES w="panelW - 60" textColour="#000000" name="protoOption" type="radio" x="prpt._x" y="prpt._y + prpt._height + 30" label="{pageIcon.templateData.mcq[projPI].option[icon.index()].text}" group="grp" erase="1" exit="0"> <SCR name="trackAnswers"><![CDATA[//track the questionif (pageIcon.templateData.mcq[projPI].type == 'Single Answer'){ for (i = 0; i < ln; i++){ optionTracking[i] = 0; } optionTracking[icon.parentNode.index()] = 1;} if (pageIcon.templateData.mcq[projPI].type == 'Multiple Answer'){ if (icon.parentNode.clip().getValue() == true){ optionTracking[icon.parentNode.index()] = 1; } else { optionTracking[icon.parentNode.index()] = 0; }} btnSubmit.setEnabled(true);fb = pageIcon.templateData.mcq[projPI].option[icon.parentNode.index()].feedback;]]></SCR> </RES> <RES w="panelW - 60" textColour="#000000" name="protoOption" type="radio" x="prpt._x" y="_ytile + 10" label="{pageIcon.templateData.mcq[projPI].option[icon.index()].text}" group="grp" erase="1" exit="0"> <SCR name="trackAnswers"><![CDATA[//track the questionif (pageIcon.templateData.mcq[projPI].type == 'Single Answer'){ for (i = 0; i < ln; i++){ optionTracking[i] = 0; } optionTracking[icon.parentNode.index()] = 1;} if (pageIcon.templateData.mcq[projPI].type == 'Multiple Answer'){ if (icon.parentNode.clip().getValue() == true){ optionTracking[icon.parentNode.index()] = 1; } else { optionTracking[icon.parentNode.index()] = 0; }} btnSubmit.setEnabled(true);fb = pageIcon.templateData.mcq[projPI].option[icon.parentNode.index()].feedback;]]></SCR> </RES> <RES w="checkBtnWidth" toolTip="{checkBtnTip}" enabled="0" rs="btnSubmit" swf="templatePath + 'common/button.swf'" name="button" type="button" x="prpt._x" y="_ytile + 10" label="{checkBtnTxt}" erase="1" exit="0"> <SCR name="makeFeedback"><![CDATA[//single answer feedbackfb = "";for (i = 0; i < ln; i++){ if (optionTracking[i] == 1){ fb += pageIcon.templateData.mcq[projPI].option[i].feedback + '\r\r'; }}if (pageIcon.templateData.mcq[projPI].feedback != undefined){ fb += pageIcon.templateData.mcq[projPI].feedback;}fb = '<b>' + feedbackLabel + '</b><br>' + fb;]]></SCR> <DIS scrolling="auto" textColour="#000000" name="feedback" x="btnSubmit._x" y="btnSubmit._y + 40" w="panelW - 40" h="474 - (btnSubmit._y + btnSubmit._height) - 10" type="text"><![CDATA[{fb}]]></DIS> </RES> </INT> </PG>
<PG title="Multiple Choice" name="mcq"> <SCR name="getPageID"><![CDATA[pageIcon = icon.parentNode.clip();if (rootIcon.projMode == "dev"){ // Page Wizard pageIcon.templateData = pageIcon.extXML.toObject(); pageIcon.templateData = pageIcon.templateData.pageWizard[0];} else { // Toolkits myXML = new XML(extXML.firstChild.childNodes[rootIcon.getPageIndex() - pgOffset]); pageIcon.templateData = myXML.toObject();} rootIcon.setTitleText(templateData.learningObject[0].name); // handle multiple page data definitions in a project if (rootIcon.projectPageIndex == undefined){ rootIcon.projectPageIndex = 0;}// check if this page has a definition for the current project index and default to 0 if notif (pageIcon.templateData.mcq[rootIcon.projectPageIndex].name == undefined){ projPI = 0;} else { projPI = rootIcon.projectPageIndex; } // set up text stringsif (pageIcon.templateData.mcq[projPI].checkBtnTxt != undefined){ checkBtnTxt = pageIcon.templateData.mcq[projPI].checkBtnTxt;} else { checkBtnTxt = "Check";}if (pageIcon.templateData.mcq[projPI].checkBtnTip != undefined){ checkBtnTip = pageIcon.templateData.mcq[projPI].checkBtnTip;} else { checkBtnTip = "Check Answer";}if (pageIcon.templateData.mcq[projPI].checkBtnWidth != undefined){ checkBtnWidth = pageIcon.templateData.mcq[projPI].checkBtnWidth;} else { checkBtnWidth = "100";}if (pageIcon.templateData.mcq[projPI].feedbackLabel != undefined){ feedbackLabel = pageIcon.templateData.mcq[projPI].feedbackLabel;} else { feedbackLabel = "Feedback";}if (pageIcon.templateData.mcq[projPI].singleRight != undefined){ singleRight = pageIcon.templateData.mcq[projPI].singleRight; } else { singleRight="Your answer is correct";}if (pageIcon.templateData.mcq[projPI].singleWrong != undefined){ singleWrong = pageIcon.templateData.mcq[projPI].singleWrong;} else { singleWrong="Your answer is incorrect";}if (pageIcon.templateData.mcq[projPI].multiRight != undefined){ multiRight = pageIcon.templateData.mcq[projPI].multiRight;} else { multiRight="You have selected all the correct answers"; }if (pageIcon.templateData.mcq[projPI].multiWrong != undefined){ multiWrong = pageIcon.templateData.mcq[projPI].multiWrong; } else { multiWrong="You have not selected the correct combination of answers"; }align = pageIcon.templateData.mcq[projPI].align;panelWidth = pageIcon.templateData.mcq[projPI].panelWidth;if (panelWidth == "Small"){ panelW = 300; textW = 440;} else if (panelWidth == "Medium"){ panelW = 450; textW = 290;} else if (panelWidth == "Large"){ panelW = 600; textW = 140;} else { panelW = 760; textW = 0;}if (pageIcon.templateData.mcq[projPI].narration != undefined){ narration = pageIcon.templateData.mcq[projPI].narration; rootIcon.broadcast('showAudio');}]]></SCR> <DIS w="panelW" h="474" tabIndex="-1" id="panel" name="panel" x="align == 'Right' ? 20 : textW + 40" y="20" type="ext" url="templatePath + 'common/whitePanel.swf'"><![CDATA[]]></DIS> <INT name="loadPanel" perpetual="0"> <RES name="onLoad" type="event" eventName="onLoad" icon="panel" erase="1" exit="1"> <SCR name="calculate"><![CDATA[//ok to move on]]></SCR> </RES> </INT> <DIS scrolling="auto" name="instruction" x="align == 'Right' ? panel._x + panelW + 20 : 20" y="panel._y" w="textW" h="474" type="text"><![CDATA[{pageIcon.templateData.mcq[projPI].instruction}]]></DIS> <DIS textColour="#000000" id="prpt" name="question" x="panel._x + 20" y="panel._y + 20" w="panelW - 40" h="10" type="text"><![CDATA[{pageIcon.templateData.mcq[projPI].prompt}]]></DIS> <SCR name="makeOptions"><![CDATA[ln = pageIcon.templateData.mcq[projPI].option.length;trackingWeight = 1.0;if (pageIcon.templateData.mcq[projPI].trackingWeight !- undefined){ trackingWeight = pageIcon.templateData.mcq[projPI].trackingWeight;}_level0.XTSetPageType(rootIcon.getPageIndex() - pgOffset + 1, 'numeric', 1, trackingWeight); optionTracking = new Array();if (icon.attributes.built != "true"){ icon.nextSibling.childNodes[1].duplicate(pageIcon.templateData.mcq[projPI].option.length - 2); icon.attributes.built = "true";}//multi answer?if (pageIcon.templateData.mcq[projPI].type == 'Multiple Answer'){ for (i = 0; i < pageIcon.templateData.mcq[projPI].option.length; i++){ icon.nextSibling.childNodes[i].attributes.type="checkBox"; }}correctOptions="";correctAnswer="";correctFeedback="";for (i = 0; i < ln; i++){ optionTracking[i] = 0; if (pageIcon.templateData.mcq[projPI].option[i].correct == 'true'){ icon.nextSibling.childNodes[i].attributes.correct = 1; if (correctAnswer.length > 0) { correctAnswer+=";"; correctOptions+=";"; } correctAnswer += pageIcon.templateData.mcq[projPI].option[i].text; correctOptions += String(i+1); if (correctFeedback.length > 0) { correctFeedback+="; "; } correctFeedback += pageIcon.templateData.mcq[projPI].option[i].feedback; } else { icon.nextSibling.childNodes[i].attributes.correct = 0; }}// Start interaction tracking_level0.XTEnterInteraction(rootIcon.getPageIndex() - pgOffset + 1, 0, 'multiplechoice', pageIcon.templateData.mcq[projPI].prompt, correctOptions, correctAnswer, correctFeedback)]]></SCR> <INT id="ques" name="buttonInteraction" perpetual="0"> <RES rs="firstOption" w="panelW - 60" textColour="#000000" name="protoOption" type="radio" x="prpt._x" y="prpt._y + prpt._height + 30" label="{pageIcon.templateData.mcq[projPI].option[icon.index()].text}" group="grp" erase="1" exit="0"> <SCR name="trackAnswers"><![CDATA[//track the questionif (pageIcon.templateData.mcq[projPI].type == 'Single Answer'){ for (i = 0; i < ln; i++){ optionTracking[i] = 0; } optionTracking[icon.parentNode.index()] = 1;} if (pageIcon.templateData.mcq[projPI].type == 'Multiple Answer'){ if (icon.parentNode.clip().getValue() == true){ optionTracking[icon.parentNode.index()] = 1; } else { optionTracking[icon.parentNode.index()] = 0; }} btnSubmit.setEnabled(true);]]></SCR> </RES> <RES w="panelW - 60" textColour="#000000" name="protoOption" type="radio" x="prpt._x" y="_ytile + 10" label="{pageIcon.templateData.mcq[projPI].option[icon.index()].text}" group="grp" erase="1" exit="0"> <SCR name="trackAnswers"><![CDATA[//track the questionif (pageIcon.templateData.mcq[projPI].type == 'Single Answer'){ for (i = 0; i < ln; i++){ optionTracking[i] = 0; } optionTracking[icon.parentNode.index()] = 1;} if (pageIcon.templateData.mcq[projPI].type == 'Multiple Answer'){ if (icon.parentNode.clip().getValue() == true){ optionTracking[icon.parentNode.index()] = 1; } else { optionTracking[icon.parentNode.index()] = 0; }} btnSubmit.setEnabled(true);]]></SCR> </RES> <RES w="checkBtnWidth" toolTip="{checkBtnTip}" enabled="0" rs="btnSubmit" swf="templatePath + 'common/button.swf'" name="button" type="button" x="prpt._x" y="_ytile + 10" label="{checkBtnTxt}" erase="1" exit="0"> <SCR name="makeFeedback"><![CDATA[fb = "";l_answer = "";l_options = "";feedback = "";for (i = 0; i < ln; i++){ if (optionTracking[i] == 1){ feedback += pageIcon.templateData.mcq[projPI].option[i].feedback + '\r\r'; if (l_answer.length > 0) { l_answer += ";"; l_options += ";"; } l_answer += pageIcon.templateData.mcq[projPI].option[i].text; l_options += String(i+1); }}//track the scorm score?if (ques.judge()){ answeredCorrect = true; score = 100.0;}else{ answeredCorrect = false; score = 0.0;}_level0.XTExitInteraction(rootIcon.getPageIndex() - pgOffset + 1, 0, answeredCorrect, l_options, l_answer, feedback);_level0.XTSetPageScore(rootIcon.getPageIndex() - pgOffset + 1, score);fb = '<b>' + feedbackLabel + '</b><br>';if (pageIcon.templateData.mcq[projPI].feedback != undefined){ fb += pageIcon.templateData.mcq[projPI].feedback;}fb += '<br>' + feedback + '<br>';if (pageIcon.templateData.mcq[projPI].type == 'Single Answer'){ if (answeredCorrect){ fb+= singleRight ; } else { fb += singleWrong; }} else { if (answeredCorrect){ fb+= multiRight; } else { fb += multiWrong; }}if (_level0.XTGetMode() == 'tracking'){ // Disable the options and the submit button btnSubmit.setEnabled(false); ln = pageIcon.templateData.mcq[projPI].option.length; for (i = 0; i < ln; i++){ firstOption.handlerObj.controls[i].setEnabled(false); }}]]></SCR> <DIS scrolling="auto" textColour="#000000" name="feedback" x="btnSubmit._x" y="btnSubmit._y + 40" w="panelW - 40" h="474 - (btnSubmit._y + btnSubmit._height) - 10" type="text"><![CDATA[{fb}]]></DIS> </RES> </INT> </PG>
Expand Down

0 comments on commit f13ccf5

Please sign in to comment.