From f491786c47860d9e05a0b9a8a436691688df38d7 Mon Sep 17 00:00:00 2001 From: Svein-Tore Griff With Date: Mon, 13 Oct 2014 21:51:36 +0200 Subject: [PATCH 01/10] Added xAPI support --- js/questionset.js | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/js/questionset.js b/js/questionset.js index cd75192..d3a2be5 100644 --- a/js/questionset.js +++ b/js/questionset.js @@ -16,6 +16,7 @@ H5P.QuestionSet = function (options, contentId) { } var $ = H5P.jQuery; + var self = this; var texttemplate = '<% if (introPage.showIntroPage) { %>' + @@ -90,8 +91,7 @@ H5P.QuestionSet = function (options, contentId) { finishButtonText: 'Finish', solutionButtonText: 'Show solution', showAnimations: false - }, - postUserStatistics: (H5P.postUserStatistics === true) + } }; var template = new EJS({text: texttemplate}); @@ -109,8 +109,7 @@ H5P.QuestionSet = function (options, contentId) { // TODO: Render on init, inject in template. $.extend(question.params, { - displaySolutionsButton: false, - postUserStatistics: false + displaySolutionsButton: false }); questionInstances.push(H5P.newRunnable(question, contentId)); } @@ -153,7 +152,7 @@ H5P.QuestionSet = function (options, contentId) { // Trigger resize on question in case the size of the QS has changed. var instance = questionInstances[questionNumber]; if (instance.$ !== undefined) { - instance.$.trigger('resize'); + instance.triggerH5PEvent('resize'); } // Update progress indicator @@ -202,9 +201,7 @@ H5P.QuestionSet = function (options, contentId) { passed: success }; var displayResults = function () { - if (params.postUserStatistics === true) { - H5P.setFinished(contentId, getScore(), totalScore()); - } + self.triggerH5PxAPIEvent('completed', H5P.getxAPIScoredResult(getScore(), totalScore())); if (!params.endGame.showResultPage) { $(returnObject).trigger('h5pQuestionSetFinished', eventData); @@ -302,9 +299,11 @@ H5P.QuestionSet = function (options, contentId) { var question = questionInstances[i]; question.attach($('.question-container:eq(' + i + ')', $myDom)); - $(question).on('h5pQuestionAnswered', function () { - $('.progress-dot:eq(' + currentQuestion +')', $myDom).removeClass('unanswered').addClass('answered'); - _updateButtons(); + question.registerH5PEventListener('xAPI', function (event) { + if (event.verb === 'attempted') { + $('.progress-dot:eq(' + currentQuestion +')', $myDom).removeClass('unanswered').addClass('answered'); + _updateButtons(); + } }); if (question.getAnswerGiven()) { $('.progress-dot:eq(' + i +')' @@ -343,7 +342,7 @@ H5P.QuestionSet = function (options, contentId) { showSolutions(); } - this.$.trigger('resize'); + this.triggerH5PEvent('resize'); return this; }; From e2efc849c91e5d395547532546b35f9195cb7f70 Mon Sep 17 00:00:00 2001 From: falcon Date: Sun, 26 Oct 2014 22:14:26 +0100 Subject: [PATCH 02/10] Shorter function names --- js/questionset.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/js/questionset.js b/js/questionset.js index d3a2be5..053eaf8 100644 --- a/js/questionset.js +++ b/js/questionset.js @@ -152,7 +152,7 @@ H5P.QuestionSet = function (options, contentId) { // Trigger resize on question in case the size of the QS has changed. var instance = questionInstances[questionNumber]; if (instance.$ !== undefined) { - instance.triggerH5PEvent('resize'); + instance.trigger('resize'); } // Update progress indicator @@ -201,7 +201,7 @@ H5P.QuestionSet = function (options, contentId) { passed: success }; var displayResults = function () { - self.triggerH5PxAPIEvent('completed', H5P.getxAPIScoredResult(getScore(), totalScore())); + self.triggerXAPI('completed', {result: H5P.getxAPIScoredResult(getScore(), totalScore())}); if (!params.endGame.showResultPage) { $(returnObject).trigger('h5pQuestionSetFinished', eventData); @@ -342,7 +342,7 @@ H5P.QuestionSet = function (options, contentId) { showSolutions(); } - this.triggerH5PEvent('resize'); + this.trigger('resize'); return this; }; From 0165ebb695cba1add98f23da9eaa06cc517cde0e Mon Sep 17 00:00:00 2001 From: Frode Petterson Date: Wed, 3 Dec 2014 13:02:31 +0100 Subject: [PATCH 03/10] Added textual editor. --- library.json | 7 ++++++- semantics.json | 11 ++++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/library.json b/library.json index 397fadb..4b8cd4d 100644 --- a/library.json +++ b/library.json @@ -44,7 +44,12 @@ { "machineName": "H5PEditor.VerticalTabs", "majorVersion": 1, + "minorVersion": 1 + }, + { + "machineName": "H5PEditor.QuestionSetTextualEditor", + "majorVersion": 1, "minorVersion": 0 } ] -} \ No newline at end of file +} diff --git a/semantics.json b/semantics.json index 7e061cc..5027864 100644 --- a/semantics.json +++ b/semantics.json @@ -92,7 +92,16 @@ "name": "questions", "label": "Questions", "type": "list", - "widget": "verticalTabs", + "widgets": [ + { + "name": "VerticalTabs", + "label": "Default" + }, + { + "name": "QuestionSetTextualEditor", + "label": "Textual" + } + ], "min": 1, "entity": "question", "field": { From 5c158d235f6fef52f88a50e3e1f5385c00bfb544 Mon Sep 17 00:00:00 2001 From: Svein-Tore Griff With Date: Thu, 29 Jan 2015 13:13:07 +0100 Subject: [PATCH 04/10] Run in iframe since drag and drop needs iframe --- library.json | 3 +++ 1 file changed, 3 insertions(+) diff --git a/library.json b/library.json index 431253b..645e854 100644 --- a/library.json +++ b/library.json @@ -4,6 +4,9 @@ "majorVersion": 1, "minorVersion": 1, "patchVersion": 0, + "embedTypes": [ + "iframe" + ], "runnable": 1, "fullscreen": 0, "machineName": "H5P.QuestionSet", From 7c519e770d7eb5fb101f75fc7420e2988434a233 Mon Sep 17 00:00:00 2001 From: Svein-Tore Griff With Date: Wed, 4 Feb 2015 18:13:03 +0100 Subject: [PATCH 05/10] Update core version and minor version --- library.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/library.json b/library.json index 645e854..bf27392 100644 --- a/library.json +++ b/library.json @@ -2,7 +2,7 @@ "title": "Question set", "contentType": "question", "majorVersion": 1, - "minorVersion": 1, + "minorVersion": 2, "patchVersion": 0, "embedTypes": [ "iframe" @@ -13,7 +13,7 @@ "author": "Amendor AS", "coreApi": { "majorVersion": 1, - "minorVersion": 1 + "minorVersion": 4 }, "license": "cc-by-sa", "preloadedJs": [ From 9777d3964e9628c262234a8051617ddfd8ebef64 Mon Sep 17 00:00:00 2001 From: Svein-Tore Griff With Date: Wed, 4 Feb 2015 20:57:49 +0100 Subject: [PATCH 06/10] Correct author --- library.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library.json b/library.json index bf27392..57bd2b7 100644 --- a/library.json +++ b/library.json @@ -10,7 +10,7 @@ "runnable": 1, "fullscreen": 0, "machineName": "H5P.QuestionSet", - "author": "Amendor AS", + "author": "Joubel AS", "coreApi": { "majorVersion": 1, "minorVersion": 4 From aeee49e85ed5114eed4fbaee0a68e725819715be Mon Sep 17 00:00:00 2001 From: Svein-Tore Griff With Date: Thu, 12 Feb 2015 14:07:07 +0100 Subject: [PATCH 07/10] dependency version updates --- library.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/library.json b/library.json index 57bd2b7..5349f89 100644 --- a/library.json +++ b/library.json @@ -40,14 +40,14 @@ { "machineName": "H5P.Video", "majorVersion": 1, - "minorVersion": 0 + "minorVersion": 1 } ], "editorDependencies": [ { "machineName": "H5PEditor.VerticalTabs", "majorVersion": 1, - "minorVersion": 0 + "minorVersion": 1 } ] } From d6ecc1705a5962c46f76b44abf9a7ad1722ed2a5 Mon Sep 17 00:00:00 2001 From: Svein-Tore Griff With Date: Fri, 13 Feb 2015 10:37:59 +0100 Subject: [PATCH 08/10] xAPI update --- js/questionset.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/questionset.js b/js/questionset.js index 6050ae4..f93c871 100644 --- a/js/questionset.js +++ b/js/questionset.js @@ -355,7 +355,7 @@ H5P.QuestionSet = function (options, contentId) { question.attach($('.question-container:eq(' + i + ')', $myDom)); question.on('xAPI', function (event) { - if (event.verb === 'attempted') { + if (event.getVerb() === 'attempted') { $('.progress-dot:eq(' + currentQuestion +')', $myDom).removeClass('unanswered').addClass('answered'); _updateButtons(); } From 061c15a2d61b5948d2b33c6fa7338d0d37aea389 Mon Sep 17 00:00:00 2001 From: Svein-Tore Griff With Date: Tue, 17 Feb 2015 11:14:49 +0100 Subject: [PATCH 09/10] Update to video 1.2 api --- js/questionset.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/js/questionset.js b/js/questionset.js index f93c871..0fe64f9 100644 --- a/js/questionset.js +++ b/js/questionset.js @@ -293,21 +293,23 @@ H5P.QuestionSet = function (options, contentId) { var $videoContainer = $('
').appendTo($myDom); var video = new H5P.Video({ - files: videoData, + sources: videoData, fitToWrapper: true, controls: false, autoplay: false }, contentId); - video.endedCallback = function () { - displayResults(); - $videoContainer.hide(); - }; + video.on('stateChange', function (event) { + if (event.data === H5P.Video.ENDED) { + displayResults(); + $videoContainer.hide(); + } + }); video.attach($videoContainer); video.play(); if (params.endGame.skipButtonText) { $('').click(function () { - video.stop(); + video.pause(); $videoContainer.hide(); displayResults(); }).appendTo($videoContainer); From f064ad59d5079243663d55c42db22c5bfa0f5020 Mon Sep 17 00:00:00 2001 From: Svein-Tore Griff With Date: Wed, 18 Feb 2015 18:08:57 +0100 Subject: [PATCH 10/10] resize when displaying solution --- js/questionset.js | 1 + 1 file changed, 1 insertion(+) diff --git a/js/questionset.js b/js/questionset.js index 0fe64f9..655c042 100644 --- a/js/questionset.js +++ b/js/questionset.js @@ -320,6 +320,7 @@ H5P.QuestionSet = function (options, contentId) { } // Trigger finished event. displayResults(); + self.trigger('resize'); }; // Function for attaching the multichoice to a DOM element.