Merge remote-tracking branch 'h5p/master'

Conflicts:
	language/de.json
pull/4/head
Paul Mickan 2016-10-27 12:02:00 +02:00
commit 622bc227d7
11 changed files with 1076 additions and 353 deletions

1
.gitignore vendored
View File

@ -1,2 +1,3 @@
*~ *~
/nbproject/private/ /nbproject/private/
.idea

View File

@ -35,6 +35,12 @@
.dots-container { .dots-container {
text-align: center; text-align: center;
line-height: 2em; line-height: 2em;
padding: 0;
margin: 0;
}
.progress-item {
list-style: none;
display: inline-block;
} }
.progress-dot { .progress-dot {
display: inline-block; display: inline-block;
@ -46,7 +52,12 @@
background: #fff; background: #fff;
background: #cecece; background: #cecece;
} }
.progress-dot:hover {
.progress-dot.disabled {
cursor: default;
}
.progress-dot:not(.disabled):hover {
box-shadow: 0 0 0.5em #c7c7c7; box-shadow: 0 0 0.5em #c7c7c7;
} }
.progress-dot.answered { .progress-dot.answered {
@ -55,6 +66,11 @@
.progress-dot.current { .progress-dot.current {
background: #285585; background: #285585;
} }
.progress-dot.disabled:focus {
outline: none
}
.progress-dot:focus { .progress-dot:focus {
outline-color: rgb(40, 130, 211); outline-color: rgb(40, 130, 211);
outline-width: thin; outline-width: thin;
@ -95,6 +111,7 @@
} }
.qs-footer { .qs-footer {
overflow: hidden; overflow: hidden;
clear: both;
} }
.qs-footer > .prev { .qs-footer > .prev {
@ -125,6 +142,13 @@
transition: none; transition: none;
} }
.qs-progress-announcer {
height: 0;
width: 0;
position: absolute;
overflow: hidden;
}
.h5p-question .h5p-question-prev, .h5p-question .h5p-question-prev,
.h5p-question .h5p-question-finish, .h5p-question .h5p-question-finish,
.h5p-question .h5p-question-next { .h5p-question .h5p-question-next {
@ -137,6 +161,12 @@
width: 2.1875em; width: 2.1875em;
} }
.h5p-question .h5p-question-prev.truncated,
.h5p-question .h5p-question-next.truncated {
padding: 0;
line-height: 2.2335em;
}
.h5p-question .h5p-question-next, .h5p-question .h5p-question-next,
.h5p-question .h5p-question-finish { .h5p-question .h5p-question-finish {
margin: 0 0 1.5em 0.5em; margin: 0 0 1.5em 0.5em;
@ -178,6 +208,7 @@
} }
.video-container > video { .video-container > video {
background-color: #000; background-color: #000;
width: 100%;
} }
.video-container > .h5p-button { .video-container > .h5p-button {
position: absolute; position: absolute;

View File

@ -8,11 +8,12 @@ var H5P = H5P || {};
* *
* @param {Array} options * @param {Array} options
* @param {int} contentId * @param {int} contentId
* @param {Object} contentData
* @returns {H5P.QuestionSet} Instance * @returns {H5P.QuestionSet} Instance
*/ */
H5P.QuestionSet = function (options, contentId) { H5P.QuestionSet = function (options, contentId, contentData) {
if (!(this instanceof H5P.QuestionSet)) { if (!(this instanceof H5P.QuestionSet)) {
return new H5P.QuestionSet(options, contentId); return new H5P.QuestionSet(options, contentId, contentData);
} }
H5P.EventDispatcher.call(this); H5P.EventDispatcher.call(this);
var $ = H5P.jQuery; var $ = H5P.jQuery;
@ -31,6 +32,7 @@ H5P.QuestionSet = function (options, contentId) {
' <div class="buttons"><a class="qs-startbutton h5p-joubelui-button h5p-button"><%= introPage.startButtonText %></a></div>' + ' <div class="buttons"><a class="qs-startbutton h5p-joubelui-button h5p-button"><%= introPage.startButtonText %></a></div>' +
'</div>' + '</div>' +
'<% } %>' + '<% } %>' +
'<div tabindex="-1" class="qs-progress-announcer"></div>' +
'<div class="questionset<% if (introPage.showIntroPage) { %> hidden<% } %>">' + '<div class="questionset<% if (introPage.showIntroPage) { %> hidden<% } %>">' +
' <% for (var i=0; i<questions.length; i++) { %>' + ' <% for (var i=0; i<questions.length; i++) { %>' +
' <div class="question-container"></div>' + ' <div class="question-container"></div>' +
@ -38,9 +40,18 @@ H5P.QuestionSet = function (options, contentId) {
' <div class="qs-footer">' + ' <div class="qs-footer">' +
' <div class="qs-progress">' + ' <div class="qs-progress">' +
' <% if (progressType == "dots") { %>' + ' <% if (progressType == "dots") { %>' +
' <div class="dots-container">' + ' <ul class="dots-container" role="navigation">' +
' <% for (var i=0; i<questions.length; i++) { %>' + ' <% for (var i=0; i<questions.length; i++) { %>' +
' <a href="#" class="progress-dot unanswered" aria-label="<%= questions[i].jumpAriaLabel %>"></a>' + ' <li class="progress-item">' +
' <a href="#" ' +
' class="progress-dot unanswered<%' +
' if (disableBackwardsNavigation) { %> disabled <% } %>"' +
' aria-label="<%=' +
' texts.jumpToQuestion.replace("%d", i + 1).replace("%total", questions.length)' +
' + ", " + texts.unansweredText %>" tabindex="-1" ' +
' <% if (disableBackwardsNavigation) { %> aria-disabled="true" <% } %>' +
' ></a>' +
' </li>' +
' <% } %>' + ' <% } %>' +
' </div>' + ' </div>' +
' <% } else if (progressType == "textual") { %>' + ' <% } else if (progressType == "textual") { %>' +
@ -60,7 +71,9 @@ H5P.QuestionSet = function (options, contentId) {
' <% if (comment) { %>' + ' <% if (comment) { %>' +
' <div class="result-header"><%= comment %></div>' + ' <div class="result-header"><%= comment %></div>' +
' <% } %>' + ' <% } %>' +
' <% if (resulttext) { %>' +
' <div class="result-text"><%= resulttext %></div>' + ' <div class="result-text"><%= resulttext %></div>' +
' <% } %>' +
' <div class="buttons">' + ' <div class="buttons">' +
' <button type="button" class="h5p-joubelui-button h5p-button qs-finishbutton"><%= finishButtonText %></button>' + ' <button type="button" class="h5p-joubelui-button h5p-button qs-finishbutton"><%= finishButtonText %></button>' +
' <button type="button" class="h5p-joubelui-button h5p-button qs-solutionbutton"><%= solutionButtonText %></button>' + ' <button type="button" class="h5p-joubelui-button h5p-button qs-solutionbutton"><%= solutionButtonText %></button>' +
@ -69,7 +82,6 @@ H5P.QuestionSet = function (options, contentId) {
'</div>'; '</div>';
var defaults = { var defaults = {
randomOrder: false,
initialQuestion: 0, initialQuestion: 0,
progressType: 'dots', progressType: 'dots',
passPercentage: 50, passPercentage: 50,
@ -85,37 +97,130 @@ H5P.QuestionSet = function (options, contentId) {
nextButton: 'Next question', nextButton: 'Next question',
finishButton: 'Finish', finishButton: 'Finish',
textualProgress: 'Question: @current of @total questions', textualProgress: 'Question: @current of @total questions',
jumpToQuestion: 'Jump to question %d', jumpToQuestion: 'Question %d of %total',
questionLabel: 'Question' questionLabel: 'Question',
readSpeakerProgress: 'Question @current of @total',
unansweredText: 'Unanswered',
answeredText: 'Answered',
currentQuestionText: 'Current question'
}, },
endGame: { endGame: {
showResultPage: true, showResultPage: true,
noResultMessage: 'Finished',
message: 'Your result:', message: 'Your result:',
successGreeting: 'Congratulations!', successGreeting: 'Congratulations!',
successComment: 'You have enough correct answers to pass the test.', successComment: 'You have enough correct answers to pass the test.',
failGreeting: 'Sorry!', failGreeting: 'Sorry!',
failComment: "You don't have enough correct answers to pass this test.", failComment: "You don't have enough correct answers to pass this test.",
scoreString: '@score of @total points', scoreString: 'You got @score of @total points',
finishButtonText: 'Finish', finishButtonText: 'Finish',
solutionButtonText: 'Solution', solutionButtonText: 'Show solution',
retryButtonText: 'Retry', retryButtonText: 'Retry',
showAnimations: false, showAnimations: false,
skipButtonText: 'Skip video' skipButtonText: 'Skip video'
} },
disableBackwardsNavigation: false
}; };
var template = new EJS({text: texttemplate}); var template = new EJS({text: texttemplate});
var endTemplate = new EJS({text: resulttemplate}); var endTemplate = new EJS({text: resulttemplate});
var params = $.extend(true, {}, defaults, options); var params = $.extend(true, {}, defaults, options);
var poolOrder; // Order of questions in a pool
var currentQuestion = 0; var currentQuestion = 0;
var questionInstances = []; var questionInstances = [];
var questionOrder; //Stores order of questions to allow resuming of question set
var $myDom; var $myDom;
var scoreBar; var scoreBar;
var up; var up;
renderSolutions = false; var renderSolutions = false;
var showingSolutions = false;
contentData = contentData || {};
// Bring question set up to date when resuming
if (contentData.previousState) {
if (contentData.previousState.progress) {
currentQuestion = contentData.previousState.progress;
}
questionOrder = contentData.previousState.order;
}
// Create a pool of questions if necessary
/**
* Randomizes questions in an array and updates an array containing their order
* @param {array} questions
* @param {array} questionOrder
* @return {Object.<array, array>} questionOrdering
*/
var randomizeQuestionOrdering = function (questions, questionOrder) {
// Save the original order of the questions in a multidimensional array [[question0,0],[question1,1]...
var questionOrdering = questions.map(function(questionInstance, index) { return [questionInstance, index] });
// Shuffle the multidimensional array
questionOrdering = H5P.shuffleArray(questionOrdering);
// Retrieve question objects from the first index
var questions = [];
for (var i = 0; i < questionOrdering.length; i++) {
questions[i] = questionOrdering[i][0];
}
// Retrieve the new shuffled order from the second index
var newOrder = [];
for (var i = 0; i< questionOrdering.length; i++) {
// Use a previous order if it exists
if(questionOrder) {
newOrder[i] = questionOrder[questionOrdering[i][1]];
}
else {
newOrder[i] = questionOrdering[i][1];
}
}
// Return the questions in their new order *with* their new order
return {
questions: questions,
questionOrder: newOrder
};
}
// Create a pool (a subset) of questions if necessary
if (params.poolSize && params.poolSize < params.questions.length) {
// If a previous pool exists, recreate it
if(contentData.previousState && contentData.previousState.poolOrder) {
poolOrder = contentData.previousState.poolOrder;
// Recreate the pool from the saved data
var pool = [];
for (var i = 0; i < poolOrder.length; i++) {
pool[i] = params.questions[poolOrder[i]];
}
// Replace original questions with just the ones in the pool
params.questions = pool;
}
else { // Otherwise create a new pool
// Randomize and get the results
var poolResult = randomizeQuestionOrdering(params.questions, poolOrder);
var poolQuestions = poolResult.questions;
poolOrder = poolResult.questionOrder;
// Discard extra questions
poolQuestions = poolQuestions.slice(0, params.poolSize);
poolOrder = poolOrder.slice(0, params.poolSize);
// Replace original questions with just the ones in the pool
params.questions = poolQuestions;
}
}
// Create the html template for the question container
var $template = $(template.render(params)); var $template = $(template.render(params));
// Set overrides for questions // Set overrides for questions
var override; var override;
if (params.override.showSolutionButton || params.override.retryButton) { if (params.override.showSolutionButton || params.override.retryButton) {
@ -135,9 +240,17 @@ H5P.QuestionSet = function (options, contentId) {
// Instantiate question instances // Instantiate question instances
for (var i = 0; i < params.questions.length; i++) { for (var i = 0; i < params.questions.length; i++) {
var question = params.questions[i];
question.jumpAriaLabel = params.texts.jumpToQuestion.replace('%d', i + 1); var question;
// If a previous order exists, use it
if (questionOrder !== undefined) {
question = params.questions[questionOrder[i]];
}
else {
// Use a generic order when initialzing for the first time
question = params.questions[i];
}
if (override) { if (override) {
// Extend subcontent with the overrided settings. // Extend subcontent with the overrided settings.
$.extend(question.params.behaviour, override); $.extend(question.params.behaviour, override);
@ -145,10 +258,14 @@ H5P.QuestionSet = function (options, contentId) {
question.params = question.params || {}; question.params = question.params || {};
question.params.overrideSettings = question.params.overrideSettings || {}; question.params.overrideSettings = question.params.overrideSettings || {};
question.params.overrideSettings.$confirmationDialogParent = $template; question.params.overrideSettings.$confirmationDialogParent = $template.last();
question.params.overrideSettings.instance = this; question.params.overrideSettings.instance = this;
var hasAnswers = contentData.previousState && contentData.previousState.answers;
var questionInstance = H5P.newRunnable(question, contentId, undefined, undefined, {parent: self}); var questionInstance = H5P.newRunnable(question, contentId, undefined, undefined,
{
previousState: hasAnswers ? contentData.previousState.answers[i] : undefined,
parent: self
});
questionInstance.on('resize', function () { questionInstance.on('resize', function () {
up = true; up = true;
self.trigger('resize'); self.trigger('resize');
@ -156,6 +273,13 @@ H5P.QuestionSet = function (options, contentId) {
questionInstances.push(questionInstance); questionInstances.push(questionInstance);
} }
// Randomize questions only on instantiation
if (params.randomQuestions && contentData.previousState === undefined) {
var result = randomizeQuestionOrdering(questionInstances,questionOrder);
questionInstances = result.questions;
questionOrder = result.questionOrder;
}
// Resize all interactions on resize // Resize all interactions on resize
self.on('resize', function () { self.on('resize', function () {
if (up) { if (up) {
@ -171,15 +295,31 @@ H5P.QuestionSet = function (options, contentId) {
// Update button state. // Update button state.
var _updateButtons = function () { var _updateButtons = function () {
// Verify that current question is answered when backward nav is disabled
if (params.disableBackwardsNavigation) {
if (questionInstances[currentQuestion].getAnswerGiven()
&& questionInstances.length-1 !== currentQuestion) {
questionInstances[currentQuestion].showButton('next');
}
else {
questionInstances[currentQuestion].hideButton('next');
}
}
var answered = true; var answered = true;
for (var i = questionInstances.length - 1; i >= 0; i--) { for (var i = questionInstances.length - 1; i >= 0; i--) {
answered = answered && (questionInstances[i]).getAnswerGiven(); answered = answered && (questionInstances[i]).getAnswerGiven();
} }
if (currentQuestion === (params.questions.length - 1) && answered && if (currentQuestion === (params.questions.length - 1) &&
questionInstances[currentQuestion]) { questionInstances[currentQuestion]) {
if (answered) {
questionInstances[currentQuestion].showButton('finish'); questionInstances[currentQuestion].showButton('finish');
} }
else {
questionInstances[currentQuestion].hideButton('finish');
}
}
}; };
var _stopQuestion = function (questionNumber) { var _stopQuestion = function (questionNumber) {
@ -188,7 +328,7 @@ H5P.QuestionSet = function (options, contentId) {
} }
}; };
var _showQuestion = function (questionNumber) { var _showQuestion = function (questionNumber, preventAnnouncement) {
// Sanitize input. // Sanitize input.
if (questionNumber < 0) { if (questionNumber < 0) {
questionNumber = 0; questionNumber = 0;
@ -218,8 +358,29 @@ H5P.QuestionSet = function (options, contentId) {
} }
else { else {
// Set currentNess // Set currentNess
$('.progress-dot.current', $myDom).removeClass('current'); var previousQuestion = $('.progress-dot.current', $myDom).parent().index();
$('.progress-dot:eq(' + questionNumber +')', $myDom).addClass('current'); if (previousQuestion >= 0) {
toggleCurrentDot(previousQuestion, false);
toggleAnsweredDot(previousQuestion, questionInstances[previousQuestion].getAnswerGiven());
}
toggleCurrentDot(questionNumber, true);
}
if (!preventAnnouncement) {
// Announce question number of total, must use timeout because of buttons logic
setTimeout(function () {
var humanizedProgress = params.texts.readSpeakerProgress
.replace('@current', (currentQuestion + 1).toString())
.replace('@total', questionInstances.length.toString());
$('.qs-progress-announcer', $myDom)
.html(humanizedProgress)
.show().focus();
if (instance && instance.readFeedback) {
instance.readFeedback();
}
}, 0);
} }
// Remember where we are // Remember where we are
@ -234,9 +395,23 @@ H5P.QuestionSet = function (options, contentId) {
* @public * @public
*/ */
var showSolutions = function () { var showSolutions = function () {
showingSolutions = true;
for (var i = 0; i < questionInstances.length; i++) { for (var i = 0; i < questionInstances.length; i++) {
// Enable back and forth navigation in solution mode
toggleDotsNavigation(true);
if (i < questionInstances.length - 1) {
questionInstances[i].showButton('next');
}
if (i > 0) {
questionInstances[i].showButton('prev');
}
try { try {
// Do not read answers
questionInstances[i].toggleReadSpeaker(true);
questionInstances[i].showSolutions(); questionInstances[i].showSolutions();
questionInstances[i].toggleReadSpeaker(false);
} }
catch(error) { catch(error) {
H5P.error("subcontent does not contain a valid showSolutions function"); H5P.error("subcontent does not contain a valid showSolutions function");
@ -245,15 +420,45 @@ H5P.QuestionSet = function (options, contentId) {
} }
}; };
/**
* Toggles whether dots are enabled for navigation
*/
var toggleDotsNavigation = function (enable) {
$('.progress-dot', $myDom).each(function () {
$(this).toggleClass('disabled', !enable);
$(this).attr('aria-disabled', enable ? 'false' : 'true');
// Remove tabindex
if (!enable) {
$(this).attr('tabindex', '-1');
}
});
};
/** /**
* Resets the task and every subcontent task. * Resets the task and every subcontent task.
* Used for contracts with integrated content. * Used for contracts with integrated content.
* @public * @public
*/ */
var resetTask = function () { var resetTask = function () {
showingSolutions = false;
for (var i = 0; i < questionInstances.length; i++) { for (var i = 0; i < questionInstances.length; i++) {
try { try {
questionInstances[i].resetTask(); questionInstances[i].resetTask();
// Hide back and forth navigation in normal mode
if (params.disableBackwardsNavigation) {
toggleDotsNavigation(false);
// Check if first question is answered by default
if (i === 0 && questionInstances[i].getAnswerGiven()) {
questionInstances[i].showButton('next');
}
else {
questionInstances[i].hideButton('next');
}
questionInstances[i].hideButton('prev');
}
} }
catch(error) { catch(error) {
H5P.error("subcontent does not contain a valid resetTask function"); H5P.error("subcontent does not contain a valid resetTask function");
@ -264,8 +469,18 @@ H5P.QuestionSet = function (options, contentId) {
// Hide finish button // Hide finish button
questionInstances[questionInstances.length - 1].hideButton('finish'); questionInstances[questionInstances.length - 1].hideButton('finish');
// Mark all tasks as unanswered:
$('.progress-dot').each(function (idx) {
toggleAnsweredDot(idx, false);
});
//Force the last page to be reRendered //Force the last page to be reRendered
rendered = false; rendered = false;
if (params.randomQuestions) {
randomizeQuestions();
}
}; };
var rendered = false; var rendered = false;
@ -274,18 +489,136 @@ H5P.QuestionSet = function (options, contentId) {
rendered = false; rendered = false;
}; };
/**
* Randomizes question instances
*/
var randomizeQuestions = function () {
var result = randomizeQuestionOrdering(questionInstances,questionOrder);
questionInstances = result.questions;
questionOrder = result.questionOrder;
// Find all question containers and detach questions from them
$('.question-container', $myDom).each(function (){
$(this).children().detach();
});
// Reattach questions and their buttons in the new order
for (var i = 0; i < questionInstances.length; i++) {
var question = questionInstances[i];
// Make sure styles are not being added twice
$('.question-container:eq(' + i + ')', $myDom).attr('class', 'question-container');
question.attach($('.question-container:eq(' + i + ')', $myDom));
//Show buttons if necessary
if(questionInstances[questionInstances.length -1] === question
&& question.hasButton('finish')) {
question.showButton('finish');
}
if(questionInstances[questionInstances.length -1] !== question
&& question.hasButton('next')) {
question.showButton('next');
}
if(questionInstances[0] !== question
&& question.hasButton('prev')
&& !params.disableBackwardsNavigation) {
question.showButton('prev');
}
// Hide relevant buttons since the order has changed
if (questionInstances[0] === question) {
question.hideButton('prev');
}
if (questionInstances[questionInstances.length-1] === question) {
question.hideButton('next');
}
if (questionInstances[questionInstances.length-1] !== question) {
question.hideButton('finish');
}
}
}
var moveQuestion = function (direction) { var moveQuestion = function (direction) {
if (params.disableBackwardsNavigation && !questionInstances[currentQuestion].getAnswerGiven()) {
questionInstances[currentQuestion].hideButton('next');
questionInstances[currentQuestion].hideButton('finish');
return;
}
_stopQuestion(currentQuestion); _stopQuestion(currentQuestion);
if (currentQuestion + direction >= questionInstances.length) { if (currentQuestion + direction >= questionInstances.length) {
_displayEndGame(); _displayEndGame();
} }
else { else {
// Allow movement if backward navigation enabled or answer given
_showQuestion(currentQuestion + direction); _showQuestion(currentQuestion + direction);
} }
}; };
/**
* Toggle answered state of dot at given index
* @param {number} dotIndex Index of dot
* @param {boolean} isAnswered True if is answered, False if not answered
*/
var toggleAnsweredDot = function(dotIndex, isAnswered) {
var $el = $('.progress-dot:eq(' + dotIndex +')', $myDom);
// Skip current button
if ($el.hasClass('current')) {
return;
}
// Ensure boolean
isAnswered = !!isAnswered;
var label = params.texts.jumpToQuestion
.replace('%d', (dotIndex + 1).toString())
.replace('%total', $('.progress-dot', $myDom).length) +
', ' +
(isAnswered ? params.texts.answeredText : params.texts.unansweredText);
$el.toggleClass('unanswered', !isAnswered)
.toggleClass('answered', isAnswered)
.attr('aria-label', label);
};
/**
* Toggle current state of dot at given index
* @param dotIndex
* @param isCurrent
*/
var toggleCurrentDot = function (dotIndex, isCurrent) {
var $el = $('.progress-dot:eq(' + dotIndex +')', $myDom);
var texts = params.texts;
var label = texts.jumpToQuestion
.replace('%d', (dotIndex + 1).toString())
.replace('%total', $('.progress-dot', $myDom).length);
if (!isCurrent) {
var isAnswered = $el.hasClass('answered');
label += ', ' + (isAnswered ? texts.answeredText : texts.unansweredText);
}
else {
label += ', ' + texts.currentQuestionText;
}
var disabledTabindex = params.disableBackwardsNavigation && !showingSolutions;
$el.toggleClass('current', isCurrent)
.attr('aria-label', label)
.attr('tabindex', isCurrent && !disabledTabindex ? 0 : -1);
};
var _displayEndGame = function () { var _displayEndGame = function () {
$('.progress-dot.current', $myDom).removeClass('current');
if (rendered) { if (rendered) {
$myDom.children().hide().filter('.questionset-results').show(); $myDom.children().hide().filter('.questionset-results').show();
self.trigger('resize'); self.trigger('resize');
@ -297,7 +630,7 @@ H5P.QuestionSet = function (options, contentId) {
// Get total score. // Get total score.
var finals = self.getScore(); var finals = self.getScore();
var totals = self.totalScore(); var totals = self.getMaxScore();
var scoreString = params.endGame.scoreString.replace("@score", finals).replace("@total", totals); var scoreString = params.endGame.scoreString.replace("@score", finals).replace("@total", totals);
var success = ((100 * finals / totals) >= params.passPercentage); var success = ((100 * finals / totals) >= params.passPercentage);
var eventData = { var eventData = {
@ -322,17 +655,12 @@ H5P.QuestionSet = function (options, contentId) {
}; };
var displayResults = function () { var displayResults = function () {
self.triggerXAPICompleted(self.getScore(), self.totalScore(), success); self.triggerXAPICompleted(self.getScore(), self.getMaxScore(), success);
if (!params.endGame.showResultPage) {
self.trigger('h5pQuestionSetFinished', eventData);
return;
}
var eparams = { var eparams = {
message: params.endGame.message, message: params.endGame.showResultPage ? params.endGame.message : params.endGame.noResultMessage,
comment: (success ? params.endGame.successGreeting : params.endGame.failGreeting), comment: params.endGame.showResultPage ? (success ? params.endGame.successGreeting : params.endGame.failGreeting) : undefined,
resulttext: (success ? params.endGame.successComment : params.endGame.failComment), resulttext: params.endGame.showResultPage ? (success ? params.endGame.successComment : params.endGame.failComment) : undefined,
finishButtonText: params.endGame.finishButtonText, finishButtonText: params.endGame.finishButtonText,
solutionButtonText: params.endGame.solutionButtonText, solutionButtonText: params.endGame.solutionButtonText,
retryButtonText: params.endGame.retryButtonText retryButtonText: params.endGame.retryButtonText
@ -342,6 +670,7 @@ H5P.QuestionSet = function (options, contentId) {
$myDom.children().hide(); $myDom.children().hide();
$myDom.append(endTemplate.render(eparams)); $myDom.append(endTemplate.render(eparams));
if (params.endGame.showResultPage) {
// Add event handlers to summary buttons // Add event handlers to summary buttons
hookUpButton('.qs-finishbutton', function () { hookUpButton('.qs-finishbutton', function () {
self.trigger('h5pQuestionSetFinished', eventData); self.trigger('h5pQuestionSetFinished', eventData);
@ -373,6 +702,23 @@ H5P.QuestionSet = function (options, contentId) {
scoreBar.appendTo($('.feedback-scorebar', $myDom)); scoreBar.appendTo($('.feedback-scorebar', $myDom));
scoreBar.setScore(finals); scoreBar.setScore(finals);
$('.feedback-text', $myDom).html(scoreString); $('.feedback-text', $myDom).html(scoreString);
// Announce that the question set is complete
setTimeout(function () {
$('.qs-progress-announcer', $myDom)
.html(eparams.message + '.' +
scoreString + '.' +
eparams.comment + '.' +
eparams.resulttext)
.show().focus();
}, 0);
}
else {
// Remove buttons and feedback section
$('.qs-finishbutton, .qs-solutionbutton, .qs-retrybutton, .feedback-section', $myDom).remove();
}
self.trigger('resize');
}; };
if (params.endGame.showAnimations) { if (params.endGame.showAnimations) {
@ -400,7 +746,7 @@ H5P.QuestionSet = function (options, contentId) {
}); });
video.play(); video.play();
if (params.endGame.skipButtonText) { if (params.endGame.skippable) {
$('<a class="h5p-joubelui-button h5p-button skip">' + params.endGame.skipButtonText + '</a>').click(function () { $('<a class="h5p-joubelui-button h5p-button skip">' + params.endGame.skipButtonText + '</a>').click(function () {
video.pause(); video.pause();
$videoContainer.hide(); $videoContainer.hide();
@ -466,28 +812,27 @@ H5P.QuestionSet = function (options, contentId) {
// Listen for image resize // Listen for image resize
registerImageLoadedListener(question); registerImageLoadedListener(question);
// Add next/finish button // Add finish button
if (questionInstances[questionInstances.length -1] === question) {
// Add finish question set button
question.addButton('finish', params.texts.finishButton, question.addButton('finish', params.texts.finishButton,
moveQuestion.bind(this, 1), false); moveQuestion.bind(this, 1), false);
} else { // Add next button
question.addButton('next', '', moveQuestion.bind(this, 1),
// Add next question button !params.disableBackwardsNavigation || !!question.getAnswerGiven(), {
question.addButton('next', '', moveQuestion.bind(this, 1), true, {
href: '#', // Use href since this is a navigation button href: '#', // Use href since this is a navigation button
'aria-label': params.texts.nextButton 'aria-label': params.texts.nextButton
}); });
}
// Add previous question button // Add previous button
if (questionInstances[0] !== question) { question.addButton('prev', '', moveQuestion.bind(this, -1),
question.addButton('prev', '', moveQuestion.bind(this, -1), true, { !(questionInstances[0] === question || params.disableBackwardsNavigation), {
href: '#', // Use href since this is a navigation button href: '#', // Use href since this is a navigation button
'aria-label': params.texts.prevButton 'aria-label': params.texts.prevButton
}); });
// Hide next button if it is the last question
if(questionInstances[questionInstances.length -1] === question) {
question.hideButton('next');
} }
question.on('xAPI', function (event) { question.on('xAPI', function (event) {
@ -495,7 +840,8 @@ H5P.QuestionSet = function (options, contentId) {
if (shortVerb === 'interacted' || if (shortVerb === 'interacted' ||
shortVerb === 'answered' || shortVerb === 'answered' ||
shortVerb === 'attempted') { shortVerb === 'attempted') {
$('.progress-dot:eq(' + currentQuestion +')', $myDom).removeClass('unanswered').addClass('answered'); toggleAnsweredDot(currentQuestion,
questionInstances[currentQuestion].getAnswerGiven());
_updateButtons(); _updateButtons();
} }
if (shortVerb === 'completed') { if (shortVerb === 'completed') {
@ -503,13 +849,13 @@ H5P.QuestionSet = function (options, contentId) {
event.setVerb('answered'); event.setVerb('answered');
} }
if (event.data.statement.context.extensions === undefined) { if (event.data.statement.context.extensions === undefined) {
event.data.statement.context.extensions = []; event.data.statement.context.extensions = {};
} }
event.data.statement.context.extensions['http://id.tincanapi.com/extension/ending-point'] = currentQuestion + 1; event.data.statement.context.extensions['http://id.tincanapi.com/extension/ending-point'] = currentQuestion + 1;
}); });
if (question.getAnswerGiven()) {
$('.progress-dot:eq(' + i +')', $myDom).removeClass('unanswered').addClass('answered'); // Mark question if answered
} toggleAnsweredDot(i, question.getAnswerGiven());
} }
// Allow other libraries to add transitions after the questions have been inited // Allow other libraries to add transitions after the questions have been inited
@ -521,20 +867,63 @@ H5P.QuestionSet = function (options, contentId) {
_showQuestion(params.initialQuestion); _showQuestion(params.initialQuestion);
}); });
// Set event listeners. /**
$('.progress-dot', $myDom).click(function () { * Triggers changing the current question.
*
* @private
* @param {Object} [event]
*/
var handleProgressDotClick = function (event) {
// Disable dots when backward nav disabled
event.preventDefault();
if (params.disableBackwardsNavigation && !showingSolutions) {
return;
}
_stopQuestion(currentQuestion); _stopQuestion(currentQuestion);
_showQuestion($(this).index()); _showQuestion($(this).parent().index());
return false; };
// Set event listeners.
$('.progress-dot', $myDom).click(handleProgressDotClick).keydown(function (event) {
var $this = $(this);
switch (event.which) {
case 13: // Enter
case 32: // Space
handleProgressDotClick.call(this, event);
break;
case 37: // Left Arrow
case 38: // Up Arrow
// Go to previous dot
var $prev = $this.parent().prev();
if ($prev.length) {
$prev.children('a').attr('tabindex', '0').focus();
$this.attr('tabindex', '-1');
}
break;
case 39: // Right Arrow
case 40: // Down Arrow
// Go to next dot
var $next = $this.parent().next();
if ($next.length) {
$next.children('a').attr('tabindex', '0').focus();
$this.attr('tabindex', '-1');
}
break;
}
}); });
// Hide all but initial Question.
_showQuestion(params.initialQuestion);
_updateButtons(); // Hide all but current question
_showQuestion(currentQuestion, true);
if (renderSolutions) { if (renderSolutions) {
showSolutions(); showSolutions();
} }
// Update buttons in case they have changed (restored user state)
_updateButtons();
this.trigger('resize'); this.trigger('resize');
@ -551,7 +940,7 @@ H5P.QuestionSet = function (options, contentId) {
}; };
// Get total score possible for questionset. // Get total score possible for questionset.
this.totalScore = function () { this.getMaxScore = function () {
var score = 0; var score = 0;
for (var i = questionInstances.length - 1; i >= 0; i--) { for (var i = questionInstances.length - 1; i >= 0; i--) {
score += questionInstances[i].getMaxScore(); score += questionInstances[i].getMaxScore();
@ -559,6 +948,15 @@ H5P.QuestionSet = function (options, contentId) {
return score; return score;
}; };
/**
* @deprecated since version 1.9.2
* @returns {number}
*/
this.totalScore = function () {
return this.getMaxScore();
};
/** /**
* Gather copyright information for the current content. * Gather copyright information for the current content.
* *
@ -649,6 +1047,22 @@ H5P.QuestionSet = function (options, contentId) {
H5P.error(err); H5P.error(err);
} }
}; };
/**
* Returns the complete state of question set and sub-content
*
* @returns {Object} current state
*/
this.getCurrentState = function () {
return {
progress: showingSolutions ? questionInstances.length - 1 : currentQuestion,
answers: questionInstances.map(function (qi) {
return qi.getCurrentState();
}),
order: questionOrder,
poolOrder: poolOrder
};
};
}; };
H5P.QuestionSet.prototype = Object.create(H5P.EventDispatcher.prototype); H5P.QuestionSet.prototype = Object.create(H5P.EventDispatcher.prototype);

View File

@ -77,21 +77,55 @@
}, },
{ {
"label": "Label for jumping to a certain question", "label": "Label for jumping to a certain question",
"description": "You must use the placeholder '%d' instead of the question number.", "description": "You must use the placeholder '%d' instead of the question number, and %total instead of total amount of questions.",
"default": "Jump to question %d" "default": "Question %d of %total"
}, },
{ {
"label": "Copyright dialog question label", "label": "Copyright dialog question label",
"default": "Question" "default": "Question"
},
{
"label": "Readspeaker progress",
"description": "May use @current and @total question variables",
"default": "Question @current of @total"
},
{
"label": "Unanswered question text",
"default": "Unanswered"
},
{
"label": "Answered question text",
"default": "Answered"
},
{
"label": "Current question text",
"default": "Current question"
} }
] ]
}, },
{
"label": "Disable backwards navigation",
"description": "This option will only allow you to move forward in Question Set"
},
{
"label": "Randomize questions",
"description": "Enable to randomize the order of questions on display."
},
{
"label": "Number of questions to be shown:",
"description": "Create a randomized batch of questions from the total."
},
{ {
"label": "انتهاء المسابقة", "label": "انتهاء المسابقة",
"fields": [ "fields": [
{ {
"label": "عرض النتائج" "label": "عرض النتائج"
}, },
{
"label": "No results message",
"description": "Text displayed on end page when \"Display results\" is disabled",
"default": "Finished"
},
{ {
"label": "نص راس الملاحظات", "label": "نص راس الملاحظات",
"description": "سيتم عرض هذا العنوان في نهاية هذه المسابقة حيثما أجاب المستخدم على جميع الأسئلة المستعملة" "description": "سيتم عرض هذا العنوان في نهاية هذه المسابقة حيثما أجاب المستخدم على جميع الأسئلة المستعملة"

View File

@ -42,7 +42,7 @@
}, },
{ {
"label": "Prozent bearbeitet", "label": "Prozent bearbeitet",
"description": "Prozent der Gesamtpunkte sind notwendig, um das Quiz zu bestehen." "description": "Prozent der Gesamtpunkte sind notwendig um das Quiz zu bestehen."
}, },
{ {
"label": "Fragen", "label": "Fragen",
@ -77,34 +77,68 @@
}, },
{ {
"label": "Fortschrittstext", "label": "Fortschrittstext",
"description": "Verwendeter Text, wenn Text Fortschrittsanzeige gewählt wurde.", "description": "Verwendeter Text wenn Text Fortschrittsanzeige gewählt wurde.",
"default": "Aktuelle Frage: @current von @total Fragen" "default": "Aktuelle Frage: @current von @total Fragen"
}, },
{ {
"label": "Label, um zu einer bestimmten Frage zu springen", "label": "Label for jumping to a certain question",
"description": "Platzhalter '%d' anstatt der Fragenummer verwenden.", "description": "You must use the placeholder '%d' instead of the question number, and %total instead of total amount of questions.",
"default": "Zu Frage %d springen" "default": "Question %d of %total"
}, },
{ {
"label": "Copyright Frage", "label": "Copyright dialog question label",
"default": "Frage" "default": "Question"
},
{
"label": "Readspeaker progress",
"description": "May use @current and @total question variables",
"default": "Question @current of @total"
},
{
"label": "Unanswered question text",
"default": "Unanswered"
},
{
"label": "Answered question text",
"default": "Answered"
},
{
"label": "Current question text",
"default": "Current question"
} }
] ]
}, },
{
"label": "Disable backwards navigation",
"description": "This option will only allow you to move forward in Question Set"
},
{
"label": "Randomize questions",
"description": "Enable to randomize the order of questions on display."
},
{
"label": "Number of questions to be shown:",
"description": "Create a randomized batch of questions from the total."
},
{ {
"label": "Quiz beendet", "label": "Quiz beendet",
"fields": [ "fields": [
{ {
"label": "Ergebnisanzeige" "label": "Ergebnisanzeige"
}, },
{
"label": "No results message",
"description": "Text displayed on end page when \"Display results\" is disabled",
"default": "Finished"
},
{ {
"label": "Kopfzeile Feedback", "label": "Kopfzeile Feedback",
"default": "Dein Ergebnis:", "default": "Dein Ergebnis:",
"description": "Diese Kopfzeile wird am Ende des Quiz angezeigt, wenn der Benutzer alle Fragen beantwortet hat." "description": "diese Kopfzeile wird am Ende des Quiz angezeigt, wenn der Benutzer alle Fragen beantwortet hat."
}, },
{ {
"label": "Punkt Anzeige Text", "label": "Punkt Anzeige Text",
"description": "Dieser Text wird verwendet, um die Gesamtpunkte des Benutzers anzuzeigen. \"@score\" wird durch die errechneten Punkte ersetzt, \"@total\" wird durch die maximal erreichbaren Punkte ersetzt.", "description": "Dieser Text wird verwendet um die Gesamtpunkte des Benutzers anzuzeigen. \"@score\" wird durch die errechneten Punkte ersetzt, \"@total\" wird durch die maximal erreichbaren Punkte ersetzt.",
"default": "Du hast @score Punkte von @total möglichen." "default": "Du hast @score Punkte von @total möglichen."
}, },
{ {
@ -115,16 +149,16 @@
{ {
"label": "Bestanden Kommentar", "label": "Bestanden Kommentar",
"default": "Gut gemacht!", "default": "Gut gemacht!",
"description": "Dieser Kommentar wird nach den Punkten angezeigt, wenn der Benutzer das Quiz erfolgreich bestanden hat." "description": "dieser Kommentar wird nach den Punkten angezeigt, wenn der Benutzer das Quiz erfolgreich bestanden hat."
}, },
{ {
"label": "Quiz nicht bestanden Titel", "label": "Quiz nicht bestanden Titel",
"default": "Dieses Mal leider nicht bestanden.", "default": "Diese Mal hast du nicht bestanden.",
"description": "Dieser Text wird oberhalb der Punkte angezeigt, wenn der Benutzer das Quiz nicht bestanden hat." "description": "dieser Text wird oberhalb der Punkte angezeigt, wenn der Benutzer das Quiz nicht bestanden hat."
}, },
{ {
"label": "Nicht bestanden Kommentar", "label": "Nicht bestanden Kommentar",
"default": "Noch einmal versuchen!", "default": "Versuche es noch einmal!",
"description": "Dieser Kommentar wird nach den Punkten angezeigt, wenn der Benutzer das Quiz nicht bestanden hat." "description": "Dieser Kommentar wird nach den Punkten angezeigt, wenn der Benutzer das Quiz nicht bestanden hat."
}, },
{ {
@ -134,7 +168,7 @@
}, },
{ {
"label": "Wiederholen Button Beschriftung", "label": "Wiederholen Button Beschriftung",
"default": "Noch einmal versuchen", "default": "Versuch es nochmal",
"description": "Text für den Wiederholen Button." "description": "Text für den Wiederholen Button."
}, },
{ {
@ -145,10 +179,10 @@
"label": "Zeige Video vor den Quizergebnissen" "label": "Zeige Video vor den Quizergebnissen"
}, },
{ {
"label": "Aktiviere Video überspringen Button" "label": "Aktiviere Skip Video Button"
}, },
{ {
"label": "Video überspringen Button Beschriftung", "label": "Skip Video Button Beschriftung",
"default": "Überspringe Video" "default": "Überspringe Video"
}, },
{ {
@ -165,26 +199,26 @@
"label": "Einstellungen für \"Zeige die Lösung\" Button und \"Nochmal\".", "label": "Einstellungen für \"Zeige die Lösung\" Button und \"Nochmal\".",
"fields": [ "fields": [
{ {
"label": "Überschreiben des \"Lösung anzeigen\" Buttons", "label": "Override \"Show Solution\" button",
"description": "Diese Option legt fest, ob der \"Lösung anzeigen\" Button für alle Fragen angezeigt, deaktiviert oder für jede Frage individuell konfiguriert wird.", "description": "This option determines if the \"Show Solution\" button will be shown for all questions, disabled for all or configured for each question individually.",
"options": [ "options": [
{ {
"label": "Aktiviert" "label": "Enabled"
}, },
{ {
"label": "Deaktiviert" "label": "Disabled"
} }
] ]
}, },
{ {
"label": "Überschreiben des \"Wiederholen\" Buttons", "label": "Override \"Retry\" button",
"description": "Diese Option legt fest, ob der \"Wiederholen\" Button für alle Fragen angezeigt, deaktiviert oder für jede Frage individuell konfiguriert wird.", "description": "This option determines if the \"Retry\" button will be shown for all questions, disabled for all or configured for each question individually.",
"options": [ "options": [
{ {
"label": "Aktiviert" "label": "Enabled"
}, },
{ {
"label": "Deaktiviert" "label": "Disabled"
} }
] ]
} }

View File

@ -4,7 +4,7 @@
"label": "Introduction du Quiz ", "label": "Introduction du Quiz ",
"fields": [ "fields": [
{ {
"label": "Montrer l'introduction" "label": "Afficher l'introduction"
}, },
{ {
"label": "Titre", "label": "Titre",
@ -15,7 +15,8 @@
"description": "Ce texte sera affiché avant le démarrage du quiz." "description": "Ce texte sera affiché avant le démarrage du quiz."
}, },
{ {
"label": "Texte du bouton de démarrage" "label": "Texte du bouton de démarrage",
"default": "Commencer"
}, },
{ {
"label": "Image d'arrière-plan", "label": "Image d'arrière-plan",
@ -29,7 +30,7 @@
}, },
{ {
"label": "Indicateur de progression", "label": "Indicateur de progression",
"description": "Style de l'indicateur de progression de la série de questions", "description": "Style de l'indicateur de progression de la série de questions.",
"options": [ "options": [
{ {
"label": "Texte" "label": "Texte"
@ -41,7 +42,7 @@
}, },
{ {
"label": "Pourcentage de réussite", "label": "Pourcentage de réussite",
"description": "Pourcentage exigé pour la réussite du quiz." "description": "Pourcentage exigé pour considérer que le quiz est réussi."
}, },
{ {
"label": "Questions", "label": "Questions",
@ -60,116 +61,165 @@
} }
}, },
{ {
"label": "Interface des Textes dans le quiz", "label": "Textes de l'interface du quiz",
"fields": [ "fields": [
{ {
"label": "Bouton précédent" "label": "Bouton précédent",
"default": "Retour"
}, },
{ {
"label": "Bouton suivant" "label": "Bouton suivant",
"default": "Suite"
}, },
{ {
"label": "Bouton fin" "label": "Bouton fin",
"default": "Terminer"
}, },
{ {
"label": "Texte de progression", "label": "Texte de progression",
"description": "Texte utilisé si la progression textuelle est utilisée." "description": "Texte utilisé si la progression textuelle a été sélectionnée.",
"default": "Question @current sur @total"
}, },
{ {
"label": "Label for jumping to a certain question", "label": "Texte pour aller directement à une question",
"description": "You must use the placeholder '%d' instead of the question number.", "description": "Vous devez utiliser la variable '%d' à la place du numéro de la question et %total à la place du nombre total de questions.",
"default": "Jump to question %d" "default": "Question %d sur %total"
}, },
{ {
"label": "Copyright dialog question label", "label": "Texte de la question de la boîte de dialogue de copyright",
"default": "Question" "default": "Question"
},
{
"label": "Progression pour la synthèse vocale",
"description": "Vous pouvez utiliser les variables @current et @total",
"default": "Question @current sur @total"
},
{
"label": "Texte d'une question sans réponse",
"default": "Pas de réponse donnée"
},
{
"label": "Texte d'une question ayant reçu une réponse",
"default": "Réponse donnée"
},
{
"label": "Texte de la question en cours",
"default": "Question en cours"
} }
] ]
}, },
{ {
"label": "Quiz fini", "label": "Disable backwards navigation",
"fields": [ "description": "This option will only allow you to move forward in Question Set"
{
"label": "Montrer les résultats"
}, },
{ {
"label": "Feedback de fin", "label": "Randomize questions",
"description": "Ce texte sera affiché quand l'utilisateur aura totalement terminé le quiz." "description": "Enable to randomize the order of questions on display."
},
{
"label": "Number of questions to be shown:",
"description": "Create a randomized batch of questions from the total."
},
{
"label": "Quiz terminé",
"fields": [
{
"label": "Afficher les résultats"
},
{
"label": "Message si pas de résultats",
"description": "Texte affiché sur la page finale si l'option \"Afficher les résultats\" est désactivée.",
"default": "Terminé"
},
{
"label": "Titre des commentaires",
"default": "Vos résultats :",
"description": "Ce titre sera affiché à la fin du quiz quand l'utilisateur aura répondu à toutes les questions."
}, },
{ {
"label": "Texte d'affichage du score", "label": "Texte d'affichage du score",
"description": "Texte utilisé pour afficher le score total de l'utilisateur. \"@score\" sera remplacé par le score de l'utilisateur, \"@total\" sera remplacé par le score maximum possible." "description": "Texte utilisé pour afficher le score total de l'utilisateur. \"@score\" sera remplacé par le score de l'utilisateur, \"@total\" sera remplacé par le score maximum possible.",
"default": "Vous avez obtenu @score point(s) sur @total"
}, },
{ {
"label": "Texte de félicitation", "label": "Commentaire de félicitation",
"description": "Texte affiché lors du passage du quiz avec succès." "placeholder": "Bravo !",
"default": "Bravo !",
"description": "Ce commentaire sera affiché au-dessus du score de l'utilisateur si celui-ci réussit le quiz."
}, },
{ {
"label": "Commentaire de fin de quiz réussi", "label": "Commentaire en cas de succès",
"default": "Vous avez obtenu un très bon score !",
"description": "Commentaire affiché lors du passage du quiz avec succès." "description": "Commentaire affiché lors du passage du quiz avec succès."
}, },
{ {
"label": "Texte d'échec", "label": "Commentaire en cas d'échec",
"description": "Texte affiché lors de l'échec au quiz." "default": "Vous n'avez pas réussi ce questionnaire.",
"description": "Ce commentaire sera affiché au-dessus du score de l'utilisateur si celui-ci échoue au quiz."
}, },
{ {
"label": "Commentaire de fin de quiz échoué", "label": "Commentaire additionnel en cas d'échec",
"description": "Commentaire affiché lors de l'échec au quiz." "default": "Refaites un essai !",
"description": "Commentaire additionnel affiché lors de l'échec au quiz."
}, },
{ {
"label": "Texte du bouton Solution", "label": "Texte du bouton \"Solution\"",
"default": "Voir la solution",
"description": "Texte pour le bouton de solution." "description": "Texte pour le bouton de solution."
}, },
{ {
"label": "Texte du bouton Réessayer", "label": "Texte du bouton \"Recommencer\"",
"description": "Texte pour le bouton Réessayer." "default": "Recommencer",
"description": "Texte pour le bouton Recommencer."
}, },
{ {
"label": "Texte pour le bouton de fin" "label": "Texte pour le bouton de fin",
"default": "Terminer"
}, },
{ {
"label": "Montrer une vidéo avant l'affichage des résultats du quiz" "label": "Afficher une vidéo avant l'affichage des résultats du quiz"
}, },
{ {
"label": "Activer le bouton passer la vidéo" "label": "Activer le bouton \"Passer la vidéo\""
}, },
{ {
"label": "Texte du bouton passer la vidéo" "label": "Texte du bouton \"Passer la vidéo\"",
"default": "Passer la vidéo"
}, },
{ {
"label": "Video en cas de succès", "label": "Vidéo en cas de succès",
"description": "Vidéo affichée lors du passage du quiz avec succès." "description": "Vidéo affichée si l'utilisateur réussit le quiz."
}, },
{ {
"label": "Video en cas d'échec", "label": "Vidéo en cas d'échec",
"description": "Vidéo affichée lors de l'échec au quiz." "description": "Vidéo affichée si l'utilisateur échoue au quiz."
} }
] ]
}, },
{ {
"label": "Options pour les boutons \"Montrer la solution\" et \"Réessayer\".", "label": "Options pour les boutons \"Montrer la solution\" et \"Recommencer\".",
"fields": [ "fields": [
{ {
"label": "Override \"Show Solution\" button", "label": "Ecraser le bouton \"Voir la solution\"",
"description": "This option determines if the \"Show Solution\" button will be shown for all questions, disabled for all or configured for each question individually.", "description": "Cette option détermine si le bouton \"Voir la solution\" sera affiché pour toutes les questions, désactivé pour toutes ou configuré pour chaque question individuellement.",
"options": [ "options": [
{ {
"label": "Enabled" "label": "Activé"
}, },
{ {
"label": "Disabled" "label": "Désactivé"
} }
] ]
}, },
{ {
"label": "Override \"Retry\" button", "label": "Ecraser le bouton \"Recommencer\"",
"description": "This option determines if the \"Retry\" button will be shown for all questions, disabled for all or configured for each question individually.", "description": "Cette option détermine si le bouton \"Recommencer\" sera affiché pour toutes les questions, désactivé pour toutes ou configuré pour chaque question individuellement.",
"options": [ "options": [
{ {
"label": "Enabled" "label": "Activé"
}, },
{ {
"label": "Disabled" "label": "Désactivé"
} }
] ]
} }

View File

@ -77,21 +77,55 @@
}, },
{ {
"label": "Label for jumping to a certain question", "label": "Label for jumping to a certain question",
"description": "You must use the placeholder '%d' instead of the question number.", "description": "You must use the placeholder '%d' instead of the question number, and %total instead of total amount of questions.",
"default": "Jump to question %d" "default": "Question %d of %total"
}, },
{ {
"label": "Copyright dialog question label", "label": "Copyright dialog question label",
"default": "Question" "default": "Question"
},
{
"label": "Readspeaker progress",
"description": "May use @current and @total question variables",
"default": "Question @current of @total"
},
{
"label": "Unanswered question text",
"default": "Unanswered"
},
{
"label": "Answered question text",
"default": "Answered"
},
{
"label": "Current question text",
"default": "Current question"
} }
] ]
}, },
{
"label": "Disable backwards navigation",
"description": "This option will only allow you to move forward in Question Set"
},
{
"label": "Randomize questions",
"description": "Enable to randomize the order of questions on display."
},
{
"label": "Number of questions to be shown:",
"description": "Create a randomized batch of questions from the total."
},
{ {
"label": "Quiz terminato", "label": "Quiz terminato",
"fields": [ "fields": [
{ {
"label": "Visualizza risultati" "label": "Visualizza risultati"
}, },
{
"label": "No results message",
"description": "Text displayed on end page when \"Display results\" is disabled",
"default": "Finished"
},
{ {
"label": "Intestazione Feedback", "label": "Intestazione Feedback",
"description": "Questa intestazione verrà visualizzata alla fine del quiz, dopo che l'utente avrà risposto a tutte le domande." "description": "Questa intestazione verrà visualizzata alla fine del quiz, dopo che l'utente avrà risposto a tutte le domande."

View File

@ -79,21 +79,55 @@
}, },
{ {
"label": "Merkelapp ved hopping til spørsmål", "label": "Merkelapp ved hopping til spørsmål",
"description": "Du må bruke plassholderen '%d' istedenfor spørsmålsnummeret.", "description": "Du må bruke plassholderen '%d' istedenfor spørsmålsnummeret, og '%total' istedet for totalt antall spørsmål.",
"default": "Hopp til spørsmål %d" "default": "Spørsmål %d av %total"
}, },
{ {
"label": "Opphavsrett spørsmål-etikett", "label": "Opphavsrett spørsmål-etikett",
"default": "Spørsmål" "default": "Spørsmål"
},
{
"label": "Fremdriftstekst for hjelpemiddelteknologi",
"description": "Kan bruke @current og @total variabler",
"default": "Deloppgave @current av @total"
},
{
"label": "Ikke svart på spørsmål-tekst",
"default": "Ikke svart"
},
{
"label": "Svart på spørsmål-tekst",
"default": "Svar avgitt"
},
{
"label": "Aktivt spørsmål-tekst",
"default": "Aktivt spørsmål"
} }
] ]
}, },
{
"label": "Slå av bakoverknapp",
"description": "Slå på for å nekte å gå tilbake i Question Set"
},
{
"label": "Randomize questions",
"description": "Enable to randomize the order of questions on display."
},
{
"label": "Number of questions to be shown:",
"description": "Create a randomized batch of questions from the total."
},
{ {
"label": "Spørsmålssett avslutning", "label": "Spørsmålssett avslutning",
"fields": [ "fields": [
{ {
"label": "Vis resultater" "label": "Vis resultater"
}, },
{
"label": "Melding når resultater ikke vises",
"description": "Teksten vises på avslutnings-siden når resultater ikke vises",
"default": "Ferdig"
},
{ {
"label": "Overskrift over tilbakemeldinger", "label": "Overskrift over tilbakemeldinger",
"default": "Resultat:", "default": "Resultat:",
@ -126,7 +160,7 @@
}, },
{ {
"label": "Tekst til \"Fasit\" knapp", "label": "Tekst til \"Fasit\" knapp",
"default": "Gå gjennom fasit.", "default": "Gå gjennom fasit",
"description": "" "description": ""
}, },
{ {

View File

@ -79,21 +79,55 @@
}, },
{ {
"label": "Merkelapp ved hopping til spørsmål", "label": "Merkelapp ved hopping til spørsmål",
"description": "Du må bruke plassholderen '%d' istedenfor spørsmålstalet.", "description": "Du må bruke plassholderen '%d' istedenfor spørsmålsnummeret, og '%total' istedet for totalt antall spørsmål.",
"default": "Hopp til spørsmål %d" "default": "Spørsmål %d av %total"
}, },
{ {
"label": "Opphavsrett spørsmål-etikett", "label": "Opphavsrett spørsmål-etikett",
"default": "Spørsmål" "default": "Spørsmål"
},
{
"label": "Fremdriftstekst for hjelpemiddelteknologi",
"description": "Kan bruke @current og @total variabler",
"default": "Deloppgave @current av @total"
},
{
"label": "Ikke svart på spørsmål-tekst",
"default": "Ikke svart"
},
{
"label": "Svart på spørsmål-tekst",
"default": "Svar avgitt"
},
{
"label": "Aktivt spørsmål-tekst",
"default": "Aktivt spørsmål"
} }
] ]
}, },
{
"label": "Slå av bakoverknapp",
"description": "Slå på for å nekte å gå tilbake i Question Set"
},
{
"label": "Randomize questions",
"description": "Enable to randomize the order of questions on display."
},
{
"label": "Number of questions to be shown:",
"description": "Create a randomized batch of questions from the total."
},
{ {
"label": "Spørsmålssett avslutning", "label": "Spørsmålssett avslutning",
"fields": [ "fields": [
{ {
"label": "Vis resultat" "label": "Vis resultat"
}, },
{
"label": "Melding når resultater ikke vises",
"description": "Teksten vises på avslutnings-siden når resultater ikke vises",
"default": "Ferdig"
},
{ {
"label": "Overskrift over tilbakemeldingar", "label": "Overskrift over tilbakemeldingar",
"default": "Resultat:", "default": "Resultat:",

View File

@ -3,8 +3,8 @@
"description": "Put together a set of different questions that has to be solved. (Quiz)", "description": "Put together a set of different questions that has to be solved. (Quiz)",
"contentType": "question", "contentType": "question",
"majorVersion": 1, "majorVersion": 1,
"minorVersion": 8, "minorVersion": 10,
"patchVersion": 1, "patchVersion": 0,
"embedTypes": [ "embedTypes": [
"iframe" "iframe"
], ],
@ -41,7 +41,7 @@
{ {
"machineName": "H5P.Video", "machineName": "H5P.Video",
"majorVersion": 1, "majorVersion": 1,
"minorVersion": 2 "minorVersion": 3
}, },
{ {
"machineName": "H5P.JoubelUI", "machineName": "H5P.JoubelUI",
@ -53,7 +53,7 @@
{ {
"machineName": "H5PEditor.VerticalTabs", "machineName": "H5PEditor.VerticalTabs",
"majorVersion": 1, "majorVersion": 1,
"minorVersion": 1 "minorVersion": 2
}, },
{ {
"machineName": "H5PEditor.QuestionSetTextualEditor", "machineName": "H5PEditor.QuestionSetTextualEditor",

View File

@ -110,11 +110,12 @@
"label": "Question type", "label": "Question type",
"description": "Library for this question.", "description": "Library for this question.",
"options": [ "options": [
"H5P.MultiChoice 1.6", "H5P.MultiChoice 1.8",
"H5P.DragQuestion 1.5", "H5P.DragQuestion 1.7",
"H5P.Blanks 1.5", "H5P.Blanks 1.7",
"H5P.MarkTheWords 1.5", "H5P.MarkTheWords 1.6",
"H5P.DragText 1.4" "H5P.DragText 1.5",
"H5P.TrueFalse 1.0"
] ]
} }
}, },
@ -157,17 +158,65 @@
"name": "jumpToQuestion", "name": "jumpToQuestion",
"type": "text", "type": "text",
"label": "Label for jumping to a certain question", "label": "Label for jumping to a certain question",
"description": "You must use the placeholder '%d' instead of the question number.", "description": "You must use the placeholder '%d' instead of the question number, and %total instead of total amount of questions.",
"default": "Jump to question %d" "default": "Question %d of %total"
}, },
{ {
"name": "questionLabel", "name": "questionLabel",
"type": "text", "type": "text",
"label": "Copyright dialog question label", "label": "Copyright dialog question label",
"default": "Question" "default": "Question"
},
{
"name": "readSpeakerProgress",
"type": "text",
"label": "Readspeaker progress",
"description": "May use @current and @total question variables",
"default": "Question @current of @total"
},
{
"name": "unansweredText",
"type": "text",
"label": "Unanswered question text",
"default": "Unanswered"
},
{
"name": "answeredText",
"type": "text",
"label": "Answered question text",
"default": "Answered"
},
{
"name": "currentQuestionText",
"type": "text",
"label": "Current question text",
"default": "Current question"
} }
] ]
}, },
{
"name": "disableBackwardsNavigation",
"type": "boolean",
"label": "Disable backwards navigation",
"description": "This option will only allow you to move forward in Question Set",
"optional": true,
"default": false
},
{
"name": "randomQuestions",
"type": "boolean",
"label": "Randomize questions",
"description": "Enable to randomize the order of questions on display.",
"default": false
},
{
"name": "poolSize",
"type": "number",
"min": 1,
"label": "Number of questions to be shown:",
"description": "Create a randomized batch of questions from the total.",
"optional": true
},
{ {
"name": "endGame", "name": "endGame",
"type": "group", "type": "group",
@ -179,6 +228,14 @@
"label": "Display results", "label": "Display results",
"default": true "default": true
}, },
{
"name": "noResultMessage",
"type": "text",
"label": "No results message",
"description": "Text displayed on end page when \"Display results\" is disabled",
"default": "Finished",
"optional": true
},
{ {
"name": "message", "name": "message",
"type": "text", "type": "text",
@ -196,7 +253,7 @@
"type": "text", "type": "text",
"label": "Score display text", "label": "Score display text",
"description": "Text used to display Total user score. \"@score\" will be replaced by calculated score, \"@total\" will be replaced by maximum possible score. ", "description": "Text used to display Total user score. \"@score\" will be replaced by calculated score, \"@total\" will be replaced by maximum possible score. ",
"default": "@score of @total points", "default": "You got @score of @total points",
"optional": true "optional": true
}, },
{ {
@ -262,7 +319,7 @@
"name": "solutionButtonText", "name": "solutionButtonText",
"type": "text", "type": "text",
"label": "Solution button label", "label": "Solution button label",
"default": "Solution", "default": "Show solution",
"description": "Text for the solution button." "description": "Text for the solution button."
}, },
{ {