From 20e133b4414a296951502ea98c9db81fe815f5c9 Mon Sep 17 00:00:00 2001 From: Frode Petterson Date: Fri, 19 Jun 2015 15:40:35 +0200 Subject: [PATCH 1/7] Get generic copyrights from content types that doesnt implement getCopyrights. --- js/questionset.js | 50 +++++++++++++++++++++++++++++++++-------------- semantics.json | 6 ++++++ 2 files changed, 41 insertions(+), 15 deletions(-) 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/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" } ] From e090c9444423a3a2528a1c46924d3bf6fde095c8 Mon Sep 17 00:00:00 2001 From: Frode Petterson Date: Mon, 22 Jun 2015 13:51:30 +0200 Subject: [PATCH 2/7] Translations. --- language/ar.json | 4 ++++ language/it.json | 6 +++++- language/nb.json | 4 ++++ language/nn.json | 4 ++++ 4 files changed, 17 insertions(+), 1 deletion(-) 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" } ] } From 997db862e798bb3e15d0a9810d483ae8c49b7d6c Mon Sep 17 00:00:00 2001 From: Paal Joergensen Date: Mon, 22 Jun 2015 14:22:25 +0200 Subject: [PATCH 3/7] Bump --- library.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/library.json b/library.json index a3ca89d..0634561 100644 --- a/library.json +++ b/library.json @@ -3,7 +3,7 @@ "contentType": "question", "majorVersion": 1, "minorVersion": 4, - "patchVersion": 0, + "patchVersion": 1, "embedTypes": [ "iframe" ], @@ -55,4 +55,4 @@ "minorVersion": 0 } ] -} +} \ No newline at end of file From 3f0c1ee0bf184d369a4764f26d6ff8f7479e7207 Mon Sep 17 00:00:00 2001 From: Svein-Tore Griff With Date: Mon, 22 Jun 2015 14:49:16 +0200 Subject: [PATCH 4/7] bump --- library.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/library.json b/library.json index a3ca89d..0634561 100644 --- a/library.json +++ b/library.json @@ -3,7 +3,7 @@ "contentType": "question", "majorVersion": 1, "minorVersion": 4, - "patchVersion": 0, + "patchVersion": 1, "embedTypes": [ "iframe" ], @@ -55,4 +55,4 @@ "minorVersion": 0 } ] -} +} \ No newline at end of file From 02d358542536d806fb10bd73359ebbc5f1bb2502 Mon Sep 17 00:00:00 2001 From: Thomas Marstrander Date: Wed, 8 Jul 2015 11:01:20 +0200 Subject: [PATCH 5/7] Resize on video loaded and when results are already rendered. (cherry picked from commit b02fe7c) --- js/questionset.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/js/questionset.js b/js/questionset.js index c784991..6554bdf 100644 --- a/js/questionset.js +++ b/js/questionset.js @@ -235,6 +235,7 @@ H5P.QuestionSet = function (options, contentId) { var _displayEndGame = function () { if (rendered) { $myDom.children().hide().filter('.questionset-results').show(); + self.trigger('resize'); return; } //Remove old score screen. @@ -306,6 +307,10 @@ H5P.QuestionSet = function (options, contentId) { } }); video.attach($videoContainer); + // Resize on video loaded + video.on('loaded', function () { + self.trigger('resize'); + }); video.play(); if (params.endGame.skipButtonText) { From 18e21683837420854243c17bea9f228369d2e31b Mon Sep 17 00:00:00 2001 From: Frode Petterson Date: Wed, 8 Jul 2015 15:27:16 +0200 Subject: [PATCH 6/7] Added missing translation. --- language/nb.json | 5 +++++ language/nn.json | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/language/nb.json b/language/nb.json index b97ce56..023a101 100644 --- a/language/nb.json +++ b/language/nb.json @@ -120,6 +120,11 @@ "default": "Vis fasit", "description": "" }, + { + "label": "Tekst til \"Prøv igjen\" knapp", + "default": "Prøv igjen", + "description": "" + }, { "label": "Tekst til \"Avslutt\" knapp", "default": "Avslutt" diff --git a/language/nn.json b/language/nn.json index 7bda071..106be80 100644 --- a/language/nn.json +++ b/language/nn.json @@ -120,6 +120,11 @@ "default": "Vis fasit", "description": "" }, + { + "label": "Tekst til \"Prøv igjen\" knapp", + "default": "Prøv igjen", + "description": "" + }, { "label": "Tekst til \"Avslutt\" knapp", "default": "Avslutt" From d38867bfd008ada40d8ab297a43cdf84c327ec5c Mon Sep 17 00:00:00 2001 From: Svein-Tore Griff With Date: Thu, 9 Jul 2015 15:19:18 +0200 Subject: [PATCH 7/7] bump --- library.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library.json b/library.json index 0634561..2f96968 100644 --- a/library.json +++ b/library.json @@ -3,7 +3,7 @@ "contentType": "question", "majorVersion": 1, "minorVersion": 4, - "patchVersion": 1, + "patchVersion": 2, "embedTypes": [ "iframe" ],