diff --git a/js/questionset.js b/js/questionset.js index ae0442b..c784991 100644 --- a/js/questionset.js +++ b/js/questionset.js @@ -98,7 +98,8 @@ H5P.QuestionSet = function (options, contentId) { overrideButtons: false, overrideShowSolutionButton: false, overrideRetry: false - } + }, + questionLabel: 'Question' }; var template = new EJS({text: texttemplate}); @@ -106,7 +107,7 @@ H5P.QuestionSet = function (options, contentId) { var params = $.extend(true, {}, defaults, options); var currentQuestion = 0; - var questionInstances = new Array(); + var questionInstances = []; var $myDom; renderSolutions = false; @@ -364,8 +365,7 @@ H5P.QuestionSet = function (options, contentId) { } }); if (question.getAnswerGiven()) { - $('.progress-dot:eq(' + i +')' - , $myDom).removeClass('unanswered').addClass('answered'); + $('.progress-dot:eq(' + i +')', $myDom).removeClass('unanswered').addClass('answered'); } } @@ -399,7 +399,7 @@ H5P.QuestionSet = function (options, contentId) { if (renderSolutions) { showSolutions(); } - + this.trigger('resize'); return this; @@ -439,20 +439,40 @@ H5P.QuestionSet = function (options, contentId) { } // Questions + var questionCopyrights; for (var i = 0; i < questionInstances.length; i++) { - var questionInstance = questionInstances[i]; - if (questionInstance.getCopyrights !== undefined) { - var rights = questionInstance.getCopyrights(); - if (rights !== undefined) { - rights.setLabel('Question '+(i+1)); - info.addContent(rights); - } + var instance = questionInstances[i]; + var qParams = params.questions[i].params; + questionCopyrights = undefined; + + if (instance.getCopyrights !== undefined) { + // Use the instance's own copyright generator + questionCopyrights = instance.getCopyrights(); } + if (questionCopyrights === undefined) { + // Create a generic flat copyright list + questionCopyrights = new H5P.ContentCopyrights(); + H5P.findCopyrights(questionCopyrights, qParams, contentId); + } + + // Determine label + var label = (params.questionLabel + ' ' + (i + 1)); + if (qParams.contentName !== undefined) { + label += ': ' + qParams.contentName; + } + else if (instance.getTitle !== undefined) { + label += ': ' + instance.getTitle(); + } + questionCopyrights.setLabel(label); + + // Add info + info.addContent(questionCopyrights); } // Success video + var video; if (params.endGame.successVideo !== undefined && params.endGame.successVideo.length > 0) { - var video = params.endGame.successVideo[0]; + video = params.endGame.successVideo[0]; if (video.copyright !== undefined) { info.addMedia(new H5P.MediaCopyright(video.copyright)); } @@ -473,7 +493,7 @@ H5P.QuestionSet = function (options, contentId) { }; this.showSolutions = function() { renderSolutions = true; - } + }; }; H5P.QuestionSet.prototype = Object.create(H5P.EventDispatcher.prototype); -H5P.QuestionSet.prototype.constructor = H5P.QuestionSet; \ No newline at end of file +H5P.QuestionSet.prototype.constructor = H5P.QuestionSet; diff --git a/language/ar.json b/language/ar.json index e5b357f..55032b7 100644 --- a/language/ar.json +++ b/language/ar.json @@ -154,6 +154,10 @@ "description": "تفعيل هذا الخيار يجعل المستخدم قادرا على \"إعادة المحاولة\"" } ] + }, + { + "label": "Question label text", + "default": "Question" } ] } diff --git a/language/it.json b/language/it.json index 9f20c35..42f76ea 100644 --- a/language/it.json +++ b/language/it.json @@ -154,6 +154,10 @@ "description": "L'attivazione di questa opzione far� in modo che per l'utente sia abilitata l'opzione \"Riprova\"." } ] + }, + { + "label": "Question label text", + "default": "Question" } ] -} \ No newline at end of file +} diff --git a/language/nb.json b/language/nb.json index c731683..b97ce56 100644 --- a/language/nb.json +++ b/language/nb.json @@ -161,6 +161,10 @@ "description": "Aktivering vil slå på \"Prøv igjen\" ." } ] + }, + { + "label": "Spørsmål-etikett", + "default": "Spørsmål" } ] } diff --git a/language/nn.json b/language/nn.json index 667389e..7bda071 100644 --- a/language/nn.json +++ b/language/nn.json @@ -161,6 +161,10 @@ "description": "Aktivering vil slå på \"Prøv igjen\" ." } ] + }, + { + "label": "Spørsmål-etikett", + "default": "Spørsmål" } ] } diff --git a/semantics.json b/semantics.json index 2ddc479..a83cdc9 100644 --- a/semantics.json +++ b/semantics.json @@ -324,5 +324,11 @@ "default": false } ] + }, + { + "name": "questionLabel", + "type": "text", + "label": "Question label text", + "default": "Question" } ]