==================================================
-This is v2.3.0 of the HotPot module for Moodle 1.8
+This is v2.4.1 of the HotPot module for Moodle 1.9
==================================================
This module allows teachers to administer Hot Potatoes and TexToys quizzes via Moodle.
It has been tested on:
- Hot Potatoes 6
- - Moodle 1.8
- - PHP 4.1 thru 5.1.2
+ - Moodle 1.9
+ - PHP 4.1 thru 5.2
- MySQL 4.x thru 5.0
- PostgreSQL 7.3 thru 8.2
JQuiz[5] = false; // show number of checks of incorrect answers (legacy field superceded by [12])
// HP6 v6 quizzes only
JQuiz[6] = false; // show answer value (false) or A,B,C... index (true)
- JQuiz[7] = true; // show all students answers
+ JQuiz[7] = false; // show all students answers
JQuiz[8] = true; // show student's wrong answers
JQuiz[9] = true; // show ignored answers (not relevant for multi-select questions)
JQuiz[10] = true; // show score weightings
if (Login[0]) { // user name
var v = getCookie(self, 'UserName');
html += '<tr>'
- + '<th align="right" nowrap="nowrap" scope="row">' + MSG[0] + ' :</th>'
+ + '<th align=right nowrap>' + MSG[0] + ' :</th>'
+ '<td>'
;
if (typeof(Login[0])=='boolean') { // text box
- html += '<input type="text" name="UserName" value="' + v + '" />';
+ html += '<input type=text name=UserName value="' + v + '">';
} else { // drop down menu of names
// pattern to match commas and white space
var comma = (window.RegExp) ? new RegExp('\\s*,\\s*') : ',';
if (typeof(Login[0])=='string') {
Login[0] = Login[0].split(comma);
}
- html += '<select name="UserName" size="1">'
+ html += '<select name=UserName size=1>'
+ '<option value=""></option>'
;
for(var i=0; i<Login[0].length; i++) {
}
if (Login[1]) { // user ID
var v = getCookie(self, 'UserID');
- html += '<tr><th align="right" nowrap="nowrap" scope="row">' + MSG[1] + ' :</th><td><input type="text" name="UserID" value="' + v + '" /></td></tr>';
+ html += '<tr><th align=right nowrap>' + MSG[1] + ' :</th><td><input type=text name=UserID value="' + v + '"></td></tr>';
}
if (Login[2]) { // user email
var v = getCookie(self, 'UserEmail');
- html += '<tr><th align="right" nowrap="nowrap" scope="row">' + MSG[2] +' :</th><td><input type="text" name="UserEmail" value="' + v + '" /></td></tr>';
+ html += '<tr><th align=right nowrap>' + MSG[2] +' :</th><td><input type=text name=UserEmail value="' + v + '"></td></tr>';
}
if (Login[3]) { // quiz password
var v = getCookie(self, 'Password');
- html += '<tr><th align="right" nowrap="nowrap" scope="row">' + MSG[3] + ' :</th><td><input type="password" name="Password" value="' + v + '" /></td></tr>';
+ html += '<tr><th align=right nowrap>' + MSG[3] + ' :</th><td><input type=password name=Password value="' + v + '"></td></tr>';
}
if (Login[4]) { // cookie lifespan
var v = getCookie(self, 'CookieExpiry');
html += '<tr>'
- + '<th align="right" nowrap="nowrap" scope="row">' + MSG[4] + ' :</th>'
+ + '<th align=right nowrap>' + MSG[4] + ' :</th>'
+ '<td>'
+ '<select name="CookieExpiry" size=1>'
+ makeOption('session', v, MSG[7])
;
}
html += '<tr>'
- + '<th scope="row"> </th>'
+ + '<th> </th>'
+ '<td nowrap>'
- + '<input type="submit" value="' + MSG[5] + '" /> '
- + '<input type="button" value="' + MSG[6] + '" onClick="opener.goBack();self.close();" />'
+ + '<input type=submit value="' + MSG[5] + '"> '
+ + '<input type=button value="' + MSG[6] + '" onClick="opener.goBack();self.close();">'
+ '</td>'
+ '</tr>'
+ '</table></form></body></html>'
sDetails += hpHiddenField('email', window.UserEmail);
}
if (sDetails && window.RegExp) {
- // insert sDetails before '<input...Score... /></input>'
+ // insert sDetails before '<input...Score...></input>'
var r = new RegExp('<input[^>]*Score[^>]*><\\/input>', 'i');
var m = r.exec(ResultForm);
if (m) {
var x = new Array();
} else {
// get required part of 'x' and convert to array
- var i = x.lastIndexOf('|');
- var x = x.substring((flag==2 ? (i+1) : 1), ((flag==0 || flag==2) ? x.length : i)).split('|');
+ if (x.charAt(0)=='|') {
+ // HP 6.0 and 6.1 (always has leading bar)
+ var i = x.lastIndexOf('|');
+ var x = x.substring((flag==2 ? (i+1) : 1), ((flag==0 || flag==2) ? x.length : i)).split('|');
+ } else {
+ // HP 6.2 (no leading delimiter)
+ var i = x.lastIndexOf(' | ');
+ var x = x.substring((flag==2 ? (i+3) : 0), ((flag==0 || flag==2) ? x.length : i)).split(' | ');
+ }
}
for (var i=0; i<x.length; i++) {
var a = new Array();
x[i] = a.join('+');
}
} else if (x) { // multiple-choice, short-answer and hybrid
- // remove trailing comma and convert to array
- x = x.substring(0, x.length-1).split(',');
+ if (x.charAt(x.length-1)==',') {
+ // HP 6.0 and 6.1 (always has trailing comma)
+ x = x.substring(0, x.length-1).split(',');
+ } else {
+ // HP 6.2 (short answer also contains student entered text)
+ x = x.split(' | ');
+ }
if (flag) {
var a = new Array();
if (flag==1 || flag==2 || flag==3) {
for (var i=0; i<x.length; i++) {
- var ii = I[q][3][(x[i].charCodeAt(0)-65)][2];
- if(((flag==1 || flag==2) && ii==1) || (flag==3 && ii==0)) a.push(x[i]);
+ var is_correct = false;
+ if (x[i].length==1) { // single letter
+ var ii = x[i].charCodeAt(0) - 65;
+ if (I[q][3] && I[q][3][ii] && I[q][3][ii][2]) {
+ var is_correct = true;
+ }
+ }
+ if (is_correct) {
+ if (flag==2) {
+ a.push(x[i]);
+ }
+ } else {
+ if (flag==1 || flag==3) {
+ a.push(x[i]);
+ }
+ }
}
}
if (flag==1) {
// convert answer indexes to values, if required
if (JQuiz[6]==false) {
for (var i=0; i<x.length; i++) {
- var ii = x[i].charCodeAt(0) - 65;
- x[i] = I[q][3][ii][0];
+ if (x[i].length==1) { // single letter
+ var ii = x[i].charCodeAt(0) - 65;
+ if (I[q][3] && I[q][3][ii]) {
+ x[i] = I[q][3][ii][0];
+ }
+ }
}
}
} else {
}
function hpClickCheck(hp, t, v, args) {
if (t==2) { // JCloze
- if (v==5 || v==6) {
+ if (v==5 || v==6) {
var r = hpRottmeier();
var already_correct = 'true';
if (r==0) {
}
}
}
- return true;
+ //return true;
}
function hpClickCheckJCrossV5V6(hp, v, AD, q, row, col) {
// v is the version of Hot Potatoes
}
field = '<field><fieldname>' + name + '</fieldname><fielddata>' + value + '</fielddata></field>';
} else {
- field = '<input type=hidden name="' + name + '" value="' + value + '" />';
+ field = '<input type=hidden name="' + name + '" value="' + value + '">';
}
return field;
}
}
return s;
}
-function getArgsStr(args) {
+function getArgsStr(args, addQuotes) {
// make s(tring) version of function args array
var s = '';
var i_max = args.length;
for (var i=0; i<i_max; i++) {
- s += '"' + args[i] + '",';
+ if (addQuotes) {
+ s += '"' + args[i] + '",';
+ } else {
+ if (s) {
+ s += ',';
+ }
+ s += args[i];
+ }
}
return s;
}
html += '<html><body>'
+ '<form action="' + FEEDBACK[0] + '" method="POST">'
+ '<table border="0">'
- + '<tr><th valign="top" align="right" scope="row">' + FEEDBACK[7] + ':</th><td>' + document.title + '</td></tr>'
- + '<tr><th valign="top" align="right" scope="row">' + FEEDBACK[8] + ': </th><td>'
+ + '<tr><th valign="top" align="right">' + FEEDBACK[7] + ':</th><td>' + document.title + '</td></tr>'
+ + '<tr><th valign="top" align="right">' + FEEDBACK[8] + ': </th><td>'
;
if (typeof(FEEDBACK[1])=='string') {
html += FEEDBACK[1] + hpHiddenField('recipient', FEEDBACK[1], ',', true);
}
}
html += '</td></tr>'
- + '<tr><th valign="top" align="right" scope="row">' + FEEDBACK[9] + ':</th>'
+ + '<tr><th valign="top" align="right">' + FEEDBACK[9] + ':</th>'
+ '<td><TEXTAREA name="message" rows="10" cols="40"></TEXTAREA></td></tr>'
- + '<tr><td> </td><td><input type="submit" value="' + FEEDBACK[6] + '" />'
+ + '<tr><td> </td><td><input type="submit" value="' + FEEDBACK[6] + '">'
+ hpHiddenField('realname', FEEDBACK[2], ',', true)
+ hpHiddenField('email', FEEDBACK[3], ',', true)
+ hpHiddenField('subject', document.title, ',', true)
var i_max = FEEDBACK[1].length;
if (i_max>1) { // several teachers
html += '<html><body>'
- + '<form action="' + FEEDBACK[0] + '" method="post" onsubmit="this.action+=this.recipient.options[this.recipient.selectedIndex].value">'
+ + '<form action="' + FEEDBACK[0] + '" method="POST" onsubmit="this.action+=this.recipient.options[this.recipient.selectedIndex].value">'
+ '<table border="0">'
- + '<tr><th valign="top" align="right" scope="row">' + FEEDBACK[7] + ':</th><td>' + document.title + '</td></tr>'
- + '<tr><th valign="top" align="right" scope="row">' + FEEDBACK[8] + ': </th><td>'
+ + '<tr><th valign="top" align="right">' + FEEDBACK[7] + ':</th><td>' + document.title + '</td></tr>'
+ + '<tr><th valign="top" align="right">' + FEEDBACK[8] + ': </th><td>'
;
html += '<select name="recipient">';
for (var i=0; i<i_max; i++) {
}
html += '</select>';
html += '</td></tr>'
- + '<tr><td> </td><td><input type="submit" value="' + FEEDBACK[6] + '" />'
+ + '<tr><td> </td><td><input type="submit" value="' + FEEDBACK[6] + '">'
+ '</td></tr></table></form></body></html>'
;
} else if (i_max==1) { // one teacher
// ********************
// intercept clicks
// ********************
+function hpNewFunction(f, a, s) {
+ if (window.C && C.safari) {
+ if (f=='CheckAnswers') {
+ if (s.indexOf('TotalChars-State[i].HintsAndChecks/')>=0) {
+ // special fix for "CheckAnswers" in JCloze
+ s = s.replace(/TotalChars-State\[i\]\.HintsAndChecks/g, '(TotalChars-State[i].HintsAndChecks)');
+ }
+ if (s.indexOf('CorrectLetters-Penalties/')>=0) {
+ // special fix for "CheckAnswers" in JMatch
+ s = s.replace(/CorrectLetters-Penalties/g, '(CorrectLetters-Penalties)');
+ }
+ if (s.indexOf('TotCorrectChoices-Penalties/')>=0) {
+ // special fix for "CheckAnswers" in JMix (v6)
+ s = s.replace(/TotCorrectChoices-Penalties/g, '(TotCorrectChoices-Penalties)');
+ }
+ if (s.indexOf('TotalCorrect-Penalties/')>=0) {
+ // special fix for "CheckAnswers" in JMix (v6+) Drag-and_Drop
+ s = s.replace(/TotalCorrect-Penalties/g, '(TotalCorrect-Penalties)');
+ }
+ }
+ if (s.indexOf('replace(\\[')>=0) {
+ s = s.replace(/\\\[/g, '/\\[');
+ s = s.replace(/\\\]/g, '\\]/g');
+ }
+ if (s.indexOf('for (i')>=0) {
+ s = s.replace(/for \(/g, 'for (var ');
+ }
+ eval('window.' + f + '=function(' + getArgsStr(a) + '){' + s + '}');
+ } else {
+ eval('window.' + f + '=new Function(' + getArgsStr(a, true) + 's);');
+ }
+}
function hpInterceptFeedback() {
// modify the function which writes feedback
// v6: ShowMessage(Feedback)
if (a[0] && window.FEEDBACK && FEEDBACK[0]) {
s = a[0] + "+='<br /><br />" + '<a href="javascript:hpFeedback();">' + FEEDBACK[6] + "</A>';" + s;
}
- eval('window.' + f + '=new Function(' + getArgsStr(a) + 's);');
+ hpNewFunction(f, a, s);
}
}
function hpInterceptHints() {
// add the e(x)tra code, if any, to the start of the hint (f)unction
if (x) {
var s = getFuncCode(f, x, '', true);
- eval('window.' + f + '=new Function(' + getArgsStr(a) + 's);');
+ hpNewFunction(f, a, s);
}
}
function hpInterceptClues() {
// add the e(x)tra code, if any, to the start of the clue (f)unction
if (x) {
var s = getFuncCode(f, x, '', true);
- eval('window.' + f + '=new Function(' + getArgsStr(a) + 's);');
+ var s = getFuncCode(f, '', '', true);
+ hpNewFunction(f, a, s);
}
}
function hpInterceptChecks() {
if (x) {
x = "if(!Finished&&State[QNum].length&&State[QNum][0]<0){" + x + "hpClick(3,args)}";
var s = getFuncCode(f[i], x, '', true);
- eval('window.' + f[i] + '=new Function(' + getArgsStr(a) + 's);');
+ hpNewFunction(f[i], a, s);
}
}
}
}
if (f) {
var s = getFuncCode(f, x, '', true);
- eval('window.' + f + '=new Function(' + getArgsStr(a) + 's);');
+ hpNewFunction(f, a, s);
}
// JMatch has three possible check functions, depending on the version
// (NB: other quiz types also have these functions)
var a = getFuncArgs(f[i], true);
if (a.length==0) {
var s = getFuncCode(f[i], "hpClick(3);", '', true);
- eval('window.' + f[i] + '=new Function(' + getArgsStr(a) + 's);');
+ hpNewFunction(f[i], a, s);
break; // out of the loop
}
}
} else if (t==3) { // jcross
if (v==3) x = hpScoreEngine(1, CorrectAnswers, "document.QuizForm.elements[i*2].selectedIndex==a[i]");
else if (v==4) x = hpScoreEngine(1, WinLetters, "ConvertCase(GetBoxValue(i),1).charAt(0)==a[i].charAt(0)");
- else if (v==5 || v==6) x = hpScoreEngine(1, L, "", "L[i]", "L[i][ii] && L[i][ii]==G[i][ii]", "L[i][ii]");
+ else if (v==5 || v==6) {
+ if (window.CaseSensitive) { // HP 6.2
+ x = hpScoreEngine(1, L, "", "L[i]", "L[i][ii] && L[i][ii]==G[i][ii]", "L[i][ii]");
+ } else {
+ x = hpScoreEngine(1, L, "", "L[i]", "L[i][ii] && L[i][ii].toUpperCase()==G[i][ii].toUpperCase()", "L[i][ii]");
+ }
+ }
} else if (t==4) { // jmatch
if (v==3) x = hpScoreEngine(1, CorrectAnswers, "document.QuizForm.elements[i*2].selectedIndex==a[i]");
else if (v==4) x = hpScoreEngine(1, Draggables, "a[i].correct=='1'");
} else if (t==3) { // jcross
if (v==3) x = hpFinishedEngine(document.Crossword.elements, "ConvertCase(is.mac?unescape(MacStringToWin(a[i].value)):a[i].value,1)!=Letters[i]");
else if (v==4) x = hpFinishedEngine(WinLetters, "ConvertCase(GetBoxValue(i),1).charAt(0) != a[i].charAt(0)");
- else if (v==5 || v==6) x = hpFinishedEngine(L, "", "L[i]", "L[i][ii] && L[i][ii]!=G[i][ii]");
+ else if (v==5 || v==6) {
+ if (window.CaseSensitive) { // 6.2
+ x = hpFinishedEngine(L, "", "L[i]", "L[i][ii] && L[i][ii]!=G[i][ii]");
+ } else {
+ x = hpFinishedEngine(L, "", "L[i]", "L[i][ii] && L[i][ii].toUpperCase()!=G[i][ii].toUpperCase()");
+ }
+ }
} else if (t==4) { // jmatch
if (v==3) x = hpFinishedEngine(CorrectAnswers, "document.QuizForm.elements[i*2].selectedIndex != a[i]");
else if (v==4) x = hpFinishedEngine(Draggables, "a[i].correct!='1'");
// **************
// initialization
// **************
-hpInterceptFeedback();
-hpInterceptHints();
-hpInterceptClues();
+//hpInterceptFeedback();
+//hpInterceptHints();
+//hpInterceptClues();
hpInterceptChecks();
function hpFindForm(formname, w) {
if (w==null) w = self;
var p = getPrompt(window.GetUserName || window.StartUp);
var c = getStartUpCode(window.StartUp);
if (p && c) {
- window.StartUp = new Function('QuizLogin("' + p + '")');
- window.StartQuiz = new Function(c);
+ if (window.C && C.safari) {
+ eval('window.StartUp=function(){QuizLogin("' + p + '")}');
+ eval('window.StartQuiz=function(){' + c + '}');
+ } else {
+ window.StartUp = new Function('QuizLogin("' + p + '")');
+ window.StartQuiz = new Function(c);
+ }
// "QuizLogin" finshes by calling "StartQuiz"
}
// reassign the SendResults function
// [1] the full block name (including optional leading 'str' or 'incl')
// [2] leading 'incl' or 'str', if any
// [3] the real block name ([1] without [2])
- $search = '/\[\/((incl|str)?(\w+))\]/';
+ $search = '/\[\/((incl|str)?((?:\w|\.)+))\]/';
preg_match_all($search, $this->$tag, $names);
$i_max = count($names[0]);
for ($i=0; $i<$i_max; $i++) {
- $method = $this->parent->template_dir.'_expand_'.$names[3][$i];
+ $method = $this->parent->template_dir.'_expand_'.str_replace('.', '', $names[3][$i]);
if (method_exists($this, $method)) {
eval('$value=$this->'.$method.'();');
$search = '/\['.$names[1][$i].'\](.*?)\[\/'.$names[1][$i].'\]/s';
return $this->v6_expand_NavButtons();
}
+ // switch off scorm
+ function v6_expand_Scorm12() {
+ return false;
+ }
+
// js files (all quiz types)
function v6_expand_JSBrowserCheck() {
<!--
+[inclScorm1.2]
+[strJSScorm_1_2]
+[/inclScorm1.2]
+
[strJSBrowserCheck]
[strJSButtons]
</head>
-<body onload="TimerStartUp()" id="TheBody">
+<body onload="TimerStartUp()" id="TheBody" [inclScorm1.2]onunload="CheckLMSFinish()"[/inclScorm1.2]>
<!-- BeginTopNavButtons -->
[inclNavButtons]
</div>
<div id="InstructionsDiv" class="StdDiv">
- <p id="Instructions">[strInstructions]</p>
+ <div id="Instructions">[strInstructions]</div>
</div>
<div class="StdDiv" id="CheckButtonDiv">
+[inclScorm1.2]
+//JMATCH-SPECIFIC SCORM-RELATED JAVASCRIPT CODE
+
+function SetScormScore(){
+//Reports the current score and any other information back to the LMS
+ if (API != null){
+ API.LMSSetValue('cmi.core.score.raw', Score);
+
+
+//Now send a detailed reports on the item
+ var ItemLabel = 'Matching';
+ API.LMSSetValue('cmi.objectives.0.id', 'obj'+ItemLabel);
+ API.LMSSetValue('cmi.interactions.0.id', 'int'+ItemLabel);
+ API.LMSSetValue('cmi.objectives.0.status', API.LMSGetValue('cmi.core.lesson_status'));
+ API.LMSSetValue('cmi.objectives.0.score.min', '0');
+ API.LMSSetValue('cmi.objectives.0.score.max', '100');
+ API.LMSSetValue('cmi.objectives.0.score.raw', Score);
+//We can only use the performance type, because we're storing multiple responses of various types.
+ API.LMSSetValue('cmi.interactions.0.type', 'performance');
+ API.LMSSetValue('cmi.interactions.0.student_response', AnswersTried);
+
+ API.LMSCommit('');
+ }
+}
+[/inclScorm1.2]
+
+//JMATCH-SPECIFIC CORE JAVASCRIPT CODE
+
var CorrectResponse = '[strGuessCorrect]';
var IncorrectResponse = '[strGuessIncorrect]';
var YourScoreIs = '[strYourScoreIs]';
var RightColPos = 500;
var DragTop = 120;
var Finished = false;
+var AnswersTried = '';
//Fixed and draggable card arrays
FC = new Array();
function StartUp(){
+[inclScorm1.2]
+ ScormStartUp();
+[/inclScorm1.2]
+
[inclSendResults]
GetUserName();
[/inclSendResults]
if (TempInt > WidestRight){WidestRight = TempInt;}
}
- var HeightToSet = Highest;
- if (C.gecko||C.ie5mac){HeightToSet -= 12;}
- var WidthToSet = WidestRight;
- if (C.gecko||C.ie5mac){WidthToSet -= 12;}
+//Fix for 6.2: the reduction by 12 seems to be required -- no idea why!
+ var HeightToSet = Highest-12;
+ var WidthToSet = WidestRight-12;
for (i=0; i<D.length; i++){
DC[i].SetT(CurrTop);
var Feedback = '';
//for each fixed, check to see if the tag value for the draggable is the same as the fixed
+ if (AnswersTried.length > 0){AnswersTried += ' | ';}
var i, j;
for (i=0; i<D.length; i++){
+ if (i>0){AnswersTried += ',';}
+ AnswersTried += D[i][1] + '.' + D[i][2] + '';
if ((D[i][2] == D[i][1])&&(D[i][2] > 0)){
TotalCorrect++;
}
setTimeout('Finish()', SubmissionTimeout);
WriteToInstructions(Feedback);
}
+[inclScorm1.2]
+ if (AllDone == true){
+ SetScormComplete();
+ }
+ else{
+ SetScormIncomplete();
+ }
+[/inclScorm1.2]
}
[inclTimer]
TimeOver = true;
CheckAnswers();
Locked = true;
+[inclScorm1.2]
+ SetScormTimedOut();
+[/inclScorm1.2]
}
[/inclTimer]
<!--
+[inclScorm1.2]
+[strJSScorm_1_2]
+[/inclScorm1.2]
+
[strJSBrowserCheck]
[strJSButtons]
</head>
-<body onload="TimerStartUp()" id="TheBody">
+<body onload="TimerStartUp()" id="TheBody" [inclScorm1.2]onunload="CheckLMSFinish()"[/inclScorm1.2]>
<!-- BeginTopNavButtons -->
[inclNavButtons]
</div>
<div id="InstructionsDiv" class="StdDiv">
- <p id="Instructions">[strInstructions]</p>
+ <div id="Instructions">[strInstructions]</div>
</div>
<div class="StdDiv" id="CheckButtonDiv">
+[inclScorm1.2]
+//JMMIX-SPECIFIC SCORM-RELATED JAVASCRIPT CODE
+
+function SetScormScore(){
+//Reports the current score and any other information back to the LMS
+ if (API != null){
+ API.LMSSetValue('cmi.core.score.raw', Score);
+
+//Now send a detailed reports on the item
+ var ItemLabel = 'Item_1';
+ API.LMSSetValue('cmi.objectives.0.id', 'obj'+ItemLabel);
+ API.LMSSetValue('cmi.interactions.0.id', 'int'+ItemLabel);
+ if (Finished == true){
+ API.LMSSetValue('cmi.objectives.0.status', 'completed');
+ }
+ else{
+ API.LMSSetValue('cmi.objectives.0.status', 'incomplete');
+ }
+
+ API.LMSSetValue('cmi.objectives.0.score.min', '0');
+ API.LMSSetValue('cmi.objectives.0.score.max', '100');
+ API.LMSSetValue('cmi.objectives.0.score.raw', Score);
+//We can only use the performance type, because we're storing multiple responses of various types.
+ API.LMSSetValue('cmi.interactions.0.type', 'performance');
+ API.LMSSetValue('cmi.interactions.0.student_response', AnswersTried);
+
+
+ API.LMSCommit('');
+ }
+}
+[/inclScorm1.2]
+
//JMIX DRAG-DROP OUTPUT FORMAT CODE
var Punctuation = '[strPunctuation]';
var LeftColPos = 100;
var DragTop = 120;
var DragNumber = -1;
+var AnswersTried = '';
Lines = new Array();
}
}
WellDone = '<span class="CorrectAnswer">' + CompiledOutput + '</span><br /><br />' + CorrectResponse + '<br />';
+
+ if (AnswersTried.length > 0){AnswersTried += ' | ';}
+ AnswersTried += CompiledOutput;
//Do score calculation here
Score = Math.floor(((Segments.length-Penalties) * 100)/Segments.length);
}
else{
- TryAgain = '<span class="Guess">' + CompileString(GuessSequence) + '</span><br /><br />';
+ var WrongGuess = CompileString(GuessSequence);
+ if (AnswersTried.length > 0){AnswersTried += ' | ';}
+ AnswersTried += WrongGuess;
+ TryAgain = '<span class="Guess">' + WrongGuess + '</span><br /><br />';
if ((CheckType == 0)||(LongestCorrect.length==0)){
TryAgain += IncorrectResponse + '<br />';
}
setTimeout('Finish()', SubmissionTimeout);
WriteToInstructions(YourScoreIs + ' ' + Score + '%.');
}
+
+[inclScorm1.2]
+ if (AllDone == true){
+ SetScormComplete();
+ }
+ else{
+ SetScormIncomplete();
+ }
+[/inclScorm1.2]
}
GetUserName();
[/inclSendResults]
+[inclScorm1.2]
+ ScormStartUp();
+[/inclScorm1.2]
+
[inclPreloadImages]
PreloadImages([PreloadImageList]);
[/inclPreloadImages]
TimeOver = true;
CheckAnswer(0);
Locked = true;
+[inclScorm1.2]
+ SetScormTimedOut();
+[/inclScorm1.2]
}
[/inclTimer]
<!--
+[inclScorm1.2]
+[strJSScorm_1_2]
+[/inclScorm1.2]
[strJSBrowserCheck]
</head>
<!--<body>Fool those dumb ad-inserting ISPs</body>-->
-<body onload="StartUp()" id="TheBody">
+<body onload="StartUp()" id="TheBody" [inclScorm1.2]onunload="SetScormBrowseTime(); CheckLMSFinish()"[/inclScorm1.2]>
<!-- BeginTopNavButtons -->
</div>
<div id="InstructionsDiv" class="StdDiv">
- <p id="Instructions">[strInstructions]</p>
+ <div id="Instructions">[strInstructions]</div>
</div>
<div id="MainDiv" class="StdDiv">
+[inclScorm1.2]
+//JMATCH-SPECIFIC SCORM-RELATED JAVASCRIPT CODE
+
+function SetScormBrowseTime(){
+if (API != null){
+ API.LMSSetValue('cmi.core.session_time', MillisecondsToTime((new Date()).getTime() - ScormStartTime));
+ API.LMSCommit('');
+ }
+}
+[/inclScorm1.2]
+
+//JMATCH-SPECIFIC CORE JAVASCRIPT CODE
+
var CurrItem = null;
var Stage = 2;
var QList = new Array();
function StartUp(){
SetUpItems();
+
+[inclScorm1.2]
+ initAPI(window);
+ if (API != null){
+ API.LMSInitialize('');
+ API.LMSSetValue('cmi.core.lesson_status', 'browsed');
+ API.LMSSetValue('cmi.comments', 'This exercise has no checking or scoring features.');
+ API.LMSCommit('');
+ }
+[/inclScorm1.2]
+
[inclPreloadImages]
PreloadImages([PreloadImageList]);
/* Made with executable version [strFullVersionInfo] */
+
+/* Hack to hide a nested Quicktime player from IE, which can't handle it. */
+* html object.MediaPlayerNotForIE {
+ display: none;
+}
+
body{
font-family: [strFontFace];
[inclPageBGColor] background-color: [strPageBGColor];[/inclPageBGColor]
div.Keypad{
text-align: center;
display: none; /* initially hidden, shown if needed */
+ margin-bottom: 0.5em;
}
div.Keypad button{
}
.QuestionText{
-
+ text-align: left;
+ margin: 0px;
+ font-size: 100%;
}
.Answer{
CA.GetBestMatch();
//Store any match in the state tracking field
+ if (State[QNum][5].length > 0){State[QNum][5] += ' | ';}
if (CA.MatchNum > -1){
- State[QNum][5] += String.fromCharCode(65+CA.MatchNum) + ',';
+ State[QNum][5] += String.fromCharCode(65+CA.MatchNum);
+ }
+//Else store the student's answer
+ else{
+ State[QNum][5] += G;
}
//Add the percent correct value for this answer to the Q State (works for all
-[QuickTime Player]
-<object classid="clsid:02bf25d5-8c17-4b23-bc80-d3488abddc6b" data="[strFilePath]" width="[strWidth]" height="[strHeight]">
-<param name="src" value="[strFilePath]" />
-<param name="autoplay" value="false" />
-<param name="controller" value="true" />
-<object type="audio/quicktime" data="[strFilePath]" width="[strWidth]" height="[strHeight]">
-<param name="src" value="[strFilePath]" />
-<param name="autoplay" value="false" />
-<param name="controller" value="true" />
-[strContent]</object>
-</object>[/QuickTime Player]
+[QuickTime Player]<object classid="clsid:02bf25d5-8c17-4b23-bc80-d3488abddc6b" data="[strFilePath]" width="[strWidth]" height="[strHeight]" type="audio/quicktime"><param name="src" value="[strFilePath]" /> <param name="autoplay" value="false" /> <param name="controller" value="true" /> <object class="MediaPlayerNotForIE" type="video/quicktime" data="[strFilePath]" width="[strWidth]" height="[strHeight]"> <param name="src" value="[strFilePath]" /> <param name="autoplay" value="false" /> <param name="controller" value="true" /> [strContent]</object> </object>[/QuickTime Player]
-[Windows Media Player]
-<object classid="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6" width="[strWidth]" height="[strHeight]">
+[Windows Media Player]<object classid="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6" width="[strWidth]" height="[strHeight]">
<param name="url" value="[strFilePath]" />
<param name="autostart" value="false" />
<param name="showcontrols" value="true" />[strContent]</object>
<param name="controls" value="[inclVideo]ImageWindow,[/inclVideo]ControlPanel" />
[strContent]</object>[/Real Player]
-[Flash Player]
-<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
-codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,14,0"
-type="application/x-shockwave-flash"
-width="[strWidth]" height="[strHeight]">
-<param name="movie" value="[strFilePath]" />
-[strContent]</object>[/Flash Player]
+[Flash Player]<object codebase="[strFilePath]" type="application/x-shockwave-flash" width="[strWidth]" height="[strHeight]" data="[strFilePath]"> <param name="movie" value="[strFilePath]" />[strContent]</object>[/Flash Player]
var StartTime = (new Date()).toLocaleString();
var ResultForm = '<html><body><form name="Results" action="[strFormMailURL]" method="post" enctype="x-www-form-encoded">';
-ResultForm += '<input type="hidden" name="recipient" value="[strEMail]" /></input>';
-ResultForm += '<input type="hidden" name="subject" value="[strEscapedExerciseTitle]" /></input>';
-ResultForm += '<input type="hidden" name="Exercise" value="[strEscapedExerciseTitle]" /></input>';
-ResultForm += '<input type="hidden" name="realname" value="" /></input>';
-ResultForm += '<input type="hidden" name="Score" value="" /></input>';
-ResultForm += '<input type="hidden" name="Start_Time" value="" /></input>';
-ResultForm += '<input type="hidden" name="End_Time" value="" /></input>';
-ResultForm += '<input type="hidden" name="title" value="Thanks!" /></input>';
-[inclPageBGColor]ResultForm += '<input type="hidden" name="bgcolor" value="[strPageBGColor]" /></input>';[/inclPageBGColor]
-ResultForm += '<input type="hidden" name="text_color" value="[strTitleColor]" /></input>';
-ResultForm += '<input type="hidden" name="sort" value="order:realname,Exercise,Score,Start_Time,End_Time" /></input>';
+ResultForm += '<input type="hidden" name="recipient" value="[strEMail]"></input>';
+ResultForm += '<input type="hidden" name="subject" value="[strEscapedExerciseTitle]"></input>';
+ResultForm += '<input type="hidden" name="Exercise" value="[strEscapedExerciseTitle]"></input>';
+ResultForm += '<input type="hidden" name="realname" value=""></input>';
+ResultForm += '<input type="hidden" name="Score" value=""></input>';
+ResultForm += '<input type="hidden" name="Start_Time" value=""></input>';
+ResultForm += '<input type="hidden" name="End_Time" value=""></input>';
+ResultForm += '<input type="hidden" name="title" value="Thanks!"></input>';
+[inclPageBGColor]ResultForm += '<input type="hidden" name="bgcolor" value="[strPageBGColor]"></input>';[/inclPageBGColor]
+ResultForm += '<input type="hidden" name="text_color" value="[strTitleColor]"></input>';
+ResultForm += '<input type="hidden" name="sort" value="order:realname,Exercise,Score,Start_Time,End_Time"></input>';
ResultForm += '</form></body></html>';
function GetUserName(){
function ShowMessage(Feedback){
var Output = Feedback + '<br /><br />';
+ document.getElementById('FeedbackContent').innerHTML = Output;
+ var FDiv = document.getElementById('FeedbackDiv');
+ topZ++;
+ FDiv.style.zIndex = topZ;
+ FDiv.style.top = TopSettingWithScrollOffset(30) + 'px';
- var obj = document.getElementById('FeedbackContent');
- if (obj) {
- obj.innerHTML = Output;
- }
- var obj = document.getElementById('FeedbackDiv');
- if (obj) {
- topZ++;
- obj.style.zIndex = topZ;
- obj.style.top = TopSettingWithScrollOffset(30) + 'px';
- obj.style.display = 'block';
- }
+ FDiv.style.display = 'block';
ShowElements(false, 'input');
ShowElements(false, 'select');
ShowElements(false, 'object');
+ ShowElements(true, 'object', 'FeedbackContent');
//Focus the OK button
- var obj = document.getElementById('FeedbackOKButton');
- if (obj) {
- setTimeout("document.getElementById('FeedbackOKButton').focus()", 50);
- }
+ setTimeout("document.getElementById('FeedbackOKButton').focus()", 50);
//[inclPreloadImages]
// RefreshImages();
//[/inclPreloadImages]
}
-function ShowElements(Show, TagName){
-//Special for IE bug -- hide all the form elements that will show through the popup
- if (C.ie){
- var Els = document.getElementsByTagName(TagName);
- for (var i=0; i<Els.length; i++){
+function ShowElements(Show, TagName, ContainerToReverse){
+// added third argument to allow objects in the feedback box to appear
+//IE bug -- hide all the form elements that will show through the popup
+//FF on Mac bug : doesn't redisplay objects whose visibility is set to visible
+//unless the object's display property is changed
+
+ //get container object (by Id passed in, or use document otherwise)
+ TopNode = document.getElementById(ContainerToReverse);
+ var Els;
+ if (TopNode != null) {
+ Els = TopNode.getElementsByTagName(TagName);
+ } else {
+ Els = document.getElementsByTagName(TagName);
+ }
+
+ for (var i=0; i<Els.length; i++){
+ if (TagName == "object") {
+ //manipulate object elements in all browsers
if (Show == true){
- Els[i].style.display = 'inline';
+ Els[i].style.visibility = 'visible';
+ //get Mac FireFox to manipulate display, to force screen redraw
+ if (C.mac && C.gecko) {Els[i].style.display = '';}
}
else{
- Els[i].style.display = 'none';
+ Els[i].style.visibility = 'hidden';
+ if (C.mac && C.gecko) {Els[i].style.display = 'none';}
+ }
+ }
+ else {
+ // tagName is either input or select (that is, Form Elements)
+ // ie6 has a problem with Form elements, so manipulate those
+ if (C.ie) {
+ if (C.ieVer < 7) {
+ if (Show == true){
+ Els[i].style.visibility = 'visible';
+ }
+ else{
+ Els[i].style.visibility = 'hidden';
+ }
+ }
}
}
- }
+ }
}
+
+
function HideFeedback(){
document.getElementById('FeedbackDiv').style.display = 'none';
ShowElements(true, 'input');
}
function GetScrollTop(){
- if (document.documentElement && document.documentElement.scrollTop){
- return document.documentElement.scrollTop;
+ if (typeof(window.pageYOffset) == 'number'){
+ return window.pageYOffset;
}
else{
- if (document.body){
- return document.body.scrollTop;
+ if ((document.body)&&(document.body.scrollTop)){
+ return document.body.scrollTop;
}
else{
- return window.pageYOffset;
+ if ((document.documentElement)&&(document.documentElement.scrollTop)){
+ return document.documentElement.scrollTop;
+ }
+ else{
+ return 0;
+ }
}
}
}
function GetViewportHeight(){
- if (window.innerHeight){
+ if (typeof window.innerHeight != 'undefined'){
return window.innerHeight;
}
else{
- return document.getElementsByTagName('body')[0].clientHeight;
+ if (((typeof document.documentElement != 'undefined')&&(typeof document.documentElement.clientHeight !=
+ 'undefined'))&&(document.documentElement.clientHeight != 0)){
+ return document.documentElement.clientHeight;
+ }
+ else{
+ return document.getElementsByTagName('body')[0].clientHeight;
+ }
}
}
<!--
+[inclScorm1.2]
+[strJSScorm_1_2]
+[/inclScorm1.2]
+
[strJSBrowserCheck]
[strJSButtons]
</head>
-<body onload="StartUp()" id="TheBody">
+<body onload="StartUp()" id="TheBody" [inclScorm1.2]onunload="CheckLMSFinish()"[/inclScorm1.2]>
<!-- BeginTopNavButtons -->
</div>
<div id="InstructionsDiv" class="StdDiv">
- <p id="Instructions">[strInstructions]</p>
+ <div id="Instructions">[strInstructions]</div>
</div>
[inclReading]
</div>
[inclKeypad]
-<div class="Keypad">
+<div class="Keypad" id="CharacterKeypad">
[strKeypad]
</div>
[/inclKeypad]
+[inclScorm1.2]
+//JCLOZE-SPECIFIC SCORM-RELATED JAVASCRIPT CODE
+
+function SetScormScore(){
+//Reports the current score and any other information back to the LMS
+ if (API != null){
+ API.LMSSetValue('cmi.core.score.raw', Score);
+//Now send detailed reports about each item
+ for (var i=0; i<State.length; i++){
+ var ThisItemGuesses = '';
+ var GapLabel = 'Gap_' + (i+1).toString();
+ var ThisItemScore = Math.floor(State[i].ItemScore * 100) + '';
+ API.LMSSetValue('cmi.objectives.' + i + '.id', 'obj'+GapLabel);
+ API.LMSSetValue('cmi.interactions.' + i + '.id', 'int'+GapLabel);
+ API.LMSSetValue('cmi.objectives.' + i + '.score.raw', ThisItemScore);
+ API.LMSSetValue('cmi.objectives.' + i + '.score.min', '0');
+ API.LMSSetValue('cmi.objectives.' + i + '.score.max', '100');
+ if (State[i].AnsweredCorrectly == true){
+ API.LMSSetValue('cmi.objectives.' + i + '.status', 'completed');
+ }
+ else{
+ API.LMSSetValue('cmi.objectives.' + i + '.status', 'incomplete');
+ }
+ for (var j=0; j<State[i].Guesses.length; j++){
+ if (j>0){ThisItemGuesses += ' | ';}
+ ThisItemGuesses += State[i].Guesses[j];
+ }
+ API.LMSSetValue('cmi.interactions.' + i + '.type', 'fill-in');
+ API.LMSSetValue('cmi.interactions.' + i + '.student_response', ThisItemGuesses);
+ }
+ API.LMSCommit('');
+ }
+}
+[/inclScorm1.2]
+
//JCLOZE CORE JAVASCRIPT CODE
function ItemState(){
function StartUp(){
RemoveBottomNavBarForIE();
+//Show a keypad if there is one (added bugfix for 6.0.4.12)
+ if (document.getElementById('CharacterKeypad') != null){
+ document.getElementById('CharacterKeypad').style.display = 'block';
+ }
+
+[inclScorm1.2]
+ ScormStartUp();
+[/inclScorm1.2]
[inclSendResults]
GetUserName();
}
function SaveCurrentAnswers(){
- var Ans = ''
+ var Ans = '';
for (var i=0; i<I.length; i++){
Ans = GetGapValue(i);
if ((Ans.length > 0)&&(Ans != State[i].Guesses[State[i].Guesses.length-1])){
CompileGuesses();
if ((AllCorrect == true)||(Finished == true)){
+
[inclSendResults]
setTimeout('SendResults(' + TotalScore + ')', 50);
[/inclSendResults]
Finished = true;
setTimeout('Finish()', SubmissionTimeout);
}
+[inclScorm1.2]
+ if (AllCorrect == true){
+ SetScormComplete();
+ }
+ else{
+ SetScormIncomplete();
+ }
+[/inclScorm1.2]
}
function TrackFocus(BoxNumber){
}
function ShowHint(){
+ if (document.getElementById('FeedbackDiv').style.display == 'block'){return;}
if (Locked == true){return;}
var CurrGap = FindCurrent();
if (CurrGap < 0){return;}
Finished = true;
CheckAnswers();
Locked = true;
+[inclScorm1.2]
+ SetScormTimedOut();
+[/inclScorm1.2]
}
[/inclTimer]
\ No newline at end of file
<!--
+[inclScorm1.2]
+[strJSScorm_1_2]
+[/inclScorm1.2]
+
[strJSBrowserCheck]
[strJSButtons]
</head>
-<body onload="StartUp()" id="TheBody">
+<body onload="StartUp()" id="TheBody" [inclScorm1.2]onunload="CheckLMSFinish()"[/inclScorm1.2]>
<!-- BeginTopNavButtons -->
</div>
<div id="InstructionsDiv" class="StdDiv">
- <p id="Instructions">[strInstructions]</p>
+ <div id="Instructions">[strInstructions]</div>
</div>
[inclReading]
<div id="MainDiv" class="StdDiv">
[inclKeypad]
-<div class="Keypad" style="float: left;">
+<div class="Keypad" id="CharacterKeypad" style="float: left;">
[strKeypad]
</div>
[/inclKeypad]
+[inclScorm1.2]
+//JCROSS-SPECIFIC SCORM-RELATED JAVASCRIPT CODE
+
+function SetScormScore(){
+//Reports the current score and any other information back to the LMS
+ if (API != null){
+ API.LMSSetValue('cmi.core.score.raw', Score);
+
+//Now send a detailed reports on the item
+ var ItemLabel = 'Crossword';
+ API.LMSSetValue('cmi.objectives.0.id', 'obj'+ItemLabel);
+ API.LMSSetValue('cmi.interactions.0.id', 'int'+ItemLabel);
+ if (Finished == true){
+ API.LMSSetValue('cmi.objectives.0.status', 'completed');
+ }
+ else{
+ API.LMSSetValue('cmi.objectives.0.status', 'incomplete');
+ }
+ API.LMSSetValue('cmi.objectives.0.score.min', '0');
+ API.LMSSetValue('cmi.objectives.0.score.max', '100');
+ API.LMSSetValue('cmi.objectives.0.score.raw', Score);
+//We're not sending any student response data, so we can set this to a non-standard value
+ API.LMSSetValue('cmi.interactions.0.type', 'crossword');
+
+ API.LMSCommit('');
+ }
+}
+[/inclScorm1.2]
//JCROSS CORE JAVASCRIPT CODE
var InTextBox = false;
var Locked = false;
var TimeOver = false;
+var CaseSensitive = [boolCaseSensitive];
var InputStuff = '<form method="post" action="" onsubmit="return false;"><span class="ClueNum">[strClueNum]: </span>';
-InputStuff += '[strClue] <input onfocus="CurrentBox=this;InTextBox=true;" onblur="InTextBox=false;" id="[strBoxId]" type="edit" size="[strEditSize]" maxlength="[strMaxLength]" /></input>';
+InputStuff += '[strClue] <input onfocus="CurrentBox=this;InTextBox=true;" onblur="InTextBox=false;" id="[strBoxId]" type="edit" size="[strEditSize]" maxlength="[strMaxLength]"></input>';
InputStuff += '<button class="FuncButton" onfocus="FuncBtnOver(this)" onblur="FuncBtnOut(this)" onmouseover="FuncBtnOver(this)" onmouseout="FuncBtnOut(this)" onmousedown="FuncBtnDown(this)" onmouseup="FuncBtnOut(this)" onclick="EnterGuess([strParams])">[strEnterCaption]</button>';
InputStuff += '[inclHint]<button class="FuncButton" onfocus="FuncBtnOver(this)" onblur="FuncBtnOut(this)" onmouseover="FuncBtnOver(this)" onmouseout="FuncBtnOut(this)" onmousedown="FuncBtnDown(this)" onmouseup="FuncBtnOut(this)" onclick="ShowHint([strParams])">[strHintCaption]</button>[/inclHint]';
InputStuff += '</form>';
function StartUp(){
RemoveBottomNavBarForIE();
+//Show a keypad if there is one (added bugfix for 6.0.4.12)
+ if (document.getElementById('CharacterKeypad') != null){
+ document.getElementById('CharacterKeypad').style.display = 'block';
+ }
+[inclScorm1.2]
+ ScormStartUp();
+[/inclScorm1.2]
+
AcrossCaption = document.getElementById('CluesAcrossLabel').innerHTML;
DownCaption = document.getElementById('CluesDownLabel').innerHTML;
[inclSendResults]
}
function EnterAnswer(Guess,Across,AnsLength,x,y){
- Guess = Guess.toUpperCase();
-
var PC = new Array();
SplitStringToPerceivedChars(Guess, PC);
function ShowHint(Across,ClueNum,x,y,BoxId){
var i=x;
var j=y;
+ var LetterFromGuess = '';
+ var LetterFromKey = '';
var OutString = '';
if (Across==true){
while (j<L[i].length){
if (L[i][j] != ''){
OutString += L[i][j];
- if (G[i][j] != L[i][j]){
+ if (CaseSensitive == true){
+ LetterFromKey = L[i][j];
+ LetterFromGuess = G[i][j];
+ }
+ else {
+ LetterFromKey = L[i][j].toUpperCase();
+ LetterFromGuess = G[i][j].toUpperCase();
+ }
+ if (LetterFromGuess != LetterFromKey){
+// if (G[i][j] != L[i][j]){
G[i][j] = L[i][j];
Penalties++;
break;
while (i<L.length){
if (L[i][j] != ''){
OutString += L[i][j];
- if (G[i][j] != L[i][j]){
+ if (CaseSensitive == true){
+ LetterFromKey = L[i][j];
+ LetterFromGuess = G[i][j];
+ }
+ else {
+ LetterFromKey = L[i][j].toUpperCase();
+ LetterFromGuess = G[i][j].toUpperCase();
+ }
+ if (LetterFromGuess != LetterFromKey){
+// if (G[i][j] != L[i][j]){
G[i][j] = L[i][j];
Penalties++;
break;
var AllCorrect = true;
var TotLetters = 0;
var CorrectLetters = 0;
-
+ var LetterFromKey = '';
+ var LetterFromGuess = '';
+
//Check each letter
for (var i=0; i<L.length; i++){
for (var j=0; j<L[i].length; j++){
if (L[i][j] != ''){
TotLetters++;
- if (G[i][j] != L[i][j]){
+ if (CaseSensitive == true) {
+ LetterFromKey = L[i][j];
+ LetterFromGuess = G[i][j];
+ }
+ else {
+ LetterFromKey = L[i][j].toUpperCase();
+ LetterFromGuess = G[i][j].toUpperCase();
+ }
+ if (LetterFromGuess != LetterFromKey){
G[i][j] = '';
//Blank that square in the grid
SetGridSquareValue(i,j,'');
Finished = true;
setTimeout('Finish()', SubmissionTimeout);
}
+[inclScorm1.2]
+ if (AllCorrect == true){
+ SetScormComplete();
+ }
+ else{
+ SetScormIncomplete();
+ }
+[/inclScorm1.2]
}
function Finish(){
Finished = true;
CheckAnswers();
Locked = true;
+[inclScorm1.2]
+ SetScormTimedOut();
+[/inclScorm1.2]
}
[/inclTimer]
\ No newline at end of file
<!--
+[inclScorm1.2]
+[strJSScorm_1_2]
+[/inclScorm1.2]
+
[strJSBrowserCheck]
[strJSButtons]
</head>
-<body onload="StartUp()" id="TheBody">
+<body onload="StartUp()" id="TheBody" [inclScorm1.2]onunload="CheckLMSFinish()"[/inclScorm1.2]>
<!-- BeginTopNavButtons -->
</div>
<div id="InstructionsDiv" class="StdDiv">
- <p id="Instructions">[strInstructions]</p>
+ <div id="Instructions">[strInstructions]</div>
</div>
[inclReading]
+[inclScorm1.2]
+//JMATCH-SPECIFIC SCORM-RELATED JAVASCRIPT CODE
+
+function SetScormScore(){
+//Reports the current score and any other information back to the LMS
+ if (API != null){
+ API.LMSSetValue('cmi.core.score.raw', Score);
+
+//Now send a detailed reports on the item
+ var ItemLabel = 'Matching';
+ API.LMSSetValue('cmi.objectives.0.id', 'obj'+ItemLabel);
+ API.LMSSetValue('cmi.interactions.0.id', 'int'+ItemLabel);
+ API.LMSSetValue('cmi.objectives.0.status', API.LMSGetValue('cmi.core.lesson_status'));
+ API.LMSSetValue('cmi.objectives.0.score.min', '0');
+ API.LMSSetValue('cmi.objectives.0.score.max', '100');
+ API.LMSSetValue('cmi.objectives.0.score.raw', Score);
+//We can only use the performance type, because we're storing multiple responses of various types.
+ API.LMSSetValue('cmi.interactions.0.type', 'performance');
+
+ var AnswersTried = '';
+ for (var i=0; i<Status[0][3].length; i++){
+ if (i>0){AnswersTried += ' | ';}
+ for (var j=0; j<Status.length; j++){
+ if (j>0){AnswersTried += ',';}
+ AnswersTried += j + '.' + Status[j][3][i];
+ }
+ }
+ API.LMSSetValue('cmi.interactions.0.student_response', AnswersTried);
+ API.LMSCommit('');
+ }
+}
+[/inclScorm1.2]
+
+//JMATCH CORE JAVASCRIPT CODE
+
var CorrectIndicator = '[strCorrectIndicator]';
var IncorrectIndicator = '[strIncorrectIndicator]';
var YourScoreIs = '[strYourScoreIs]';
function StartUp(){
RemoveBottomNavBarForIE();
+[inclScorm1.2]
+ ScormStartUp();
+[/inclScorm1.2]
+
[inclSendResults]
GetUserName();
[/inclSendResults]
Status[x][0] = 0; // Item not matched correctly yet
Status[x][1] = 0; //Tries at this item so far
Status[x][2] = Selects[x].id; //Store a ref to the original drop-down
+ Status[x][3] = new Array(); //Sequence of guesses for this item
}
}
//Get a pointer to the drop-down
Select = document.getElementById(Status[i][2]);
Key = GetKeyFromSelect(Select);
+//Save the answer given
+ Status[i][3].push(Select.options[Select.selectedIndex].value);
//Check the answer
if (Select.options[Select.selectedIndex].value == Key){
Parent.nextSibling.innerHTML = IncorrectIndicator;
}
}
+ else{
+//Add a copy of the last (correct) answer.
+ Status[i][3].push(Status[i][3][Status[i][3].length-1]);
+ }
//If it's correct, count it
if (Status[i][0] == 1){
TotCorrectChoices++;
//Show the feedback
ShowMessage(Feedback);
+
+[inclScorm1.2]
+ if (AllDone == true){
+ SetScormComplete();
+ }
+ else{
+ SetScormIncomplete();
+ }
+[/inclScorm1.2]
}
[inclTimer]
Finished = true;
CheckAnswers();
Locked = true;
+[inclScorm1.2]
+ SetScormTimedOut();
+[/inclScorm1.2]
}
[/inclTimer]
<!--
+[inclScorm1.2]
+[strJSScorm_1_2]
+[/inclScorm1.2]
+
[strJSBrowserCheck]
[strJSButtons]
</head>
-<body onload="StartUp()" id="TheBody">
+<body onload="StartUp()" id="TheBody" [inclScorm1.2]onunload="CheckLMSFinish()"[/inclScorm1.2]>
<!-- BeginTopNavButtons -->
</div>
<div id="InstructionsDiv" class="StdDiv">
- <p id="Instructions">[strInstructions]</p>
+ <div id="Instructions">[strInstructions]</div>
</div>
[inclReading]
-//JMIX STANDARD OUTPUT FORMAT CODE
+[inclScorm1.2]
+//JMIX-SPECIFIC SCORM-RELATED JAVASCRIPT CODE
+function SetScormScore(){
+//Reports the current score and any other information back to the LMS
+ if (API != null){
+ API.LMSSetValue('cmi.core.score.raw', Score);
+
+//Now send a detailed reports on the item
+ var ItemLabel = 'Item_1';
+ API.LMSSetValue('cmi.objectives.0.id', 'obj'+ItemLabel);
+ API.LMSSetValue('cmi.interactions.0.id', 'int'+ItemLabel);
+ if (Finished == true){
+ API.LMSSetValue('cmi.objectives.0.status', 'completed');
+ }
+ else{
+ API.LMSSetValue('cmi.objectives.0.status', 'incomplete');
+ }
+
+ API.LMSSetValue('cmi.objectives.0.score.min', '0');
+ API.LMSSetValue('cmi.objectives.0.score.max', '100');
+ API.LMSSetValue('cmi.objectives.0.score.raw', Score);
+//We can only use the performance type, because we're storing multiple responses of various types.
+ API.LMSSetValue('cmi.interactions.0.type', 'performance');
+ API.LMSSetValue('cmi.interactions.0.student_response', AnswersTried);
+
+ API.LMSCommit('');
+ }
+}
+[/inclScorm1.2]
+
+//JMIX STANDARD OUTPUT FORMAT CODE
var CorrectResponse = '[strGuessCorrect]';
var IncorrectResponse = '[strGuessIncorrect]';
var TimeOver = false;
var Score = 0;
var strInstructions = '';
+var AnswersTried = '';
var SegmentTemplate = ' <a class="ExSegment" href="javascript:void(0)" onclick="AddSegment([SegmentNumber])" title="[strClickToAdd]">[CurrentSegment]</a> ';
WellDone = '<span class="Answer">' + Output + '</span><br /><br />' + CorrectResponse + '<br />';
+ if (AnswersTried.length > 0){AnswersTried += ' | ';}
+ AnswersTried += Output;
+
//Do score calculation here
Score = Math.floor(((Segments.length-Penalties) * 100)/Segments.length);
WellDone += YourScoreIs + ' ' + Score + '%.<br />';
}
else{
- TryAgain = '<span class="Answer">' + CompileString(GuessSequence) + '</span><br /><br />';
+ var WrongGuess = CompileString(GuessSequence);
+ if (AnswersTried.length > 0){AnswersTried += ' | ';}
+ AnswersTried += WrongGuess;
+ TryAgain = '<span class="Answer">' + WrongGuess + '</span><br /><br />';
if (CheckType == 0){
TryAgain += IncorrectResponse + '<br />';
}
setTimeout('Finish()', SubmissionTimeout);
WriteToInstructions(YourScoreIs + ' ' + Score + '%.');
}
+[inclScorm1.2]
+ if (AllDone == true){
+ SetScormComplete();
+ }
+ else{
+ SetScormIncomplete();
+ }
+[/inclScorm1.2]
}
function FindSegment(SegID){
GetUserName();
[/inclSendResults]
+[inclScorm1.2]
+ ScormStartUp();
+[/inclScorm1.2]
+
[inclPreloadImages]
PreloadImages([PreloadImageList]);
[/inclPreloadImages]
Finished = true;
CheckAnswer(0);
Locked = true;
+[inclScorm1.2]
+ SetScormTimedOut();
+[/inclScorm1.2]
}
[/inclTimer]
\ No newline at end of file
<!--
+[inclScorm1.2]
+[strJSScorm_1_2]
+[/inclScorm1.2]
+
[strJSBrowserCheck]
[strJSButtons]
</head>
-<body onload="StartUp()" id="TheBody">
+<body onload="StartUp()" id="TheBody" [inclScorm1.2]onunload="CheckLMSFinish()"[/inclScorm1.2]>
<!-- BeginTopNavButtons -->
</div>
<div id="InstructionsDiv" class="StdDiv">
- <p id="Instructions">[strInstructions]</p>
+ <div id="Instructions">[strInstructions]</div>
</div>
[inclReading]
+[inclScorm1.2]
+//JQUIZ-SPECIFIC SCORM-RELATED JAVASCRIPT CODE
+
+function SetScormScore(){
+//Reports the current score and any other information back to the LMS
+ if (API != null){
+ API.LMSSetValue('cmi.core.score.raw', Score);
+//Now send detailed reports about each item
+ for (var i=0; i<State.length; i++){
+ if (State[i] != null){
+ var ItemLabel = 'Item_' + (i+1).toString();
+ var ThisItemScore = '';
+ var ThisItemStatus = '';
+ API.LMSSetValue('cmi.objectives.' + i + '.id', 'obj'+ItemLabel);
+ API.LMSSetValue('cmi.interactions.' + i + '.id', 'int'+ItemLabel);
+ API.LMSSetValue('cmi.objectives.' + i + '.score.min', '0');
+ API.LMSSetValue('cmi.objectives.' + i + '.score.max', '100');
+ if (State[i][2] > 0){
+ ThisItemScore = Math.floor(State[i][0] * 100) + '';
+ ThisItemStatus = 'completed';
+ }
+ else{
+ ThisItemScore = '0';
+ ThisItemStatus = 'incomplete';
+ }
+ API.LMSSetValue('cmi.objectives.' + i + '.score.raw', ThisItemScore);
+ API.LMSSetValue('cmi.objectives.' + i + '.status', ThisItemStatus);
+ API.LMSSetValue('cmi.interactions.' + i + '.weighting', I[i][0]);
+//We can only use the performance type, because we're storing multiple responses of various types.
+ API.LMSSetValue('cmi.interactions.' + i + '.type', 'performance');
+ API.LMSSetValue('cmi.interactions.' + i + '.student_response', State[i][5]);
+ }
+ }
+
+ API.LMSCommit('');
+ }
+}
+[/inclScorm1.2]
+
//JQUIZ CORE JAVASCRIPT CODE
var CurrQNum = 0;
var Feedback = '';
var TimeOver = false;
var strInstructions = '';
+var Locked = false;
//The following variable can be used to add a message explaining that
//the question is finished, so no further marking will take place.
document.getElementById('ReadingDiv').innerHTML = '';
}
if (QArray[CurrQNum] != null){
- var Children = QArray[CurrQNum].childNodes;
+//Fix for 6.0.4.25
+ var Children = QArray[CurrQNum].getElementsByTagName('div');
for (var i=0; i<Children.length; i++){
if (Children[i].className=="HiddenReading"){
document.getElementById('ReadingDiv').innerHTML = Children[i].innerHTML;
//Stash the instructions so they can be redisplayed
strInstructions = document.getElementById('InstructionsDiv').innerHTML;
+[inclScorm1.2]
+ ScormStartUp();
+[/inclScorm1.2]
+
[inclSendResults]
GetUserName();
[/inclSendResults]
//Store the try number in the answer part of the State array, for tracking purposes
State[QNum][1][ANum] = State[QNum][2];
- State[QNum][5] += String.fromCharCode(65+ANum) + ',';
+ if (State[QNum][5].length > 0){State[QNum][5] += ' | ';}
+ State[QNum][5] += String.fromCharCode(65+ANum);
//Should this answer be accepted as correct?
if (I[QNum][3][ANum][2] < 1){
var ShouldBeChecked;
var Matches = 0;
- State[QNum][5] += '|';
+ if (State[QNum][5].length > 0){State[QNum][5] += ' | ';}
//Check if there are any mismatches
Feedback = '';
[inclTimer]
window.clearInterval(Interval);
[/inclTimer]
+
+[inclScorm1.2]
+ if (TimeOver == true){
+ SetScormTimedOut();
+ }
+ else{
+ SetScormComplete();
+ }
+[/inclScorm1.2]
+
TimeOver = true;
Locked = true;
Detail += '</fields></hpnetresult>';
setTimeout('Finish()', SubmissionTimeout);
}
+[inclScorm1.2]
+ else{
+ SetScormIncomplete();
+ }
+[/inclScorm1.2]
}
[inclTimer]
<!-- Made with executable version [strFullVersionInfo] -->
+<!-- The following insertion allows you to add your own code directly to this head tag from the configuration screen -->
+
+[strHeaderCode]
+
<style type="text/css">
body{
<script type="text/javascript" src="hp6browsercheck.js_"></script>
-<base href="http://web.uvic.ca/hrd/hotpot/" />
+<base href="http://hotpot.uvic.ca/" />
</head>
/// Code fragment to define the version of hotpot
/// This fragment is called by moodle_needs_upgrading() and /admin/index.php
/////////////////////////////////////////////////////////////////////////////////
-$module->version = 2007020200; // release date of this version (see note below)
-$module->release = 'v2.3.0'; // human-friendly version name (used in mod/hotpot/lib.php)
+$module->version = 2007020201; // release date of this version (see note below)
+$module->release = 'v2.4.1'; // human-friendly version name (used in mod/hotpot/lib.php)
$module->requires = 2007020200; // Requires this Moodle version
$module->cron = 0; // period for cron to check this module (secs)
// interpretation of YYYYMMDDXY version numbers