From 1d1d2eef007475bc8d6fd993641468f65213f2ed Mon Sep 17 00:00:00 2001 From: Thomas Date: Sat, 1 Nov 2014 13:43:14 +0100 Subject: [PATCH 01/11] Added MarkTheWords as a question option. --- semantics.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/semantics.json b/semantics.json index 7e061cc..38ab49a 100644 --- a/semantics.json +++ b/semantics.json @@ -103,7 +103,8 @@ "options": [ "H5P.MultiChoice 1.0", "H5P.DragQuestion 1.0", - "H5P.Blanks 1.0" + "H5P.Blanks 1.0", + "H5P.MarkTheWords 1.0" ] } }, From 46aa455310293819eb3b8da0bd67561bb901b87e Mon Sep 17 00:00:00 2001 From: Thomas Date: Wed, 12 Nov 2014 09:07:08 +0100 Subject: [PATCH 02/11] Added hiding of check button for Mark The Words --- css/questionset.css | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/css/questionset.css b/css/questionset.css index 52eb139..946926b 100644 --- a/css/questionset.css +++ b/css/questionset.css @@ -22,9 +22,15 @@ .questionset.hidden { display: none; } + +/* Quick fix for hiding check buttons in integrated h5p content: */ +.questionset .h5p-word button.h5p-button.h5p-check-button { + display: none; +} .questionset .h5p-multichoice > .h5p-show-solution, .questionset .dragndrop > .h5p-show-solution, .h5p-blanks .h5p-button { display: none; } + .questionset, .intro-page, .questionset-results { position: relative; } @@ -261,4 +267,4 @@ font-style: normal; color: #6aa81b; text-align: left; -} +} \ No newline at end of file From 55109596150a82555a534c0cf9a5861e43a959ea Mon Sep 17 00:00:00 2001 From: Thomas Marstrander Date: Thu, 27 Nov 2014 11:01:47 +0100 Subject: [PATCH 03/11] Added override-buttons branch. --- css/questionset.css | 35 +++++++++--------- js/questionset.js | 90 ++++++++++++++++++++++++++++++++++++--------- semantics.json | 44 ++++++++++++++++++++-- 3 files changed, 131 insertions(+), 38 deletions(-) diff --git a/css/questionset.css b/css/questionset.css index 946926b..19130c0 100644 --- a/css/questionset.css +++ b/css/questionset.css @@ -22,15 +22,6 @@ .questionset.hidden { display: none; } - -/* Quick fix for hiding check buttons in integrated h5p content: */ -.questionset .h5p-word button.h5p-button.h5p-check-button { - display: none; -} -.questionset .h5p-multichoice > .h5p-show-solution, .questionset .dragndrop > .h5p-show-solution, .h5p-blanks .h5p-button { - display: none; -} - .questionset, .intro-page, .questionset-results { position: relative; } @@ -100,7 +91,7 @@ .qs-footer { overflow: hidden; } -.qs-footer .button, .qs-startbutton, .qs-finishbutton, .questionset-results .button, .video-container > .button { +.qs-footer .h5p-button, .qs-startbutton, .qs-finishbutton, .questionset-results .h5p-button, .video-container > .h5p-button { display: inline-block; padding: 0 0.7em; border: 0.2em solid #fff; @@ -118,7 +109,7 @@ background: -ms-linear-gradient(top, rgba(100,152,254,1) 0%,rgba(4,104,206,1) 100%); /* IE10+ */ filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#6498fe', endColorstr='#0468ce',GradientType=0 ); /* IE6-9 */ } -.qs-footer .button:hover, .qs-startbutton:hover, .questionset-results .button:hover, .video-container > .button:hover { +.qs-footer .h5p-button:hover, .qs-startbutton:hover, .questionset-results .h5p-button:hover, .video-container > .h5p-button:hover { text-decoration: none; box-shadow: 0 0 0.5em #999; color: #ffffff; @@ -139,16 +130,26 @@ float: none; } +.qs-footer > .qs-retrybutton { + float: none; +} + +.questionset-results a.h5p-button.qs-retrybutton:before { + font-family: 'H5PFontAwesome4'; + padding-right: 0.5em; + content: "\f021"; +} + .qs-footer > .next, .qs-footer > .finish, .qs-finishbutton { float: right; } -.qs-footer a.next.button:after { +.qs-footer a.next.h5p-button:after { font-family: 'H5PFontAwesome4'; content: "\f054"; /* TODO: Use margin not whitespace, spacing is not content! */ } -.qs-footer a.prev.button:before { +.qs-footer a.prev.h5p-button:before { font-family: 'H5PFontAwesome4'; content: "\f053"; } @@ -157,12 +158,12 @@ display: none; } -.qs-footer a.finish.button:before { +.qs-footer a.finish.h5p-button:before { font-family: 'H5PFontAwesome4'; content: "\f00c "; } -.questionset-results a.button.qs-solutionbutton:before { +.questionset-results a.h5p-button.qs-solutionbutton:before { font-family: 'H5PFontAwesome4'; content: "\f06e "; } @@ -173,7 +174,7 @@ .video-container > video { background-color: #000; } -.video-container > .button { +.video-container > .h5p-button { position: absolute; top: 0.5em; right: 0.5em; @@ -267,4 +268,4 @@ font-style: normal; color: #6aa81b; text-align: left; -} \ No newline at end of file +} diff --git a/js/questionset.js b/js/questionset.js index 10db075..a49e05f 100644 --- a/js/questionset.js +++ b/js/questionset.js @@ -26,7 +26,7 @@ H5P.QuestionSet = function (options, contentId) { ' <% if (introPage.introduction) { %>' + '
<%= introPage.introduction %>
' + ' <% } %>' + - ' ' + + ' ' + '' + '<% } %>' + '
' + @@ -45,9 +45,9 @@ H5P.QuestionSet = function (options, contentId) { ' ' + ' <% } %>' + '
' + - ' ' + - ' ' + - ' <%= texts.finishButton %>' + + ' ' + + ' ' + + ' <%= texts.finishButton %>' + ' ' + ''; @@ -58,7 +58,7 @@ H5P.QuestionSet = function (options, contentId) { '
' + '
<% if (comment) { %>

<%= comment %>

<% } %><%= score %>
<%= resulttext %>
' + ' ' + - ' ' + + ' ' + ''; var defaults = { @@ -89,8 +89,14 @@ H5P.QuestionSet = function (options, contentId) { scoreString: 'You got @score points of @total possible.', finishButtonText: 'Finish', solutionButtonText: 'Show solution', + retryButtonText: 'Retry', showAnimations: false }, + override: { + overrideButtons: false, + overrideShowSolutionButton: false, + overrideRetryButton: false + }, postUserStatistics: (H5P.postUserStatistics === true) }; @@ -103,13 +109,23 @@ H5P.QuestionSet = function (options, contentId) { var $myDom; renderSolutions = false; + + // Instantiate question instances for (var i = 0; i < params.questions.length; i++) { var question = params.questions[i]; // TODO: Render on init, inject in template. + // override content parameters. + if (params.override.overrideButtons) { + // Extend subcontent with the overrided settings. + $.extend(question.params, { + enableRetryButton: params.override.overrideRetryButton, + enableSolutionsButton: params.override.overrideShowSolutionButton + }); + } + $.extend(question.params, { - displaySolutionsButton: false, postUserStatistics: false }); questionInstances.push(H5P.newRunnable(question, contentId)); @@ -123,18 +139,18 @@ H5P.QuestionSet = function (options, contentId) { } if (currentQuestion === 0) { - $('.prev.button', $myDom).hide(); + $('.prev.h5p-button', $myDom).hide(); } else { - $('.prev.button', $myDom).show(); + $('.prev.h5p-button', $myDom).show(); } if (currentQuestion === (params.questions.length - 1)) { - $('.next.button', $myDom).hide(); + $('.next.h5p-button', $myDom).hide(); if (answered) { - $('.finish.button', $myDom).show(); + $('.finish.h5p-button', $myDom).show(); } } else { - $('.next.button', $myDom).show(); - $('.finish.button', $myDom).hide(); + $('.next.h5p-button', $myDom).show(); + $('.finish.h5p-button', $myDom).hide(); } }; @@ -173,12 +189,42 @@ H5P.QuestionSet = function (options, contentId) { return currentQuestion; }; + /** + * Show solutions for subcontent, and hide subcontent buttons. + * Used for contracts with integrated content. + * @public + */ var showSolutions = function () { for (var i = 0; i < questionInstances.length; i++) { - questionInstances[i].showSolutions(); + try { + questionInstances[i].showSolutions(); + } + catch(error) { + console.log(error); + console.log("subcontent does not contain a valid showSolutions() function"); + } } }; + /** + * Resets the task and every subcontent task. + * Used for contracts with integrated content. + * @public + */ + var resetTask = function () { + for (var i = 0; i < questionInstances.length; i++) { + try { + questionInstances[i].resetTask(); + } + catch(error) { + console.log(error); + console.log("subcontent does not contain a valid resetTask() function"); + } + } + //Force the last page to be reRendered + rendered = false; + }; + var rendered = false; var reRender = function () { @@ -190,6 +236,8 @@ H5P.QuestionSet = function (options, contentId) { $myDom.children().hide().filter('.questionset-results').show(); return; } + //Remove old score screen. + $myDom.children().hide().filter('.questionset-results').remove(); rendered = true; // Get total score. @@ -232,6 +280,12 @@ H5P.QuestionSet = function (options, contentId) { $myDom.children().hide().filter('.questionset').show(); _showQuestion(params.initialQuestion); }); + $('.qs-retrybutton', $myDom) + .html(params.endGame.retryButtonText) + .click(function () { + resetTask(); + $myDom.children().hide().filter('.questionset').show(); + _showQuestion(params.initialQuestion);}); }; if (params.endGame.showAnimations) { @@ -254,7 +308,7 @@ H5P.QuestionSet = function (options, contentId) { video.play(); if (params.endGame.skipButtonText) { - $('').click(function () { + $('').click(function () { video.stop(); $videoContainer.hide(); displayResults(); @@ -325,13 +379,13 @@ H5P.QuestionSet = function (options, contentId) { $('.progress-dot', $myDom).click(function () { _showQuestion($(this).index()); }); - $('.next.button', $myDom).click(function () { + $('.next.h5p-button', $myDom).click(function () { _showQuestion(currentQuestion + 1); }); - $('.prev.button', $myDom).click(function () { + $('.prev.h5p-button', $myDom).click(function () { _showQuestion(currentQuestion - 1); }); - $('.finish.button', $myDom).click(function () { + $('.finish.h5p-button', $myDom).click(function () { _displayEndGame(); }); @@ -426,4 +480,4 @@ H5P.QuestionSet = function (options, contentId) { getCopyrights: getCopyrights }; return returnObject; -}; +}; \ No newline at end of file diff --git a/semantics.json b/semantics.json index 38ab49a..73f17ab 100644 --- a/semantics.json +++ b/semantics.json @@ -104,7 +104,8 @@ "H5P.MultiChoice 1.0", "H5P.DragQuestion 1.0", "H5P.Blanks 1.0", - "H5P.MarkTheWords 1.0" + "H5P.MarkTheWords 1.0", + "H5P.DragText 1.0" ] } }, @@ -240,6 +241,13 @@ "default": "Show solution", "description": "Text for the solution button." }, + { + "name": "retryButtonText", + "type": "text", + "label": "Retry button label", + "default": "Retry", + "description": "Text for the retry button." + }, { "name": "finishButtonText", "type": "text", @@ -260,8 +268,7 @@ "name": "skipButtonText", "type": "text", "label": "Skip video button label", - "default": "Skip video", - "common": true + "default": "Skip video" }, { "name": "successVideo", @@ -278,5 +285,36 @@ "description": "This video will be played if the user failes the quiz." } ] + }, + { + "name": "override", + "type": "group", + "label": "Override native button options", + "description": "These options will let you override when to display \"Show solution\" and \"Retry\" buttons in integrated h5p content.", + "common": true, + "optional": true, + "fields": [ + { + "name": "overrideButtons", + "type": "boolean", + "label": "Override native button settings.", + "description": "Enabling this option will let you override display settings for integrated content buttons with the following options.", + "default": false + }, + { + "name": "overrideShowSolutionButton", + "type": "boolean", + "label": "Enable \"Show solution\" button for subcontent.", + "description": "Enabling this option will override subcontent to show the \"Show solution\" button.", + "default": false + }, + { + "name": "overrideRetryButton", + "type": "boolean", + "label": "Enable \"Retry\" button for subcontent.", + "description": "Enabling this option will override subcontent to show the \"Retry\" button.", + "default": false + } + ] } ] From 02589ff35aeab201ab7327330d2df3c5c423dd91 Mon Sep 17 00:00:00 2001 From: Svein-Tore Griff With Date: Thu, 27 Nov 2014 13:39:39 +0100 Subject: [PATCH 04/11] Textual improvements in semantics --- semantics.json | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/semantics.json b/semantics.json index 73f17ab..a635dc2 100644 --- a/semantics.json +++ b/semantics.json @@ -289,30 +289,29 @@ { "name": "override", "type": "group", - "label": "Override native button options", + "label": "Settings for \"Show solution\" and \"Retry\" buttons", "description": "These options will let you override when to display \"Show solution\" and \"Retry\" buttons in integrated h5p content.", - "common": true, "optional": true, "fields": [ { "name": "overrideButtons", "type": "boolean", - "label": "Override native button settings.", - "description": "Enabling this option will let you override display settings for integrated content buttons with the following options.", + "label": "Enable override for \"Show solution\" and \"Retry\" settings.", + "description": "If this is enabled the questions own settings will be ignored and the below settings will be used instead.", "default": false }, { "name": "overrideShowSolutionButton", "type": "boolean", - "label": "Enable \"Show solution\" button for subcontent.", - "description": "Enabling this option will override subcontent to show the \"Show solution\" button.", + "label": "Enable \"Show solution\" buttons.", + "description": "Enabling this option will make questions show the \"Show solution\" button.", "default": false }, { "name": "overrideRetryButton", "type": "boolean", - "label": "Enable \"Retry\" button for subcontent.", - "description": "Enabling this option will override subcontent to show the \"Retry\" button.", + "label": "Enable \"Retry\" buttons.", + "description": "Enabling this option will make questions show the \"Retry\" button.", "default": false } ] From 587c5934740e152061d066161d742caf263b6ba5 Mon Sep 17 00:00:00 2001 From: Thomas Marstrander Date: Fri, 28 Nov 2014 13:51:26 +0100 Subject: [PATCH 05/11] changed semantics enableRetryButton to enableRetry. --- js/questionset.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/questionset.js b/js/questionset.js index a49e05f..1595880 100644 --- a/js/questionset.js +++ b/js/questionset.js @@ -120,7 +120,7 @@ H5P.QuestionSet = function (options, contentId) { if (params.override.overrideButtons) { // Extend subcontent with the overrided settings. $.extend(question.params, { - enableRetryButton: params.override.overrideRetryButton, + enableRetry: params.override.overrideRetryButton, enableSolutionsButton: params.override.overrideShowSolutionButton }); } From 4897db48fd904cba19506a69b8c9548de8db745a Mon Sep 17 00:00:00 2001 From: Thomas Marstrander Date: Fri, 28 Nov 2014 15:39:19 +0100 Subject: [PATCH 06/11] Semantics description for overrideRetry changed. --- js/questionset.js | 4 ++-- semantics.json | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/js/questionset.js b/js/questionset.js index 1595880..04d3d27 100644 --- a/js/questionset.js +++ b/js/questionset.js @@ -95,7 +95,7 @@ H5P.QuestionSet = function (options, contentId) { override: { overrideButtons: false, overrideShowSolutionButton: false, - overrideRetryButton: false + overrideRetry: false }, postUserStatistics: (H5P.postUserStatistics === true) }; @@ -120,7 +120,7 @@ H5P.QuestionSet = function (options, contentId) { if (params.override.overrideButtons) { // Extend subcontent with the overrided settings. $.extend(question.params, { - enableRetry: params.override.overrideRetryButton, + enableRetry: params.override.overrideRetry, enableSolutionsButton: params.override.overrideShowSolutionButton }); } diff --git a/semantics.json b/semantics.json index a635dc2..13527c1 100644 --- a/semantics.json +++ b/semantics.json @@ -289,8 +289,8 @@ { "name": "override", "type": "group", - "label": "Settings for \"Show solution\" and \"Retry\" buttons", - "description": "These options will let you override when to display \"Show solution\" and \"Retry\" buttons in integrated h5p content.", + "label": "Settings for \"Show solution\" button and \"Retry\".", + "description": "These options will let you override when to display \"Show solution\" button and \"Retry\" in integrated h5p content.", "optional": true, "fields": [ { @@ -308,10 +308,10 @@ "default": false }, { - "name": "overrideRetryButton", + "name": "overrideRetry", "type": "boolean", - "label": "Enable \"Retry\" buttons.", - "description": "Enabling this option will make questions show the \"Retry\" button.", + "label": "Enable \"Retry\".", + "description": "Enabling this option will make the user able to \"Retry\" .", "default": false } ] From 1d5dd187424d9dae6f257ca9d737c87cddc6fa5b Mon Sep 17 00:00:00 2001 From: Thomas Marstrander Date: Thu, 4 Dec 2014 10:13:06 +0100 Subject: [PATCH 07/11] Updated question minor versions. --- semantics.json | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/semantics.json b/semantics.json index 13527c1..3b1a835 100644 --- a/semantics.json +++ b/semantics.json @@ -101,11 +101,11 @@ "label": "Question type", "description": "Library for this question.", "options": [ - "H5P.MultiChoice 1.0", - "H5P.DragQuestion 1.0", - "H5P.Blanks 1.0", - "H5P.MarkTheWords 1.0", - "H5P.DragText 1.0" + "H5P.MultiChoice 1.1", + "H5P.DragQuestion 1.1", + "H5P.Blanks 1.1", + "H5P.MarkTheWords 1.1", + "H5P.DragText 1.1" ] } }, From 33f9ea3ba1d0846eb61e30a0f377bd174d932b8b Mon Sep 17 00:00:00 2001 From: Thomas Marstrander Date: Thu, 4 Dec 2014 10:26:52 +0100 Subject: [PATCH 08/11] Added the override settings into the correct subcontent semantics group. --- js/questionset.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/js/questionset.js b/js/questionset.js index 04d3d27..37ffefb 100644 --- a/js/questionset.js +++ b/js/questionset.js @@ -109,8 +109,6 @@ H5P.QuestionSet = function (options, contentId) { var $myDom; renderSolutions = false; - - // Instantiate question instances for (var i = 0; i < params.questions.length; i++) { var question = params.questions[i]; @@ -120,8 +118,10 @@ H5P.QuestionSet = function (options, contentId) { if (params.override.overrideButtons) { // Extend subcontent with the overrided settings. $.extend(question.params, { - enableRetry: params.override.overrideRetry, - enableSolutionsButton: params.override.overrideShowSolutionButton + behaviour: { + enableRetry: params.override.overrideRetry, + enableSolutionsButton: params.override.overrideShowSolutionButton + } }); } From 41063026b496dc3e8ffe8b9203b2a2c15b3f8bd8 Mon Sep 17 00:00:00 2001 From: Thomas Marstrander Date: Fri, 5 Dec 2014 11:55:36 +0100 Subject: [PATCH 09/11] Fixed so not all behaviour of subcontent will be overwritten. --- js/questionset.js | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/js/questionset.js b/js/questionset.js index 37ffefb..0f7fe77 100644 --- a/js/questionset.js +++ b/js/questionset.js @@ -117,11 +117,9 @@ H5P.QuestionSet = function (options, contentId) { // override content parameters. if (params.override.overrideButtons) { // Extend subcontent with the overrided settings. - $.extend(question.params, { - behaviour: { - enableRetry: params.override.overrideRetry, - enableSolutionsButton: params.override.overrideShowSolutionButton - } + $.extend(question.params.behaviour, { + enableRetry: params.override.overrideRetry, + enableSolutionsButton: params.override.overrideShowSolutionButton }); } From ab62111f31fec1c0f10095aabe5b2ed16aaf908d Mon Sep 17 00:00:00 2001 From: Thomas Marstrander Date: Wed, 17 Dec 2014 13:33:59 +0100 Subject: [PATCH 10/11] Fixed nn and nb languge semantics --- language/nb.json | 18 ++++++++++++++++++ language/nn.json | 18 ++++++++++++++++++ 2 files changed, 36 insertions(+) diff --git a/language/nb.json b/language/nb.json index c5e68e8..c731683 100644 --- a/language/nb.json +++ b/language/nb.json @@ -143,6 +143,24 @@ "description": "Denne videoen vil bli vist dersom brukeren ikke består spørsmålssettet." } ] + }, + { + "label": "Innstillinger for \"Vis svar\" knapp og \"Prøv igjen\".", + "description": "Disse instillingene lar deg overstyre når \"Vis svar\" knapp og \"Prøv igjen\" er slått på i integrert h5p innhold.", + "fields": [ + { + "label": "Slå på overstyring for \"Vis svar\" og \"Prøv igjen\".", + "description": "Aktivering vil overstyre de følgende innstillingene for integrert innhold." + }, + { + "label": "Slå på \"Vis svar\" knapp.", + "description": "Aktivering vil slå på \"Vis svar\" knappen." + }, + { + "label": "Slå på \"Prøv igjen\".", + "description": "Aktivering vil slå på \"Prøv igjen\" ." + } + ] } ] } diff --git a/language/nn.json b/language/nn.json index e14190f..667389e 100644 --- a/language/nn.json +++ b/language/nn.json @@ -143,6 +143,24 @@ "description": "Denne videoen vil bli vist dersom brukaren ikkje består spørsmålssettet." } ] + }, + { + "label": "Innstillinger for \"Vis svar\" knapp og \"Prøv igjen\".", + "description": "Disse instillingene lar deg overstyre når \"Vis svar\" knapp og \"Prøv igjen\" er slått på i integrert h5p innhald.", + "fields": [ + { + "label": "Slå på overstyring for \"Vis svar\" og \"Prøv igjen\".", + "description": "Aktivering vil overstyre dei følgjande innstillingene for integrert innhald." + }, + { + "label": "Slå på \"Vis svar\" knapp.", + "description": "Aktivering vil slå på \"Vis svar\" knappen." + }, + { + "label": "Slå på \"Prøv igjen\".", + "description": "Aktivering vil slå på \"Prøv igjen\" ." + } + ] } ] } From 1e2f94c15ac7d43aab75621055b08dd13eb49bd4 Mon Sep 17 00:00:00 2001 From: Frode Petterson Date: Thu, 8 Jan 2015 14:39:55 +0100 Subject: [PATCH 11/11] Changed version to make upgraded question types work. --- library.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/library.json b/library.json index 2057c17..431253b 100644 --- a/library.json +++ b/library.json @@ -2,8 +2,8 @@ "title": "Question set", "contentType": "question", "majorVersion": 1, - "minorVersion": 0, - "patchVersion": 58, + "minorVersion": 1, + "patchVersion": 0, "runnable": 1, "fullscreen": 0, "machineName": "H5P.QuestionSet", @@ -47,4 +47,4 @@ "minorVersion": 0 } ] -} \ No newline at end of file +}