From 71a10ef2ada3b356498517a96ba4b61486d53eb3 Mon Sep 17 00:00:00 2001 From: gbateson Date: Thu, 24 Nov 2005 07:00:33 +0000 Subject: [PATCH] removed bad newlines (\r\r\n) which caused double-spacing in HTML/JS/CSS source --- mod/hotpot/template/v6/djmatch6.ht_ | 248 ++-- mod/hotpot/template/v6/djmatch6.js_ | 646 ++++----- mod/hotpot/template/v6/djmix6.ht_ | 264 ++-- mod/hotpot/template/v6/djmix6.js_ | 1042 +++++++------- mod/hotpot/template/v6/fjmatch6.ht_ | 204 +-- mod/hotpot/template/v6/fjmatch6.js_ | 214 +-- mod/hotpot/template/v6/hotpot6r.ht_ | 16 +- mod/hotpot/template/v6/hp6.cs_ | 1192 ++++++++-------- mod/hotpot/template/v6/hp6browsercheck.js_ | 110 +- mod/hotpot/template/v6/hp6buttons.js_ | 84 +- mod/hotpot/template/v6/hp6card.js_ | 304 ++--- .../template/v6/hp6checkshortanswer.js_ | 798 +++++------ mod/hotpot/template/v6/hp6hotpotnet.js_ | 36 +- mod/hotpot/template/v6/hp6navbar.ht_ | 30 +- mod/hotpot/template/v6/hp6objecttags.ht_ | 70 +- mod/hotpot/template/v6/hp6plainpage.ht_ | 84 +- mod/hotpot/template/v6/hp6sendresults.js_ | 106 +- mod/hotpot/template/v6/hp6showmessage.js_ | 120 +- mod/hotpot/template/v6/hp6timer.js_ | 66 +- mod/hotpot/template/v6/hp6utilities.js_ | 474 +++---- mod/hotpot/template/v6/jcloze6.ht_ | 330 ++--- mod/hotpot/template/v6/jcloze6.js_ | 666 ++++----- mod/hotpot/template/v6/jcross6.ht_ | 374 ++--- mod/hotpot/template/v6/jcross6.js_ | 592 ++++---- mod/hotpot/template/v6/jcross6print.ht_ | 364 ++--- mod/hotpot/template/v6/jmatch6.ht_ | 288 ++-- mod/hotpot/template/v6/jmatch6.js_ | 504 +++---- mod/hotpot/template/v6/jmix6.ht_ | 302 ++-- mod/hotpot/template/v6/jmix6.js_ | 712 +++++----- mod/hotpot/template/v6/jquiz6.ht_ | 318 ++--- mod/hotpot/template/v6/jquiz6.js_ | 1212 ++++++++--------- mod/hotpot/template/v6/masher.ht_ | 178 +-- mod/hotpot/template/v6/mashernav.ht_ | 56 +- mod/hotpot/template/v6/testbrowsercheck.htm | 68 +- 34 files changed, 6036 insertions(+), 6036 deletions(-) diff --git a/mod/hotpot/template/v6/djmatch6.ht_ b/mod/hotpot/template/v6/djmatch6.ht_ index 8829f950157..37141ff76ff 100644 --- a/mod/hotpot/template/v6/djmatch6.ht_ +++ b/mod/hotpot/template/v6/djmatch6.ht_ @@ -1,124 +1,124 @@ - - - - -[strDublinCoreMetadata] - - - - -[strPlainTitle] - - - - - - -[strHeaderCode] - - - - - - - - - - -[inclNavButtons] -[strTopNavBar] -[/inclNavButtons] - - - -
-

[strExerciseTitle]

-[inclExerciseSubtitle] -

[strExerciseSubtitle]

-[/inclExerciseSubtitle] -[inclTimer] -
    
-[/inclTimer] - -
- -
-

[strInstructions]

-
- -
- -
- - - -
-
- -
- - - - - - - - - - - + + + + +[strDublinCoreMetadata] + + + + +[strPlainTitle] + + + + + + +[strHeaderCode] + + + + + + + + + + +[inclNavButtons] +[strTopNavBar] +[/inclNavButtons] + + + +
+

[strExerciseTitle]

+[inclExerciseSubtitle] +

[strExerciseSubtitle]

+[/inclExerciseSubtitle] +[inclTimer] +
    
+[/inclTimer] + +
+ +
+

[strInstructions]

+
+ +
+ +
+ + + +
+
+ +
+ + + + + + + + + + + diff --git a/mod/hotpot/template/v6/djmatch6.js_ b/mod/hotpot/template/v6/djmatch6.js_ index 0a051d88a97..2ca48f9aa97 100644 --- a/mod/hotpot/template/v6/djmatch6.js_ +++ b/mod/hotpot/template/v6/djmatch6.js_ @@ -1,323 +1,323 @@ - -var CorrectResponse = '[strGuessCorrect]'; -var IncorrectResponse = '[strGuessIncorrect]'; -var YourScoreIs = '[strYourScoreIs]'; -var DivWidth = 600; //default value -var FeedbackWidth = 200; //default -var ExBGColor = '[strExBGColor]'; -var PageBGColor = '[strPageBGColor]'; -var TextColor = '[strTextColor]'; -var TitleColor = '[strTitleColor]'; -var Penalties = 0; -var Score = 0; -var TimeOver = false; -var Locked = false; -var ShuffleQs = [boolShuffleQs]; -var QsToShow = [QsToShow]; - -var DragWidth = 200; -var LeftColPos = 100; -var RightColPos = 500; -var DragTop = 120; -var Finished = false; - -//Fixed and draggable card arrays -FC = new Array(); -DC = new Array(); - -function onEndDrag(){ -//Is it dropped on any of the fixed cards? - var Docked = false; - var DropTarget = DroppedOnFixed(CurrDrag); - if (DropTarget > -1){ -//If so, send home any card that is currently docked there - for (var i=0; i OverlapArea){ - OverlapArea = Temp; - Result = i; - } - } - return Result; -} - - -function StartUp(){ - -[inclSendResults] - GetUserName(); -[/inclSendResults] - -[inclPreloadImages] - PreloadImages([PreloadImageList]); -[/inclPreloadImages] - -//Calculate page dimensions and positions - pg = new PageDim(); - DivWidth = Math.floor((pg.W*4)/5); - DragWidth = Math.floor((DivWidth*3)/10); - LeftColPos = Math.floor(pg.W/15); - RightColPos = pg.W - (DragWidth + LeftColPos); - DragTop = parseInt(document.getElementById('CheckButtonDiv').offsetHeight) + parseInt(document.getElementById('CheckButtonDiv').offsetTop) + 10; - - if (C.ie){ - DragTop += 15; - } - -//Reduce array if required - if (QsToShow < F.length){ - ReduceItems2(); - } - -//Shuffle the left items if required - if (ShuffleQs == true){ - F = Shuffle(F); - } - -//Shuffle the items on the right - D = Shuffle(D); - - var CurrTop = DragTop; - var TempInt = 0; - var DropHome = 0; - var Widest = 0; - var CardContent = ''; - for (var i=0; i Widest){ - Widest = FC[i].GetW(); - } - } - - if (Widest > DragWidth){Widest = DragWidth;} - - CurrTop = DragTop; - - DragWidth = Math.floor((DivWidth-Widest)/2) - 24; - RightColPos = DivWidth + LeftColPos - (DragWidth + 14); - var Highest = 0; - var WidestRight = 0; - - for (i=0; i -1){CardContent += '
';} //used to be required for Navigator rendering bug with images - DC[i].elm.innerHTML = CardContent; - if (DC[i].GetW() > DragWidth){DC[i].SetW(DragWidth);} - DC[i].css.cursor = 'move'; - DC[i].css.backgroundColor = '[strExBGColor]'; - DC[i].css.color = '[strTextColor]'; - TempInt = DC[i].GetH(); - if (TempInt > Highest){Highest = TempInt;} - TempInt = DC[i].GetW(); - 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;} - - for (i=0; i 0){ - DC[i].tag = D[i][1]; - D[i][2] = D[i][1]; - var TopChange = 0; -//Find the right target element - var TargItem = -1; - for (var j=0; j DC[i].GetT()){ - TopChange = 1; - } - } - Slide(i, TargetLeft, TargetTop, TopChange); - D[i][2] = F[TargItem][1]; - DC[i].tag = TargItem+1; - } - } -[/inclSlide] -[inclTimer] - StartTimer(); -[/inclTimer] -} - -[inclSlide] -function Slide(MoverNum, TargL, TargT, TopChange){ - var TempInt = DC[MoverNum].GetL(); - if (TempInt > TargL){ - DC[MoverNum].SetL(TempInt - 5); - } - TempInt = DC[MoverNum].GetT(); - if (TempInt != TargT){ - DC[MoverNum].SetT(TempInt + TopChange); - } - if ((DC[MoverNum].GetL() > TargL)||(DC[MoverNum].GetT() != TargT)){ - setTimeout('Slide('+MoverNum+','+TargL+','+TargT+','+TopChange+')', 1); - } - else{ - DC[MoverNum].SetL(TargL); - } -} -[/inclSlide] - -F = new Array(); -[FixedArray] - -D = new Array(); -[DragArray] - -function ReduceItems2(){ - var ItemToDump=0; - var j=0; - while (F.length > QsToShow){ - ItemToDump = Math.floor(F.length*Math.random()); - for (j=ItemToDump; j<(F.length-1); j++){ - F[j] = F[j+1]; - } - for (j=ItemToDump; j<(D.length-1); j++){ - D[j] = D[j+1]; - } - F.length = F.length-1; - D.length = D.length-1; - } -} - -function TimerStartUp(){ - setTimeout('StartUp()', 300); -} - -function CheckAnswers(){ - if (Locked == true){return;} -//Set the default score and response - var TotalCorrect = 0; - Score = 0; - var Feedback = ''; - -//for each fixed, check to see if the tag value for the draggable is the same as the fixed - var i, j; - for (i=0; i 0)){ - TotalCorrect++; - } - else{ -//Change made for version 6.0.3.41: don't send wrong items home, -//show them in a more conspicuous way. -// DC[i].GoHome(); - DC[i].SetL(DC[i].GetL() + 10); - DC[i].Highlight(); - } - } - - Score = Math.floor((100*(TotalCorrect-Penalties))/F.length); - - var AllDone = false; - - if (TotalCorrect == F.length) { - AllDone = true; - } - - if (AllDone == true){ - Feedback = YourScoreIs + ' ' + Score + '%.'; - ShowMessage(Feedback + '
' + CorrectResponse); - } - else { - Feedback = IncorrectResponse + '
' + YourScoreIs + ' ' + Score + '%.'; - ShowMessage(Feedback); - Penalties++; // Penalty for inaccurate check - } -//If the exercise is over, deal with that - if ((AllDone == true)||(TimeOver == true)){ -[inclSendResults] - setTimeout('SendResults(' + Score + ')', 50); -[/inclSendResults] -[inclTimer] - window.clearInterval(Interval); -[/inclTimer] - TimeOver = true; - Locked = true; - Finished = true; - setTimeout('Finish()', SubmissionTimeout); - WriteToInstructions(Feedback); - } -} - -[inclTimer] -function TimesUp() { - document.getElementById('Timer').innerHTML = '[strTimesUp]'; -[inclPreloadImages] - RefreshImages(); -[/inclPreloadImages] - TimeOver = true; - CheckAnswers(); - Locked = true; -} -[/inclTimer] - + +var CorrectResponse = '[strGuessCorrect]'; +var IncorrectResponse = '[strGuessIncorrect]'; +var YourScoreIs = '[strYourScoreIs]'; +var DivWidth = 600; //default value +var FeedbackWidth = 200; //default +var ExBGColor = '[strExBGColor]'; +var PageBGColor = '[strPageBGColor]'; +var TextColor = '[strTextColor]'; +var TitleColor = '[strTitleColor]'; +var Penalties = 0; +var Score = 0; +var TimeOver = false; +var Locked = false; +var ShuffleQs = [boolShuffleQs]; +var QsToShow = [QsToShow]; + +var DragWidth = 200; +var LeftColPos = 100; +var RightColPos = 500; +var DragTop = 120; +var Finished = false; + +//Fixed and draggable card arrays +FC = new Array(); +DC = new Array(); + +function onEndDrag(){ +//Is it dropped on any of the fixed cards? + var Docked = false; + var DropTarget = DroppedOnFixed(CurrDrag); + if (DropTarget > -1){ +//If so, send home any card that is currently docked there + for (var i=0; i OverlapArea){ + OverlapArea = Temp; + Result = i; + } + } + return Result; +} + + +function StartUp(){ + +[inclSendResults] + GetUserName(); +[/inclSendResults] + +[inclPreloadImages] + PreloadImages([PreloadImageList]); +[/inclPreloadImages] + +//Calculate page dimensions and positions + pg = new PageDim(); + DivWidth = Math.floor((pg.W*4)/5); + DragWidth = Math.floor((DivWidth*3)/10); + LeftColPos = Math.floor(pg.W/15); + RightColPos = pg.W - (DragWidth + LeftColPos); + DragTop = parseInt(document.getElementById('CheckButtonDiv').offsetHeight) + parseInt(document.getElementById('CheckButtonDiv').offsetTop) + 10; + + if (C.ie){ + DragTop += 15; + } + +//Reduce array if required + if (QsToShow < F.length){ + ReduceItems2(); + } + +//Shuffle the left items if required + if (ShuffleQs == true){ + F = Shuffle(F); + } + +//Shuffle the items on the right + D = Shuffle(D); + + var CurrTop = DragTop; + var TempInt = 0; + var DropHome = 0; + var Widest = 0; + var CardContent = ''; + for (var i=0; i Widest){ + Widest = FC[i].GetW(); + } + } + + if (Widest > DragWidth){Widest = DragWidth;} + + CurrTop = DragTop; + + DragWidth = Math.floor((DivWidth-Widest)/2) - 24; + RightColPos = DivWidth + LeftColPos - (DragWidth + 14); + var Highest = 0; + var WidestRight = 0; + + for (i=0; i -1){CardContent += '
';} //used to be required for Navigator rendering bug with images + DC[i].elm.innerHTML = CardContent; + if (DC[i].GetW() > DragWidth){DC[i].SetW(DragWidth);} + DC[i].css.cursor = 'move'; + DC[i].css.backgroundColor = '[strExBGColor]'; + DC[i].css.color = '[strTextColor]'; + TempInt = DC[i].GetH(); + if (TempInt > Highest){Highest = TempInt;} + TempInt = DC[i].GetW(); + 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;} + + for (i=0; i 0){ + DC[i].tag = D[i][1]; + D[i][2] = D[i][1]; + var TopChange = 0; +//Find the right target element + var TargItem = -1; + for (var j=0; j DC[i].GetT()){ + TopChange = 1; + } + } + Slide(i, TargetLeft, TargetTop, TopChange); + D[i][2] = F[TargItem][1]; + DC[i].tag = TargItem+1; + } + } +[/inclSlide] +[inclTimer] + StartTimer(); +[/inclTimer] +} + +[inclSlide] +function Slide(MoverNum, TargL, TargT, TopChange){ + var TempInt = DC[MoverNum].GetL(); + if (TempInt > TargL){ + DC[MoverNum].SetL(TempInt - 5); + } + TempInt = DC[MoverNum].GetT(); + if (TempInt != TargT){ + DC[MoverNum].SetT(TempInt + TopChange); + } + if ((DC[MoverNum].GetL() > TargL)||(DC[MoverNum].GetT() != TargT)){ + setTimeout('Slide('+MoverNum+','+TargL+','+TargT+','+TopChange+')', 1); + } + else{ + DC[MoverNum].SetL(TargL); + } +} +[/inclSlide] + +F = new Array(); +[FixedArray] + +D = new Array(); +[DragArray] + +function ReduceItems2(){ + var ItemToDump=0; + var j=0; + while (F.length > QsToShow){ + ItemToDump = Math.floor(F.length*Math.random()); + for (j=ItemToDump; j<(F.length-1); j++){ + F[j] = F[j+1]; + } + for (j=ItemToDump; j<(D.length-1); j++){ + D[j] = D[j+1]; + } + F.length = F.length-1; + D.length = D.length-1; + } +} + +function TimerStartUp(){ + setTimeout('StartUp()', 300); +} + +function CheckAnswers(){ + if (Locked == true){return;} +//Set the default score and response + var TotalCorrect = 0; + Score = 0; + var Feedback = ''; + +//for each fixed, check to see if the tag value for the draggable is the same as the fixed + var i, j; + for (i=0; i 0)){ + TotalCorrect++; + } + else{ +//Change made for version 6.0.3.41: don't send wrong items home, +//show them in a more conspicuous way. +// DC[i].GoHome(); + DC[i].SetL(DC[i].GetL() + 10); + DC[i].Highlight(); + } + } + + Score = Math.floor((100*(TotalCorrect-Penalties))/F.length); + + var AllDone = false; + + if (TotalCorrect == F.length) { + AllDone = true; + } + + if (AllDone == true){ + Feedback = YourScoreIs + ' ' + Score + '%.'; + ShowMessage(Feedback + '
' + CorrectResponse); + } + else { + Feedback = IncorrectResponse + '
' + YourScoreIs + ' ' + Score + '%.'; + ShowMessage(Feedback); + Penalties++; // Penalty for inaccurate check + } +//If the exercise is over, deal with that + if ((AllDone == true)||(TimeOver == true)){ +[inclSendResults] + setTimeout('SendResults(' + Score + ')', 50); +[/inclSendResults] +[inclTimer] + window.clearInterval(Interval); +[/inclTimer] + TimeOver = true; + Locked = true; + Finished = true; + setTimeout('Finish()', SubmissionTimeout); + WriteToInstructions(Feedback); + } +} + +[inclTimer] +function TimesUp() { + document.getElementById('Timer').innerHTML = '[strTimesUp]'; +[inclPreloadImages] + RefreshImages(); +[/inclPreloadImages] + TimeOver = true; + CheckAnswers(); + Locked = true; +} +[/inclTimer] + diff --git a/mod/hotpot/template/v6/djmix6.ht_ b/mod/hotpot/template/v6/djmix6.ht_ index 3e60043357b..d954337e41d 100644 --- a/mod/hotpot/template/v6/djmix6.ht_ +++ b/mod/hotpot/template/v6/djmix6.ht_ @@ -1,132 +1,132 @@ - - - - -[strDublinCoreMetadata] - - - - -[strPlainTitle] - - - - - - -[strHeaderCode] - - - - - - - - - - -[inclNavButtons] -[strTopNavBar] -[/inclNavButtons] - - - -
-

[strExerciseTitle]

-[inclExerciseSubtitle] -

[strExerciseSubtitle]

-[/inclExerciseSubtitle] -[inclTimer] -
    
-[/inclTimer] - -
- -
-

[strInstructions]

-
- -
- - -[inclRestart] - -[/inclRestart] - -[inclHint] - -[/inclHint] -
- - - - - - - - - - - - - - - + + + + +[strDublinCoreMetadata] + + + + +[strPlainTitle] + + + + + + +[strHeaderCode] + + + + + + + + + + +[inclNavButtons] +[strTopNavBar] +[/inclNavButtons] + + + +
+

[strExerciseTitle]

+[inclExerciseSubtitle] +

[strExerciseSubtitle]

+[/inclExerciseSubtitle] +[inclTimer] +
    
+[/inclTimer] + +
+ +
+

[strInstructions]

+
+ +
+ + +[inclRestart] + +[/inclRestart] + +[inclHint] + +[/inclHint] +
+ + + + + + + + + + + + + + + diff --git a/mod/hotpot/template/v6/djmix6.js_ b/mod/hotpot/template/v6/djmix6.js_ index faecf7f5b0e..8059a7c0704 100644 --- a/mod/hotpot/template/v6/djmix6.js_ +++ b/mod/hotpot/template/v6/djmix6.js_ @@ -1,521 +1,521 @@ -//JMIX DRAG-DROP OUTPUT FORMAT CODE - -var Punctuation = '[strPunctuation]'; - -var Openers = '[strOpenPunctuation]'; -var CorrectResponse = '[strGuessCorrect]'; -var IncorrectResponse = '[strGuessIncorrect]'; -var ThisMuchCorrect = '[strThisMuch]'; -var TheseAnswersToo = '[strTheseAnswersToo]'; -var YourScoreIs = '[strYourScoreIs]'; -var NextCorrect = '[strNextCorrect]'; -var FeedbackWidth = 200; //default -var ExBGColor = '[strExBGColor]'; -var PageBGColor = '[strPageBGColor]'; -var TextColor = '[strTextColor]'; -var TitleColor = '[strTitleColor]'; -var DropTotal = 3; // number of lines that will be available for dropping on -var Gap = 4; //Gap between two segments when they're next to each other on a line -var DropHeight = 30; -var CapitalizeFirst = [boolCapitalizeFirst]; -var CompiledOutput = ''; -var TempSegment = ''; -var FirstSegment = -1; -var FirstDiv = -1; -var Penalties = 0; -var Score = 0; -var TimeOver = false; - -var CurrDrag = -1; -var topZ = 100; -var Cds = new Array(); -var L = new Array(); -var Finished = false; - -var Locked = false; -var DivWidth = 600; -var LeftColPos = 100; -var DragTop = 120; -var DragNumber = -1; - -Lines = new Array(); - -function CapFirst(InString){ - var i = 0; - if ((Openers.indexOf(InString.charAt(i))>-1)||(InString.charAt(i) == ' ')){ - i++; - } - if ((Openers.indexOf(InString.charAt(i))>-1)||(InString.charAt(i) == ' ')){ - i++; - } - var Temp = InString.charAt(i); - Temp = Temp.toUpperCase(); - InString = InString.substring(0, i) + Temp + InString.substring(i+1, InString.length); - return InString; -} - -function CheckResults(ChkType){ -//Get sequence student has chosen - GetGuessSequence(); - -//Compile the answer - CompiledOutput = CompileString(GuessSequence); - -//Check the answer - CheckAnswer(ChkType); -} - -function GetGuessSequence(){ -//Put pointers to draggables in arrays based on the lines they're sitting on - var Drops = new Array(); - for (var i=0; i -4)){ - Drops[j][Drops[j].length] = Cds[i]; - } - } - } - -//Sort the drop arrays based on the Left of each div - for (i=0; i 0){ - NewFirstDiv = Drops[i][0].index; - break; - } - } - return NewFirstDiv; -} - -function CompDrags(a,b){ - return a.GetL() - b.GetL(); -} - -function FindSegment(SegID){ - var Seg = ''; - for (var i=0; i 0){ - OutString = OutArray[0]; - } - else{ - OutString = ''; - } - var Spacer = ''; - - for (i=1; i -1)||(Punctuation.indexOf(OutArray[i].charAt(0)) > -1)){ - Spacer = ''; - } - OutString = OutString + Spacer + OutArray[i]; - } - -//Capitalize the first letter if necessary - if (CapitalizeFirst == true){ - OutString = CapFirst(OutString); - } - return OutString; -} - -function CheckAnswer(CheckType){ - if (Locked == true){return;} - if (GuessSequence.length < 1){ - if (CheckType == 1){ - Penalties++; - ShowMessage(NextCorrect + '

' + FindSegment(Answers[0][0])); - } - return; - } - var i = 0; - var j = 0; - var k = 0; - var WellDone = ''; - var WhichCorrect = -1; - var TryAgain = ''; - var LongestCorrectBit = ''; - TempCorrect = new Array(); - LongestCorrect = new Array(); - var TempHint = ''; - var HintToReturn = 1; - var OtherAnswers = ''; - var AllDone = false; - - for (i=0; i LongestCorrect.length){ - LongestCorrect.length = 0; - for (k=0; k -1){ - AllDone = true; - for (i=0; i

' + CorrectResponse + '
'; - -//Do score calculation here - Score = Math.floor(((Segments.length-Penalties) * 100)/Segments.length); - WellDone += YourScoreIs + ' ' + Score + '%.
'; - -[inclAlsoCorrect] - if (OtherAnswers.length > 0){ - WellDone += TheseAnswersToo + '' + OtherAnswers + ''; - } -[/inclAlsoCorrect] - - ShowMessage(WellDone); - WriteToInstructions(YourScoreIs + ' ' + Score + '%.'); - } - - else{ - TryAgain = '' + CompileString(GuessSequence) + '

'; - if ((CheckType == 0)||(LongestCorrect.length==0)){ - TryAgain += IncorrectResponse + '
'; - } - - if (LongestCorrect.length > 0){ - LongestCorrectBit = CompileString(LongestCorrect); - GuessSequence.length = LongestCorrect.length; - TryAgain += '
' + ThisMuchCorrect + '
' + LongestCorrectBit + '
'; - } - - if (CheckType == 1){ - TryAgain += '
' + NextCorrect + '
' + FindSegment(HintToReturn); - } - -[inclTimer] - if (TimeOver == true){ - Score = Math.floor(((LongestCorrect.length-Penalties) * 100)/Segments.length); - if (Score < 0){Score = 0;} - TryAgain += YourScoreIs + ' ' + Score + '%.
'; - } -[/inclTimer] - Penalties++; //Penalty for inaccurate check - ShowMessage(TryAgain); - } - -//If the exercise is over, deal with that - if ((AllDone == true)||(TimeOver == true)){ -[inclSendResults] - setTimeout('SendResults(' + Score + ')', 50); -[/inclSendResults] -[inclTimer] - window.clearInterval(Interval); -[/inclTimer] - TimeOver = true; - Locked = true; - Finished = true; - setTimeout('Finish()', SubmissionTimeout); - WriteToInstructions(YourScoreIs + ' ' + Score + '%.'); - } -} - - -var Segments = new Array(); -[SegmentArray] - -var GuessSequence = new Array(); - -var Answers = new Array(); -[AnswerArray] - -function doDrag(e) { - if (CurrDrag == -1) {return}; - if (C.ie){var Ev = window.event}else{var Ev = e} - var difX = Ev.clientX-window.lastX; - var difY = Ev.clientY-window.lastY; - var newX = Cds[CurrDrag].GetL()+difX; - var newY = Cds[CurrDrag].GetT()+difY; - Cds[CurrDrag].SetL(newX); - Cds[CurrDrag].SetT(newY); - window.lastX = Ev.clientX; - window.lastY = Ev.clientY; - return false; -} - -function beginDrag(e, DragNum) { - CurrDrag = DragNum; - if (C.ie){ - var Ev = window.event; - document.onmousemove=doDrag; - document.onmouseup=endDrag; - } - else{ - var Ev = e; - window.onmousemove=doDrag; - window.onmouseup=endDrag; - } - Cds[CurrDrag].SwapColours(); - topZ++; - Cds[CurrDrag].css.zIndex = topZ; - window.lastX=Ev.clientX; - window.lastY=Ev.clientY; - return true; -} - -function endDrag(e) { - if (CurrDrag == -1) {return}; - Cds[CurrDrag].SwapColours(); - if (C.ie){document.onmousemove=null}else{window.onmousemove=null;} - onEndDrag(); - CurrDrag = -1; - return true; -} - -function onEndDrag(){ -//Snap to lines - var i = 0; - var SnapLine = Cds[CurrDrag].GetT(); - var BiggestOverlap = -1; - var OverlapRect = 0; - for (i=0; i OverlapRect){ - OverlapRect = Cds[CurrDrag].Overlap(L[i]); - BiggestOverlap = i; - } - } - if (BiggestOverlap > -1){ - SnapLine = L[BiggestOverlap].GetB() - (Cds[CurrDrag].GetH() + 2); - Cds[CurrDrag].SetT(SnapLine); - CheckOver(-1); - } - if (CapitalizeFirst==true){ - setTimeout('DoCapitalization()', 50); - } -} - -function DoCapitalization(){ -//Capitalize first segment if necessary - var FD = GetGuessSequence(); - if ((FD == -1)&&(FirstDiv > -1)){ - Cds[FirstDiv].elm.innerHTML = Segments[FirstDiv][0]; - } - if (((FD != FirstDiv)&&(CapitalizeFirst == true))&&(FD > -1)){ - if (FirstDiv > -1){ - Cds[FirstDiv].elm.innerHTML = Segments[FirstDiv][0]; - } - } - if ((FD > -1)&&(CapitalizeFirst == true)){ - var Temp = CapFirst(Segments[FD][0]); - Cds[FD].elm.innerHTML = Temp; - FirstDiv = FD; - } -} - -function CheckOver(NoMove){ -//This recursive function spreads out the Cards on a line if two of them are overlapping; -//if the spread operation moves one beyond the end of a line, it wraps it to the next line. - for (var i=0; i 0){ - if ((i==NoMove)||(Cds[i].GetL() < Cds[j].GetL())){ - Cds[j].DockToR(Cds[i]); - if (Cds[j].GetR() > (LeftColPos + DivWidth)){ - Cds[j].SetL(LeftColPos); - Cds[j].SetT(Cds[j].GetT() + DropHeight); - } - CheckOver(j); - } - else{ - Cds[i].DockToR(Cds[j]); - if (Cds[i].GetR() > (LeftColPos + DivWidth)){ - Cds[i].SetL(LeftColPos); - Cds[i].SetT(Cds[i].GetT() + DropHeight); - } - CheckOver(i); - } - } - } - } - } -} - -function StartUp(){ - -[inclSendResults] - GetUserName(); -[/inclSendResults] - -[inclPreloadImages] - PreloadImages([PreloadImageList]); -[/inclPreloadImages] - - Segments = Shuffle(Segments); - -//Calculate page dimensions and positions - pg = new PageDim(); - DivWidth = Math.floor((pg.W*4)/5); - LeftColPos = Math.floor(pg.W/10); - DragTop = parseInt(document.getElementById('CheckButtonDiv').offsetHeight) + parseInt(document.getElementById('CheckButtonDiv').offsetTop) + 10; - - var CurrTop = DragTop + 10; - -//Position the drop divs - for (var i=0; i-1)||(InString.charAt(i) == ' ')){ + i++; + } + if ((Openers.indexOf(InString.charAt(i))>-1)||(InString.charAt(i) == ' ')){ + i++; + } + var Temp = InString.charAt(i); + Temp = Temp.toUpperCase(); + InString = InString.substring(0, i) + Temp + InString.substring(i+1, InString.length); + return InString; +} + +function CheckResults(ChkType){ +//Get sequence student has chosen + GetGuessSequence(); + +//Compile the answer + CompiledOutput = CompileString(GuessSequence); + +//Check the answer + CheckAnswer(ChkType); +} + +function GetGuessSequence(){ +//Put pointers to draggables in arrays based on the lines they're sitting on + var Drops = new Array(); + for (var i=0; i -4)){ + Drops[j][Drops[j].length] = Cds[i]; + } + } + } + +//Sort the drop arrays based on the Left of each div + for (i=0; i 0){ + NewFirstDiv = Drops[i][0].index; + break; + } + } + return NewFirstDiv; +} + +function CompDrags(a,b){ + return a.GetL() - b.GetL(); +} + +function FindSegment(SegID){ + var Seg = ''; + for (var i=0; i 0){ + OutString = OutArray[0]; + } + else{ + OutString = ''; + } + var Spacer = ''; + + for (i=1; i -1)||(Punctuation.indexOf(OutArray[i].charAt(0)) > -1)){ + Spacer = ''; + } + OutString = OutString + Spacer + OutArray[i]; + } + +//Capitalize the first letter if necessary + if (CapitalizeFirst == true){ + OutString = CapFirst(OutString); + } + return OutString; +} + +function CheckAnswer(CheckType){ + if (Locked == true){return;} + if (GuessSequence.length < 1){ + if (CheckType == 1){ + Penalties++; + ShowMessage(NextCorrect + '

' + FindSegment(Answers[0][0])); + } + return; + } + var i = 0; + var j = 0; + var k = 0; + var WellDone = ''; + var WhichCorrect = -1; + var TryAgain = ''; + var LongestCorrectBit = ''; + TempCorrect = new Array(); + LongestCorrect = new Array(); + var TempHint = ''; + var HintToReturn = 1; + var OtherAnswers = ''; + var AllDone = false; + + for (i=0; i LongestCorrect.length){ + LongestCorrect.length = 0; + for (k=0; k -1){ + AllDone = true; + for (i=0; i

' + CorrectResponse + '
'; + +//Do score calculation here + Score = Math.floor(((Segments.length-Penalties) * 100)/Segments.length); + WellDone += YourScoreIs + ' ' + Score + '%.
'; + +[inclAlsoCorrect] + if (OtherAnswers.length > 0){ + WellDone += TheseAnswersToo + '' + OtherAnswers + ''; + } +[/inclAlsoCorrect] + + ShowMessage(WellDone); + WriteToInstructions(YourScoreIs + ' ' + Score + '%.'); + } + + else{ + TryAgain = '' + CompileString(GuessSequence) + '

'; + if ((CheckType == 0)||(LongestCorrect.length==0)){ + TryAgain += IncorrectResponse + '
'; + } + + if (LongestCorrect.length > 0){ + LongestCorrectBit = CompileString(LongestCorrect); + GuessSequence.length = LongestCorrect.length; + TryAgain += '
' + ThisMuchCorrect + '
' + LongestCorrectBit + '
'; + } + + if (CheckType == 1){ + TryAgain += '
' + NextCorrect + '
' + FindSegment(HintToReturn); + } + +[inclTimer] + if (TimeOver == true){ + Score = Math.floor(((LongestCorrect.length-Penalties) * 100)/Segments.length); + if (Score < 0){Score = 0;} + TryAgain += YourScoreIs + ' ' + Score + '%.
'; + } +[/inclTimer] + Penalties++; //Penalty for inaccurate check + ShowMessage(TryAgain); + } + +//If the exercise is over, deal with that + if ((AllDone == true)||(TimeOver == true)){ +[inclSendResults] + setTimeout('SendResults(' + Score + ')', 50); +[/inclSendResults] +[inclTimer] + window.clearInterval(Interval); +[/inclTimer] + TimeOver = true; + Locked = true; + Finished = true; + setTimeout('Finish()', SubmissionTimeout); + WriteToInstructions(YourScoreIs + ' ' + Score + '%.'); + } +} + + +var Segments = new Array(); +[SegmentArray] + +var GuessSequence = new Array(); + +var Answers = new Array(); +[AnswerArray] + +function doDrag(e) { + if (CurrDrag == -1) {return}; + if (C.ie){var Ev = window.event}else{var Ev = e} + var difX = Ev.clientX-window.lastX; + var difY = Ev.clientY-window.lastY; + var newX = Cds[CurrDrag].GetL()+difX; + var newY = Cds[CurrDrag].GetT()+difY; + Cds[CurrDrag].SetL(newX); + Cds[CurrDrag].SetT(newY); + window.lastX = Ev.clientX; + window.lastY = Ev.clientY; + return false; +} + +function beginDrag(e, DragNum) { + CurrDrag = DragNum; + if (C.ie){ + var Ev = window.event; + document.onmousemove=doDrag; + document.onmouseup=endDrag; + } + else{ + var Ev = e; + window.onmousemove=doDrag; + window.onmouseup=endDrag; + } + Cds[CurrDrag].SwapColours(); + topZ++; + Cds[CurrDrag].css.zIndex = topZ; + window.lastX=Ev.clientX; + window.lastY=Ev.clientY; + return true; +} + +function endDrag(e) { + if (CurrDrag == -1) {return}; + Cds[CurrDrag].SwapColours(); + if (C.ie){document.onmousemove=null}else{window.onmousemove=null;} + onEndDrag(); + CurrDrag = -1; + return true; +} + +function onEndDrag(){ +//Snap to lines + var i = 0; + var SnapLine = Cds[CurrDrag].GetT(); + var BiggestOverlap = -1; + var OverlapRect = 0; + for (i=0; i OverlapRect){ + OverlapRect = Cds[CurrDrag].Overlap(L[i]); + BiggestOverlap = i; + } + } + if (BiggestOverlap > -1){ + SnapLine = L[BiggestOverlap].GetB() - (Cds[CurrDrag].GetH() + 2); + Cds[CurrDrag].SetT(SnapLine); + CheckOver(-1); + } + if (CapitalizeFirst==true){ + setTimeout('DoCapitalization()', 50); + } +} + +function DoCapitalization(){ +//Capitalize first segment if necessary + var FD = GetGuessSequence(); + if ((FD == -1)&&(FirstDiv > -1)){ + Cds[FirstDiv].elm.innerHTML = Segments[FirstDiv][0]; + } + if (((FD != FirstDiv)&&(CapitalizeFirst == true))&&(FD > -1)){ + if (FirstDiv > -1){ + Cds[FirstDiv].elm.innerHTML = Segments[FirstDiv][0]; + } + } + if ((FD > -1)&&(CapitalizeFirst == true)){ + var Temp = CapFirst(Segments[FD][0]); + Cds[FD].elm.innerHTML = Temp; + FirstDiv = FD; + } +} + +function CheckOver(NoMove){ +//This recursive function spreads out the Cards on a line if two of them are overlapping; +//if the spread operation moves one beyond the end of a line, it wraps it to the next line. + for (var i=0; i 0){ + if ((i==NoMove)||(Cds[i].GetL() < Cds[j].GetL())){ + Cds[j].DockToR(Cds[i]); + if (Cds[j].GetR() > (LeftColPos + DivWidth)){ + Cds[j].SetL(LeftColPos); + Cds[j].SetT(Cds[j].GetT() + DropHeight); + } + CheckOver(j); + } + else{ + Cds[i].DockToR(Cds[j]); + if (Cds[i].GetR() > (LeftColPos + DivWidth)){ + Cds[i].SetL(LeftColPos); + Cds[i].SetT(Cds[i].GetT() + DropHeight); + } + CheckOver(i); + } + } + } + } + } +} + +function StartUp(){ + +[inclSendResults] + GetUserName(); +[/inclSendResults] + +[inclPreloadImages] + PreloadImages([PreloadImageList]); +[/inclPreloadImages] + + Segments = Shuffle(Segments); + +//Calculate page dimensions and positions + pg = new PageDim(); + DivWidth = Math.floor((pg.W*4)/5); + LeftColPos = Math.floor(pg.W/10); + DragTop = parseInt(document.getElementById('CheckButtonDiv').offsetHeight) + parseInt(document.getElementById('CheckButtonDiv').offsetTop) + 10; + + var CurrTop = DragTop + 10; + +//Position the drop divs + for (var i=0; i - - - -[strDublinCoreMetadata] - - - - -[strPlainTitle] - - - - - - -[strHeaderCode] - - - - - - - - - - - - - -[inclNavButtons] -[strTopNavBar] -[/inclNavButtons] - - - -
-

[strExerciseTitle]

-[inclExerciseSubtitle] -

[strExerciseSubtitle]

-[/inclExerciseSubtitle] -
- -
-

[strInstructions]

-
- -
- - - - - -
- - - - -[strTRows] - - -
- - - -[inclNavButtons] -[strBottomNavBar] -[/inclNavButtons] - - - - - - - - - - + + + + +[strDublinCoreMetadata] + + + + +[strPlainTitle] + + + + + + +[strHeaderCode] + + + + + + + + + + + + + +[inclNavButtons] +[strTopNavBar] +[/inclNavButtons] + + + +
+

[strExerciseTitle]

+[inclExerciseSubtitle] +

[strExerciseSubtitle]

+[/inclExerciseSubtitle] +
+ +
+

[strInstructions]

+
+ +
+ + + + + +
+ + + + +[strTRows] + + +
+ + + +[inclNavButtons] +[strBottomNavBar] +[/inclNavButtons] + + + + + + + + + + diff --git a/mod/hotpot/template/v6/fjmatch6.js_ b/mod/hotpot/template/v6/fjmatch6.js_ index df0905a56ec..79db982d861 100644 --- a/mod/hotpot/template/v6/fjmatch6.js_ +++ b/mod/hotpot/template/v6/fjmatch6.js_ @@ -1,107 +1,107 @@ - -var CurrItem = null; -var Stage = 2; -var QList = new Array(); -var ShuffleQs = [boolShuffleQs]; - -function SetUpItems(){ - - var i; - var Row = null; - -//Remove all the table rows and put them in an array for processing - var Qs = document.getElementById('Questions'); - -//Remove the table rows to an array - while (Qs.getElementsByTagName('tr').length > 0){ - Row = Qs.getElementsByTagName('tr')[0]; - Row.getElementsByTagName('td')[0].className = 'Hidden'; - Row.getElementsByTagName('td')[1].className = 'Hidden'; - QList.push(Qs.removeChild(Row)); - } - -//Shuffle the rows - if (ShuffleQs == true){ - QList = Shuffle(QList); - } - -//Write the rows back to the table body - for (i=0; i 0){ + Row = Qs.getElementsByTagName('tr')[0]; + Row.getElementsByTagName('td')[0].className = 'Hidden'; + Row.getElementsByTagName('td')[1].className = 'Hidden'; + QList.push(Qs.removeChild(Row)); + } + +//Shuffle the rows + if (ShuffleQs == true){ + QList = Shuffle(QList); + } + +//Write the rows back to the table body + for (i=0; i[strReadingTitle] -[/inclReadingTitle] -
-[strReadingText] -
- + +[inclReadingTitle] +

[strReadingTitle]

+[/inclReadingTitle] +
+[strReadingText] +
+ diff --git a/mod/hotpot/template/v6/hp6.cs_ b/mod/hotpot/template/v6/hp6.cs_ index 262b64c7258..2ea245bcda8 100644 --- a/mod/hotpot/template/v6/hp6.cs_ +++ b/mod/hotpot/template/v6/hp6.cs_ @@ -1,596 +1,596 @@ - -/* This is the CSS stylesheet used in the exercise. */ -/* Elements in square brackets are replaced by data based on configuration settings when the exercise is built. */ - -/* BeginCorePageCSS */ - -/* Made with executable version [strFullVersionInfo] */ - -body{ - font-family: [strFontFace]; -[inclPageBGColor] background-color: [strPageBGColor];[/inclPageBGColor] - color: [strTextColor]; -[inclGraphicURL] background-image: url([strGraphicURL]);[/inclGraphicURL] - margin-right: 5%; - margin-left: 5%; - font-size: [strFontSize]; -} - -p{ - text-align: left; - margin: 0px; - font-size: 100%; -} - -table,div,span,td{ - font-size: 100%; - color: [strTextColor]; -} - -div.Titles{ - padding: 0.5em;; - text-align: center; - color: [strTitleColor]; -} - -button{ - font-family: [strFontFace]; - font-size: 100%; - display: inline; -} - -.ExerciseTitle{ - font-size: 140%; - color: [strTitleColor]; -} - -.ExerciseSubtitle{ - font-size: 120%; - color: [strTitleColor]; -} - -div.StdDiv{ -[inclExBGColor] background-color: [strExBGColor];[/inclExBGColor] - text-align: center; - font-size: 100%; - color: [strTextColor]; - padding: 0.5em; - border-style: solid; - border-width: 1px 1px 1px 1px; - border-color: [strTextColor]; - margin-bottom: 1px; -} - -/* EndCorePageCSS */ - -.RTLText{ - text-align: right; - font-size: 150%; - direction: rtl; - font-family: "Simplified Arabic", "Traditional Arabic", "Times New Roman", [strFontFace]; -} - -.CentredRTLText{ - text-align: center; - font-size: 150%; - direction: rtl; - font-family: "Simplified Arabic", "Traditional Arabic", "Times New Roman", [strFontFace]; -} - -button p.RTLText{ - text-align: center; -} - -.RTLGapBox{ - text-align: right; - font-size: 150%; - direction: rtl; - font-family: "Times New Roman", [strFontFace]; -} - -.Guess{ - font-weight: bold; -} - -.CorrectAnswer{ - font-weight: bold; -} - -div#Timer{ - padding: 0.25em; - margin-left: auto; - margin-right: auto; - text-align: center; - color: [strTitleColor]; -} - -span#TimerText{ - padding: 0.25em; - border-width: 1px; - border-style: solid; - font-weight: bold; - display: none; - color: [strTitleColor]; -} - -span.Instructions{ - -} - -div.ExerciseText{ - -} - -.FeedbackText, .FeedbackText span.CorrectAnswer, .FeedbackText span.Guess, .FeedbackText span.Answer{ - color: [strTitleColor]; -} - -.LeftItem{ - font-size: 100%; - color: [strTextColor]; - text-align: left; -} - -.RightItem{ - font-weight: bold; - font-size: 100%; - color: [strTextColor]; -} - -span.CorrectMark{ - -} - -input, textarea{ - font-family: [strFontFace]; - font-size: 120%; -} - -select{ - font-size: 100%; -} - -div.Feedback { -[inclPageBGColor] background-color: [strPageBGColor];[/inclPageBGColor] - left: 33%; - width: 34%; - top: 33%; - z-index: 1; - border-style: solid; - border-width: 1px; - padding: 5px; - text-align: center; - color: [strTitleColor]; - position: absolute; - display: none; - font-size: 100%; -} - - -[inclReading] -div.LeftContainer{ - border-style: none; - padding: 2px 0px 2px 0px; - float: left; - width: 49.8%; - margin-bottom: 0px; -} - -div.RightContainer{ - border-style: none; - padding: 2px 0px 2px 0px; - float: right; - width: 49.8%; - margin-bottom: 0px; -} - -.ReadingText{ - text-align: left; -} - -#ReadingDiv h3.ExerciseSubtitle{ - color: [strTextColor]; -} - -[/inclReading] - -div.ExerciseDiv{ - color: [strTextColor]; -} - -/* JMatch flashcard styles */ -table.FlashcardTable{ - background-color: transparent; - color: [strTextColor]; - border-color: [strTextColor]; - margin-left: 5%; - margin-right: 5%; - margin-top: 2em; - margin-bottom: 2em; - width: 90%; - position: relative; - text-align: center; - padding: 0px; -} - -table.FlashcardTable tr{ - border-style: none; - margin: 0px; - padding: 0px; -[inclExBGColor] background-color: [strExBGColor];[/inclExBGColor] -} - -table.FlashcardTable td.Showing{ - font-size: 140%; - text-align: center; - width: 50%; - display: table-cell; - padding: 2em; - margin: 0px; - border-style: solid; - border-width: 1px; - color: [strTextColor]; -[inclExBGColor] background-color: [strExBGColor];[/inclExBGColor] -} - -table.FlashcardTable td.Hidden{ - display: none; -} - -/* JMix styles */ -div#SegmentDiv{ - margin-top: 2em; - margin-bottom: 2em; - text-align: center; -} - -a.ExSegment{ - font-size: 120%; - font-weight: bold; - text-decoration: none; - color: [strTextColor]; -} - -span.RemainingWordList{ - font-style: italic; -} - -div.DropLine { - position: absolute; - text-align: center; - border-bottom-style: solid; - border-bottom-width: 1px; - border-bottom-color: [strTitleColor]; - width: 80%; -} - -/* JCloze styles */ - -.ClozeWordList{ - text-align: center; - font-weight: bold; -} - -div.ClozeBody{ - text-align: left; - margin-top: 2em; - margin-bottom: 2em; - line-height: 2.0 -} - -span.GapSpan{ - font-weight: bold; -} - -/* JCross styles */ - -table.CrosswordGrid{ - margin: auto auto 1em auto; - border-collapse: collapse; - padding: 0px; - background-color: #000000; -} - -table.CrosswordGrid tbody tr td{ - width: 1.5em; - height: 1.5em; - text-align: center; - vertical-align: middle; - font-size: 140%; - padding: 1px; - margin: 0px; - border-style: solid; - border-width: 1px; - border-color: #000000; - color: #000000; -} - -table.CrosswordGrid span{ - color: #000000; -} - -table.CrosswordGrid td.BlankCell{ - background-color: #000000; - color: #000000; -} - -table.CrosswordGrid td.LetterOnlyCell{ - text-align: center; - vertical-align: middle; - background-color: #ffffff; - color: #000000; - font-weight: bold; -} - -table.CrosswordGrid td.NumLetterCell{ - text-align: left; - vertical-align: top; - background-color: #ffffff; - color: #000000; - padding: 1px; - font-weight: bold; -} - -.NumLetterCellText{ - cursor: pointer; - color: #000000; -} - -.GridNum{ - vertical-align: super; - font-size: 66%; - font-weight: bold; - text-decoration: none; - color: #000000; -} - -.GridNum:hover, .GridNum:visited{ - color: #000000; -} - -table#Clues{ - margin: auto; - vertical-align: top; -} - -table#Clues td{ - vertical-align: top; -} - -table.ClueList{ - margin: auto; -} - -td.ClueNum{ - text-align: right; - font-weight: bold; - vertical-align: top; -} - -td.Clue{ - text-align: left; -} - -div#ClueEntry{ - text-align: left; - margin-bottom: 1em; -} - -/* Keypad styles */ - -div.Keypad{ - text-align: center; - display: none; /* initially hidden, shown if needed */ -} - -div.Keypad button{ - font-family: [strFontFace]; - font-size: 120%; - background-color: #ffffff; - color: #000000; - width: 2em; -} - -/* JQuiz styles */ - -div.QuestionNavigation{ - text-align: center; -} - -.QNum{ - margin: 0em 1em 0.5em 1em; - font-weight: bold; - vertical-align: middle; -} - -textarea{ - font-family: [strFontFace]; -} - -.QuestionText{ - -} - -.Answer{ - font-size: 120%; - letter-spacing: 0.1em; -} - -.PartialAnswer{ - font-size: 120%; - letter-spacing: 0.1em; - color: [strTitleColor]; -} - -.Highlight{ - color: #000000; - background-color: #ffff00; - font-weight: bold; - font-size: 120%; -} - -ol.QuizQuestions{ - text-align: left; - list-style-type: none; -} - -li.QuizQuestion{ - padding: 1em; - border-style: solid; - border-width: 0px 0px 1px 0px; -} - -ol.MCAnswers{ - text-align: left; - list-style-type: upper-alpha; - padding: 1em; -} - -ol.MCAnswers li{ - margin-bottom: 1em; -} - -ol.MSelAnswers{ - text-align: left; - list-style-type: lower-alpha; - padding: 1em; -} - -div.ShortAnswer{ - padding: 1em; -} - -.FuncButton { - text-align: center; - border-style: solid; -[inclExBGColor] - border-left-color: [strFuncLightColor]; - border-top-color: [strFuncLightColor]; - border-right-color: [strFuncShadeColor]; - border-bottom-color: [strFuncShadeColor]; - color: [strTextColor]; - background-color: [strExBGColor]; -[/inclExBGColor] - border-width: 2px; - padding: 3px 6px 3px 6px; - cursor: pointer; -} - -.FuncButtonUp { - color: [strExBGColor]; - text-align: center; - border-style: solid; -[inclExBGColor] - border-left-color: [strFuncLightColor]; - border-top-color: [strFuncLightColor]; - border-right-color: [strFuncShadeColor]; - border-bottom-color: [strFuncShadeColor]; -[/inclExBGColor] - background-color: [strTextColor]; - color: [strExBGColor]; - border-width: 2px; - padding: 3px 6px 3px 6px; - cursor: pointer; -} - -.FuncButtonDown { - color: [strExBGColor]; - text-align: center; - border-style: solid; -[inclExBGColor] - border-left-color: [strFuncShadeColor]; - border-top-color: [strFuncShadeColor]; - border-right-color: [strFuncLightColor]; - border-bottom-color: [strFuncLightColor]; - background-color: [strTextColor]; - color: [strExBGColor]; -[/inclExBGColor] - border-width: 2px; - padding: 3px 6px 3px 6px; - cursor: pointer; -} - -/*BeginNavBarStyle*/ - -div.NavButtonBar{ -[inclNavBarColor] background-color: [strNavBarColor];[/inclNavBarColor] - text-align: center; - margin: 2px 0px 2px 0px; - clear: both; - font-size: 100%; -} - -.NavButton { - border-style: solid; -[inclNavBarColor] - border-left-color: [strNavLightColor]; - border-top-color: [strNavLightColor]; - border-right-color: [strNavShadeColor]; - border-bottom-color: [strNavShadeColor]; - background-color: [strNavBarColor]; - color: [strNavTextColor]; -[/inclNavBarColor] - border-width: 2px; - cursor: pointer; -} - -.NavButtonUp { - border-style: solid; -[inclNavBarColor] - border-left-color: [strNavLightColor]; - border-top-color: [strNavLightColor]; - border-right-color: [strNavShadeColor]; - border-bottom-color: [strNavShadeColor]; - color: [strNavBarColor]; - background-color: [strNavTextColor]; -[/inclNavBarColor] - border-width: 2px; - cursor: pointer; -} - -.NavButtonDown { - border-style: solid; -[inclNavBarColor] - border-left-color: [strNavShadeColor]; - border-top-color: [strNavShadeColor]; - border-right-color: [strNavLightColor]; - border-bottom-color: [strNavLightColor]; - color: [strNavBarColor]; - background-color: [strNavTextColor]; -[/inclNavBarColor] - border-width: 2px; - cursor: pointer; -} - -/*EndNavBarStyle*/ - -a{ - color: [strLinkColor]; -} - -a:visited{ - color: [strVLinkColor]; -} - -a:hover{ - color: [strLinkColor]; -} - -div.CardStyle { - position: absolute; - font-family: [strFontFace]; - font-size: 100%; - padding: 5px; - border-style: solid; - border-width: 1px; - color: [strTextColor]; -[inclExBGColor] background-color: [strExBGColor];[/inclExBGColor] - left: -50px; - top: -50px; - overflow: visible; -} - -.rtl{ - text-align: right; - font-size: 140%; -} + +/* This is the CSS stylesheet used in the exercise. */ +/* Elements in square brackets are replaced by data based on configuration settings when the exercise is built. */ + +/* BeginCorePageCSS */ + +/* Made with executable version [strFullVersionInfo] */ + +body{ + font-family: [strFontFace]; +[inclPageBGColor] background-color: [strPageBGColor];[/inclPageBGColor] + color: [strTextColor]; +[inclGraphicURL] background-image: url([strGraphicURL]);[/inclGraphicURL] + margin-right: 5%; + margin-left: 5%; + font-size: [strFontSize]; +} + +p{ + text-align: left; + margin: 0px; + font-size: 100%; +} + +table,div,span,td{ + font-size: 100%; + color: [strTextColor]; +} + +div.Titles{ + padding: 0.5em;; + text-align: center; + color: [strTitleColor]; +} + +button{ + font-family: [strFontFace]; + font-size: 100%; + display: inline; +} + +.ExerciseTitle{ + font-size: 140%; + color: [strTitleColor]; +} + +.ExerciseSubtitle{ + font-size: 120%; + color: [strTitleColor]; +} + +div.StdDiv{ +[inclExBGColor] background-color: [strExBGColor];[/inclExBGColor] + text-align: center; + font-size: 100%; + color: [strTextColor]; + padding: 0.5em; + border-style: solid; + border-width: 1px 1px 1px 1px; + border-color: [strTextColor]; + margin-bottom: 1px; +} + +/* EndCorePageCSS */ + +.RTLText{ + text-align: right; + font-size: 150%; + direction: rtl; + font-family: "Simplified Arabic", "Traditional Arabic", "Times New Roman", [strFontFace]; +} + +.CentredRTLText{ + text-align: center; + font-size: 150%; + direction: rtl; + font-family: "Simplified Arabic", "Traditional Arabic", "Times New Roman", [strFontFace]; +} + +button p.RTLText{ + text-align: center; +} + +.RTLGapBox{ + text-align: right; + font-size: 150%; + direction: rtl; + font-family: "Times New Roman", [strFontFace]; +} + +.Guess{ + font-weight: bold; +} + +.CorrectAnswer{ + font-weight: bold; +} + +div#Timer{ + padding: 0.25em; + margin-left: auto; + margin-right: auto; + text-align: center; + color: [strTitleColor]; +} + +span#TimerText{ + padding: 0.25em; + border-width: 1px; + border-style: solid; + font-weight: bold; + display: none; + color: [strTitleColor]; +} + +span.Instructions{ + +} + +div.ExerciseText{ + +} + +.FeedbackText, .FeedbackText span.CorrectAnswer, .FeedbackText span.Guess, .FeedbackText span.Answer{ + color: [strTitleColor]; +} + +.LeftItem{ + font-size: 100%; + color: [strTextColor]; + text-align: left; +} + +.RightItem{ + font-weight: bold; + font-size: 100%; + color: [strTextColor]; +} + +span.CorrectMark{ + +} + +input, textarea{ + font-family: [strFontFace]; + font-size: 120%; +} + +select{ + font-size: 100%; +} + +div.Feedback { +[inclPageBGColor] background-color: [strPageBGColor];[/inclPageBGColor] + left: 33%; + width: 34%; + top: 33%; + z-index: 1; + border-style: solid; + border-width: 1px; + padding: 5px; + text-align: center; + color: [strTitleColor]; + position: absolute; + display: none; + font-size: 100%; +} + + +[inclReading] +div.LeftContainer{ + border-style: none; + padding: 2px 0px 2px 0px; + float: left; + width: 49.8%; + margin-bottom: 0px; +} + +div.RightContainer{ + border-style: none; + padding: 2px 0px 2px 0px; + float: right; + width: 49.8%; + margin-bottom: 0px; +} + +.ReadingText{ + text-align: left; +} + +#ReadingDiv h3.ExerciseSubtitle{ + color: [strTextColor]; +} + +[/inclReading] + +div.ExerciseDiv{ + color: [strTextColor]; +} + +/* JMatch flashcard styles */ +table.FlashcardTable{ + background-color: transparent; + color: [strTextColor]; + border-color: [strTextColor]; + margin-left: 5%; + margin-right: 5%; + margin-top: 2em; + margin-bottom: 2em; + width: 90%; + position: relative; + text-align: center; + padding: 0px; +} + +table.FlashcardTable tr{ + border-style: none; + margin: 0px; + padding: 0px; +[inclExBGColor] background-color: [strExBGColor];[/inclExBGColor] +} + +table.FlashcardTable td.Showing{ + font-size: 140%; + text-align: center; + width: 50%; + display: table-cell; + padding: 2em; + margin: 0px; + border-style: solid; + border-width: 1px; + color: [strTextColor]; +[inclExBGColor] background-color: [strExBGColor];[/inclExBGColor] +} + +table.FlashcardTable td.Hidden{ + display: none; +} + +/* JMix styles */ +div#SegmentDiv{ + margin-top: 2em; + margin-bottom: 2em; + text-align: center; +} + +a.ExSegment{ + font-size: 120%; + font-weight: bold; + text-decoration: none; + color: [strTextColor]; +} + +span.RemainingWordList{ + font-style: italic; +} + +div.DropLine { + position: absolute; + text-align: center; + border-bottom-style: solid; + border-bottom-width: 1px; + border-bottom-color: [strTitleColor]; + width: 80%; +} + +/* JCloze styles */ + +.ClozeWordList{ + text-align: center; + font-weight: bold; +} + +div.ClozeBody{ + text-align: left; + margin-top: 2em; + margin-bottom: 2em; + line-height: 2.0 +} + +span.GapSpan{ + font-weight: bold; +} + +/* JCross styles */ + +table.CrosswordGrid{ + margin: auto auto 1em auto; + border-collapse: collapse; + padding: 0px; + background-color: #000000; +} + +table.CrosswordGrid tbody tr td{ + width: 1.5em; + height: 1.5em; + text-align: center; + vertical-align: middle; + font-size: 140%; + padding: 1px; + margin: 0px; + border-style: solid; + border-width: 1px; + border-color: #000000; + color: #000000; +} + +table.CrosswordGrid span{ + color: #000000; +} + +table.CrosswordGrid td.BlankCell{ + background-color: #000000; + color: #000000; +} + +table.CrosswordGrid td.LetterOnlyCell{ + text-align: center; + vertical-align: middle; + background-color: #ffffff; + color: #000000; + font-weight: bold; +} + +table.CrosswordGrid td.NumLetterCell{ + text-align: left; + vertical-align: top; + background-color: #ffffff; + color: #000000; + padding: 1px; + font-weight: bold; +} + +.NumLetterCellText{ + cursor: pointer; + color: #000000; +} + +.GridNum{ + vertical-align: super; + font-size: 66%; + font-weight: bold; + text-decoration: none; + color: #000000; +} + +.GridNum:hover, .GridNum:visited{ + color: #000000; +} + +table#Clues{ + margin: auto; + vertical-align: top; +} + +table#Clues td{ + vertical-align: top; +} + +table.ClueList{ + margin: auto; +} + +td.ClueNum{ + text-align: right; + font-weight: bold; + vertical-align: top; +} + +td.Clue{ + text-align: left; +} + +div#ClueEntry{ + text-align: left; + margin-bottom: 1em; +} + +/* Keypad styles */ + +div.Keypad{ + text-align: center; + display: none; /* initially hidden, shown if needed */ +} + +div.Keypad button{ + font-family: [strFontFace]; + font-size: 120%; + background-color: #ffffff; + color: #000000; + width: 2em; +} + +/* JQuiz styles */ + +div.QuestionNavigation{ + text-align: center; +} + +.QNum{ + margin: 0em 1em 0.5em 1em; + font-weight: bold; + vertical-align: middle; +} + +textarea{ + font-family: [strFontFace]; +} + +.QuestionText{ + +} + +.Answer{ + font-size: 120%; + letter-spacing: 0.1em; +} + +.PartialAnswer{ + font-size: 120%; + letter-spacing: 0.1em; + color: [strTitleColor]; +} + +.Highlight{ + color: #000000; + background-color: #ffff00; + font-weight: bold; + font-size: 120%; +} + +ol.QuizQuestions{ + text-align: left; + list-style-type: none; +} + +li.QuizQuestion{ + padding: 1em; + border-style: solid; + border-width: 0px 0px 1px 0px; +} + +ol.MCAnswers{ + text-align: left; + list-style-type: upper-alpha; + padding: 1em; +} + +ol.MCAnswers li{ + margin-bottom: 1em; +} + +ol.MSelAnswers{ + text-align: left; + list-style-type: lower-alpha; + padding: 1em; +} + +div.ShortAnswer{ + padding: 1em; +} + +.FuncButton { + text-align: center; + border-style: solid; +[inclExBGColor] + border-left-color: [strFuncLightColor]; + border-top-color: [strFuncLightColor]; + border-right-color: [strFuncShadeColor]; + border-bottom-color: [strFuncShadeColor]; + color: [strTextColor]; + background-color: [strExBGColor]; +[/inclExBGColor] + border-width: 2px; + padding: 3px 6px 3px 6px; + cursor: pointer; +} + +.FuncButtonUp { + color: [strExBGColor]; + text-align: center; + border-style: solid; +[inclExBGColor] + border-left-color: [strFuncLightColor]; + border-top-color: [strFuncLightColor]; + border-right-color: [strFuncShadeColor]; + border-bottom-color: [strFuncShadeColor]; +[/inclExBGColor] + background-color: [strTextColor]; + color: [strExBGColor]; + border-width: 2px; + padding: 3px 6px 3px 6px; + cursor: pointer; +} + +.FuncButtonDown { + color: [strExBGColor]; + text-align: center; + border-style: solid; +[inclExBGColor] + border-left-color: [strFuncShadeColor]; + border-top-color: [strFuncShadeColor]; + border-right-color: [strFuncLightColor]; + border-bottom-color: [strFuncLightColor]; + background-color: [strTextColor]; + color: [strExBGColor]; +[/inclExBGColor] + border-width: 2px; + padding: 3px 6px 3px 6px; + cursor: pointer; +} + +/*BeginNavBarStyle*/ + +div.NavButtonBar{ +[inclNavBarColor] background-color: [strNavBarColor];[/inclNavBarColor] + text-align: center; + margin: 2px 0px 2px 0px; + clear: both; + font-size: 100%; +} + +.NavButton { + border-style: solid; +[inclNavBarColor] + border-left-color: [strNavLightColor]; + border-top-color: [strNavLightColor]; + border-right-color: [strNavShadeColor]; + border-bottom-color: [strNavShadeColor]; + background-color: [strNavBarColor]; + color: [strNavTextColor]; +[/inclNavBarColor] + border-width: 2px; + cursor: pointer; +} + +.NavButtonUp { + border-style: solid; +[inclNavBarColor] + border-left-color: [strNavLightColor]; + border-top-color: [strNavLightColor]; + border-right-color: [strNavShadeColor]; + border-bottom-color: [strNavShadeColor]; + color: [strNavBarColor]; + background-color: [strNavTextColor]; +[/inclNavBarColor] + border-width: 2px; + cursor: pointer; +} + +.NavButtonDown { + border-style: solid; +[inclNavBarColor] + border-left-color: [strNavShadeColor]; + border-top-color: [strNavShadeColor]; + border-right-color: [strNavLightColor]; + border-bottom-color: [strNavLightColor]; + color: [strNavBarColor]; + background-color: [strNavTextColor]; +[/inclNavBarColor] + border-width: 2px; + cursor: pointer; +} + +/*EndNavBarStyle*/ + +a{ + color: [strLinkColor]; +} + +a:visited{ + color: [strVLinkColor]; +} + +a:hover{ + color: [strLinkColor]; +} + +div.CardStyle { + position: absolute; + font-family: [strFontFace]; + font-size: 100%; + padding: 5px; + border-style: solid; + border-width: 1px; + color: [strTextColor]; +[inclExBGColor] background-color: [strExBGColor];[/inclExBGColor] + left: -50px; + top: -50px; + overflow: visible; +} + +.rtl{ + text-align: right; + font-size: 140%; +} diff --git a/mod/hotpot/template/v6/hp6browsercheck.js_ b/mod/hotpot/template/v6/hp6browsercheck.js_ index f7d11323727..b15bf7d2f64 100644 --- a/mod/hotpot/template/v6/hp6browsercheck.js_ +++ b/mod/hotpot/template/v6/hp6browsercheck.js_ @@ -1,55 +1,55 @@ - -function Client(){ -//if not a DOM browser, hopeless - this.min = false; if (document.getElementById){this.min = true;}; - - this.ua = navigator.userAgent; - this.name = navigator.appName; - this.ver = navigator.appVersion; - -//Get data about the browser - this.mac = (this.ver.indexOf('Mac') != -1); - this.win = (this.ver.indexOf('Windows') != -1); - -//Look for Gecko - this.gecko = (this.ua.indexOf('Gecko') > 1); - if (this.gecko){ - this.geckoVer = parseInt(this.ua.substring(this.ua.indexOf('Gecko')+6, this.ua.length)); - if (this.geckoVer < 20020000){this.min = false;} - } - -//Look for Firebird - this.firebird = (this.ua.indexOf('Firebird') > 1); - -//Look for Safari - this.safari = (this.ua.indexOf('Safari') > 1); - if (this.safari){ - this.gecko = false; - } - -//Look for IE - this.ie = (this.ua.indexOf('MSIE') > 0); - if (this.ie){ - this.ieVer = parseFloat(this.ua.substring(this.ua.indexOf('MSIE')+5, this.ua.length)); - if (this.ieVer < 5.5){this.min = false;} - } - -//Look for Opera - this.opera = (this.ua.indexOf('Opera') > 0); - if (this.opera){ - this.operaVer = parseFloat(this.ua.substring(this.ua.indexOf('Opera')+6, this.ua.length)); - if (this.operaVer < 7.04){this.min = false;} - } - if (this.min == false){ - alert('Your browser may not be able to handle this page.'); - } - -//Special case for the horrible ie5mac - this.ie5mac = (this.ie&&this.mac&&(this.ieVer<6)); -} - -var C = new Client(); - -//for (prop in C){ -// alert(prop + ': ' + C[prop]); -//} + +function Client(){ +//if not a DOM browser, hopeless + this.min = false; if (document.getElementById){this.min = true;}; + + this.ua = navigator.userAgent; + this.name = navigator.appName; + this.ver = navigator.appVersion; + +//Get data about the browser + this.mac = (this.ver.indexOf('Mac') != -1); + this.win = (this.ver.indexOf('Windows') != -1); + +//Look for Gecko + this.gecko = (this.ua.indexOf('Gecko') > 1); + if (this.gecko){ + this.geckoVer = parseInt(this.ua.substring(this.ua.indexOf('Gecko')+6, this.ua.length)); + if (this.geckoVer < 20020000){this.min = false;} + } + +//Look for Firebird + this.firebird = (this.ua.indexOf('Firebird') > 1); + +//Look for Safari + this.safari = (this.ua.indexOf('Safari') > 1); + if (this.safari){ + this.gecko = false; + } + +//Look for IE + this.ie = (this.ua.indexOf('MSIE') > 0); + if (this.ie){ + this.ieVer = parseFloat(this.ua.substring(this.ua.indexOf('MSIE')+5, this.ua.length)); + if (this.ieVer < 5.5){this.min = false;} + } + +//Look for Opera + this.opera = (this.ua.indexOf('Opera') > 0); + if (this.opera){ + this.operaVer = parseFloat(this.ua.substring(this.ua.indexOf('Opera')+6, this.ua.length)); + if (this.operaVer < 7.04){this.min = false;} + } + if (this.min == false){ + alert('Your browser may not be able to handle this page.'); + } + +//Special case for the horrible ie5mac + this.ie5mac = (this.ie&&this.mac&&(this.ieVer<6)); +} + +var C = new Client(); + +//for (prop in C){ +// alert(prop + ': ' + C[prop]); +//} diff --git a/mod/hotpot/template/v6/hp6buttons.js_ b/mod/hotpot/template/v6/hp6buttons.js_ index 9fd43ef003e..5732bb80a1d 100644 --- a/mod/hotpot/template/v6/hp6buttons.js_ +++ b/mod/hotpot/template/v6/hp6buttons.js_ @@ -1,42 +1,42 @@ - -//CODE FOR HANDLING NAV BUTTONS AND FUNCTION BUTTONS - -//[strNavBarJS] -function NavBtnOver(Btn){ - if (Btn.className != 'NavButtonDown'){Btn.className = 'NavButtonUp';} -} - -function NavBtnOut(Btn){ - Btn.className = 'NavButton'; -} - -function NavBtnDown(Btn){ - Btn.className = 'NavButtonDown'; -} -//[/strNavBarJS] - -function FuncBtnOver(Btn){ - if (Btn.className != 'FuncButtonDown'){Btn.className = 'FuncButtonUp';} -} - -function FuncBtnOut(Btn){ - Btn.className = 'FuncButton'; -} - -function FuncBtnDown(Btn){ - Btn.className = 'FuncButtonDown'; -} - -function FocusAButton(){ - if (document.getElementById('CheckButton1') != null){ - document.getElementById('CheckButton1').focus(); - } - else{ - if (document.getElementById('CheckButton2') != null){ - document.getElementById('CheckButton2').focus(); - } - else{ - document.getElementsByTagName('button')[0].focus(); - } - } -} + +//CODE FOR HANDLING NAV BUTTONS AND FUNCTION BUTTONS + +//[strNavBarJS] +function NavBtnOver(Btn){ + if (Btn.className != 'NavButtonDown'){Btn.className = 'NavButtonUp';} +} + +function NavBtnOut(Btn){ + Btn.className = 'NavButton'; +} + +function NavBtnDown(Btn){ + Btn.className = 'NavButtonDown'; +} +//[/strNavBarJS] + +function FuncBtnOver(Btn){ + if (Btn.className != 'FuncButtonDown'){Btn.className = 'FuncButtonUp';} +} + +function FuncBtnOut(Btn){ + Btn.className = 'FuncButton'; +} + +function FuncBtnDown(Btn){ + Btn.className = 'FuncButtonDown'; +} + +function FocusAButton(){ + if (document.getElementById('CheckButton1') != null){ + document.getElementById('CheckButton1').focus(); + } + else{ + if (document.getElementById('CheckButton2') != null){ + document.getElementById('CheckButton2').focus(); + } + else{ + document.getElementsByTagName('button')[0].focus(); + } + } +} diff --git a/mod/hotpot/template/v6/hp6card.js_ b/mod/hotpot/template/v6/hp6card.js_ index be0d95ec81e..e9eb06e49f0 100644 --- a/mod/hotpot/template/v6/hp6card.js_ +++ b/mod/hotpot/template/v6/hp6card.js_ @@ -1,152 +1,152 @@ - -function Card(ID, OverlapTolerance){ - this.elm=document.getElementById(ID); - this.name=ID; - this.css=this.elm.style; - this.elm.style.left = 0 +'px'; - this.elm.style.top = 0 +'px'; - this.HomeL = 0; - this.HomeT = 0; - this.tag=-1; - this.index=-1; - this.OverlapTolerance = OverlapTolerance; -} - -function CardGetL(){return parseInt(this.css.left)} -Card.prototype.GetL=CardGetL; - -function CardGetT(){return parseInt(this.css.top)} -Card.prototype.GetT=CardGetT; - -function CardGetW(){return parseInt(this.elm.offsetWidth)} -Card.prototype.GetW=CardGetW; - -function CardGetH(){return parseInt(this.elm.offsetHeight)} -Card.prototype.GetH=CardGetH; - -function CardGetB(){return this.GetT()+this.GetH()} -Card.prototype.GetB=CardGetB; - -function CardGetR(){return this.GetL()+this.GetW()} -Card.prototype.GetR=CardGetR; - -function CardSetL(NewL){this.css.left = NewL+'px'} -Card.prototype.SetL=CardSetL; - -function CardSetT(NewT){this.css.top = NewT+'px'} -Card.prototype.SetT=CardSetT; - -function CardSetW(NewW){this.css.width = NewW+'px'} -Card.prototype.SetW=CardSetW; - -function CardSetH(NewH){this.css.height = NewH+'px'} -Card.prototype.SetH=CardSetH; - -function CardInside(X,Y){ - var Result=false; - if(X>=this.GetL()){if(X<=this.GetR()){if(Y>=this.GetT()){if(Y<=this.GetB()){Result=true;}}}} - return Result; -} -Card.prototype.Inside=CardInside; - -function CardSwapColours(){ - var c=this.css.backgroundColor; - this.css.backgroundColor=this.css.color; - this.css.color=c; -} -Card.prototype.SwapColours=CardSwapColours; - -function CardHighlight(){ - this.css.backgroundColor='[strTextColor]'; - this.css.color='[strExBGColor]'; -} -Card.prototype.Highlight=CardHighlight; - -function CardUnhighlight(){ - this.css.backgroundColor='[strExBGColor]'; - this.css.color='[strTextColor]'; -} -Card.prototype.Unhighlight=CardUnhighlight; - -function CardOverlap(OtherCard){ - var smR=(this.GetR()<(OtherCard.GetR()+this.OverlapTolerance))? this.GetR(): (OtherCard.GetR()+this.OverlapTolerance); - var lgL=(this.GetL()>OtherCard.GetL())? this.GetL(): OtherCard.GetL(); - var HDim=smR-lgL; - if (HDim<1){return 0;} - var smB=(this.GetB()OtherCard.GetT())? this.GetT(): OtherCard.GetT(); - var VDim=smB-lgT; - if (VDim<1){return 0;} - return (HDim*VDim); -} -Card.prototype.Overlap=CardOverlap; - -function CardDockToR(OtherCard){ - this.SetL(OtherCard.GetR() + 5); - this.SetT(OtherCard.GetT()); -} - -Card.prototype.DockToR=CardDockToR; - -function CardSetHome(){ - this.HomeL=this.GetL(); - this.HomeT=this.GetT(); -} -Card.prototype.SetHome=CardSetHome; - -function CardGoHome(){ - this.SetL(this.HomeL); - this.SetT(this.HomeT); -} - -Card.prototype.GoHome=CardGoHome; - - -function doDrag(e) { - if (CurrDrag == -1) {return}; - if (C.ie){var Ev = window.event}else{var Ev = e} - var difX = Ev.clientX-window.lastX; - var difY = Ev.clientY-window.lastY; - var newX = DC[CurrDrag].GetL()+difX; - var newY = DC[CurrDrag].GetT()+difY; - DC[CurrDrag].SetL(newX); - DC[CurrDrag].SetT(newY); - window.lastX = Ev.clientX; - window.lastY = Ev.clientY; - return false; -} - -function beginDrag(e, DragNum) { - CurrDrag = DragNum; - if (C.ie){ - var Ev = window.event; - document.onmousemove=doDrag; - document.onmouseup=endDrag; - } - else{ - var Ev = e; - window.onmousemove=doDrag; - window.onmouseup=endDrag; - } - DC[CurrDrag].Highlight(); - topZ++; - DC[CurrDrag].css.zIndex = topZ; - window.lastX=Ev.clientX; - window.lastY=Ev.clientY; - return false; -} - -function endDrag(e) { - if (CurrDrag == -1) {return}; - DC[CurrDrag].Unhighlight(); - if (C.ie){document.onmousemove=null}else{window.onmousemove=null;} - onEndDrag(); - CurrDrag = -1; -//Need a bugfix for Opera focus problem here - if (C.opera){FocusAButton();} - return true; -} - -var CurrDrag = -1; -var topZ = 100; - + +function Card(ID, OverlapTolerance){ + this.elm=document.getElementById(ID); + this.name=ID; + this.css=this.elm.style; + this.elm.style.left = 0 +'px'; + this.elm.style.top = 0 +'px'; + this.HomeL = 0; + this.HomeT = 0; + this.tag=-1; + this.index=-1; + this.OverlapTolerance = OverlapTolerance; +} + +function CardGetL(){return parseInt(this.css.left)} +Card.prototype.GetL=CardGetL; + +function CardGetT(){return parseInt(this.css.top)} +Card.prototype.GetT=CardGetT; + +function CardGetW(){return parseInt(this.elm.offsetWidth)} +Card.prototype.GetW=CardGetW; + +function CardGetH(){return parseInt(this.elm.offsetHeight)} +Card.prototype.GetH=CardGetH; + +function CardGetB(){return this.GetT()+this.GetH()} +Card.prototype.GetB=CardGetB; + +function CardGetR(){return this.GetL()+this.GetW()} +Card.prototype.GetR=CardGetR; + +function CardSetL(NewL){this.css.left = NewL+'px'} +Card.prototype.SetL=CardSetL; + +function CardSetT(NewT){this.css.top = NewT+'px'} +Card.prototype.SetT=CardSetT; + +function CardSetW(NewW){this.css.width = NewW+'px'} +Card.prototype.SetW=CardSetW; + +function CardSetH(NewH){this.css.height = NewH+'px'} +Card.prototype.SetH=CardSetH; + +function CardInside(X,Y){ + var Result=false; + if(X>=this.GetL()){if(X<=this.GetR()){if(Y>=this.GetT()){if(Y<=this.GetB()){Result=true;}}}} + return Result; +} +Card.prototype.Inside=CardInside; + +function CardSwapColours(){ + var c=this.css.backgroundColor; + this.css.backgroundColor=this.css.color; + this.css.color=c; +} +Card.prototype.SwapColours=CardSwapColours; + +function CardHighlight(){ + this.css.backgroundColor='[strTextColor]'; + this.css.color='[strExBGColor]'; +} +Card.prototype.Highlight=CardHighlight; + +function CardUnhighlight(){ + this.css.backgroundColor='[strExBGColor]'; + this.css.color='[strTextColor]'; +} +Card.prototype.Unhighlight=CardUnhighlight; + +function CardOverlap(OtherCard){ + var smR=(this.GetR()<(OtherCard.GetR()+this.OverlapTolerance))? this.GetR(): (OtherCard.GetR()+this.OverlapTolerance); + var lgL=(this.GetL()>OtherCard.GetL())? this.GetL(): OtherCard.GetL(); + var HDim=smR-lgL; + if (HDim<1){return 0;} + var smB=(this.GetB()OtherCard.GetT())? this.GetT(): OtherCard.GetT(); + var VDim=smB-lgT; + if (VDim<1){return 0;} + return (HDim*VDim); +} +Card.prototype.Overlap=CardOverlap; + +function CardDockToR(OtherCard){ + this.SetL(OtherCard.GetR() + 5); + this.SetT(OtherCard.GetT()); +} + +Card.prototype.DockToR=CardDockToR; + +function CardSetHome(){ + this.HomeL=this.GetL(); + this.HomeT=this.GetT(); +} +Card.prototype.SetHome=CardSetHome; + +function CardGoHome(){ + this.SetL(this.HomeL); + this.SetT(this.HomeT); +} + +Card.prototype.GoHome=CardGoHome; + + +function doDrag(e) { + if (CurrDrag == -1) {return}; + if (C.ie){var Ev = window.event}else{var Ev = e} + var difX = Ev.clientX-window.lastX; + var difY = Ev.clientY-window.lastY; + var newX = DC[CurrDrag].GetL()+difX; + var newY = DC[CurrDrag].GetT()+difY; + DC[CurrDrag].SetL(newX); + DC[CurrDrag].SetT(newY); + window.lastX = Ev.clientX; + window.lastY = Ev.clientY; + return false; +} + +function beginDrag(e, DragNum) { + CurrDrag = DragNum; + if (C.ie){ + var Ev = window.event; + document.onmousemove=doDrag; + document.onmouseup=endDrag; + } + else{ + var Ev = e; + window.onmousemove=doDrag; + window.onmouseup=endDrag; + } + DC[CurrDrag].Highlight(); + topZ++; + DC[CurrDrag].css.zIndex = topZ; + window.lastX=Ev.clientX; + window.lastY=Ev.clientY; + return false; +} + +function endDrag(e) { + if (CurrDrag == -1) {return}; + DC[CurrDrag].Unhighlight(); + if (C.ie){document.onmousemove=null}else{window.onmousemove=null;} + onEndDrag(); + CurrDrag = -1; +//Need a bugfix for Opera focus problem here + if (C.opera){FocusAButton();} + return true; +} + +var CurrDrag = -1; +var topZ = 100; + diff --git a/mod/hotpot/template/v6/hp6checkshortanswer.js_ b/mod/hotpot/template/v6/hp6checkshortanswer.js_ index 4112eac9b37..ce7357f4e85 100644 --- a/mod/hotpot/template/v6/hp6checkshortanswer.js_ +++ b/mod/hotpot/template/v6/hp6checkshortanswer.js_ @@ -1,400 +1,400 @@ -//CORE CODE FOR CHECKING SHORT ANSWER GUESSES AGAINST ANSWER ARRAYS - -var CaseSensitive = [boolCaseSensitive]; -var ShowAlsoCorrect = [boolShowAlsoCorrect]; -var PleaseEnter = '[strPleaseEnter]'; -var HybridTries = [intHybridTries]; -var PartlyIncorrect = '[strPartlyIncorrect]'; -var CorrectList = '[strCorrectList]'; -var NextCorrect = '[strNextCorrect]'; -var CurrBox = null; - -function TrackFocus(BoxID){ - InTextBox = true; - CurrBox = document.getElementById(BoxID); -} - -function LeaveGap(){ - InTextBox = false; -} - -function TypeChars(Chars){ - if (CurrBox != null){ -//Following check added for 6.0.4.4 to avoid error message in IE6 - if (CurrBox.style.display != 'none'){ - CurrBox.value += Chars; - CurrBox.focus(); - } - } -} - -function CheckGuess(Guess, Answer, CaseSensitive, PercentCorrect, Feedback){ - this.Guess = Guess; - this.Answer = Answer; - this.PercentCorrect = PercentCorrect; - this.Feedback = Feedback; - if (CaseSensitive == false){ - this.WorkingGuess = Guess.toLowerCase(); - this.WorkingAnswer = Answer.toLowerCase(); - } - else{ - this.WorkingGuess = Guess; - this.WorkingAnswer = Answer; - } - this.Hint = ''; - this.HintPenalty = 1/Answer.length; - this.CorrectStart = ''; - this.WrongMiddle = ''; - this.CorrectEnd = ''; - this.PercentMatch = 0; - this.DoCheck(); -} - -function CheckGuess_DoCheck(){ -//Check if it's an exact match - if (this.WorkingAnswer == this.WorkingGuess){ - this.PercentMatch = 100; - this.CorrectStart = this.Guess; - return; - } -//Figure out how much of the beginning is correct - var i = 0; - var CorrectChars = 0; - while (this.WorkingAnswer.charAt(i) == this.WorkingGuess.charAt(i)){ - i++; - CorrectChars++; - } -//Stash the hint - this.Hint = this.Answer.charAt(i); - - this.CorrectStart = this.Guess.substring(0, i); - -//If there's more to the answer, look at the rest of it - if (i=i)&&((this.WorkingAnswer.charAt(k) == this.WorkingGuess.charAt(j))&&(CorrectChars < this.Answer.length))){ - CorrectChars++; - j--; - k--; - } - this.CorrectEnd = this.Guess.substring(j+1, this.Guess.length); - this.WrongMiddle = this.Guess.substring(i, j+1); - } - if (TrimString(this.WrongMiddle).length < 1){this.WrongMiddle = '_';} -//Calculate match score based on how much of the guess is correct - if (CorrectChars < this.Answer.length){ - this.PercentMatch = Math.floor(100*CorrectChars)/this.Answer.length; - } - else{ - this.PercentMatch = Math.floor((100 * CorrectChars)/this.Guess.length); - } -} - -CheckGuess.prototype.DoCheck = CheckGuess_DoCheck; - -function CheckAnswerArray(CaseSensitive){ - this.CaseSensitive = CaseSensitive; - this.Answers = new Array(); - this.Score = 0; - this.Feedback = ''; - this.Hint = ''; - this.HintPenalty = 0; - this.MatchedAnswerLength = 1; - this.CompleteMatch = false; - this.MatchNum = -1; -} - -function CheckAnswerArray_AddAnswer(Guess, Answer, PercentCorrect, Feedback){ - this.Answers.push(new CheckGuess(Guess, Answer, this.CaseSensitive, PercentCorrect, Feedback)); -} - -CheckAnswerArray.prototype.AddAnswer = CheckAnswerArray_AddAnswer; - -function CheckAnswerArray_ClearAll(){ - this.Answers.length = 0; -} - -CheckAnswerArray.prototype.ClearAll = CheckAnswerArray_ClearAll; - -function CheckAnswerArray_GetBestMatch(){ -//First check for a 100% match - for (var i=0; i PercentMatch)&&(this.Answers[i].PercentCorrect == 100)){ - BestMatch = i; - PercentMatch = this.Answers[i].PercentMatch; - } - } - if (BestMatch > -1){ - this.Score = this.Answers[BestMatch].PercentMatch; - this.Feedback = PartlyIncorrect + ' '; - this.Feedback += '' + this.Answers[BestMatch].CorrectStart; - this.Feedback += '' + this.Answers[BestMatch].WrongMiddle + ''; - this.Feedback += this.Answers[BestMatch].CorrectEnd + ''; - this.Hint = '' + this.Answers[BestMatch].CorrectStart; - this.Hint += '' + this.Answers[BestMatch].Hint + ''; - this.HintPenalty = this.Answers[BestMatch].HintPenalty; - } - else{ - this.Score = 0; - this.Feedback = ''; - } -} - -CheckAnswerArray.prototype.GetBestMatch = CheckAnswerArray_GetBestMatch; - -function CheckShortAnswer(QNum){ -//bail if question doesn't exist or exercise finished - if ((State[QNum].length < 1)||(Finished == true)){return;} - -//bail if question already complete - if (State[QNum][0] > -1){return;} - -//Get the guess (TrimString added to fix bug for 6.0.4.3) - var G = TrimString(document.getElementById('Q_' + QNum + '_Guess').value); - -//If no guess, bail with message; no penalty - if (G.length < 1){ - ShowMessage(PleaseEnter); - return; - } - -//Increment tries - State[QNum][2]++; - -//Create a check object - var CA = new CheckAnswerArray(CaseSensitive); - - CA.ClearAll(); - for (var ANum=0; ANum -1){ - State[QNum][5] += String.fromCharCode(65+CA.MatchNum) + ','; - } - -//Add the percent correct value for this answer to the Q State (works for all -//situations, wrong or right) - State[QNum][3] += CA.Score; - -//Now branch, based on the nature of the match -//Is it a complete match? - if (CA.CompleteMatch == true){ - -//Is it with a wrong answer, or a right answer? - if (CA.Score == 100){ -//It's right - CalculateShortAnsQuestionScore(QNum); -//Get correct answer list if required, assuming there are any other correct alternatives - if (ShowAlsoCorrect == true){ - var AlsoCorrectList = GetCorrectList(QNum, G, false); - if (AlsoCorrectList.length > 0){ - CA.Feedback += '
' + CorrectList + '
' + AlsoCorrectList; - } - } - -//Get the overall score and add it to the feedback - if (ContinuousScoring == true){ - CalculateOverallScore(); - CA.Feedback += '
' + YourScoreIs + ' ' + Score + '%.'; - WriteToInstructions(YourScoreIs + ' ' + Score + '%.'); - } - ShowMessage(CA.Feedback); -//Put the answer in - ReplaceGuessBox(QNum, G); - CheckFinished(); - return; - } - } - -//Otherwise, it's a match to a predicted wrong/partially correct, or a partial -//match to a right answer - if (CA.Feedback.length < 1){CA.Feedback = DefaultWrong;} -//Remove any previous score unless exercise is finished (6.0.3.8+) - if (Finished == false){ - WriteToInstructions(strInstructions); - } - ShowMessage(CA.Feedback); - -//If necessary, switch a hybrid question to m/c - if (State[QNum][2] >= HybridTries){ - SwitchHybridDisplay(QNum); - } -} - -function CalculateShortAnsQuestionScore(QNum){ - var Tries = State[QNum][2] + State[QNum][4]; //include tries and hint penalties; - var PercentCorrect = State[QNum][3]; - var HintPenalties = State[QNum][4]; - -//Make sure it's not already complete - if (State[QNum][0] < 0){ - if (HintPenalties >= 1){ - State[QNum][0] = 0; - } - else{ - State[QNum][0] = (PercentCorrect/(100*Tries)); - } - if (State[QNum][0] < 0){ - State[QNum][0] = 0; - } - } -} - -function SwitchHybridDisplay(QNum){ - if (document.getElementById('Q_' + QNum + '_Hybrid_MC') != null){ - document.getElementById('Q_' + QNum + '_Hybrid_MC').style.display = ''; - if (document.getElementById('Q_' + QNum + '_SA') != null){ - document.getElementById('Q_' + QNum + '_SA').style.display = 'none'; - } - } -} - -function GetCorrectArray(QNum){ - var Result = new Array(); - for (var ANum=0; ANum'; - } - } - return Result; -} - -function GetFirstCorrectAnswer(QNum){ - var As = GetCorrectArray(QNum); - if (As.length > 0){ - return As[0]; - } - else{ - return ''; - } -} - -function ReplaceGuessBox(QNum, Ans){ - if (document.getElementById('Q_' + QNum + '_SA') != null){ - var El = document.getElementById('Q_' + QNum + '_SA'); - while (El.childNodes.length > 0){ - El.removeChild(El.childNodes[0]); - } - var A = document.createElement('span'); - A.setAttribute('class', 'Answer'); - var T = document.createTextNode(Ans); - A.appendChild(T); - El.appendChild(A); - } -} - -[inclShowAnswer] - -function ShowAnswers(QNum){ -//bail if question doesn't exist or exercise finished - if ((State[QNum].length < 1)||(Finished == true)){return;} - -//Get the answer list to display - var Ans = GetCorrectList(QNum, '', false); - Ans = CorrectList + '
' + Ans; - -//Display feedback - ShowMessage(Ans); - -//Set the score for this question to 0 if no - if (State[QNum][0] < 1){ - State[QNum][0] = 0; - } - -//Get the first correct answer - var FirstAns = GetFirstCorrectAnswer(QNum); - -//Replace the textbox - ReplaceGuessBox(QNum, FirstAns); - -//Remove any current score - WriteToInstructions(strInstructions); - -//This may be the last, so check finished status - CheckFinished(); -} - -[/inclShowAnswer] - -[inclHint] - -function ShowHint(QNum){ -//bail if question doesn't exist or exercise finished - if ((State[QNum].length < 1)||(Finished == true)){return;} - -//bail if question already complete - if (State[QNum][0] > -1){return;} - -//Get the guess - var G = document.getElementById('Q_' + QNum + '_Guess').value; - -//If no guess, give the first correct bit - if (G.length < 1){ - var Ans = GetFirstCorrectAnswer(QNum); - var Hint = Ans.charAt(0); - ShowMessage(NextCorrect + '
' + Hint); -//Penalty for hint - State[QNum][4] += (1/Ans.length); - return; - } - -//Increment tries - State[QNum][2]++; - -//Create a check object - var CA = new CheckAnswerArray(CaseSensitive); - - CA.ClearAll(); - for (var ANum=0; ANum 0){ - ShowMessage(NextCorrect + '
' + CA.Hint); - State[QNum][4] += CA.HintPenalty; - } - else{ - ShowMessage(DefaultWrong + '
' + NextCorrect + '
' + GetFirstCorrectAnswer(QNum).charAt(0)); - } - } -} - +//CORE CODE FOR CHECKING SHORT ANSWER GUESSES AGAINST ANSWER ARRAYS + +var CaseSensitive = [boolCaseSensitive]; +var ShowAlsoCorrect = [boolShowAlsoCorrect]; +var PleaseEnter = '[strPleaseEnter]'; +var HybridTries = [intHybridTries]; +var PartlyIncorrect = '[strPartlyIncorrect]'; +var CorrectList = '[strCorrectList]'; +var NextCorrect = '[strNextCorrect]'; +var CurrBox = null; + +function TrackFocus(BoxID){ + InTextBox = true; + CurrBox = document.getElementById(BoxID); +} + +function LeaveGap(){ + InTextBox = false; +} + +function TypeChars(Chars){ + if (CurrBox != null){ +//Following check added for 6.0.4.4 to avoid error message in IE6 + if (CurrBox.style.display != 'none'){ + CurrBox.value += Chars; + CurrBox.focus(); + } + } +} + +function CheckGuess(Guess, Answer, CaseSensitive, PercentCorrect, Feedback){ + this.Guess = Guess; + this.Answer = Answer; + this.PercentCorrect = PercentCorrect; + this.Feedback = Feedback; + if (CaseSensitive == false){ + this.WorkingGuess = Guess.toLowerCase(); + this.WorkingAnswer = Answer.toLowerCase(); + } + else{ + this.WorkingGuess = Guess; + this.WorkingAnswer = Answer; + } + this.Hint = ''; + this.HintPenalty = 1/Answer.length; + this.CorrectStart = ''; + this.WrongMiddle = ''; + this.CorrectEnd = ''; + this.PercentMatch = 0; + this.DoCheck(); +} + +function CheckGuess_DoCheck(){ +//Check if it's an exact match + if (this.WorkingAnswer == this.WorkingGuess){ + this.PercentMatch = 100; + this.CorrectStart = this.Guess; + return; + } +//Figure out how much of the beginning is correct + var i = 0; + var CorrectChars = 0; + while (this.WorkingAnswer.charAt(i) == this.WorkingGuess.charAt(i)){ + i++; + CorrectChars++; + } +//Stash the hint + this.Hint = this.Answer.charAt(i); + + this.CorrectStart = this.Guess.substring(0, i); + +//If there's more to the answer, look at the rest of it + if (i=i)&&((this.WorkingAnswer.charAt(k) == this.WorkingGuess.charAt(j))&&(CorrectChars < this.Answer.length))){ + CorrectChars++; + j--; + k--; + } + this.CorrectEnd = this.Guess.substring(j+1, this.Guess.length); + this.WrongMiddle = this.Guess.substring(i, j+1); + } + if (TrimString(this.WrongMiddle).length < 1){this.WrongMiddle = '_';} +//Calculate match score based on how much of the guess is correct + if (CorrectChars < this.Answer.length){ + this.PercentMatch = Math.floor(100*CorrectChars)/this.Answer.length; + } + else{ + this.PercentMatch = Math.floor((100 * CorrectChars)/this.Guess.length); + } +} + +CheckGuess.prototype.DoCheck = CheckGuess_DoCheck; + +function CheckAnswerArray(CaseSensitive){ + this.CaseSensitive = CaseSensitive; + this.Answers = new Array(); + this.Score = 0; + this.Feedback = ''; + this.Hint = ''; + this.HintPenalty = 0; + this.MatchedAnswerLength = 1; + this.CompleteMatch = false; + this.MatchNum = -1; +} + +function CheckAnswerArray_AddAnswer(Guess, Answer, PercentCorrect, Feedback){ + this.Answers.push(new CheckGuess(Guess, Answer, this.CaseSensitive, PercentCorrect, Feedback)); +} + +CheckAnswerArray.prototype.AddAnswer = CheckAnswerArray_AddAnswer; + +function CheckAnswerArray_ClearAll(){ + this.Answers.length = 0; +} + +CheckAnswerArray.prototype.ClearAll = CheckAnswerArray_ClearAll; + +function CheckAnswerArray_GetBestMatch(){ +//First check for a 100% match + for (var i=0; i PercentMatch)&&(this.Answers[i].PercentCorrect == 100)){ + BestMatch = i; + PercentMatch = this.Answers[i].PercentMatch; + } + } + if (BestMatch > -1){ + this.Score = this.Answers[BestMatch].PercentMatch; + this.Feedback = PartlyIncorrect + ' '; + this.Feedback += '' + this.Answers[BestMatch].CorrectStart; + this.Feedback += '' + this.Answers[BestMatch].WrongMiddle + ''; + this.Feedback += this.Answers[BestMatch].CorrectEnd + ''; + this.Hint = '' + this.Answers[BestMatch].CorrectStart; + this.Hint += '' + this.Answers[BestMatch].Hint + ''; + this.HintPenalty = this.Answers[BestMatch].HintPenalty; + } + else{ + this.Score = 0; + this.Feedback = ''; + } +} + +CheckAnswerArray.prototype.GetBestMatch = CheckAnswerArray_GetBestMatch; + +function CheckShortAnswer(QNum){ +//bail if question doesn't exist or exercise finished + if ((State[QNum].length < 1)||(Finished == true)){return;} + +//bail if question already complete + if (State[QNum][0] > -1){return;} + +//Get the guess (TrimString added to fix bug for 6.0.4.3) + var G = TrimString(document.getElementById('Q_' + QNum + '_Guess').value); + +//If no guess, bail with message; no penalty + if (G.length < 1){ + ShowMessage(PleaseEnter); + return; + } + +//Increment tries + State[QNum][2]++; + +//Create a check object + var CA = new CheckAnswerArray(CaseSensitive); + + CA.ClearAll(); + for (var ANum=0; ANum -1){ + State[QNum][5] += String.fromCharCode(65+CA.MatchNum) + ','; + } + +//Add the percent correct value for this answer to the Q State (works for all +//situations, wrong or right) + State[QNum][3] += CA.Score; + +//Now branch, based on the nature of the match +//Is it a complete match? + if (CA.CompleteMatch == true){ + +//Is it with a wrong answer, or a right answer? + if (CA.Score == 100){ +//It's right + CalculateShortAnsQuestionScore(QNum); +//Get correct answer list if required, assuming there are any other correct alternatives + if (ShowAlsoCorrect == true){ + var AlsoCorrectList = GetCorrectList(QNum, G, false); + if (AlsoCorrectList.length > 0){ + CA.Feedback += '
' + CorrectList + '
' + AlsoCorrectList; + } + } + +//Get the overall score and add it to the feedback + if (ContinuousScoring == true){ + CalculateOverallScore(); + CA.Feedback += '
' + YourScoreIs + ' ' + Score + '%.'; + WriteToInstructions(YourScoreIs + ' ' + Score + '%.'); + } + ShowMessage(CA.Feedback); +//Put the answer in + ReplaceGuessBox(QNum, G); + CheckFinished(); + return; + } + } + +//Otherwise, it's a match to a predicted wrong/partially correct, or a partial +//match to a right answer + if (CA.Feedback.length < 1){CA.Feedback = DefaultWrong;} +//Remove any previous score unless exercise is finished (6.0.3.8+) + if (Finished == false){ + WriteToInstructions(strInstructions); + } + ShowMessage(CA.Feedback); + +//If necessary, switch a hybrid question to m/c + if (State[QNum][2] >= HybridTries){ + SwitchHybridDisplay(QNum); + } +} + +function CalculateShortAnsQuestionScore(QNum){ + var Tries = State[QNum][2] + State[QNum][4]; //include tries and hint penalties; + var PercentCorrect = State[QNum][3]; + var HintPenalties = State[QNum][4]; + +//Make sure it's not already complete + if (State[QNum][0] < 0){ + if (HintPenalties >= 1){ + State[QNum][0] = 0; + } + else{ + State[QNum][0] = (PercentCorrect/(100*Tries)); + } + if (State[QNum][0] < 0){ + State[QNum][0] = 0; + } + } +} + +function SwitchHybridDisplay(QNum){ + if (document.getElementById('Q_' + QNum + '_Hybrid_MC') != null){ + document.getElementById('Q_' + QNum + '_Hybrid_MC').style.display = ''; + if (document.getElementById('Q_' + QNum + '_SA') != null){ + document.getElementById('Q_' + QNum + '_SA').style.display = 'none'; + } + } +} + +function GetCorrectArray(QNum){ + var Result = new Array(); + for (var ANum=0; ANum'; + } + } + return Result; +} + +function GetFirstCorrectAnswer(QNum){ + var As = GetCorrectArray(QNum); + if (As.length > 0){ + return As[0]; + } + else{ + return ''; + } +} + +function ReplaceGuessBox(QNum, Ans){ + if (document.getElementById('Q_' + QNum + '_SA') != null){ + var El = document.getElementById('Q_' + QNum + '_SA'); + while (El.childNodes.length > 0){ + El.removeChild(El.childNodes[0]); + } + var A = document.createElement('span'); + A.setAttribute('class', 'Answer'); + var T = document.createTextNode(Ans); + A.appendChild(T); + El.appendChild(A); + } +} + +[inclShowAnswer] + +function ShowAnswers(QNum){ +//bail if question doesn't exist or exercise finished + if ((State[QNum].length < 1)||(Finished == true)){return;} + +//Get the answer list to display + var Ans = GetCorrectList(QNum, '', false); + Ans = CorrectList + '
' + Ans; + +//Display feedback + ShowMessage(Ans); + +//Set the score for this question to 0 if no + if (State[QNum][0] < 1){ + State[QNum][0] = 0; + } + +//Get the first correct answer + var FirstAns = GetFirstCorrectAnswer(QNum); + +//Replace the textbox + ReplaceGuessBox(QNum, FirstAns); + +//Remove any current score + WriteToInstructions(strInstructions); + +//This may be the last, so check finished status + CheckFinished(); +} + +[/inclShowAnswer] + +[inclHint] + +function ShowHint(QNum){ +//bail if question doesn't exist or exercise finished + if ((State[QNum].length < 1)||(Finished == true)){return;} + +//bail if question already complete + if (State[QNum][0] > -1){return;} + +//Get the guess + var G = document.getElementById('Q_' + QNum + '_Guess').value; + +//If no guess, give the first correct bit + if (G.length < 1){ + var Ans = GetFirstCorrectAnswer(QNum); + var Hint = Ans.charAt(0); + ShowMessage(NextCorrect + '
' + Hint); +//Penalty for hint + State[QNum][4] += (1/Ans.length); + return; + } + +//Increment tries + State[QNum][2]++; + +//Create a check object + var CA = new CheckAnswerArray(CaseSensitive); + + CA.ClearAll(); + for (var ANum=0; ANum 0){ + ShowMessage(NextCorrect + '
' + CA.Hint); + State[QNum][4] += CA.HintPenalty; + } + else{ + ShowMessage(DefaultWrong + '
' + NextCorrect + '
' + GetFirstCorrectAnswer(QNum).charAt(0)); + } + } +} + [/inclHint] \ No newline at end of file diff --git a/mod/hotpot/template/v6/hp6hotpotnet.js_ b/mod/hotpot/template/v6/hp6hotpotnet.js_ index 0c2b040cfa9..1ed71f37aa6 100644 --- a/mod/hotpot/template/v6/hp6hotpotnet.js_ +++ b/mod/hotpot/template/v6/hp6hotpotnet.js_ @@ -1,18 +1,18 @@ - -//HOTPOTNET-RELATED CODE - -var HPNStartTime = (new Date()).getTime(); -var SubmissionTimeout = 30000; -var Detail = ''; //Global that is used to submit tracking data - -function Finish(){ -//If there's a form, fill it out and submit it - if (document.store != null){ - Frm = document.store; - Frm.starttime.value = HPNStartTime; - Frm.endtime.value = (new Date()).getTime(); - Frm.mark.value = Score; - Frm.detail.value = Detail; - Frm.submit(); - } -} + +//HOTPOTNET-RELATED CODE + +var HPNStartTime = (new Date()).getTime(); +var SubmissionTimeout = 30000; +var Detail = ''; //Global that is used to submit tracking data + +function Finish(){ +//If there's a form, fill it out and submit it + if (document.store != null){ + Frm = document.store; + Frm.starttime.value = HPNStartTime; + Frm.endtime.value = (new Date()).getTime(); + Frm.mark.value = Score; + Frm.detail.value = Detail; + Frm.submit(); + } +} diff --git a/mod/hotpot/template/v6/hp6navbar.ht_ b/mod/hotpot/template/v6/hp6navbar.ht_ index 1594ec9b99b..359fbea4c1a 100644 --- a/mod/hotpot/template/v6/hp6navbar.ht_ +++ b/mod/hotpot/template/v6/hp6navbar.ht_ @@ -1,15 +1,15 @@ - + diff --git a/mod/hotpot/template/v6/hp6objecttags.ht_ b/mod/hotpot/template/v6/hp6objecttags.ht_ index 3fa9b0ca003..50790285828 100644 --- a/mod/hotpot/template/v6/hp6objecttags.ht_ +++ b/mod/hotpot/template/v6/hp6objecttags.ht_ @@ -1,35 +1,35 @@ - -[QuickTime Player] - - - - - - - - -[strContent] -[/QuickTime Player] - -[Windows Media Player] - - - -[strContent] -[/Windows Media Player] - -[Real Player] - - - - - -[strContent][/Real Player] - -[Flash Player] - - -[strContent][/Flash Player] + +[QuickTime Player] + + + + + + + + +[strContent] +[/QuickTime Player] + +[Windows Media Player] + + + +[strContent] +[/Windows Media Player] + +[Real Player] + + + + + +[strContent][/Real Player] + +[Flash Player] + + +[strContent][/Flash Player] diff --git a/mod/hotpot/template/v6/hp6plainpage.ht_ b/mod/hotpot/template/v6/hp6plainpage.ht_ index 40c912a02b4..9abc49af4b0 100644 --- a/mod/hotpot/template/v6/hp6plainpage.ht_ +++ b/mod/hotpot/template/v6/hp6plainpage.ht_ @@ -1,42 +1,42 @@ - - - - - - - -Page Title - - - - - - -[strHeaderCode] - - - - - - - -
-

Page Title

-

Page Subtitle

-
- -
- -

Page content...

- -
- - - - - + + + + + + + +Page Title + + + + + + +[strHeaderCode] + + + + + + + +
+

Page Title

+

Page Subtitle

+
+ +
+ +

Page content...

+ +
+ + + + + diff --git a/mod/hotpot/template/v6/hp6sendresults.js_ b/mod/hotpot/template/v6/hp6sendresults.js_ index 5e46eb41c48..b860ec8f052 100644 --- a/mod/hotpot/template/v6/hp6sendresults.js_ +++ b/mod/hotpot/template/v6/hp6sendresults.js_ @@ -1,53 +1,53 @@ - - -//CODE FOR HANDLING SENDING OF RESULTS - -var UserName = ''; -var StartTime = (new Date()).toLocaleString(); - -var ResultForm = '
'; -ResultForm += ''; -ResultForm += ''; -ResultForm += ''; -ResultForm += ''; -ResultForm += ''; -ResultForm += ''; -ResultForm += ''; -ResultForm += ''; -[inclPageBGColor]ResultForm += '';[/inclPageBGColor] -ResultForm += ''; -ResultForm += ''; -ResultForm += '
'; - -function GetUserName(){ - UserName = prompt('[strNamePlease]',''); - UserName += ''; - if ((UserName.substring(0,4) == 'null')||(UserName.length < 1)){ - UserName = prompt('[strNamePlease]',''); - UserName += ''; - if ((UserName.substring(0,4) == 'null')||(UserName.length < 1)){ - history.back(); - } - } -} - -function SendResults(Score){ - var today = new Date; - var NewName = '' + today.getTime(); - var NewWin = window.open('', NewName, 'toolbar=no,location=no,directories=no,status=no, menubar=no,scrollbars=yes,resizable=no,,width=400,height=300'); - -//If user has prevented popups, no way to proceed -- exit - if (NewWin == null){ - return; - } - - NewWin.document.clear(); - NewWin.document.open(); - NewWin.document.write(ResultForm); - NewWin.document.close(); - NewWin.document.Results.Score.value = Score + '%'; - NewWin.document.Results.realname.value = UserName; - NewWin.document.Results.End_Time.value = (new Date()).toLocaleString(); - NewWin.document.Results.Start_Time.value = StartTime; - NewWin.document.Results.submit(); -} + + +//CODE FOR HANDLING SENDING OF RESULTS + +var UserName = ''; +var StartTime = (new Date()).toLocaleString(); + +var ResultForm = '
'; +ResultForm += ''; +ResultForm += ''; +ResultForm += ''; +ResultForm += ''; +ResultForm += ''; +ResultForm += ''; +ResultForm += ''; +ResultForm += ''; +[inclPageBGColor]ResultForm += '';[/inclPageBGColor] +ResultForm += ''; +ResultForm += ''; +ResultForm += '
'; + +function GetUserName(){ + UserName = prompt('[strNamePlease]',''); + UserName += ''; + if ((UserName.substring(0,4) == 'null')||(UserName.length < 1)){ + UserName = prompt('[strNamePlease]',''); + UserName += ''; + if ((UserName.substring(0,4) == 'null')||(UserName.length < 1)){ + history.back(); + } + } +} + +function SendResults(Score){ + var today = new Date; + var NewName = '' + today.getTime(); + var NewWin = window.open('', NewName, 'toolbar=no,location=no,directories=no,status=no, menubar=no,scrollbars=yes,resizable=no,,width=400,height=300'); + +//If user has prevented popups, no way to proceed -- exit + if (NewWin == null){ + return; + } + + NewWin.document.clear(); + NewWin.document.open(); + NewWin.document.write(ResultForm); + NewWin.document.close(); + NewWin.document.Results.Score.value = Score + '%'; + NewWin.document.Results.realname.value = UserName; + NewWin.document.Results.End_Time.value = (new Date()).toLocaleString(); + NewWin.document.Results.Start_Time.value = StartTime; + NewWin.document.Results.submit(); +} diff --git a/mod/hotpot/template/v6/hp6showmessage.js_ b/mod/hotpot/template/v6/hp6showmessage.js_ index 4e3cb5defd7..98a33c2b080 100644 --- a/mod/hotpot/template/v6/hp6showmessage.js_ +++ b/mod/hotpot/template/v6/hp6showmessage.js_ @@ -1,60 +1,60 @@ - - -//CODE FOR HANDLING DISPLAY OF POPUP FEEDBACK BOX - -var topZ = 1000; - -function ShowMessage(Feedback){ - var Output = Feedback + '

'; - - 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'; - } - - ShowElements(false, 'input'); - ShowElements(false, 'select'); - ShowElements(false, 'object'); - -//Focus the OK button - var obj = document.getElementById('FeedbackOKButton'); - if (obj) { - 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
'; + + 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'; + } + + ShowElements(false, 'input'); + ShowElements(false, 'select'); + ShowElements(false, 'object'); + +//Focus the OK button + var obj = document.getElementById('FeedbackOKButton'); + if (obj) { + 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 ReduceToSize){ - ItemToDump = Math.floor(InArray.length*Math.random()); - InArray.splice(ItemToDump, 1); - } -} - -function Shuffle(InArray){ - var Num; - var Temp = new Array(); - var Len = InArray.length; - - var j = Len; - - for (var i=0; i InArray[Longest].length){ - Longest = i; - } - } - return Longest; -} - -//UNICODE CHARACTER FUNCTIONS -function IsCombiningDiacritic(CharNum){ - var Result = (((CharNum >= 0x0300)&&(CharNum <= 0x370))||((CharNum >= 0x20d0)&&(CharNum <= 0x20ff))); - Result = Result || (((CharNum >= 0x3099)&&(CharNum <= 0x309a))||((CharNum >= 0xfe20)&&(CharNum <= 0xfe23))); - return Result; -} - -function IsCJK(CharNum){ - return ((CharNum >= 0x3000)&&(CharNum < 0xd800)); -} - -//SETUP FUNCTIONS -//BROWSER WILL REFILL TEXT BOXES FROM CACHE IF NOT PREVENTED -function ClearTextBoxes(){ - var NList = document.getElementsByTagName('input'); - for (var i=0; i -1)||(NList[i].id.indexOf('Gap') > -1)){ - NList[i].value = ''; - } - if (NList[i].id.indexOf('Chk') > -1){ - NList[i].checked = ''; - } - } -} - -//EXTENSION TO ARRAY OBJECT -function Array_IndexOf(Input){ - var Result = -1; - for (var i=0; i ReduceToSize){ + ItemToDump = Math.floor(InArray.length*Math.random()); + InArray.splice(ItemToDump, 1); + } +} + +function Shuffle(InArray){ + var Num; + var Temp = new Array(); + var Len = InArray.length; + + var j = Len; + + for (var i=0; i InArray[Longest].length){ + Longest = i; + } + } + return Longest; +} + +//UNICODE CHARACTER FUNCTIONS +function IsCombiningDiacritic(CharNum){ + var Result = (((CharNum >= 0x0300)&&(CharNum <= 0x370))||((CharNum >= 0x20d0)&&(CharNum <= 0x20ff))); + Result = Result || (((CharNum >= 0x3099)&&(CharNum <= 0x309a))||((CharNum >= 0xfe20)&&(CharNum <= 0xfe23))); + return Result; +} + +function IsCJK(CharNum){ + return ((CharNum >= 0x3000)&&(CharNum < 0xd800)); +} + +//SETUP FUNCTIONS +//BROWSER WILL REFILL TEXT BOXES FROM CACHE IF NOT PREVENTED +function ClearTextBoxes(){ + var NList = document.getElementsByTagName('input'); + for (var i=0; i -1)||(NList[i].id.indexOf('Gap') > -1)){ + NList[i].value = ''; + } + if (NList[i].id.indexOf('Chk') > -1){ + NList[i].checked = ''; + } + } +} + +//EXTENSION TO ARRAY OBJECT +function Array_IndexOf(Input){ + var Result = -1; + for (var i=0; i - - - -[strDublinCoreMetadata] - - - - -[strPlainTitle] - - - - - - -[strHeaderCode] - - - - - - - - - - - - -[inclNavButtons] -[strTopNavBar] -[/inclNavButtons] - - - -
-

[strExerciseTitle]

-[inclExerciseSubtitle] -

[strExerciseSubtitle]

-[/inclExerciseSubtitle] -[inclTimer] -
  
-[/inclTimer] - -
- -
-

[strInstructions]

-
- -[inclReading] -
- -
- -
-[strReadingText] -
-
- -
- - -
-[/inclReading] - -[inclWordList] -
-[strWordList] -
-[/inclWordList] - -
- - - - -
-
-
-[strClozeBody] -
-
-
- -[inclKeypad] -
-[strKeypad] -
-[/inclKeypad] - - - -[inclHint] - -[/inclHint] - -
- -[inclReading] -
-[/inclReading] - - - - - -[inclNavButtons] -[strBottomNavBar] -[/inclNavButtons] - - - - - - - - - - + + + + +[strDublinCoreMetadata] + + + + +[strPlainTitle] + + + + + + +[strHeaderCode] + + + + + + + + + + + + +[inclNavButtons] +[strTopNavBar] +[/inclNavButtons] + + + +
+

[strExerciseTitle]

+[inclExerciseSubtitle] +

[strExerciseSubtitle]

+[/inclExerciseSubtitle] +[inclTimer] +
  
+[/inclTimer] + +
+ +
+

[strInstructions]

+
+ +[inclReading] +
+ +
+ +
+[strReadingText] +
+
+ +
+ + +
+[/inclReading] + +[inclWordList] +
+[strWordList] +
+[/inclWordList] + +
+ + + + +
+
+
+[strClozeBody] +
+
+
+ +[inclKeypad] +
+[strKeypad] +
+[/inclKeypad] + + + +[inclHint] + +[/inclHint] + +
+ +[inclReading] +
+[/inclReading] + + + + + +[inclNavButtons] +[strBottomNavBar] +[/inclNavButtons] + + + + + + + + + + diff --git a/mod/hotpot/template/v6/jcloze6.js_ b/mod/hotpot/template/v6/jcloze6.js_ index 5f2225ad9f7..95b0c53d0c9 100644 --- a/mod/hotpot/template/v6/jcloze6.js_ +++ b/mod/hotpot/template/v6/jcloze6.js_ @@ -1,334 +1,334 @@ - -//JCLOZE CORE JAVASCRIPT CODE - -function ItemState(){ - this.ClueGiven = false; - this.HintsAndChecks = 0; - this.MatchedAnswerLength = 0; - this.ItemScore = 0; - this.AnsweredCorrectly = false; - this.Guesses = new Array(); - return this; -} - -var Feedback = ''; -var Correct = '[strCorrect]'; -var Incorrect = '[strIncorrect]'; -var GiveHint = '[strGiveHint]'; -var CaseSensitive = [boolCaseSensitive]; -var YourScoreIs = '[strYourScoreIs]'; -var Finished = false; -var Locked = false; -var Score = 0; -var CurrentWord = 0; -var Guesses = ''; -var TimeOver = false; - -I = new Array(); -[strItemArray] - -State = new Array(); - -function StartUp(){ - RemoveBottomNavBarForIE(); - -[inclSendResults] - GetUserName(); -[/inclSendResults] - -[inclPreloadImages] - PreloadImages([PreloadImageList]); -[/inclPreloadImages] - - var i = 0; - - State.length = 0; - for (i=0; i 0)&&(Ans != State[i].Guesses[State[i].Guesses.length-1])){ - State[i].Guesses[State[i].Guesses.length] = Ans; - } - } -} - -function CompileGuesses(){ - var F = document.getElementById('store'); - if (F != null){ - var Temp = ''; - var GapLabel = ''; - for (var i=0; i'; - Temp += 'student-responses' + GapLabel + ''; - Temp += 'JClozeStudentResponses'; - for (var j=0; j0){Temp += '| ';} - Temp += State[i].Guesses[j] + ' '; - } - Temp += ''; - } - Temp += ''; - Detail = Temp; - } -} - -function CheckAnswers(){ - if (Locked == true){return;} - SaveCurrentAnswers(); - var AllCorrect = true; - -//Check each answer - for (var i = 0; i -1){ - var TotalChars = GetGapValue(i).length; - State[i].ItemScore = (TotalChars-State[i].HintsAndChecks)/TotalChars; - if (State[i].ClueGiven == true){State[i].ItemScore /= 2;} - if (State[i].ItemScore <0 ){State[i].ItemScore = 0;} - State[i].AnsweredCorrectly = true; -//Drop the correct answer into the page, replacing the text box - SetCorrectAnswer(i, GetGapValue(i)); - } - else{ -//Otherwise, increment the hints for this item, as a penalty - State[i].HintsAndChecks++; - -//then set the flag - AllCorrect = false; - } - } - } - -//Calculate the total score - var TotalScore = 0; - for (i=0; i'; - } - - Output += YourScoreIs + ' ' + TotalScore + '%.
'; - if (AllCorrect == false){ - Output += '
' + Incorrect; - } - ShowMessage(Output); - setTimeout('WriteToInstructions(Output)', 50); - - Score = TotalScore; - CompileGuesses(); - - if ((AllCorrect == true)||(Finished == true)){ -[inclSendResults] - setTimeout('SendResults(' + TotalScore + ')', 50); -[/inclSendResults] -[inclTimer] - window.clearInterval(Interval); -[/inclTimer] - TimeOver = true; - Locked = true; - Finished = true; - setTimeout('Finish()', SubmissionTimeout); - } -} - -function TrackFocus(BoxNumber){ - CurrentWord = BoxNumber; - InTextBox = true; -} - -function LeaveGap(){ - InTextBox = false; -} - -function CheckBeginning(Guess, Answer){ - var OutString = ''; - var i = 0; - var UpperGuess = ''; - var UpperAnswer = ''; - - if (CaseSensitive == false) { - UpperGuess = Guess.toUpperCase(); - UpperAnswer = Answer.toUpperCase(); - } - else { - UpperGuess = Guess; - UpperAnswer = Answer; - } - - while (UpperGuess.charAt(i) == UpperAnswer.charAt(i)) { - OutString += Guess.charAt(i); - i++; - } - OutString += Answer.charAt(i); - return OutString; -} - -function GetGapValue(GNum){ - var RetVal = ''; - if ((GNum<0)||(GNum>=I.length)){return RetVal;} - if (document.getElementById('Gap' + GNum) != null){ - RetVal = document.getElementById('Gap' + GNum).value; - RetVal = TrimString(RetVal); - } - else{ - RetVal = State[GNum].Guesses[State[GNum].Guesses.length-1]; - } - return RetVal; -} - -function SetGapValue(GNum, Val){ - if ((GNum<0)||(GNum>=I.length)){return;} - if (document.getElementById('Gap' + GNum) != null){ - document.getElementById('Gap' + GNum).value = Val; - document.getElementById('Gap' + GNum).focus(); - } -} - -function SetCorrectAnswer(GNum, Val){ - if ((GNum<0)||(GNum>=I.length)){return;} - if (document.getElementById('GapSpan' + GNum) != null){ - document.getElementById('GapSpan' + GNum).innerHTML = Val; - } -} - -function FindCurrent() { - var x = 0; - FoundCurrent = -1; - -//Test the current word: -//If its state is not set to already correct, check the word. - if (State[CurrentWord].AnsweredCorrectly == false){ - if (CheckAnswer(CurrentWord, false) < 0){ - return CurrentWord; - } - } - - x=CurrentWord + 1; - while (x -1){return ''} - RightBits = new Array(); - for (var i=0; i 0){ - SetGapValue(CurrGap, HintString); - State[CurrGap].HintsAndChecks += 1; - } - ShowMessage(GiveHint); -} - -function TypeChars(Chars){ - var CurrGap = FindCurrent(); - if (CurrGap < 0){return;} - if (document.getElementById('Gap' + CurrGap) != null){ - SetGapValue(CurrGap, document.getElementById('Gap' + CurrGap).value + Chars); - } -} - -[inclTimer] -function TimesUp() { - document.getElementById('Timer').innerHTML = '[strTimesUp]'; -[inclPreloadImages] - RefreshImages(); -[/inclPreloadImages] - TimeOver = true; - Finished = true; - CheckAnswers(); - Locked = true; -} + +//JCLOZE CORE JAVASCRIPT CODE + +function ItemState(){ + this.ClueGiven = false; + this.HintsAndChecks = 0; + this.MatchedAnswerLength = 0; + this.ItemScore = 0; + this.AnsweredCorrectly = false; + this.Guesses = new Array(); + return this; +} + +var Feedback = ''; +var Correct = '[strCorrect]'; +var Incorrect = '[strIncorrect]'; +var GiveHint = '[strGiveHint]'; +var CaseSensitive = [boolCaseSensitive]; +var YourScoreIs = '[strYourScoreIs]'; +var Finished = false; +var Locked = false; +var Score = 0; +var CurrentWord = 0; +var Guesses = ''; +var TimeOver = false; + +I = new Array(); +[strItemArray] + +State = new Array(); + +function StartUp(){ + RemoveBottomNavBarForIE(); + +[inclSendResults] + GetUserName(); +[/inclSendResults] + +[inclPreloadImages] + PreloadImages([PreloadImageList]); +[/inclPreloadImages] + + var i = 0; + + State.length = 0; + for (i=0; i 0)&&(Ans != State[i].Guesses[State[i].Guesses.length-1])){ + State[i].Guesses[State[i].Guesses.length] = Ans; + } + } +} + +function CompileGuesses(){ + var F = document.getElementById('store'); + if (F != null){ + var Temp = ''; + var GapLabel = ''; + for (var i=0; i'; + Temp += 'student-responses' + GapLabel + ''; + Temp += 'JClozeStudentResponses'; + for (var j=0; j0){Temp += '| ';} + Temp += State[i].Guesses[j] + ' '; + } + Temp += ''; + } + Temp += ''; + Detail = Temp; + } +} + +function CheckAnswers(){ + if (Locked == true){return;} + SaveCurrentAnswers(); + var AllCorrect = true; + +//Check each answer + for (var i = 0; i -1){ + var TotalChars = GetGapValue(i).length; + State[i].ItemScore = (TotalChars-State[i].HintsAndChecks)/TotalChars; + if (State[i].ClueGiven == true){State[i].ItemScore /= 2;} + if (State[i].ItemScore <0 ){State[i].ItemScore = 0;} + State[i].AnsweredCorrectly = true; +//Drop the correct answer into the page, replacing the text box + SetCorrectAnswer(i, GetGapValue(i)); + } + else{ +//Otherwise, increment the hints for this item, as a penalty + State[i].HintsAndChecks++; + +//then set the flag + AllCorrect = false; + } + } + } + +//Calculate the total score + var TotalScore = 0; + for (i=0; i'; + } + + Output += YourScoreIs + ' ' + TotalScore + '%.
'; + if (AllCorrect == false){ + Output += '
' + Incorrect; + } + ShowMessage(Output); + setTimeout('WriteToInstructions(Output)', 50); + + Score = TotalScore; + CompileGuesses(); + + if ((AllCorrect == true)||(Finished == true)){ +[inclSendResults] + setTimeout('SendResults(' + TotalScore + ')', 50); +[/inclSendResults] +[inclTimer] + window.clearInterval(Interval); +[/inclTimer] + TimeOver = true; + Locked = true; + Finished = true; + setTimeout('Finish()', SubmissionTimeout); + } +} + +function TrackFocus(BoxNumber){ + CurrentWord = BoxNumber; + InTextBox = true; +} + +function LeaveGap(){ + InTextBox = false; +} + +function CheckBeginning(Guess, Answer){ + var OutString = ''; + var i = 0; + var UpperGuess = ''; + var UpperAnswer = ''; + + if (CaseSensitive == false) { + UpperGuess = Guess.toUpperCase(); + UpperAnswer = Answer.toUpperCase(); + } + else { + UpperGuess = Guess; + UpperAnswer = Answer; + } + + while (UpperGuess.charAt(i) == UpperAnswer.charAt(i)) { + OutString += Guess.charAt(i); + i++; + } + OutString += Answer.charAt(i); + return OutString; +} + +function GetGapValue(GNum){ + var RetVal = ''; + if ((GNum<0)||(GNum>=I.length)){return RetVal;} + if (document.getElementById('Gap' + GNum) != null){ + RetVal = document.getElementById('Gap' + GNum).value; + RetVal = TrimString(RetVal); + } + else{ + RetVal = State[GNum].Guesses[State[GNum].Guesses.length-1]; + } + return RetVal; +} + +function SetGapValue(GNum, Val){ + if ((GNum<0)||(GNum>=I.length)){return;} + if (document.getElementById('Gap' + GNum) != null){ + document.getElementById('Gap' + GNum).value = Val; + document.getElementById('Gap' + GNum).focus(); + } +} + +function SetCorrectAnswer(GNum, Val){ + if ((GNum<0)||(GNum>=I.length)){return;} + if (document.getElementById('GapSpan' + GNum) != null){ + document.getElementById('GapSpan' + GNum).innerHTML = Val; + } +} + +function FindCurrent() { + var x = 0; + FoundCurrent = -1; + +//Test the current word: +//If its state is not set to already correct, check the word. + if (State[CurrentWord].AnsweredCorrectly == false){ + if (CheckAnswer(CurrentWord, false) < 0){ + return CurrentWord; + } + } + + x=CurrentWord + 1; + while (x -1){return ''} + RightBits = new Array(); + for (var i=0; i 0){ + SetGapValue(CurrGap, HintString); + State[CurrGap].HintsAndChecks += 1; + } + ShowMessage(GiveHint); +} + +function TypeChars(Chars){ + var CurrGap = FindCurrent(); + if (CurrGap < 0){return;} + if (document.getElementById('Gap' + CurrGap) != null){ + SetGapValue(CurrGap, document.getElementById('Gap' + CurrGap).value + Chars); + } +} + +[inclTimer] +function TimesUp() { + document.getElementById('Timer').innerHTML = '[strTimesUp]'; +[inclPreloadImages] + RefreshImages(); +[/inclPreloadImages] + TimeOver = true; + Finished = true; + CheckAnswers(); + Locked = true; +} [/inclTimer] \ No newline at end of file diff --git a/mod/hotpot/template/v6/jcross6.ht_ b/mod/hotpot/template/v6/jcross6.ht_ index e0fd052c6d7..706af6956bb 100644 --- a/mod/hotpot/template/v6/jcross6.ht_ +++ b/mod/hotpot/template/v6/jcross6.ht_ @@ -1,187 +1,187 @@ - - - - -[strDublinCoreMetadata] - - - - -[strPlainTitle] - - - - - - -[strHeaderCode] - - - - - - - - - - - - -[inclNavButtons] -[strTopNavBar] -[/inclNavButtons] - - - -
-

[strExerciseTitle]

-[inclExerciseSubtitle] -

[strExerciseSubtitle]

-[/inclExerciseSubtitle] -[inclTimer] -
  
-[/inclTimer] - -
- -
-

[strInstructions]

-
- -[inclReading] -
- -
- -
-[strReadingText] -
-
- -
- - -
-[/inclReading] - -
- -[inclKeypad] -
-[strKeypad] -
-[/inclKeypad] - -
- -
- - - - - - - -[strGridBody] - - -
- - - - - - - - - - - -
- - - - - -[strCluesAcross] - - -

[strCluesAcrossLabel]

- -
- - - - - -[strCluesDown] - - -

[strCluesDownLabel]

- -
- -
- -[inclReading] -
-[/inclReading] - - - - - -[inclNavButtons] -[strBottomNavBar] -[/inclNavButtons] - - - - - - - - - - + + + + +[strDublinCoreMetadata] + + + + +[strPlainTitle] + + + + + + +[strHeaderCode] + + + + + + + + + + + + +[inclNavButtons] +[strTopNavBar] +[/inclNavButtons] + + + +
+

[strExerciseTitle]

+[inclExerciseSubtitle] +

[strExerciseSubtitle]

+[/inclExerciseSubtitle] +[inclTimer] +
  
+[/inclTimer] + +
+ +
+

[strInstructions]

+
+ +[inclReading] +
+ +
+ +
+[strReadingText] +
+
+ +
+ + +
+[/inclReading] + +
+ +[inclKeypad] +
+[strKeypad] +
+[/inclKeypad] + +
+ +
+ + + + + + + +[strGridBody] + + +
+ + + + + + + + + + + +
+ + + + + +[strCluesAcross] + + +

[strCluesAcrossLabel]

+ +
+ + + + + +[strCluesDown] + + +

[strCluesDownLabel]

+ +
+ +
+ +[inclReading] +
+[/inclReading] + + + + + +[inclNavButtons] +[strBottomNavBar] +[/inclNavButtons] + + + + + + + + + + diff --git a/mod/hotpot/template/v6/jcross6.js_ b/mod/hotpot/template/v6/jcross6.js_ index bfc83c5ef9e..85b90e2bd7c 100644 --- a/mod/hotpot/template/v6/jcross6.js_ +++ b/mod/hotpot/template/v6/jcross6.js_ @@ -1,297 +1,297 @@ - -//JCROSS CORE JAVASCRIPT CODE - -var InGap = false; -var CurrentBox = null; -var Feedback = ''; -var AcrossCaption = ''; -var DownCaption = ''; -var Correct = '[strCorrect]'; -var Incorrect = '[strIncorrect]'; -var GiveHint = '[strGiveHint]'; -var YourScoreIs = '[strYourScoreIs]'; -var BuiltGrid = ''; -var BuiltExercise = ''; -var Penalties = 0; -var Score = 0; -var InTextBox = false; -var Locked = false; -var TimeOver = false; - -var InputStuff = '
[strClueNum]: '; -InputStuff += '[strClue] '; -InputStuff += ''; -InputStuff += '[inclHint][/inclHint]'; -InputStuff += '
'; - -var CurrBoxElement = null; -var Finished = false; - -function StartUp(){ - RemoveBottomNavBarForIE(); - AcrossCaption = document.getElementById('CluesAcrossLabel').innerHTML; - DownCaption = document.getElementById('CluesDownLabel').innerHTML; -[inclSendResults] - GetUserName(); -[/inclSendResults] - -[inclPreloadImages] - PreloadImages([PreloadImageList]); -[/inclPreloadImages] - -[inclTimer] - StartTimer(); -[/inclTimer] - -} - -function GetAnswerLength(Across,x,y){ - Result = 0; - if (Across == false){ - while ((x 0)){ - Result += L[x][y].length; - x++; - } - return Result; - } - else{ - while ((y 0)){ - Result += L[x][y].length; - y++; - } - return Result; - } -} - -function GetEditSize(Across,x,y){ - var Len = GetAnswerLength(Across,x,y); - if (IsCJK(L[x][y].charCodeAt(0))){ - Len *= 2; - } - return Len; -} - -function ShowClue(ClueNum,x,y){ - var Result = ''; - var Temp; - var strParams; - var Clue = document.getElementById('Clue_A_' + ClueNum); - if (Clue != null){ - Temp = InputStuff.replace(/\[ClueNum\]/g, ClueNum); - Temp = Temp.replace(/\[strClueNum\]/g, AcrossCaption + ' ' + ClueNum); - strParams = 'true,' + ClueNum + ',' + x + ',' + y + ',\'[strBoxId]\''; - Temp = Temp.replace(/\[strParams\]/g, strParams); - Temp = Temp.replace(/\[strBoxId\]/g, 'GA_' + ClueNum + '_' + x + '_' + y); - Temp = Temp.replace(/\[strEditSize\]/g, GetEditSize(true,x,y)); - Temp = Temp.replace(/\[strMaxLength\]/g, GetAnswerLength(true,x,y)); - Temp = Temp.replace(/\[strClue\]/g, Clue.innerHTML, Temp); - Result += Temp; - } - Clue = document.getElementById('Clue_D_' + ClueNum); - if (Clue != null){ - Temp = InputStuff.replace(/\[ClueNum\]/g, ClueNum); - Temp = Temp.replace(/\[strClueNum\]/g, DownCaption + ' ' + ClueNum); - strParams = 'false,' + ClueNum + ',' + x + ',' + y + ',\'[strBoxId]\''; - Temp = Temp.replace(/\[strParams\]/g, strParams); - Temp = Temp.replace(/\[strBoxId\]/g, 'GD_' + ClueNum + '_' + x + '_' + y); - Temp = Temp.replace(/\[strEditSize\]/g, GetAnswerLength(false,x,y)); - Temp = Temp.replace(/\[strClue\]/g, Clue.innerHTML, Temp); - Result += Temp; - } - document.getElementById('ClueEntry').innerHTML = Result; -} - -function EnterGuess(Across,ClueNum,x,y,BoxId){ - if (document.getElementById(BoxId) != null){ - var Guess = document.getElementById(BoxId).value; - var AnsLength = GetAnswerLength(Across,x,y); - EnterAnswer(Guess,Across,AnsLength,x,y); - } -} - -function SplitStringToPerceivedChars(InString, PC){ - var Temp = InString.charAt(0); - if (InString.length > 1){ - for (var i=1; i'; - } - - Output += YourScoreIs + ' ' + Score + '%.
'; - if (AllCorrect == false){ - Output += Incorrect; - Penalties++; - } - - ShowMessage(Output); - WriteToInstructions(Output); - - if ((AllCorrect == true)||(TimeOver == true)){ -[inclSendResults] - setTimeout('SendResults(' + Score + ')', 50); -[/inclSendResults] -[inclTimer] - window.clearInterval(Interval); -[/inclTimer] - TimeOver = true; - Locked = true; - Finished = true; - setTimeout('Finish()', SubmissionTimeout); - } -} - -function Finish(){ -//If there's a form, fill it out and submit it - if (document.store != null){ - Frm = document.store; - Frm.starttime.value = HPNStartTime; - Frm.endtime.value = (new Date()).getTime(); - Frm.mark.value = Score; - Frm.submit(); - } -} - -function TypeChars(Chars){ - if (CurrentBox != null){ - CurrentBox.value += Chars; - } -} - -[inclTimer] -function TimesUp() { - document.getElementById('Timer').innerHTML = '[strTimesUp]'; -[inclPreloadImages] - RefreshImages(); -[/inclPreloadImages] - TimeOver = true; - Finished = true; - CheckAnswers(); - Locked = true; -} + +//JCROSS CORE JAVASCRIPT CODE + +var InGap = false; +var CurrentBox = null; +var Feedback = ''; +var AcrossCaption = ''; +var DownCaption = ''; +var Correct = '[strCorrect]'; +var Incorrect = '[strIncorrect]'; +var GiveHint = '[strGiveHint]'; +var YourScoreIs = '[strYourScoreIs]'; +var BuiltGrid = ''; +var BuiltExercise = ''; +var Penalties = 0; +var Score = 0; +var InTextBox = false; +var Locked = false; +var TimeOver = false; + +var InputStuff = '
[strClueNum]: '; +InputStuff += '[strClue] '; +InputStuff += ''; +InputStuff += '[inclHint][/inclHint]'; +InputStuff += '
'; + +var CurrBoxElement = null; +var Finished = false; + +function StartUp(){ + RemoveBottomNavBarForIE(); + AcrossCaption = document.getElementById('CluesAcrossLabel').innerHTML; + DownCaption = document.getElementById('CluesDownLabel').innerHTML; +[inclSendResults] + GetUserName(); +[/inclSendResults] + +[inclPreloadImages] + PreloadImages([PreloadImageList]); +[/inclPreloadImages] + +[inclTimer] + StartTimer(); +[/inclTimer] + +} + +function GetAnswerLength(Across,x,y){ + Result = 0; + if (Across == false){ + while ((x 0)){ + Result += L[x][y].length; + x++; + } + return Result; + } + else{ + while ((y 0)){ + Result += L[x][y].length; + y++; + } + return Result; + } +} + +function GetEditSize(Across,x,y){ + var Len = GetAnswerLength(Across,x,y); + if (IsCJK(L[x][y].charCodeAt(0))){ + Len *= 2; + } + return Len; +} + +function ShowClue(ClueNum,x,y){ + var Result = ''; + var Temp; + var strParams; + var Clue = document.getElementById('Clue_A_' + ClueNum); + if (Clue != null){ + Temp = InputStuff.replace(/\[ClueNum\]/g, ClueNum); + Temp = Temp.replace(/\[strClueNum\]/g, AcrossCaption + ' ' + ClueNum); + strParams = 'true,' + ClueNum + ',' + x + ',' + y + ',\'[strBoxId]\''; + Temp = Temp.replace(/\[strParams\]/g, strParams); + Temp = Temp.replace(/\[strBoxId\]/g, 'GA_' + ClueNum + '_' + x + '_' + y); + Temp = Temp.replace(/\[strEditSize\]/g, GetEditSize(true,x,y)); + Temp = Temp.replace(/\[strMaxLength\]/g, GetAnswerLength(true,x,y)); + Temp = Temp.replace(/\[strClue\]/g, Clue.innerHTML, Temp); + Result += Temp; + } + Clue = document.getElementById('Clue_D_' + ClueNum); + if (Clue != null){ + Temp = InputStuff.replace(/\[ClueNum\]/g, ClueNum); + Temp = Temp.replace(/\[strClueNum\]/g, DownCaption + ' ' + ClueNum); + strParams = 'false,' + ClueNum + ',' + x + ',' + y + ',\'[strBoxId]\''; + Temp = Temp.replace(/\[strParams\]/g, strParams); + Temp = Temp.replace(/\[strBoxId\]/g, 'GD_' + ClueNum + '_' + x + '_' + y); + Temp = Temp.replace(/\[strEditSize\]/g, GetAnswerLength(false,x,y)); + Temp = Temp.replace(/\[strClue\]/g, Clue.innerHTML, Temp); + Result += Temp; + } + document.getElementById('ClueEntry').innerHTML = Result; +} + +function EnterGuess(Across,ClueNum,x,y,BoxId){ + if (document.getElementById(BoxId) != null){ + var Guess = document.getElementById(BoxId).value; + var AnsLength = GetAnswerLength(Across,x,y); + EnterAnswer(Guess,Across,AnsLength,x,y); + } +} + +function SplitStringToPerceivedChars(InString, PC){ + var Temp = InString.charAt(0); + if (InString.length > 1){ + for (var i=1; i'; + } + + Output += YourScoreIs + ' ' + Score + '%.
'; + if (AllCorrect == false){ + Output += Incorrect; + Penalties++; + } + + ShowMessage(Output); + WriteToInstructions(Output); + + if ((AllCorrect == true)||(TimeOver == true)){ +[inclSendResults] + setTimeout('SendResults(' + Score + ')', 50); +[/inclSendResults] +[inclTimer] + window.clearInterval(Interval); +[/inclTimer] + TimeOver = true; + Locked = true; + Finished = true; + setTimeout('Finish()', SubmissionTimeout); + } +} + +function Finish(){ +//If there's a form, fill it out and submit it + if (document.store != null){ + Frm = document.store; + Frm.starttime.value = HPNStartTime; + Frm.endtime.value = (new Date()).getTime(); + Frm.mark.value = Score; + Frm.submit(); + } +} + +function TypeChars(Chars){ + if (CurrentBox != null){ + CurrentBox.value += Chars; + } +} + +[inclTimer] +function TimesUp() { + document.getElementById('Timer').innerHTML = '[strTimesUp]'; +[inclPreloadImages] + RefreshImages(); +[/inclPreloadImages] + TimeOver = true; + Finished = true; + CheckAnswers(); + Locked = true; +} [/inclTimer] \ No newline at end of file diff --git a/mod/hotpot/template/v6/jcross6print.ht_ b/mod/hotpot/template/v6/jcross6print.ht_ index d714cad7fd6..6e74246717f 100644 --- a/mod/hotpot/template/v6/jcross6print.ht_ +++ b/mod/hotpot/template/v6/jcross6print.ht_ @@ -1,182 +1,182 @@ - - - - - - - - - - - - - - - -
-

[strExerciseTitle]

-[inclExerciseSubtitle] -

[strExerciseSubtitle]

-[/inclExerciseSubtitle] -
- - - -[StartBlankCell] - -[EndBlankCell] - -[StartLetterOnlyCell] - -[EndLetterOnlyCell] - -[StartNumLetterCell] - -[EndNumLetterCell] - -
  [Letter][ClueNum] [Letter]
- - - - - - -
- - - -[StartCluesAcrossLoop] - - -[EndCluesAcrossLoop] - -

[strCluesAcrossLabel]

[ClueNum][Clue]
- -
- - - - -[StartCluesDownLoop] - - -[EndCluesDownLoop] -

[strCluesDownLabel]

[ClueNum][Clue]
- -
- - + + + + + + + + + + + + + + + +
+

[strExerciseTitle]

+[inclExerciseSubtitle] +

[strExerciseSubtitle]

+[/inclExerciseSubtitle] +
+ + + +[StartBlankCell] + +[EndBlankCell] + +[StartLetterOnlyCell] + +[EndLetterOnlyCell] + +[StartNumLetterCell] + +[EndNumLetterCell] + +
  [Letter][ClueNum] [Letter]
+ + + + + + +
+ + + +[StartCluesAcrossLoop] + + +[EndCluesAcrossLoop] + +

[strCluesAcrossLabel]

[ClueNum][Clue]
+ +
+ + + + +[StartCluesDownLoop] + + +[EndCluesDownLoop] +

[strCluesDownLabel]

[ClueNum][Clue]
+ +
+ + diff --git a/mod/hotpot/template/v6/jmatch6.ht_ b/mod/hotpot/template/v6/jmatch6.ht_ index 7efe1919109..e517cedd699 100644 --- a/mod/hotpot/template/v6/jmatch6.ht_ +++ b/mod/hotpot/template/v6/jmatch6.ht_ @@ -1,144 +1,144 @@ - - - - -[strDublinCoreMetadata] - - - - -[strPlainTitle] - - - - - - -[strHeaderCode] - - - - - - - - - - - - -[inclNavButtons] -[strTopNavBar] -[/inclNavButtons] - - - -
-

[strExerciseTitle]

-[inclExerciseSubtitle] -

[strExerciseSubtitle]

-[/inclExerciseSubtitle] -[inclTimer] -
  
-[/inclTimer] - -
- -
-

[strInstructions]

-
- -[inclReading] -
- -
- -
-[strReadingText] -
-
- -
- - -
-[/inclReading] - -
- - - -
- -
- - -[strMatchDivItems] - -
-
-
- - - -
- -[inclReading] -
-[/inclReading] - - - - - -[inclNavButtons] -[strBottomNavBar] -[/inclNavButtons] - - - - - - - - - - + + + + +[strDublinCoreMetadata] + + + + +[strPlainTitle] + + + + + + +[strHeaderCode] + + + + + + + + + + + + +[inclNavButtons] +[strTopNavBar] +[/inclNavButtons] + + + +
+

[strExerciseTitle]

+[inclExerciseSubtitle] +

[strExerciseSubtitle]

+[/inclExerciseSubtitle] +[inclTimer] +
  
+[/inclTimer] + +
+ +
+

[strInstructions]

+
+ +[inclReading] +
+ +
+ +
+[strReadingText] +
+
+ +
+ + +
+[/inclReading] + +
+ + + +
+ +
+ + +[strMatchDivItems] + +
+
+
+ + + +
+ +[inclReading] +
+[/inclReading] + + + + + +[inclNavButtons] +[strBottomNavBar] +[/inclNavButtons] + + + + + + + + + + diff --git a/mod/hotpot/template/v6/jmatch6.js_ b/mod/hotpot/template/v6/jmatch6.js_ index 5c905638231..a1153f4320f 100644 --- a/mod/hotpot/template/v6/jmatch6.js_ +++ b/mod/hotpot/template/v6/jmatch6.js_ @@ -1,252 +1,252 @@ - -var CorrectIndicator = '[strCorrectIndicator]'; -var IncorrectIndicator = '[strIncorrectIndicator]'; -var YourScoreIs = '[strYourScoreIs]'; -var CorrectResponse = '[strGuessCorrect]'; -var IncorrectResponse = '[strGuessIncorrect]'; -var TotalUnfixedLeftItems = 0; -var TotCorrectChoices = 0; -var Penalties = 0; -var Finished = false; -var TimeOver = false; - -var Score = 0; -var Locked = false; -var ShuffleQs = [boolShuffleQs]; -var QsToShow = [QsToShow]; - - -function StartUp(){ - RemoveBottomNavBarForIE(); - -[inclSendResults] - GetUserName(); -[/inclSendResults] - -[inclPreloadImages] - PreloadImages([PreloadImageList]); -[/inclPreloadImages] - - SetUpItems(ShuffleQs,QsToShow); - - TotalUnfixedLeftItems = document.getElementById('MatchDiv').getElementsByTagName('select').length; - -//Create arrays - CreateStatusArrays(); - -[inclTimer] - StartTimer(); -[/inclTimer] -} - -Status = new Array(); - - -function CreateStatusArrays(){ - var Selects = document.getElementById('Questions').getElementsByTagName('select'); - for (var x=0; x 0){ - var Select = Container.getElementsByTagName('select')[0]; - if (Select != null){ - Result = parseInt(Select.id.substring(1, Select.id.length)); - } - } - return Result; -} - -function GetKeyFromSelect(Select){ - var Result = -1; - if (Select != null){ - Result = parseInt(Select.id.substring(1, Select.id.length)); - } - return Result; -} - -var OriginalKeys = new Array(); -var ReducedKeys = new Array(); - -function GetUniqueKeys(Container, TargetArray){ - TargetArray.length = 0; - var x = -1; - var SList = Container.getElementsByTagName('select'); - if (SList.length > 0){ - for (var i=0; i 0){ - QList.push(Qs.removeChild(Qs.getElementsByTagName('tr')[0])); - } - - var Reducing = (QList.length > ReduceTo); - -//If required, select random rows to delete - if (Reducing == true){ - var DumpItem = 0; - while (ReduceTo < QList.length){ - -//Get a number to delete from the array - DumpItem = Math.floor(QList.length*Math.random()); - for (i=DumpItem; i<(QList.length-1); i++){ - QList[i] = QList[i+1]; - } - QList.length = QList.length-1; - } - } -//Shuffle the rows if necessary - if (ShuffleQs == true){ - QList = Shuffle(QList); - } - - TotalUnfixedLeftItems = QList.length; - -//Write the rows back to the table body - for (i=0; i=0; j--){ - if (OptionRequired(Options[j].value) == false){ - Selects[i].removeChild(Options[j]); - } - } - } - } -} - -function OptionRequired(Key){ - if (ReducedKeys.indexOf(Key) > -1){ - return true; - } - else{ - if (OriginalKeys.indexOf(Key) > -1){ - return false; - } - else{ - return true; - } - } -} - -function CheckAnswers(){ - if (Locked == true){return;} - var Select = null; - var Key = -1; - var Parent = null; - var Answer = null; - var AnsText = ''; - var AllDone = true; - TotCorrectChoices = 0; - -//for each item not fixed or a distractor - for (var i=0; i' + YourScoreIs + Score + '%.'; - } - else{ - Feedback = IncorrectResponse + '
' + YourScoreIs + Score + '%.'; -//Penalty for incorrect check - Penalties++; - } - -//If the exercise is over, deal with that - if ((AllDone == true)||(TimeOver == true)){ -[inclSendResults] - setTimeout('SendResults(' + Score + ')', 50); -[/inclSendResults] -[inclTimer] - window.clearInterval(Interval); -[/inclTimer] - TimeOver = true; - Locked = true; - Finished = true; - setTimeout('Finish()', SubmissionTimeout); - WriteToInstructions(Feedback); - } - -//Show the feedback - ShowMessage(Feedback); -} - -[inclTimer] -function TimesUp() { - document.getElementById('Timer').innerHTML = '[strTimesUp]'; -[inclPreloadImages] - RefreshImages(); -[/inclPreloadImages] - TimeOver = true; - Finished = true; - CheckAnswers(); - Locked = true; -} -[/inclTimer] - + +var CorrectIndicator = '[strCorrectIndicator]'; +var IncorrectIndicator = '[strIncorrectIndicator]'; +var YourScoreIs = '[strYourScoreIs]'; +var CorrectResponse = '[strGuessCorrect]'; +var IncorrectResponse = '[strGuessIncorrect]'; +var TotalUnfixedLeftItems = 0; +var TotCorrectChoices = 0; +var Penalties = 0; +var Finished = false; +var TimeOver = false; + +var Score = 0; +var Locked = false; +var ShuffleQs = [boolShuffleQs]; +var QsToShow = [QsToShow]; + + +function StartUp(){ + RemoveBottomNavBarForIE(); + +[inclSendResults] + GetUserName(); +[/inclSendResults] + +[inclPreloadImages] + PreloadImages([PreloadImageList]); +[/inclPreloadImages] + + SetUpItems(ShuffleQs,QsToShow); + + TotalUnfixedLeftItems = document.getElementById('MatchDiv').getElementsByTagName('select').length; + +//Create arrays + CreateStatusArrays(); + +[inclTimer] + StartTimer(); +[/inclTimer] +} + +Status = new Array(); + + +function CreateStatusArrays(){ + var Selects = document.getElementById('Questions').getElementsByTagName('select'); + for (var x=0; x 0){ + var Select = Container.getElementsByTagName('select')[0]; + if (Select != null){ + Result = parseInt(Select.id.substring(1, Select.id.length)); + } + } + return Result; +} + +function GetKeyFromSelect(Select){ + var Result = -1; + if (Select != null){ + Result = parseInt(Select.id.substring(1, Select.id.length)); + } + return Result; +} + +var OriginalKeys = new Array(); +var ReducedKeys = new Array(); + +function GetUniqueKeys(Container, TargetArray){ + TargetArray.length = 0; + var x = -1; + var SList = Container.getElementsByTagName('select'); + if (SList.length > 0){ + for (var i=0; i 0){ + QList.push(Qs.removeChild(Qs.getElementsByTagName('tr')[0])); + } + + var Reducing = (QList.length > ReduceTo); + +//If required, select random rows to delete + if (Reducing == true){ + var DumpItem = 0; + while (ReduceTo < QList.length){ + +//Get a number to delete from the array + DumpItem = Math.floor(QList.length*Math.random()); + for (i=DumpItem; i<(QList.length-1); i++){ + QList[i] = QList[i+1]; + } + QList.length = QList.length-1; + } + } +//Shuffle the rows if necessary + if (ShuffleQs == true){ + QList = Shuffle(QList); + } + + TotalUnfixedLeftItems = QList.length; + +//Write the rows back to the table body + for (i=0; i=0; j--){ + if (OptionRequired(Options[j].value) == false){ + Selects[i].removeChild(Options[j]); + } + } + } + } +} + +function OptionRequired(Key){ + if (ReducedKeys.indexOf(Key) > -1){ + return true; + } + else{ + if (OriginalKeys.indexOf(Key) > -1){ + return false; + } + else{ + return true; + } + } +} + +function CheckAnswers(){ + if (Locked == true){return;} + var Select = null; + var Key = -1; + var Parent = null; + var Answer = null; + var AnsText = ''; + var AllDone = true; + TotCorrectChoices = 0; + +//for each item not fixed or a distractor + for (var i=0; i' + YourScoreIs + Score + '%.'; + } + else{ + Feedback = IncorrectResponse + '
' + YourScoreIs + Score + '%.'; +//Penalty for incorrect check + Penalties++; + } + +//If the exercise is over, deal with that + if ((AllDone == true)||(TimeOver == true)){ +[inclSendResults] + setTimeout('SendResults(' + Score + ')', 50); +[/inclSendResults] +[inclTimer] + window.clearInterval(Interval); +[/inclTimer] + TimeOver = true; + Locked = true; + Finished = true; + setTimeout('Finish()', SubmissionTimeout); + WriteToInstructions(Feedback); + } + +//Show the feedback + ShowMessage(Feedback); +} + +[inclTimer] +function TimesUp() { + document.getElementById('Timer').innerHTML = '[strTimesUp]'; +[inclPreloadImages] + RefreshImages(); +[/inclPreloadImages] + TimeOver = true; + Finished = true; + CheckAnswers(); + Locked = true; +} +[/inclTimer] + diff --git a/mod/hotpot/template/v6/jmix6.ht_ b/mod/hotpot/template/v6/jmix6.ht_ index 2a991c60180..a25997b1850 100644 --- a/mod/hotpot/template/v6/jmix6.ht_ +++ b/mod/hotpot/template/v6/jmix6.ht_ @@ -1,151 +1,151 @@ - - - - -[strDublinCoreMetadata] - - - - -[strPlainTitle] - - - - - - -[strHeaderCode] - - - - - - - - - - - - -[inclNavButtons] -[strTopNavBar] -[/inclNavButtons] - - - -
-

[strExerciseTitle]

-[inclExerciseSubtitle] -

[strExerciseSubtitle]

-[/inclExerciseSubtitle] -[inclTimer] -
  
-[/inclTimer] - -
- -
-

[strInstructions]

-
- -[inclReading] -
- -
- -
-[strReadingText] -
-
- -
- - -
-[/inclReading] - -
- -
- -
- - - -[inclUndo] - -[/inclUndo] - -[inclRestart] - -[/inclRestart] - -[inclHint] - -[/inclHint] - -
- -
- -
- -[inclReading] -
-[/inclReading] - - - - - -[inclNavButtons] -[strBottomNavBar] -[/inclNavButtons] - - - - - - - - - - + + + + +[strDublinCoreMetadata] + + + + +[strPlainTitle] + + + + + + +[strHeaderCode] + + + + + + + + + + + + +[inclNavButtons] +[strTopNavBar] +[/inclNavButtons] + + + +
+

[strExerciseTitle]

+[inclExerciseSubtitle] +

[strExerciseSubtitle]

+[/inclExerciseSubtitle] +[inclTimer] +
  
+[/inclTimer] + +
+ +
+

[strInstructions]

+
+ +[inclReading] +
+ +
+ +
+[strReadingText] +
+
+ +
+ + +
+[/inclReading] + +
+ +
+ +
+ + + +[inclUndo] + +[/inclUndo] + +[inclRestart] + +[/inclRestart] + +[inclHint] + +[/inclHint] + +
+ +
+ +
+ +[inclReading] +
+[/inclReading] + + + + + +[inclNavButtons] +[strBottomNavBar] +[/inclNavButtons] + + + + + + + + + + diff --git a/mod/hotpot/template/v6/jmix6.js_ b/mod/hotpot/template/v6/jmix6.js_ index fcdf487f1ee..18d1fe0de96 100644 --- a/mod/hotpot/template/v6/jmix6.js_ +++ b/mod/hotpot/template/v6/jmix6.js_ @@ -1,357 +1,357 @@ -//JMIX STANDARD OUTPUT FORMAT CODE - - -var CorrectResponse = '[strGuessCorrect]'; -var IncorrectResponse = '[strGuessIncorrect]'; -var TheseAnswersToo = '[strTheseAnswersToo]'; -var ThisMuchCorrect = '[strThisMuch]'; -var NextCorrect = '[strNextCorrect]'; -var YourScoreIs = '[strYourScoreIs]'; -var CapitalizeFirst = [boolCapitalizeFirst]; -var Penalties = 0; -var Finished = false; -var TimeOver = false; -var Score = 0; -var strInstructions = ''; - - -var SegmentTemplate = '   [CurrentSegment]   '; - -var Exercise = ''; - -var Punctuation = '[strPunctuation]'; - -var Openers = '[strOpenPunctuation]'; - -var Guesses = new Array(); -var Remaining = new Array(); -var CorrectParts = new Array(); - -var ClosestMatch = 0; - -var LowerString=''; -var UpperString=''; - -var Output = ''; - -var Segments = new Array(); -[SegmentArray] - -var GuessSequence = new Array(); - -var Answers = new Array(); -[AnswerArray] - -function WriteToGuess(Feedback) { - document.getElementById('GuessDiv').innerHTML = Feedback; -[inclPreloadImages] - RefreshImages(); -[/inclPreloadImages] -} - -function Undo(){ - if (GuessSequence.length < 1){ - return; - } - GuessSequence.length = GuessSequence.length - 1; - BuildCurrGuess(); - BuildExercise(); - DisplayExercise(Exercise); -//Following line modified for 6.0.4.44 -- "remaining words" message removed, no longer needed - WriteToGuess('' + Output + ''); -} - -function AddSegment(SegNum){ -[inclTimer] - if (TimeOver == true){return;} -[/inclTimer] - GuessSequence[GuessSequence.length] = SegNum; - BuildCurrGuess(); - WriteToGuess('' + Output + ''); - BuildExercise(); - DisplayExercise(Exercise); -} - -function BuildCurrGuess(){ - - var i = 0; - var j = 0; - var NewSeg = ''; - -//first, create arrays of all the segments guessed so far and those not yet used - GuessSegs = new Array(); - GuessSegs.length = 0; - -//set the "used" markers all to 0 - for (i=0; i 0){ - OutString = OutArray[0]; - } - else{ - OutString = ''; - } - var Spacer = ''; - - for (i=1; i -1)||(Punctuation.indexOf(OutArray[i].charAt(0)) > -1)){ - Spacer = ''; - } - OutString = OutString + Spacer + OutArray[i]; - } - -//Capitalize the first letter if necessary - if (CapitalizeFirst == true){ - i = 0; - if ((Openers.indexOf(OutString.charAt(i))>-1)||(OutString.charAt(i) == ' ')){ - i++; - } - if ((Openers.indexOf(OutString.charAt(i))>-1)||(OutString.charAt(i) == ' ')){ - i++; - } - var Temp = OutString.charAt(i); - Temp = Temp.toUpperCase(); - OutString = OutString.substring(0, i) + Temp + OutString.substring(i+1, OutString.length); - } - return OutString; -} -function CheckAnswer(CheckType){ - - if (GuessSequence.length < 1){ - if (CheckType == 1){ - ShowMessage(NextCorrect + '
' + FindSegment(Answers[0][0]) + ''); - Penalties++; - } - return; - } - - var i = 0; - var j = 0; - var k = 0; - var WellDone = ''; - var WhichCorrect = -1; - var TryAgain = ''; - var LongestCorrectBit = ''; - TempCorrect = new Array(); - LongestCorrect = new Array(); - var TempHint = ''; - var HintToReturn = 1; - var OtherAnswers = ''; - var AllDone = false; - - for (i=0; i LongestCorrect.length){ - LongestCorrect.length = 0; - for (k=0; k -1){ - AllDone = true; - for (i=0; i

' + CorrectResponse + '
'; - -//Do score calculation here - Score = Math.floor(((Segments.length-Penalties) * 100)/Segments.length); - WellDone += YourScoreIs + ' ' + Score + '%.
'; - -[inclAlsoCorrect] - if (OtherAnswers.length > 0){ - WellDone += TheseAnswersToo + '' + OtherAnswers + ''; - } -[/inclAlsoCorrect] - - WriteToGuess(WellDone); - ShowMessage(WellDone); - } - - else{ - TryAgain = '' + CompileString(GuessSequence) + '

'; - if (CheckType == 0){ - TryAgain += IncorrectResponse + '
'; - } - - if (LongestCorrect.length > 0){ - - LongestCorrectBit = CompileString(LongestCorrect); - GuessSequence.length = LongestCorrect.length; - TryAgain += ThisMuchCorrect + '
' + LongestCorrectBit + '
'; - -//These lines added for 6.0.3.44 - WriteToGuess('' + LongestCorrectBit + ''); - } - else{ - GuessSequence.length = 0; - WriteToGuess(''); - } - - if (CheckType == 1){ - TryAgain += NextCorrect + '
' + FindSegment(HintToReturn) + ''; - } - - BuildCurrGuess(); - BuildExercise(); - DisplayExercise(Exercise); - ShowMessage(TryAgain); - Penalties++; //Penalty for inaccurate check - -[inclTimer] - if (TimeOver == true){ - Score = Math.floor(((LongestCorrect.length-Penalties) * 100)/Segments.length); - if (Score < 0){Score = 0;} - ShowMessage(YourScoreIs + ' ' + Score + '%.
'); - } -[/inclTimer] - - } -//If the exercise is over, deal with that - if ((AllDone == true)||(TimeOver == true)){ -[inclSendResults] - setTimeout('SendResults(' + Score + ')', 50); -[/inclSendResults] -[inclTimer] - window.clearInterval(Interval); -[/inclTimer] - TimeOver = true; - Locked = true; - Finished = true; - setTimeout('Finish()', SubmissionTimeout); - WriteToInstructions(YourScoreIs + ' ' + Score + '%.'); - } -} - -function FindSegment(SegID){ - var Seg = ''; - for (var i=0; i' + Output + ''); +} + +function AddSegment(SegNum){ +[inclTimer] + if (TimeOver == true){return;} +[/inclTimer] + GuessSequence[GuessSequence.length] = SegNum; + BuildCurrGuess(); + WriteToGuess('' + Output + ''); + BuildExercise(); + DisplayExercise(Exercise); +} + +function BuildCurrGuess(){ + + var i = 0; + var j = 0; + var NewSeg = ''; + +//first, create arrays of all the segments guessed so far and those not yet used + GuessSegs = new Array(); + GuessSegs.length = 0; + +//set the "used" markers all to 0 + for (i=0; i 0){ + OutString = OutArray[0]; + } + else{ + OutString = ''; + } + var Spacer = ''; + + for (i=1; i -1)||(Punctuation.indexOf(OutArray[i].charAt(0)) > -1)){ + Spacer = ''; + } + OutString = OutString + Spacer + OutArray[i]; + } + +//Capitalize the first letter if necessary + if (CapitalizeFirst == true){ + i = 0; + if ((Openers.indexOf(OutString.charAt(i))>-1)||(OutString.charAt(i) == ' ')){ + i++; + } + if ((Openers.indexOf(OutString.charAt(i))>-1)||(OutString.charAt(i) == ' ')){ + i++; + } + var Temp = OutString.charAt(i); + Temp = Temp.toUpperCase(); + OutString = OutString.substring(0, i) + Temp + OutString.substring(i+1, OutString.length); + } + return OutString; +} +function CheckAnswer(CheckType){ + + if (GuessSequence.length < 1){ + if (CheckType == 1){ + ShowMessage(NextCorrect + '
' + FindSegment(Answers[0][0]) + ''); + Penalties++; + } + return; + } + + var i = 0; + var j = 0; + var k = 0; + var WellDone = ''; + var WhichCorrect = -1; + var TryAgain = ''; + var LongestCorrectBit = ''; + TempCorrect = new Array(); + LongestCorrect = new Array(); + var TempHint = ''; + var HintToReturn = 1; + var OtherAnswers = ''; + var AllDone = false; + + for (i=0; i LongestCorrect.length){ + LongestCorrect.length = 0; + for (k=0; k -1){ + AllDone = true; + for (i=0; i

' + CorrectResponse + '
'; + +//Do score calculation here + Score = Math.floor(((Segments.length-Penalties) * 100)/Segments.length); + WellDone += YourScoreIs + ' ' + Score + '%.
'; + +[inclAlsoCorrect] + if (OtherAnswers.length > 0){ + WellDone += TheseAnswersToo + '' + OtherAnswers + ''; + } +[/inclAlsoCorrect] + + WriteToGuess(WellDone); + ShowMessage(WellDone); + } + + else{ + TryAgain = '' + CompileString(GuessSequence) + '

'; + if (CheckType == 0){ + TryAgain += IncorrectResponse + '
'; + } + + if (LongestCorrect.length > 0){ + + LongestCorrectBit = CompileString(LongestCorrect); + GuessSequence.length = LongestCorrect.length; + TryAgain += ThisMuchCorrect + '
' + LongestCorrectBit + '
'; + +//These lines added for 6.0.3.44 + WriteToGuess('' + LongestCorrectBit + ''); + } + else{ + GuessSequence.length = 0; + WriteToGuess(''); + } + + if (CheckType == 1){ + TryAgain += NextCorrect + '
' + FindSegment(HintToReturn) + ''; + } + + BuildCurrGuess(); + BuildExercise(); + DisplayExercise(Exercise); + ShowMessage(TryAgain); + Penalties++; //Penalty for inaccurate check + +[inclTimer] + if (TimeOver == true){ + Score = Math.floor(((LongestCorrect.length-Penalties) * 100)/Segments.length); + if (Score < 0){Score = 0;} + ShowMessage(YourScoreIs + ' ' + Score + '%.
'); + } +[/inclTimer] + + } +//If the exercise is over, deal with that + if ((AllDone == true)||(TimeOver == true)){ +[inclSendResults] + setTimeout('SendResults(' + Score + ')', 50); +[/inclSendResults] +[inclTimer] + window.clearInterval(Interval); +[/inclTimer] + TimeOver = true; + Locked = true; + Finished = true; + setTimeout('Finish()', SubmissionTimeout); + WriteToInstructions(YourScoreIs + ' ' + Score + '%.'); + } +} + +function FindSegment(SegID){ + var Seg = ''; + for (var i=0; i - - - -[strDublinCoreMetadata] - - - - -[strPlainTitle] - - - - - - -[strHeaderCode] - - - - - - - - - - - - -[inclNavButtons] -[strTopNavBar] -[/inclNavButtons] - - - -
-

[strExerciseTitle]

-[inclExerciseSubtitle] -

[strExerciseSubtitle]

-[/inclExerciseSubtitle] -[inclTimer] -
  
-[/inclTimer] - -
- -
-

[strInstructions]

-
- -[inclReading] -
- -
- -
-[strReadingText] -
-
- -
- - -
-[/inclReading] - - -
- -
- -

- -

- -
- - -  - - -
-
- -
- -[strQuestionOutput] - -[inclKeypad] -
-[strKeypad] -
-[/inclKeypad] - -
- -[inclReading] -
-[/inclReading] - - - - - -[inclNavButtons] -[strBottomNavBar] -[/inclNavButtons] - - - - - - - - - - + + + + +[strDublinCoreMetadata] + + + + +[strPlainTitle] + + + + + + +[strHeaderCode] + + + + + + + + + + + + +[inclNavButtons] +[strTopNavBar] +[/inclNavButtons] + + + +
+

[strExerciseTitle]

+[inclExerciseSubtitle] +

[strExerciseSubtitle]

+[/inclExerciseSubtitle] +[inclTimer] +
  
+[/inclTimer] + +
+ +
+

[strInstructions]

+
+ +[inclReading] +
+ +
+ +
+[strReadingText] +
+
+ +
+ + +
+[/inclReading] + + +
+ +
+ +

+ +

+ +
+ + +  + + +
+
+ +
+ +[strQuestionOutput] + +[inclKeypad] +
+[strKeypad] +
+[/inclKeypad] + +
+ +[inclReading] +
+[/inclReading] + + + + + +[inclNavButtons] +[strBottomNavBar] +[/inclNavButtons] + + + + + + + + + + diff --git a/mod/hotpot/template/v6/jquiz6.js_ b/mod/hotpot/template/v6/jquiz6.js_ index 445bbb52aa5..92f331bf84e 100644 --- a/mod/hotpot/template/v6/jquiz6.js_ +++ b/mod/hotpot/template/v6/jquiz6.js_ @@ -1,607 +1,607 @@ - -//JQUIZ CORE JAVASCRIPT CODE - -var CurrQNum = 0; -var CorrectIndicator = '[strCorrectIndicator]'; -var IncorrectIndicator = '[strIncorrectIndicator]'; -var YourScoreIs = '[strYourScoreIs]'; -var ContinuousScoring = [boolContinuousScoring]; -var CorrectFirstTime = '[strCorrectFirstTime]'; -var ShowCorrectFirstTime = [boolShowCorrectFirstTime]; -var ShuffleQs = [boolShuffleQs]; -var ShuffleAs = [boolShuffleAs]; -var DefaultRight = '[strDefaultRight]'; -var DefaultWrong = '[strDefaultWrong]'; -var QsToShow = [QsToShow]; -var Score = 0; -var Finished = false; -var Qs = null; -var QArray = new Array(); -var ShowingAllQuestions = false; -var ShowAllQuestionsCaption = '[strShowAllQuestionsCaptionJS]'; -var ShowOneByOneCaption = '[strShowOneByOneCaptionJS]'; -var State = new Array(); -var Feedback = ''; -var TimeOver = false; -var strInstructions = ''; - -//The following variable can be used to add a message explaining that -//the question is finished, so no further marking will take place. -var strQuestionFinished = ''; - -function CompleteEmptyFeedback(){ - var QNum, ANum; - for (QNum=0; QNum 0){ - I[QNum][3][ANum][1] = DefaultRight; - } - else{ - I[QNum][3][ANum][1] = DefaultWrong; - } - } - } - } - } -} - -function SetUpQuestions(){ - var AList = new Array(); - var QList = new Array(); - var i, j; - Qs = document.getElementById('Questions'); - while (Qs.getElementsByTagName('li').length > 0){ - QList.push(Qs.removeChild(Qs.getElementsByTagName('li')[0])); - } - var DumpItem = 0; - if (QsToShow > QList.length){ - QsToShow = QList.length; - } - while (QsToShow < QList.length){ - DumpItem = Math.floor(QList.length*Math.random()); - for (j=DumpItem; j<(QList.length-1); j++){ - QList[j] = QList[j+1]; - } - QList.length = QList.length-1; - } - if (ShuffleQs == true){ - QList = Shuffle(QList); - } - if (ShuffleAs == true){ - var As; - for (var i=0; i 0){ - AList.push(As.removeChild(As.getElementsByTagName('li')[0])); - } - AList = Shuffle(AList); - for (j=0; j= QArray.length)){return;} - QArray[CurrQNum].style.display = 'none'; - CurrQNum += ChangeBy; - QArray[CurrQNum].style.display = ''; -//Undocumented function added 10/12/2004 - ShowSpecialReadingForQuestion(); - SetQNumReadout(); - SetFocusToTextbox(); -} - -var HiddenReadingShown = false; -function ShowSpecialReadingForQuestion(){ -//Undocumented function for showing specific reading text elements which change with each question -//Added on 10/12/2004 - if (document.getElementById('ReadingDiv') != null){ - if (HiddenReadingShown == true){ - document.getElementById('ReadingDiv').innerHTML = ''; - } - if (QArray[CurrQNum] != null){ - var Children = QArray[CurrQNum].childNodes; - for (var i=0; i= QArray.length){ - if (document.getElementById('NextQButton') != null){ - document.getElementById('NextQButton').style.visibility = 'hidden'; - } - } - else{ - if (document.getElementById('NextQButton') != null){ - document.getElementById('NextQButton').style.visibility = 'visible'; - } - } - if (CurrQNum <= 0){ - if (document.getElementById('PrevQButton') != null){ - document.getElementById('PrevQButton').style.visibility = 'hidden'; - } - } - else{ - if (document.getElementById('PrevQButton') != null){ - document.getElementById('PrevQButton').style.visibility = 'visible'; - } - } -} - -[strItemArray] - -function StartUp(){ - RemoveBottomNavBarForIE(); - -//If there's only one question, no need for question navigation controls - if (QsToShow < 2){ - document.getElementById('QNav').style.display = 'none'; - } - -//Stash the instructions so they can be redisplayed - strInstructions = document.getElementById('InstructionsDiv').innerHTML; - -[inclSendResults] - GetUserName(); -[/inclSendResults] - -[inclPreloadImages] - PreloadImages([PreloadImageList]); -[/inclPreloadImages] - - CompleteEmptyFeedback(); - - SetUpQuestions(); - ClearTextBoxes(); - CreateStatusArray(); - -[inclTimer] - setTimeout('StartTimer()', 50); -[/inclTimer] - -//Check search string for q parameter - if (document.location.search.length > 0){ - if (ShuffleQs == false){ - var JumpTo = parseInt(document.location.search.substring(1,document.location.search.length))-1; - if (JumpTo <= QsToShow){ - ChangeQ(JumpTo); - } - } - } -//Undocumented function added 10/12/2004 - ShowSpecialReadingForQuestion(); -} - -function ShowHideQuestions(){ - FuncBtnOut(document.getElementById('ShowMethodButton')); - document.getElementById('ShowMethodButton').style.display = 'none'; - if (ShowingAllQuestions == false){ - for (var i=0; i -1){ -//Add an extra message explaining that the question -// is finished if defined by the user - if (strQuestionFinished.length > 0){Feedback += '
' + strQuestionFinished;} -//Show the feedback - ShowMessage(Feedback); - return; - } - -//Hide the button while processing - Btn.style.display = 'none'; - -//Increment the number of tries - State[QNum][2]++; - -//Add the percent-correct value of this answer - State[QNum][3] += I[QNum][3][ANum][3]; - -//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) + ','; - -//Should this answer be accepted as correct? - if (I[QNum][3][ANum][2] < 1){ -//It's wrong - -//Mark the answer - Btn.innerHTML = IncorrectIndicator; - -//Remove any previous score unless exercise is finished (6.0.3.8+) - if (Finished == false){ - WriteToInstructions(strInstructions); - } - -//Check whether this leaves just one MC answer unselected, in which case the Q is terminated - var RemainingAnswer = FinalAnswer(QNum); - if (RemainingAnswer > -1){ -//Behave as if the last answer had been selected, but give no credit for it -//Increment the number of tries - State[QNum][2]++; - -//Calculate the score for this question - CalculateMCQuestionScore(QNum); - -//Get the overall score and add it to the feedback - CalculateOverallScore(); - if ((ContinuousScoring == true)||(Finished == true)){ - Feedback += '
' + YourScoreIs + ' ' + Score + '%.'; - WriteToInstructions(YourScoreIs + ' ' + Score + '%.'); - } - } - } - else{ -//It's right -//Mark the answer - Btn.innerHTML = CorrectIndicator; - -//Calculate the score for this question - CalculateMCQuestionScore(QNum); - -//Get the overall score and add it to the feedback - if (ContinuousScoring == true){ - CalculateOverallScore(); - if ((ContinuousScoring == true)||(Finished == true)){ - Feedback += '
' + YourScoreIs + ' ' + Score + '%.'; - WriteToInstructions(YourScoreIs + ' ' + Score + '%.'); - } - } - } - -//Show the button again - Btn.style.display = 'inline'; - -//Finally, show the feedback - ShowMessage(Feedback); - -//Check whether all questions are now done - CheckFinished(); -} - -function CalculateMCQuestionScore(QNum){ - var Tries = State[QNum][2] + State[QNum][4]; //include tries and hint penalties - var PercentCorrect = State[QNum][3]; - var TotAns = GetTotalMCAnswers(QNum); - var HintPenalties = State[QNum][4]; - -//Make sure it's not already complete - - if (State[QNum][0] < 0){ -//Allow for Hybrids - if (HintPenalties >= 1){ - State[QNum][0] = 0; - } - else{ -//This line calculates the score for this question - if (TotAns == 1){ - State[QNum][0] = 1; - } - else{ - State[QNum][0] = ((TotAns-((Tries*100)/State[QNum][3]))/(TotAns-1)); - } - } -//Fix for Safari bug added for version 6.0.3.42 (negative infinity problem) - if ((State[QNum][0] < 0)||(State[QNum][0] == Number.NEGATIVE_INFINITY)){ - State[QNum][0] = 0; - } - } -} - -function GetTotalMCAnswers(QNum){ - var Result = 0; - for (var ANum=0; ANum' + Feedback; - if (Matches == I[QNum][3].length){ -//It's right - CalculateMultiSelQuestionScore(QNum); - if (ContinuousScoring == true){ - CalculateOverallScore(); - if ((ContinuousScoring == true)||(Finished == true)){ - Feedback += '
' + YourScoreIs + ' ' + Score + '%.'; - WriteToInstructions(YourScoreIs + ' ' + Score + '%.'); - } - } - } - else{ -//It's wrong -- Remove any previous score unless exercise is finished (6.0.3.8+) - if (Finished == false){ - WriteToInstructions(strInstructions); - } - } - -//Show the feedback - ShowMessage(Feedback); - -//Check whether all questions are now done - CheckFinished(); -} - -function CalculateMultiSelQuestionScore(QNum){ - var Tries = State[QNum][2]; - var TotAns = State[QNum][1].length; - -//Make sure it's not already complete - if (State[QNum][0] < 0){ - State[QNum][0] = (TotAns - (Tries-1)) / TotAns; - if (State[QNum][0] < 0){ - State[QNum][0] = 0; - } - } -} - -[/inclMultiSelect] - -function CalculateOverallScore(){ - var TotalWeighting = 0; - var TotalScore = 0; - - for (var QNum=0; QNum -1){ - TotalWeighting += I[QNum][0]; - TotalScore += (I[QNum][0] * State[QNum][0]); - } - } - } - if (TotalWeighting > 0){ - Score = Math.floor((TotalScore/TotalWeighting)*100); - } - else{ -//if TotalWeighting is 0, no questions so far have any value, so -//no penalty should be shown. - Score = 100; - } -} - -function CheckFinished(){ - var FB = ''; - var AllDone = true; - for (var QNum=0; QNum= 1){ - CFT++; - } - } - } - FB += '
' + CorrectFirstTime + ' ' + CFT + '/' + QsToShow; - } - WriteToInstructions(FB); - - Finished == true; -[inclTimer] - window.clearInterval(Interval); -[/inclTimer] - TimeOver = true; - Locked = true; - -[inclSendResults] - setTimeout('SendResults(' + Score + ')', 50); -[/inclSendResults] - - Finished = true; - Detail = ''; - for (QNum=0; QNum 0){ - Detail += 'Question #' + (QNum+1) + 'question-trackingQ ' + (QNum+1) + 'QuestionTrackingField' + State[QNum][5] + ''; - } - } - } - Detail += ''; - setTimeout('Finish()', SubmissionTimeout); - } -} - -[inclTimer] -function TimesUp(){ - document.getElementById('Timer').innerHTML = '[strTimesUp]'; -[inclPreloadImages] - RefreshImages(); -[/inclPreloadImages] - TimeOver = true; - Finished = true; - ShowMessage('[strTimesUp]'); - -//Set all remaining scores to 0 - for (var QNum=0; QNum 0){ + I[QNum][3][ANum][1] = DefaultRight; + } + else{ + I[QNum][3][ANum][1] = DefaultWrong; + } + } + } + } + } +} + +function SetUpQuestions(){ + var AList = new Array(); + var QList = new Array(); + var i, j; + Qs = document.getElementById('Questions'); + while (Qs.getElementsByTagName('li').length > 0){ + QList.push(Qs.removeChild(Qs.getElementsByTagName('li')[0])); + } + var DumpItem = 0; + if (QsToShow > QList.length){ + QsToShow = QList.length; + } + while (QsToShow < QList.length){ + DumpItem = Math.floor(QList.length*Math.random()); + for (j=DumpItem; j<(QList.length-1); j++){ + QList[j] = QList[j+1]; + } + QList.length = QList.length-1; + } + if (ShuffleQs == true){ + QList = Shuffle(QList); + } + if (ShuffleAs == true){ + var As; + for (var i=0; i 0){ + AList.push(As.removeChild(As.getElementsByTagName('li')[0])); + } + AList = Shuffle(AList); + for (j=0; j= QArray.length)){return;} + QArray[CurrQNum].style.display = 'none'; + CurrQNum += ChangeBy; + QArray[CurrQNum].style.display = ''; +//Undocumented function added 10/12/2004 + ShowSpecialReadingForQuestion(); + SetQNumReadout(); + SetFocusToTextbox(); +} + +var HiddenReadingShown = false; +function ShowSpecialReadingForQuestion(){ +//Undocumented function for showing specific reading text elements which change with each question +//Added on 10/12/2004 + if (document.getElementById('ReadingDiv') != null){ + if (HiddenReadingShown == true){ + document.getElementById('ReadingDiv').innerHTML = ''; + } + if (QArray[CurrQNum] != null){ + var Children = QArray[CurrQNum].childNodes; + for (var i=0; i= QArray.length){ + if (document.getElementById('NextQButton') != null){ + document.getElementById('NextQButton').style.visibility = 'hidden'; + } + } + else{ + if (document.getElementById('NextQButton') != null){ + document.getElementById('NextQButton').style.visibility = 'visible'; + } + } + if (CurrQNum <= 0){ + if (document.getElementById('PrevQButton') != null){ + document.getElementById('PrevQButton').style.visibility = 'hidden'; + } + } + else{ + if (document.getElementById('PrevQButton') != null){ + document.getElementById('PrevQButton').style.visibility = 'visible'; + } + } +} + +[strItemArray] + +function StartUp(){ + RemoveBottomNavBarForIE(); + +//If there's only one question, no need for question navigation controls + if (QsToShow < 2){ + document.getElementById('QNav').style.display = 'none'; + } + +//Stash the instructions so they can be redisplayed + strInstructions = document.getElementById('InstructionsDiv').innerHTML; + +[inclSendResults] + GetUserName(); +[/inclSendResults] + +[inclPreloadImages] + PreloadImages([PreloadImageList]); +[/inclPreloadImages] + + CompleteEmptyFeedback(); + + SetUpQuestions(); + ClearTextBoxes(); + CreateStatusArray(); + +[inclTimer] + setTimeout('StartTimer()', 50); +[/inclTimer] + +//Check search string for q parameter + if (document.location.search.length > 0){ + if (ShuffleQs == false){ + var JumpTo = parseInt(document.location.search.substring(1,document.location.search.length))-1; + if (JumpTo <= QsToShow){ + ChangeQ(JumpTo); + } + } + } +//Undocumented function added 10/12/2004 + ShowSpecialReadingForQuestion(); +} + +function ShowHideQuestions(){ + FuncBtnOut(document.getElementById('ShowMethodButton')); + document.getElementById('ShowMethodButton').style.display = 'none'; + if (ShowingAllQuestions == false){ + for (var i=0; i -1){ +//Add an extra message explaining that the question +// is finished if defined by the user + if (strQuestionFinished.length > 0){Feedback += '
' + strQuestionFinished;} +//Show the feedback + ShowMessage(Feedback); + return; + } + +//Hide the button while processing + Btn.style.display = 'none'; + +//Increment the number of tries + State[QNum][2]++; + +//Add the percent-correct value of this answer + State[QNum][3] += I[QNum][3][ANum][3]; + +//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) + ','; + +//Should this answer be accepted as correct? + if (I[QNum][3][ANum][2] < 1){ +//It's wrong + +//Mark the answer + Btn.innerHTML = IncorrectIndicator; + +//Remove any previous score unless exercise is finished (6.0.3.8+) + if (Finished == false){ + WriteToInstructions(strInstructions); + } + +//Check whether this leaves just one MC answer unselected, in which case the Q is terminated + var RemainingAnswer = FinalAnswer(QNum); + if (RemainingAnswer > -1){ +//Behave as if the last answer had been selected, but give no credit for it +//Increment the number of tries + State[QNum][2]++; + +//Calculate the score for this question + CalculateMCQuestionScore(QNum); + +//Get the overall score and add it to the feedback + CalculateOverallScore(); + if ((ContinuousScoring == true)||(Finished == true)){ + Feedback += '
' + YourScoreIs + ' ' + Score + '%.'; + WriteToInstructions(YourScoreIs + ' ' + Score + '%.'); + } + } + } + else{ +//It's right +//Mark the answer + Btn.innerHTML = CorrectIndicator; + +//Calculate the score for this question + CalculateMCQuestionScore(QNum); + +//Get the overall score and add it to the feedback + if (ContinuousScoring == true){ + CalculateOverallScore(); + if ((ContinuousScoring == true)||(Finished == true)){ + Feedback += '
' + YourScoreIs + ' ' + Score + '%.'; + WriteToInstructions(YourScoreIs + ' ' + Score + '%.'); + } + } + } + +//Show the button again + Btn.style.display = 'inline'; + +//Finally, show the feedback + ShowMessage(Feedback); + +//Check whether all questions are now done + CheckFinished(); +} + +function CalculateMCQuestionScore(QNum){ + var Tries = State[QNum][2] + State[QNum][4]; //include tries and hint penalties + var PercentCorrect = State[QNum][3]; + var TotAns = GetTotalMCAnswers(QNum); + var HintPenalties = State[QNum][4]; + +//Make sure it's not already complete + + if (State[QNum][0] < 0){ +//Allow for Hybrids + if (HintPenalties >= 1){ + State[QNum][0] = 0; + } + else{ +//This line calculates the score for this question + if (TotAns == 1){ + State[QNum][0] = 1; + } + else{ + State[QNum][0] = ((TotAns-((Tries*100)/State[QNum][3]))/(TotAns-1)); + } + } +//Fix for Safari bug added for version 6.0.3.42 (negative infinity problem) + if ((State[QNum][0] < 0)||(State[QNum][0] == Number.NEGATIVE_INFINITY)){ + State[QNum][0] = 0; + } + } +} + +function GetTotalMCAnswers(QNum){ + var Result = 0; + for (var ANum=0; ANum' + Feedback; + if (Matches == I[QNum][3].length){ +//It's right + CalculateMultiSelQuestionScore(QNum); + if (ContinuousScoring == true){ + CalculateOverallScore(); + if ((ContinuousScoring == true)||(Finished == true)){ + Feedback += '
' + YourScoreIs + ' ' + Score + '%.'; + WriteToInstructions(YourScoreIs + ' ' + Score + '%.'); + } + } + } + else{ +//It's wrong -- Remove any previous score unless exercise is finished (6.0.3.8+) + if (Finished == false){ + WriteToInstructions(strInstructions); + } + } + +//Show the feedback + ShowMessage(Feedback); + +//Check whether all questions are now done + CheckFinished(); +} + +function CalculateMultiSelQuestionScore(QNum){ + var Tries = State[QNum][2]; + var TotAns = State[QNum][1].length; + +//Make sure it's not already complete + if (State[QNum][0] < 0){ + State[QNum][0] = (TotAns - (Tries-1)) / TotAns; + if (State[QNum][0] < 0){ + State[QNum][0] = 0; + } + } +} + +[/inclMultiSelect] + +function CalculateOverallScore(){ + var TotalWeighting = 0; + var TotalScore = 0; + + for (var QNum=0; QNum -1){ + TotalWeighting += I[QNum][0]; + TotalScore += (I[QNum][0] * State[QNum][0]); + } + } + } + if (TotalWeighting > 0){ + Score = Math.floor((TotalScore/TotalWeighting)*100); + } + else{ +//if TotalWeighting is 0, no questions so far have any value, so +//no penalty should be shown. + Score = 100; + } +} + +function CheckFinished(){ + var FB = ''; + var AllDone = true; + for (var QNum=0; QNum= 1){ + CFT++; + } + } + } + FB += '
' + CorrectFirstTime + ' ' + CFT + '/' + QsToShow; + } + WriteToInstructions(FB); + + Finished == true; +[inclTimer] + window.clearInterval(Interval); +[/inclTimer] + TimeOver = true; + Locked = true; + +[inclSendResults] + setTimeout('SendResults(' + Score + ')', 50); +[/inclSendResults] + + Finished = true; + Detail = ''; + for (QNum=0; QNum 0){ + Detail += 'Question #' + (QNum+1) + 'question-trackingQ ' + (QNum+1) + 'QuestionTrackingField' + State[QNum][5] + ''; + } + } + } + Detail += ''; + setTimeout('Finish()', SubmissionTimeout); + } +} + +[inclTimer] +function TimesUp(){ + document.getElementById('Timer').innerHTML = '[strTimesUp]'; +[inclPreloadImages] + RefreshImages(); +[/inclPreloadImages] + TimeOver = true; + Finished = true; + ShowMessage('[strTimesUp]'); + +//Set all remaining scores to 0 + for (var QNum=0; QNum - - - - - - -[strPlainIndexTitle] - - - - - - - - -
-

[strIndexTitle]

-
- -
-
- -
-
- + + + + + + + +[strPlainIndexTitle] + + + + + + + + +
+

[strIndexTitle]

+
+ +
+
+ +
+
+ \ No newline at end of file diff --git a/mod/hotpot/template/v6/mashernav.ht_ b/mod/hotpot/template/v6/mashernav.ht_ index 1fb4e0f1378..d439ca4fa47 100644 --- a/mod/hotpot/template/v6/mashernav.ht_ +++ b/mod/hotpot/template/v6/mashernav.ht_ @@ -1,29 +1,29 @@ - - - - - - - - - - - - -[strTopNavBar] - - - + + + + + + + + + + + + +[strTopNavBar] + + + \ No newline at end of file diff --git a/mod/hotpot/template/v6/testbrowsercheck.htm b/mod/hotpot/template/v6/testbrowsercheck.htm index 38efe840c52..3f8cb424af0 100644 --- a/mod/hotpot/template/v6/testbrowsercheck.htm +++ b/mod/hotpot/template/v6/testbrowsercheck.htm @@ -1,35 +1,35 @@ - - - - - - -Testing browser check code - - - - - - - - - - - - - -Go - - + + + + + + +Testing browser check code + + + + + + + + + + + + + +Go + + \ No newline at end of file