Permalink
Browse files

add HP 6.2 templates; add compatability with Safari (Mac browser); mi…

…croincrement version to 2007020201 (release 2.3.1)
  • Loading branch information...
gbateson
gbateson committed May 3, 2007
1 parent df3311e commit 616f3a0584827de91333c322fdd330f478b9cc28
View
@@ -1,5 +1,5 @@
==================================================
-This is v2.3.0 of the HotPot module for Moodle 1.8
+This is v2.3.1 of the HotPot module for Moodle 1.8
==================================================
This module allows teachers to administer Hot Potatoes and TexToys quizzes via Moodle.
View

Large diffs are not rendered by default.

Oops, something went wrong.
@@ -24,11 +24,11 @@ function expand_blocks($tag) {
// [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';
@@ -324,6 +324,11 @@ function v6_expand_NavBarJS() {
return $this->v6_expand_NavButtons();
}
+ // switch off scorm
+ function v6_expand_Scorm12() {
+ return false;
+ }
+
// js files (all quiz types)
function v6_expand_JSBrowserCheck() {
@@ -29,6 +29,10 @@
<!--
+[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">
@@ -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]
@@ -29,6 +29,10 @@
<!--
+[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">
@@ -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]
@@ -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">
@@ -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]);
@@ -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{
Oops, something went wrong.

0 comments on commit 616f3a0

Please sign in to comment.