]> git.mjollnir.org Git - moodle.git/commitdiff
add HP 6.2 templates; add compatability with Safari (Mac browser); microincrement...
authorgbateson <gbateson>
Thu, 3 May 2007 00:22:50 +0000 (00:22 +0000)
committergbateson <gbateson>
Thu, 3 May 2007 00:22:50 +0000 (00:22 +0000)
29 files changed:
mod/hotpot/README.TXT
mod/hotpot/hotpot-full.js
mod/hotpot/template/default.php
mod/hotpot/template/v6.php
mod/hotpot/template/v6/djmatch6.ht_
mod/hotpot/template/v6/djmatch6.js_
mod/hotpot/template/v6/djmix6.ht_
mod/hotpot/template/v6/djmix6.js_
mod/hotpot/template/v6/fjmatch6.ht_
mod/hotpot/template/v6/fjmatch6.js_
mod/hotpot/template/v6/hp6.cs_
mod/hotpot/template/v6/hp6checkshortanswer.js_
mod/hotpot/template/v6/hp6objecttags.ht_
mod/hotpot/template/v6/hp6sendresults.js_
mod/hotpot/template/v6/hp6showmessage.js_
mod/hotpot/template/v6/hp6utilities.js_
mod/hotpot/template/v6/jcloze6.ht_
mod/hotpot/template/v6/jcloze6.js_
mod/hotpot/template/v6/jcross6.ht_
mod/hotpot/template/v6/jcross6.js_
mod/hotpot/template/v6/jmatch6.ht_
mod/hotpot/template/v6/jmatch6.js_
mod/hotpot/template/v6/jmix6.ht_
mod/hotpot/template/v6/jmix6.js_
mod/hotpot/template/v6/jquiz6.ht_
mod/hotpot/template/v6/jquiz6.js_
mod/hotpot/template/v6/masher.ht_
mod/hotpot/template/v6/testbrowsercheck.htm
mod/hotpot/version.php

index 7d44982ae0807c9c0f85e0b21263323e2af618b3..32ff96a2c0bda72923fab93d94cacf5de2ad4eb0 100644 (file)
@@ -1,12 +1,12 @@
 ==================================================
-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
 
index 55a95d0ba01228f2d1e6c7f8ee89c3b39a122b3e..45d3651f9c6b1c65a633711a2fcb9cf609162ed7 100644 (file)
@@ -288,7 +288,7 @@ if (window.JQuiz==null) {
        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
@@ -518,11 +518,11 @@ function QuizLogin(LoginPrompt) {
                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*') : ',';
@@ -530,7 +530,7 @@ function QuizLogin(LoginPrompt) {
                                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++) {
@@ -548,20 +548,20 @@ function QuizLogin(LoginPrompt) {
                }
                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])
@@ -574,10 +574,10 @@ function QuizLogin(LoginPrompt) {
                        ;
                }
                html +=         '<tr>'
-                       +               '<th scope="row">&nbsp;</th>'
+                       +               '<th>&nbsp;</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>'
@@ -856,7 +856,7 @@ function AddStudentDetailsToResultForm() {
                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) {
@@ -1361,8 +1361,15 @@ function GetJQuizAnswerDetails(q, flag) {
                        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();
@@ -1378,14 +1385,33 @@ function GetJQuizAnswerDetails(q, flag) {
                        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) {
@@ -1406,8 +1432,12 @@ function GetJQuizAnswerDetails(q, flag) {
                // 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 {
@@ -1518,7 +1548,7 @@ function hpClickClue(hp, t, v, args) {
 }
 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) {
@@ -1799,7 +1829,7 @@ function hpClickCheck(hp, t, v, args) {
                        }                       
                }
        }
-       return true;
+       //return true;
 }
 function hpClickCheckJCrossV5V6(hp, v, AD, q, row, col) {
        // v is the version of Hot Potatoes
@@ -1928,7 +1958,7 @@ function hpHiddenField(name, value, comma, forceHTML) {
                }
                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;
 }
@@ -2020,12 +2050,19 @@ function getFuncCode(fn, extraCode, anchorCode, beforeAnchor) {
        }
        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;
 }
@@ -2101,8 +2138,8 @@ function hpFeedback() {
                        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);
@@ -2119,9 +2156,9 @@ function hpFeedback() {
                                }
                        }
                        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>&nbsp;</td><td><input type="submit" value="' + FEEDBACK[6] + '" />'
+                               +       '<tr><td>&nbsp;</td><td><input type="submit" value="' + FEEDBACK[6] + '">'
                                +       hpHiddenField('realname', FEEDBACK[2], ',', true)
                                +       hpHiddenField('email', FEEDBACK[3], ',', true)
                                +       hpHiddenField('subject', document.title, ',', true)
@@ -2135,10 +2172,10 @@ function hpFeedback() {
                                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++) {
@@ -2146,7 +2183,7 @@ function hpFeedback() {
                                        }
                                        html += '</select>';
                                        html += '</td></tr>'
-                                               +       '<tr><td>&nbsp;</td><td><input type="submit" value="' + FEEDBACK[6] + '" />'
+                                               +       '<tr><td>&nbsp;</td><td><input type="submit" value="' + FEEDBACK[6] + '">'
                                                +       '</td></tr></table></form></body></html>'
                                        ;
                                } else if (i_max==1) { // one teacher
@@ -2170,6 +2207,38 @@ function hpFeedback() {
 // ********************
 //     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)
@@ -2194,7 +2263,7 @@ function hpInterceptFeedback() {
                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() {
@@ -2257,7 +2326,7 @@ 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() {
@@ -2312,7 +2381,8 @@ 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() {
@@ -2354,7 +2424,7 @@ 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);
                        }
                }
        }
@@ -2394,7 +2464,7 @@ function hpInterceptChecks() {
        }
        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)
@@ -2404,7 +2474,7 @@ function hpInterceptChecks() {
                        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
                        }
                }
@@ -2690,7 +2760,13 @@ function hpScore() {
        } 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'");
@@ -2771,7 +2847,13 @@ function hpFinished() {
        } 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'");
@@ -2830,9 +2912,9 @@ function hpIsStrict() {
 // **************
 //  initialization
 // **************
-hpInterceptFeedback();
-hpInterceptHints();
-hpInterceptClues();
+//hpInterceptFeedback();
+//hpInterceptHints();
+//hpInterceptClues();
 hpInterceptChecks();
 function hpFindForm(formname, w) {
        if (w==null) w = self;
@@ -2896,8 +2978,13 @@ if (DB[7] && DB[8] && !is_LMS()) {
 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
index 4f35b28e3f0c044f579a1a826bafceeafc88beaf..b570e4b3400f3e33b1e2159c87f0ae254495e962 100644 (file)
@@ -24,11 +24,11 @@ class hotpot_xml_template_default {
         //  [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';
index 72886764a57c3483aaa49957df7d6155400f6b2b..71c32661a7a0f4ca3d09a8a60693eaba1b94957e 100644 (file)
@@ -324,6 +324,11 @@ class hotpot_xml_quiz_template extends hotpot_xml_template_default {
         return $this->v6_expand_NavButtons();
     }
 
+    // switch off scorm
+    function v6_expand_Scorm12() {
+        return false;
+    }
+
     // js files (all quiz types)
 
     function v6_expand_JSBrowserCheck() {
index 37141ff76ff6863cc8db29dc63a7f4048db13285..04a96e16869055324cc170327cd0910d409dd930 100644 (file)
 
 <!--
 
+[inclScorm1.2]
+[strJSScorm_1_2]
+[/inclScorm1.2]
+
 [strJSBrowserCheck]
 
 [strJSButtons]
@@ -59,7 +63,7 @@
 
 </head> 
 
-<body onload="TimerStartUp()" id="TheBody"> 
+<body onload="TimerStartUp()" id="TheBody" [inclScorm1.2]onunload="CheckLMSFinish()"[/inclScorm1.2]
 <!-- BeginTopNavButtons -->
 
 [inclNavButtons]
@@ -80,7 +84,7 @@
 </div>
 
 <div id="InstructionsDiv" class="StdDiv">
-       <p id="Instructions">[strInstructions]</p>
+       <div id="Instructions">[strInstructions]</div>
 </div>
 
 <div class="StdDiv" id="CheckButtonDiv">
index 2ca48f9aa97bac6e5fb9f159cab1253ebf8b1ba0..65a148a9472ca44ed15ce3d25b2ad0560b115e8a 100644 (file)
@@ -1,4 +1,32 @@
 
+[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]';
@@ -20,6 +48,7 @@ var LeftColPos = 100;
 var RightColPos = 500;
 var DragTop = 120;
 var Finished = false;
+var AnswersTried = '';
 
 //Fixed and draggable card arrays
 FC = new Array();
@@ -69,6 +98,10 @@ function DroppedOnFixed(DNum){
 
 function StartUp(){
 
+[inclScorm1.2]
+       ScormStartUp();
+[/inclScorm1.2]
+
 [inclSendResults]
        GetUserName();
 [/inclSendResults]
@@ -140,10 +173,9 @@ function StartUp(){
                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);
@@ -262,8 +294,11 @@ function CheckAnswers(){
        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++;
                }
@@ -307,6 +342,14 @@ function CheckAnswers(){
                setTimeout('Finish()', SubmissionTimeout);
                WriteToInstructions(Feedback);
        }
+[inclScorm1.2]
+       if (AllDone == true){
+               SetScormComplete();
+       }
+       else{
+               SetScormIncomplete();
+       }
+[/inclScorm1.2]
 }
 
 [inclTimer]
@@ -318,6 +361,9 @@ function TimesUp() {
        TimeOver = true;
        CheckAnswers();
        Locked = true;
+[inclScorm1.2]
+       SetScormTimedOut();
+[/inclScorm1.2]
 }
 [/inclTimer]
 
index d954337e41d361a6f0b11022506700da75c0fb74..1fb8c7c9fc23786c789e4ef88589f0ebc7e31b79 100644 (file)
 
 <!--
 
+[inclScorm1.2]
+[strJSScorm_1_2]
+[/inclScorm1.2]
+
 [strJSBrowserCheck]
 
 [strJSButtons]
@@ -59,7 +63,7 @@
 
 </head> 
 
-<body onload="TimerStartUp()" id="TheBody"> 
+<body onload="TimerStartUp()" id="TheBody" [inclScorm1.2]onunload="CheckLMSFinish()"[/inclScorm1.2]
 <!-- BeginTopNavButtons -->
 
 [inclNavButtons]
@@ -80,7 +84,7 @@
 </div>
 
 <div id="InstructionsDiv" class="StdDiv">
-       <p id="Instructions">[strInstructions]</p>
+       <div id="Instructions">[strInstructions]</div>
 </div>
 
 <div class="StdDiv" id="CheckButtonDiv">
index 8059a7c0704098ea3a3efb78a202586a6559bf10..e568c04660612b06bf1f5b9bebe82ab36c270cb5 100644 (file)
@@ -1,3 +1,35 @@
+[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]';
@@ -37,6 +69,7 @@ var DivWidth = 600;
 var LeftColPos = 100;
 var DragTop = 120;
 var DragNumber = -1;
+var AnswersTried = '';
 
 Lines = new Array();
 
@@ -211,6 +244,9 @@ function CheckAnswer(CheckType){
                        }
                }
                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);
@@ -227,7 +263,10 @@ function CheckAnswer(CheckType){
        }
 
        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 />';
                }
@@ -267,6 +306,15 @@ function CheckAnswer(CheckType){
                setTimeout('Finish()', SubmissionTimeout);
                WriteToInstructions(YourScoreIs + ' ' + Score + '%.'); 
        }
+       
+[inclScorm1.2]
+       if (AllDone == true){
+               SetScormComplete();
+       }
+       else{
+               SetScormIncomplete();
+       }
+[/inclScorm1.2]
 }
 
 
@@ -396,6 +444,10 @@ function StartUp(){
        GetUserName();
 [/inclSendResults]
 
+[inclScorm1.2]
+       ScormStartUp();
+[/inclScorm1.2]
+
 [inclPreloadImages]
        PreloadImages([PreloadImageList]);
 [/inclPreloadImages]
@@ -517,5 +569,8 @@ function TimesUp() {
        TimeOver = true;
        CheckAnswer(0);
        Locked = true;
+[inclScorm1.2]
+       SetScormTimedOut();
+[/inclScorm1.2]
 }
 [/inclTimer]
index 3ec5d096b68f37fd5d94742d736e6cd7525b162a..2a22c60e528ced68a2b51666500b87f974f7b0a4 100644 (file)
@@ -29,6 +29,9 @@
 
 <!--
 
+[inclScorm1.2]
+[strJSScorm_1_2]
+[/inclScorm1.2]
 
 [strJSBrowserCheck]
 
@@ -48,7 +51,7 @@
 </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 -->
 
@@ -66,7 +69,7 @@
 </div>
 
 <div id="InstructionsDiv" class="StdDiv">
-       <p id="Instructions">[strInstructions]</p>
+       <div id="Instructions">[strInstructions]</div>
 </div>
 
 <div id="MainDiv" class="StdDiv">
index 79db982d861902cfa1b04ae9f8e4d2c1a4d8156a..988ac5435a5f8e416229442855e2a72bd9c1e292 100644 (file)
@@ -1,4 +1,17 @@
 
+[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();
@@ -34,6 +47,17 @@ function SetUpItems(){
 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]);
index 2ea245bcda8659e1e883e75cc1a53d0c8392f283..05c9b3e700ebbedcf3483f54ed7047f76b5f9118 100644 (file)
@@ -6,6 +6,12 @@
 
 /* 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]
@@ -381,6 +387,7 @@ div#ClueEntry{
 div.Keypad{
        text-align: center;
        display: none; /* initially hidden, shown if needed */
+       margin-bottom: 0.5em;
 }
 
 div.Keypad button{
@@ -408,7 +415,9 @@ textarea{
 }
 
 .QuestionText{
-
+       text-align: left;
+       margin: 0px;
+       font-size: 100%;
 }
 
 .Answer{
index ce7357f4e8504a0bea8651c19d442f653ad4a0c1..f3570d4d3a3e64d1edf5eabf8d50d3cc2f1c871a 100644 (file)
@@ -186,8 +186,13 @@ function CheckShortAnswer(QNum){
        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
index 50790285828ffee401cc5ac67b31ec09dfce0f12..ad0e15776425f110bad19ae27b922ed87216f673 100644 (file)
@@ -1,18 +1,7 @@
 
-[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]
index cff751d1344025aff4288dd9241929ccc2c612ae..b860ec8f052fdbd4179b6dffc3a0aaf5d25a5ed7 100644 (file)
@@ -6,17 +6,17 @@ var UserName = '';
 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(){
index 98a33c2b08095f522bdb95a4eea60b71a6778a51..58dde4675f1a78fe9b73178c9f6e8e4c46b5c0f4 100644 (file)
@@ -6,49 +6,74 @@ var topZ = 1000;
 
 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');
index d42c4e21c38fd9f8c18c7bfcd061ea80fc146749..2f12775229cb7b05db44125c67424e447c6b9f28 100644 (file)
@@ -22,25 +22,36 @@ function GetPageXY(El) {
 }
 
 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;
+               }
        }
 }
 
index eedcea8ce471aa1340d5040c14ad9de60ee25585..ac0c84fddcd306ad7334e0019bf9945eb34166dc 100644 (file)
 
 <!--
 
+[inclScorm1.2]
+[strJSScorm_1_2]
+[/inclScorm1.2]
+
 [strJSBrowserCheck]
 
 [strJSButtons]
@@ -58,7 +62,7 @@
 
 </head>
 
-<body onload="StartUp()" id="TheBody">
+<body onload="StartUp()" id="TheBody" [inclScorm1.2]onunload="CheckLMSFinish()"[/inclScorm1.2]>
 
 <!-- BeginTopNavButtons -->
 
@@ -80,7 +84,7 @@
 </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]
index 95b0c53d0c91dcdb2ffd1ae7c68b32aadc580959..3a22cce217cd2c641a6afd0a6e28a97daf9965da 100644 (file)
@@ -1,4 +1,39 @@
 
+[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(){
@@ -31,6 +66,14 @@ State = new Array();
 
 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();
@@ -62,7 +105,7 @@ function ShowClue(ItemNum){
 }
 
 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])){
@@ -146,6 +189,7 @@ function CheckAnswers(){
        CompileGuesses();
        
        if ((AllCorrect == true)||(Finished == true)){
+       
 [inclSendResults]
                setTimeout('SendResults(' + TotalScore + ')', 50);
 [/inclSendResults]
@@ -157,6 +201,14 @@ function CheckAnswers(){
                Finished = true;
                setTimeout('Finish()', SubmissionTimeout);
        }
+[inclScorm1.2]
+       if (AllCorrect == true){
+               SetScormComplete();
+       }
+       else{
+               SetScormIncomplete();
+       }
+[/inclScorm1.2]
 }
 
 function TrackFocus(BoxNumber){
@@ -299,6 +351,7 @@ function GetHint(GapNum){
 }
 
 function ShowHint(){
+       if (document.getElementById('FeedbackDiv').style.display == 'block'){return;}
        if (Locked == true){return;}
        var CurrGap = FindCurrent();
        if (CurrGap < 0){return;}
@@ -330,5 +383,8 @@ function TimesUp() {
        Finished = true;
        CheckAnswers();
        Locked = true;
+[inclScorm1.2]
+       SetScormTimedOut();
+[/inclScorm1.2]
 }
 [/inclTimer]
\ No newline at end of file
index 706af6956bb8bda0c53c8ccc7b3ecd68de75ef98..bcaeea97680df0d2af8f363330c409b46d54d4b5 100644 (file)
 
 <!--
 
+[inclScorm1.2]
+[strJSScorm_1_2]
+[/inclScorm1.2]
+
 [strJSBrowserCheck]
 
 [strJSButtons]
@@ -58,7 +62,7 @@
 
 </head>
 
-<body onload="StartUp()" id="TheBody">
+<body onload="StartUp()" id="TheBody" [inclScorm1.2]onunload="CheckLMSFinish()"[/inclScorm1.2]>
 
 <!-- BeginTopNavButtons -->
 
@@ -80,7 +84,7 @@
 </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]
index 11833c454406d6bea2c01179be53a7c836ba5075..26c911ff05ba3ef78c9f81b746ada818ebe1219a 100644 (file)
@@ -1,3 +1,31 @@
+[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
 
@@ -17,9 +45,10 @@ var Score = 0;
 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>';
@@ -29,6 +58,14 @@ var Finished = false;
 
 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]
@@ -126,8 +163,6 @@ function SplitStringToPerceivedChars(InString, PC){
 }
 
 function EnterAnswer(Guess,Across,AnsLength,x,y){
-       Guess = Guess.toUpperCase();
-
        var PC = new Array();
        SplitStringToPerceivedChars(Guess, PC);
        
@@ -161,12 +196,23 @@ function SetGridSquareValue(x,y,Val){
 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;
@@ -182,7 +228,16 @@ function ShowHint(Across,ClueNum,x,y,BoxId){
                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;
@@ -214,13 +269,23 @@ function CheckAnswers(){
        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,'');
@@ -264,6 +329,14 @@ function CheckAnswers(){
                Finished = true;
                setTimeout('Finish()', SubmissionTimeout);
        }
+[inclScorm1.2]
+       if (AllCorrect == true){
+               SetScormComplete();
+       }
+       else{
+               SetScormIncomplete();
+       }
+[/inclScorm1.2]
 }
 
 function Finish(){
@@ -293,5 +366,8 @@ function TimesUp() {
        Finished = true;
        CheckAnswers();
        Locked = true;
+[inclScorm1.2]
+       SetScormTimedOut();
+[/inclScorm1.2]
 }
 [/inclTimer]
\ No newline at end of file
index e517cedd6994ea2310d202b64c53fe756f8a17c0..988170eb7b61dd2f664830f24f2aed2bb1a20c14 100644 (file)
 
 <!--
 
+[inclScorm1.2]
+[strJSScorm_1_2]
+[/inclScorm1.2]
+
 [strJSBrowserCheck]
 
 [strJSButtons]
@@ -58,7 +62,7 @@
 
 </head>
 
-<body onload="StartUp()" id="TheBody">
+<body onload="StartUp()" id="TheBody" [inclScorm1.2]onunload="CheckLMSFinish()"[/inclScorm1.2]>
 
 <!-- BeginTopNavButtons -->
 
@@ -80,7 +84,7 @@
 </div>
 
 <div id="InstructionsDiv" class="StdDiv">
-       <p id="Instructions">[strInstructions]</p>
+       <div id="Instructions">[strInstructions]</div>
 </div>
 
 [inclReading]
index a1153f4320fcba4f3b12c192fbb1e948060a18ae..1922189d8e2bc3218f4d0337d7a7652a357e882a 100644 (file)
@@ -1,4 +1,39 @@
 
+[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]';
@@ -19,6 +54,10 @@ var QsToShow = [QsToShow];
 function StartUp(){
        RemoveBottomNavBarForIE();
 
+[inclScorm1.2]
+       ScormStartUp();
+[/inclScorm1.2]
+       
 [inclSendResults]
        GetUserName();
 [/inclSendResults]
@@ -49,6 +88,7 @@ function CreateStatusArrays(){
                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
        }
 }
 
@@ -182,6 +222,8 @@ function CheckAnswers(){
 //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){
@@ -198,6 +240,10 @@ function CheckAnswers(){
                                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++;
@@ -235,6 +281,15 @@ function CheckAnswers(){
 
 //Show the feedback
        ShowMessage(Feedback);
+       
+[inclScorm1.2]
+       if (AllDone == true){
+               SetScormComplete();
+       }
+       else{
+               SetScormIncomplete();
+       }
+[/inclScorm1.2]
 }
 
 [inclTimer]
@@ -247,6 +302,9 @@ function TimesUp() {
        Finished = true;
        CheckAnswers();
        Locked = true;
+[inclScorm1.2]
+       SetScormTimedOut();
+[/inclScorm1.2]
 }
 [/inclTimer]
 
index a25997b185096fb35d18d12f9c91a9bf5fa86a62..54c92d46dd2faa413988fc0579ead884537674a7 100644 (file)
 
 <!--
 
+[inclScorm1.2]
+[strJSScorm_1_2]
+[/inclScorm1.2]
+
 [strJSBrowserCheck]
 
 [strJSButtons]
@@ -58,7 +62,7 @@
 
 </head>
 
-<body onload="StartUp()" id="TheBody">
+<body onload="StartUp()" id="TheBody" [inclScorm1.2]onunload="CheckLMSFinish()"[/inclScorm1.2]>
 
 <!-- BeginTopNavButtons -->
 
@@ -80,7 +84,7 @@
 </div>
 
 <div id="InstructionsDiv" class="StdDiv">
-       <p id="Instructions">[strInstructions]</p>
+       <div id="Instructions">[strInstructions]</div>
 </div>
 
 [inclReading]
index 18d1fe0de9698507d892831ecdfcfa76750af722..52dbd73ac612b4acfcbbf098b943f357f2e8f1d9 100644 (file)
@@ -1,5 +1,35 @@
-//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]';
@@ -13,6 +43,7 @@ var Finished = false;
 var TimeOver = false;
 var Score = 0;
 var strInstructions = '';
+var AnswersTried = '';
 
 
 var SegmentTemplate = '&nbsp; &nbsp;<a class="ExSegment" href="javascript:void(0)" onclick="AddSegment([SegmentNumber])" title="[strClickToAdd]">[CurrentSegment]</a>&nbsp; &nbsp;';
@@ -209,6 +240,9 @@ function CheckAnswer(CheckType){
 
                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 />';
@@ -224,7 +258,10 @@ function CheckAnswer(CheckType){
        }
 
        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 />';
                }
@@ -276,6 +313,14 @@ function CheckAnswer(CheckType){
                setTimeout('Finish()', SubmissionTimeout);
                WriteToInstructions(YourScoreIs + ' ' + Score + '%.'); 
        }
+[inclScorm1.2]
+       if (AllDone == true){
+               SetScormComplete();
+       }
+       else{
+               SetScormIncomplete();
+       }
+[/inclScorm1.2]
 }
 
 function FindSegment(SegID){
@@ -299,6 +344,10 @@ function StartUp(){
        GetUserName();
 [/inclSendResults]
 
+[inclScorm1.2]
+       ScormStartUp();
+[/inclScorm1.2]
+
 [inclPreloadImages]
        PreloadImages([PreloadImageList]);
 [/inclPreloadImages]
@@ -353,5 +402,8 @@ function TimesUp() {
        Finished = true;
        CheckAnswer(0);
        Locked = true;
+[inclScorm1.2]
+       SetScormTimedOut();
+[/inclScorm1.2]
 }
 [/inclTimer]
\ No newline at end of file
index b26834c23351eec72e846cc6e1a189d4c6ecd70b..3cedaefe1f37eb7b36cc1e35c95423592f7366dd 100644 (file)
 
 <!--
 
+[inclScorm1.2]
+[strJSScorm_1_2]
+[/inclScorm1.2]
+
 [strJSBrowserCheck]
 
 [strJSButtons]
@@ -62,7 +66,7 @@
 
 </head>
 
-<body onload="StartUp()" id="TheBody">
+<body onload="StartUp()" id="TheBody" [inclScorm1.2]onunload="CheckLMSFinish()"[/inclScorm1.2]>
 
 <!-- BeginTopNavButtons -->
 
@@ -84,7 +88,7 @@
 </div>
 
 <div id="InstructionsDiv" class="StdDiv">
-       <p id="Instructions">[strInstructions]</p>
+       <div id="Instructions">[strInstructions]</div>
 </div>
 
 [inclReading]
index 92f331bf84e307cb7f6d7273ec7917ff7abe39ac..cf1a4f73cfa149c7ecdda0a4c002a7c08a221fda 100644 (file)
@@ -1,4 +1,43 @@
 
+[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;
@@ -24,6 +63,7 @@ var State = new Array();
 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.
@@ -153,7 +193,8 @@ function ShowSpecialReadingForQuestion(){
                        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;
@@ -205,6 +246,10 @@ function StartUp(){
 //Stash the instructions so they can be redisplayed
        strInstructions = document.getElementById('InstructionsDiv').innerHTML;
        
+[inclScorm1.2]
+       ScormStartUp();
+[/inclScorm1.2]
+       
 [inclSendResults]
        GetUserName();
 [/inclSendResults]
@@ -315,7 +360,8 @@ function CheckMCAnswer(QNum, ANum, Btn){
        
 //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){
@@ -446,7 +492,7 @@ function CheckMultiSelAnswer(QNum){
        
        var ShouldBeChecked;
        var Matches = 0;
-       State[QNum][5] += '|';
+       if (State[QNum][5].length > 0){State[QNum][5] += ' | ';}
        
 //Check if there are any mismatches
        Feedback = '';
@@ -563,6 +609,16 @@ function CheckFinished(){
 [inclTimer]
                window.clearInterval(Interval);
 [/inclTimer]
+
+[inclScorm1.2]
+               if (TimeOver == true){
+                       SetScormTimedOut();
+               }
+               else{
+                       SetScormComplete();
+               }
+[/inclScorm1.2]
+
                TimeOver = true;
                Locked = true;
                
@@ -582,6 +638,11 @@ function CheckFinished(){
                Detail += '</fields></hpnetresult>';
                setTimeout('Finish()', SubmissionTimeout);
        }
+[inclScorm1.2]
+       else{
+               SetScormIncomplete();
+       }
+[/inclScorm1.2]
 }
 
 [inclTimer]
index d6755b708de56614f33c405e67e29c40b07cb69d..fa795d8f30f1ad10d84f35ea6ac7101ab7cf5152 100644 (file)
 
 <!-- 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{
index 3f8cb424af03d7564879bc23d07ddee8acda0d8c..95b71ae6edb3df9d2aa23fcee651bf56aa97c669 100644 (file)
@@ -13,7 +13,7 @@ Testing browser check code
 
 <script type="text/javascript" src="hp6browsercheck.js_"></script>
 
-<base href="http://web.uvic.ca/hrd/hotpot/" />
+<base href="http://hotpot.uvic.ca/" />
 
 </head>
 
index 7cdf3191d86760edd99d9eedd6925e950156679f..19cdce0103eb55d91aaff6cd697aa442f46049cb 100644 (file)
@@ -3,8 +3,8 @@
 ///  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