From 31780324ff2cb506c8112ef50183e1d7a2145081 Mon Sep 17 00:00:00 2001 From: Thomas Horn Sivertsen Date: Tue, 27 Mar 2018 16:20:35 +0200 Subject: [PATCH 01/15] Added/modified calculation of max score --- presave.js | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 presave.js diff --git a/presave.js b/presave.js new file mode 100644 index 0000000..dca68e5 --- /dev/null +++ b/presave.js @@ -0,0 +1,33 @@ +var H5PPresave = H5PPresave || {}; + +H5PPresave['H5P.QuestionSet'] = function (content, finished) { + var presave = H5PEditor.Presave; + + if (isContentInValid()) { + throw new presave.exceptions.InvalidContentSemanticsException('Invalid Question Set Error') + } + + var score = content.questions + .filter(function (action) { + return action.hasOwnProperty('library') && action.hasOwnProperty('params'); + }) + .map(function (action) { + return (new presave).process(action.library, action.params).maxScore; + }) + .reduce(function (currentScore, scoreToAdd) { + if (presave.isInt(scoreToAdd)) { + currentScore += scoreToAdd; + } + return currentScore; + }, 0); + + presave.validateScore(score); + + if (finished) { + finished({maxScore: score}); + } + + function isContentInValid() { + return !presave.checkNestedRequirements(content, 'content.questions') || !Array.isArray(content.questions); + } +}; From 4a2d83086f9cc9b44b8f53c1daddddc58b3bf9f0 Mon Sep 17 00:00:00 2001 From: Thomas Horn Sivertsen Date: Wed, 28 Mar 2018 11:44:54 +0200 Subject: [PATCH 02/15] Added JSDoc --- presave.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/presave.js b/presave.js index dca68e5..6727b1e 100644 --- a/presave.js +++ b/presave.js @@ -1,5 +1,12 @@ var H5PPresave = H5PPresave || {}; +/** + * Resolve the presave logic for the content type Question Set + * + * @param {object} content + * @param finished + * @constructor + */ H5PPresave['H5P.QuestionSet'] = function (content, finished) { var presave = H5PEditor.Presave; @@ -27,6 +34,10 @@ H5PPresave['H5P.QuestionSet'] = function (content, finished) { finished({maxScore: score}); } + /** + * Check if required parameters is present + * @return {boolean} + */ function isContentInValid() { return !presave.checkNestedRequirements(content, 'content.questions') || !Array.isArray(content.questions); } From fbc77c7d85ea14d57485a7f8c197da057e1cc025 Mon Sep 17 00:00:00 2001 From: Frode Petterson Date: Mon, 11 Jun 2018 09:48:32 +0200 Subject: [PATCH 03/15] Update French translations. Big thanks to knowledgeplaces --- language/fr.json | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/language/fr.json b/language/fr.json index fabef16..766e875 100644 --- a/language/fr.json +++ b/language/fr.json @@ -68,12 +68,12 @@ "default": "Retour" }, { - "label": "Bouton suivant", - "default": "Suite" + "label": "Bouton Suivant", + "default": "Suivant" }, { - "label": "Bouton fin", - "default": "Confirmer" + "label": "Bouton Fin", + "default": "Terminer" }, { "label": "Texte de progression", @@ -110,15 +110,15 @@ }, { "label": "Désactiver la possibilité de naviguer en arrière", - "description": "Cette option ne permettra plus que la navigation en avant au sein du module Question Set" + "description": "Cette option ne permettra plus que la navigation en avant au sein du module Question Set." }, { - "label": "Afficher les question dans un ordre aléatoire", - "description": "Les réponses possibles seront affichées dans l'ordre aléatoire." + "label": "Afficher les questions dans un ordre aléatoire", + "description": "Activer pour choisir aléatoirement l'ordre des questions à l'affichage." }, { "label": "Nombre de questions à afficher:", - "description": "Génère aléatoire un jeu de question parmi toutes les questions disponibles." + "description": "Génère aléatoirement un jeu de questions parmi toutes les questions disponibles." }, { "label": "Quiz terminé", @@ -127,7 +127,7 @@ "label": "Afficher les résultats" }, { - "label": "Display solution button" + "label": "Afficher le bouton \"Solution\"." }, { "label": "Message si pas de résultats", @@ -145,21 +145,21 @@ { "widgets": [ { - "label": "Default" + "label": "Par défaut" } ], - "label": "Define custom feedback for any score range", - "description": "Example: 0-20% Bad score, 21-91% Average Score, 91-100% Great Score!", - "entity": "range", + "label": "Définir un retour personnalisé pour chaque tranche de score", + "description": "Exemple: 0-20% Score insuffisant, 21-91% Score moyen, 91-100% Bon score!", + "entity": "tranche", "field": { "fields": [ { - "label": "Score Range" + "label": "Tranche de score" }, {}, { - "label": "Feedback for defined score range", - "placeholder": "Fill in the feedback" + "label": "Retour pour cette tranche de score", + "placeholder": "Entrer le message de retour" } ] } @@ -199,7 +199,7 @@ }, { "label": "Texte pour le bouton de fin", - "default": "Confirmer" + "default": "Terminer" }, { "label": "Afficher une vidéo avant l'affichage des résultats du quiz" @@ -225,11 +225,11 @@ "label": "Options pour les boutons \"Montrer la solution\" et \"Recommencer\".", "fields": [ { - "label": "Show \"Check\" buttons", - "description": "This option determines if the \"Check\" button will be shown for all questions." + "label": "Montrer les boutons \"Vérifier\"", + "description": "Cette option determine si le bouton \"Vérifier\" va apparaître pour toutes les questions." }, { - "label": "Ecraser le bouton \"Voir la correction\"", + "label": "Cacher le bouton \"Voir la correction\"", "description": "Cette option détermine si le bouton \"Voir la correction\" sera affiché pour toutes les questions, désactivé pour toutes ou configuré pour chaque question individuellement.", "options": [ { @@ -241,7 +241,7 @@ ] }, { - "label": "Ecraser le bouton \"Recommencer\"", + "label": "Cacher le bouton \"Recommencer\"", "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": [ { From a3e42ed36c11132f9af3f73a4fba718e186792ae Mon Sep 17 00:00:00 2001 From: Frode Petterson Date: Mon, 11 Jun 2018 10:27:52 +0200 Subject: [PATCH 04/15] Update translations --- language/he.json | 2 +- language/nb.json | 2 +- language/nn.json | 2 +- language/zh-tw.json | 2 +- language/zh.json | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/language/he.json b/language/he.json index e3cc8d3..8b98bfe 100644 --- a/language/he.json +++ b/language/he.json @@ -255,4 +255,4 @@ ] } ] -} +} \ No newline at end of file diff --git a/language/nb.json b/language/nb.json index 9854940..9343317 100644 --- a/language/nb.json +++ b/language/nb.json @@ -255,4 +255,4 @@ ] } ] -} +} \ No newline at end of file diff --git a/language/nn.json b/language/nn.json index 038840f..b7057f0 100644 --- a/language/nn.json +++ b/language/nn.json @@ -255,4 +255,4 @@ ] } ] -} +} \ No newline at end of file diff --git a/language/zh-tw.json b/language/zh-tw.json index 29ac832..660b0e6 100644 --- a/language/zh-tw.json +++ b/language/zh-tw.json @@ -255,4 +255,4 @@ ] } ] -} +} \ No newline at end of file diff --git a/language/zh.json b/language/zh.json index 26712ea..8b7c629 100644 --- a/language/zh.json +++ b/language/zh.json @@ -255,4 +255,4 @@ ] } ] -} +} \ No newline at end of file From afddfc8491ebd4dc256c5de0a02347579b99027b Mon Sep 17 00:00:00 2001 From: Oliver Tacke Date: Thu, 21 Jun 2018 18:03:21 +0200 Subject: [PATCH 05/15] Fix German language I have not checked what went wrong when, but the translation was badly screwed. Strange that nobody reported this before. --- language/de.json | 74 ++++++++++++++++++++++++------------------------ 1 file changed, 37 insertions(+), 37 deletions(-) diff --git a/language/de.json b/language/de.json index ad2f099..8063ec8 100644 --- a/language/de.json +++ b/language/de.json @@ -124,42 +124,42 @@ "label": "Quiz beendet", "fields": [ { - "label": "Ergebnisanzeige" + "label": "Ergebnisse anzeigen" }, { - "label": "Hinweis bei keinen Ergebnissen" + "label": "Den \"Lösung zeigen\"-Button anzeigen" }, { - "label": "Kopfzeile für die Rückmeldungen", - "description": "diese Kopfzeile wird am Ende des Quizzes angezeigt, wenn der Nutzer alle Fragen beantwortet hat.", - "default": "Dein Ergebnis:" + "label": "Nachricht bei keinen Ergebnissen", + "description": "Text, der auf der Endseite angezeigt wird, wenn \"Lösung zeigen\" deaktiviert ist", + "default": "Beendet" }, { - "label": "Text für die Punkteanzeige", - "default": "Du hast @score Punkte von @total möglichen.", - "description": "Dieser Text wird verwendet, um die Gesamtpunkte des Nutzers anzuzeigen. \"@score\" wird durch die errechnete Punktzahl ersetzt, \"@total\" wird durch die maximal erreichbare Punktzahl ersetzt." + "label": "Überschrift für die Rückmeldung", + "default": "Dein Ergebnis:", + "description": "Diese Überschrift wird am Ende angezeigt, wenn alle Fragen beantwortet wurden." }, { - "label": "Hintergrunddeckkraft für bewegliche Elemente", + "label": "Rückmeldungen insgesamt", "fields": [ { "widgets": [ { - "label": "Default" + "label": "Vorgabe" } ], - "label": "Benutzerdefinierte Rückmeldung für jeden Punkte-Bereich definieren", - "description": "Example: 0-20% Bad score, 21-91% Average Score, 91-100% Great Score!", - "entity": "Bereich", + "label": "Lege individuelle Rückmeldungen für Punktebereiche fest", + "description": "Beispiel: 0-20 % Schlechte Punktzahk, 21-91 % Durchschnittliche Punktzahl, 91-100 % Hervorragende Punktzahl!", + "entity": "bereich", "field": { "fields": [ { - "label": "Punkte-Bereich" + "label": "Punktebereich" }, {}, { - "label": "Feedback for defined score range", - "placeholder": "Fill in the feedback" + "label": "Rückmeldung für den Punktebereich", + "placeholder": "Trage die Rückmeldung ein" } ] } @@ -167,8 +167,12 @@ ] }, { - "label": "Old Feedback", + "label": "Alte Rückmeldung", "fields": [ + { + "label": "Kopfzeile für bestandenes Quiz", + "description": "Dieser Text wird oberhalb der Punkte angezeigt, wenn der Nutzer das Quiz nicht bestanden hat." + }, { "label": "Kommentar für bestandenes Quiz", "description": "Dieser Kommentar wird nach den Punkten angezeigt, wenn der Nutzer das Quiz erfolgreich bestanden hat." @@ -180,53 +184,49 @@ { "label": "Kommentar für nicht bestandenes Quiz", "description": "Dieser Kommentar wird nach den Punkten angezeigt, wenn der Nutzer das Quiz nicht bestanden hat." - }, - { - "label": "Beschriftung des \"Lösung zeigen\"-Buttons", - "description": "Beschriftung des \"Lösung zeigen\"-Buttons" } ] }, + { + "label": "Beschriftung des \"Lösung zeigen\"-Buttons", + "default": "Lösung zeigen", + "description": "Beschriftung des \"Lösung zeigen\"-Buttons" + }, { "label": "Beschriftung des \"Wiederholen\"-Buttons", - "default": "Lösung anzeigen", + "default": "Wiederholen", "description": "Beschriftung des \"Wiederholen\"-Buttons" }, { "label": "Beschriftung des \"Beenden\"-Buttons", - "default": "Wiederholen", - "description": "Text for the retry button." + "default": "Beenden" }, { - "label": "Schaltflächentext Beenden", - "default": "Beenden" + "label": "Zeige ein Video vor den Ergebnissen an" }, { "label": "Aktiviere \"Video überspringen\"-Button" }, { - "label": "Beschriftung des \"Video überspringen\"-Buttons" + "label": "Beschriftung des \"Video überspringen\"-Buttons", + "default": "Video überspringen" }, { "label": "Bestanden-Video", - "default": "Skip video" + "description": "Dieses Video wird angezeigt, wenn der Nutzer das Quiz bestanden hat." }, { "label": "Nicht-bestanden-Video", "description": "Dieses Video wird angezeigt, wenn der Nutzer das Quiz nicht bestanden hat." - }, - { - "label": "Fail video", - "description": "This video will be played if the user failes the quiz." } ] }, { - "label": "Einstellungen für \"Lösung zeigen\"-Button und \"Nochmal\".", + "label": "Einstellungen für \"Lösung zeigen\"-Button und \"Wiederholen\"-Button", "fields": [ { - "label": "Show \"Check\" buttons", - "description": "This option determines if the \"Check\" button will be shown for all questions." + "label": "Zeige den \"Überprüfen\"-Button", + "description": "Diese Option legt fest, ob der \"Überprüfen\"-Button für alle Fragen angezeigt wird." }, { "label": "Überschreiben des \"Lösungen anzeigen\"-Buttons", @@ -241,7 +241,7 @@ ] }, { - "label": "Überschreiben des \"Wiederholen\"-Buttons", + "label": "berschreiben des \"Wiederholen\"-Buttons", "description": "Diese Option gibt an, ob der \"Wiederholen\" Button für alle Fragen angezeigt, ausgeblendet oder für jede Frage individuell konfiguriert wird.", "options": [ { @@ -255,4 +255,4 @@ ] } ] -} \ No newline at end of file +} From 345c39e9ca1f808b58ba1fac28bb1b87805e4e63 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Breedveld?= Date: Thu, 28 Jun 2018 10:24:42 +0200 Subject: [PATCH 06/15] Update nl.json Dutch translations added --- language/nl.json | 178 +++++++++++++++++++++++------------------------ 1 file changed, 89 insertions(+), 89 deletions(-) diff --git a/language/nl.json b/language/nl.json index 5fb8e9e..9358f9c 100644 --- a/language/nl.json +++ b/language/nl.json @@ -1,51 +1,51 @@ { "semantics": [ { - "label": "Quiz introduction", + "label": "Quiz introductie", "fields": [ { - "label": "Display introduction" + "label": "Toon de introductie" }, { "label": "Titel", - "description": "This title will be displayed above the introduction text." + "description": "Deze titel zal boven de inleidende tekst worden getoond." }, { "label": "Inleidende tekst", - "description": "This text will be displayed before the quiz starts." + "description": "Deze tekst zal worden getoond voordat de quiz begint." }, { - "label": "Start button text", - "default": "Start Quiz" + "label": "Tekst van de startknop", + "default": "Start" }, { "label": "Achtergrondafbeelding", - "description": "An optional background image for the introduction." + "description": "Een optionele achtergrondafbeelding voor de introductie." } ] }, { "label": "Achtergrondafbeelding", - "description": "An optional background image for the Question set." + "description": "Een optionele achtergrondafbeelding voor de vragenreeks." }, { - "label": "Progress indicator", - "description": "Question set progress indicator style.", + "label": "Voortgangsindicator", + "description": "Lay-out voortgangsindicator van de vragenreeks.", "options": [ { - "label": "Tekstueel" + "label": "Tekst" }, { - "label": "Dots" + "label": "Punten" } ] }, { "label": "Slagingspercentage", - "description": "Percentage van de Totale score die vereist is om te slagen." + "description": "Percentage van de totale score dat vereist is om te slagen." }, { - "label": "Questions", + "label": "Vragen", "widgets": [ { "label": "Standaard" @@ -54,112 +54,112 @@ "label": "Tekstueel" } ], - "entity": "question", + "entity": "vraag", "field": { - "label": "Question type", - "description": "Library for this question." + "label": "Type vraag", + "description": "Bibliotheek voor deze vraag." } }, { - "label": "Interface texts in quiz", + "label": "Interface teksten in de quiz", "fields": [ { - "label": "Terugknop", - "default": "Previous question" + "label": "Vorige-knop", + "default": "Vorige vraag" }, { - "label": "Next button", - "default": "Next question" + "label": "Volgende-knop", + "default": "Volgende vraag" }, { - "label": "Finish button", - "default": "Beëindigen" + "label": "Beëindigings-knop", + "default": "Klaar" }, { "label": "Tekst bij voortgang", - "description": "Text used if textual progress is selected.", - "default": "Question: @current of @total questions" + "description": "Deze tekst wordt gebruikt als 'Tekst' als voortgangsindicator is geselecteerd.", + "default": "Vraag: @current van @total vragen" }, { - "label": "Label for jumping to a certain question", - "description": "You must use the placeholder '%d' instead of the question number, and %total instead of total amount of questions.", - "default": "Question %d of %total" + "label": "Label voor naar een bepaalde vraag te springen", + "description": "Je moet de plaatsaanduiding '%d' gebruiken in plaats van het vraagnummer, en %total in plaats van het totaal aantal vragen.", + "default": "Vraag %d van %total" }, { - "label": "Copyright dialog question label", + "label": "Label van copyright dialoogvraag", "default": "Vraag" }, { - "label": "Readspeaker progress", - "description": "May use @current and @total question variables", - "default": "Question @current of @total" + "label": "Readspeaker voortgang", + "description": "Je mag @current gebruiken en @total als vraagvariabelen", + "default": "Vraag @current van @total" }, { - "label": "Unanswered question text", - "default": "Unanswered" + "label": "Tekst van de onbeantwoorde vraag", + "default": "Onbeantwoord" }, { - "label": "Answered question text", - "default": "Answered" + "label": "Tekst van de beantwoorde vraag", + "default": "Beantwoord" }, { - "label": "Current question text", - "default": "Current question" + "label": "Tekst van de huidige vraag", + "default": "Huidige vraag" } ] }, { "label": "Achteruit navigeren uitschakelen", - "description": "This option will only allow you to move forward in Question Set" + "description": "Deze optie staat je alleen toe voorwaarts te navigeren in de vragenreeks" }, { - "label": "Randomize questions", + "label": "Vragen willekeurig indelen", "description": "Vragen in willekeurige volgorde inschakelen." }, { - "label": "Number of questions to be shown:", - "description": "Create a randomized batch of questions from the total." + "label": "Het aantal te tonen vragen:", + "description": "Creëer een willekeurig aantal vragen van het totaal." }, { - "label": "Quiz finished", + "label": "Quiz voltooid", "fields": [ { - "label": "Display results" + "label": "Toon de resultaten" }, { - "label": "Display solution button" + "label": "Toon de oplossings-knop" }, { - "label": "No results message", - "description": "Text displayed on end page when \"Display results\" is disabled", - "default": "Finished" + "label": "Geen resultaten bericht", + "description": "De getoonde tekst op de eindpagina wanneer \"Toon resultaten\" is uitgeschakeld", + "default": "Voltooid" }, { - "label": "Feedback heading", - "default": "Your result:", - "description": "This heading will be displayed at the end of the quiz when the user has answered all questions." + "label": "Feedback koptekst", + "default": "Je resultaat:", + "description": "Deze koptekst verschijnt aan het einde van de test wanneer de deelnemer alle vragen heeft beantwoord." }, { - "label": "Overall Feedback", + "label": "Algehele feedback", "fields": [ { "widgets": [ { - "label": "Default" + "label": "Standaard" } ], - "label": "Define custom feedback for any score range", - "description": "Example: 0-20% Bad score, 21-91% Average Score, 91-100% Great Score!", - "entity": "range", + "label": "Definieer aangepaste feedback voor elke scorereeks", + "description": "Voorbeeld: 0-20% Onvoldoende score, 21-91% Gemiddelde score, 91-100% Uitstekende score!", + "entity": "reeks", "field": { "fields": [ { - "label": "Score Range" + "label": "Scorereeks" }, {}, { - "label": "Feedback for defined score range", - "placeholder": "Fill in the feedback" + "label": "Feedback voor de gedefinieerde scorereeks", + "placeholder": "Vul de aangepaste feedback in" } ] } @@ -167,66 +167,66 @@ ] }, { - "label": "Old Feedback", + "label": "Oude feedback", "fields": [ { - "label": "Quiz passed greeting", - "description": "This text will be displayed above the score if the user has successfully passed the quiz." + "label": "Begroeting bij een geslaagde quiz", + "description": "Deze tekst wordt boven de score weergegeven als de deelnemer de test met goed gevolg heeft afgelegd." }, { - "label": "Passed comment", - "description": "This comment will be displayed after the score if the user has successfully passed the quiz." + "label": "Commentaar bij geslaagd", + "description": "Deze opmerking wordt weergegeven na de score als de deelnemer de test met goed gevolg heeft afgelegd." }, { - "label": "Quiz failed title", - "description": "This text will be displayed above the score if the user has failed the quiz." + "label": "Titel bij niet behaalde quiz", + "description": "Deze tekst wordt boven de score getoond als de deelnemer de test niet heeft gehaald." }, { - "label": "Failed comment", - "description": "This comment will be displayed after the score if the user has failed the quiz." + "label": "Commentaar bij niet behaald", + "description": "Deze opmerking wordt weergegeven na de score als de deelnemer de test niet heeft gehaald." } ] }, { - "label": "Solution button label", + "label": "Label van de oplossings-knop", "default": "Toon oplossing", - "description": "Text for the solution button." + "description": "Tekst voor de oplossings-knop." }, { - "label": "Tekst van de Opnieuw proberen knop", + "label": "Label van de opnieuw proberen-knop", "default": "Opnieuw proberen", - "description": "Text for the retry button." + "description": "Tekst voor de opnieuw proberen-knop." }, { - "label": "Finish button text", - "default": "Beëindigen" + "label": "Tekst voor de beëindigings-knop", + "default": "Klaar" }, { - "label": "Display video before quiz results" + "label": "Toon video voor de quizresultaten" }, { - "label": "Enable skip video button" + "label": "Activeer sla de video over-knop" }, { - "label": "Skip video button label", - "default": "Skip video" + "label": "Label sla de video over-knop", + "default": "Sla de video over" }, { - "label": "Passed video", - "description": "This video will be played if the user successfully passed the quiz." + "label": "Video bij een geslaagde quiz", + "description": "Deze video wordt afgespeeld als de deelnemer de test met succes heeft afgerond." }, { - "label": "Fail video", - "description": "This video will be played if the user failes the quiz." + "label": "Video bij een niet behaalde quiz", + "description": "Deze video wordt afgespeeld als de deelnemer de test niet heeft gehaald." } ] }, { - "label": "Settings for \"Show solution\" and \"Retry\" buttons", + "label": "Instellingen voor \"Toon oplossing\" en \"Opnieuw\" -knoppen", "fields": [ { - "label": "Show \"Check\" buttons", - "description": "This option determines if the \"Check\" button will be shown for all questions." + "label": "Toon \"Controleer\"-knoppen", + "description": "Deze optie bepaalt of de knop \"Controleer\" wordt getoond voor alle vragen." }, { "label": "\"Toon oplossing\" knop instellen", @@ -241,8 +241,8 @@ ] }, { - "label": "\"Opnieuw proberen\" knop instellen", - "description": "Deze optie bepaalt of de \"Opnieuw proberen\" knop voor alle vragen wordt getoond, uitgeschakeld of voor iedere vraag afzonderlijk wordt geconfigureerd.", + "label": "\"Opnieuw proberen\"-knop instellen", + "description": "Deze optie bepaalt of de \"Opnieuw proberen\"-knop voor alle vragen wordt getoond, uitgeschakeld of voor iedere vraag afzonderlijk wordt geconfigureerd.", "options": [ { "label": "Ingeschakeld" @@ -255,4 +255,4 @@ ] } ] -} \ No newline at end of file +} From eb457bb20a5d9becc3f76f41eba2d8ca4f200af0 Mon Sep 17 00:00:00 2001 From: Oliver Tacke Date: Thu, 26 Jul 2018 18:05:21 +0200 Subject: [PATCH 07/15] HFP-2138 Fix display of max score Will also require HFP-2138 fix in JoubelUI --- js/questionset.js | 1 + 1 file changed, 1 insertion(+) diff --git a/js/questionset.js b/js/questionset.js index a51f27d..3d65355 100644 --- a/js/questionset.js +++ b/js/questionset.js @@ -788,6 +788,7 @@ H5P.QuestionSet = function (options, contentId, contentData) { eparams.comment + '.' + eparams.resulttext) .show().focus(); + scoreBar.setMaxScore(totals); scoreBar.setScore(finals); }, 0); } From 5f3d435b6653469e7a279e6d0ec75d8fa831279a Mon Sep 17 00:00:00 2001 From: Sandro Costa Date: Thu, 2 Aug 2018 17:08:19 +0100 Subject: [PATCH 08/15] Added portuguese translation --- language/pt.json | 210 +++++++++++++++++++++++------------------------ 1 file changed, 105 insertions(+), 105 deletions(-) diff --git a/language/pt.json b/language/pt.json index 5928587..294410d 100644 --- a/language/pt.json +++ b/language/pt.json @@ -1,165 +1,165 @@ { "semantics": [ { - "label": "Quiz introduction", + "label": "Introdução ao questionário", "fields": [ { - "label": "Display introduction" + "label": "Mostrar introdução" }, { - "label": "Title", - "description": "This title will be displayed above the introduction text." + "label": "Título", + "description": "Este título vai ser mostrado acima do texto introdutório." }, { - "label": "Introduction text", - "description": "This text will be displayed before the quiz starts." + "label": "Texto introdutório", + "description": "Este texto vai ser mostrado antes do início do questionário." }, { - "label": "Start button text", - "default": "Start Quiz" + "label": "Texto de iníco do questionário", + "default": "Iniciar questionário" }, { - "label": "Background image", - "description": "An optional background image for the introduction." + "label": "Imagem de fundo", + "description": "Uma imagem de fundo opcional para a introdução." } ] }, { - "label": "Background image", - "description": "An optional background image for the Question set." + "label": "Imagem de fundo", + "description": "Uma imagem de fundo opcional para a Série de questões." }, { - "label": "Progress indicator", - "description": "Question set progress indicator style.", + "label": "Indicador de progresso", + "description": "Estilo do indicador da série de questões.", "options": [ { "label": "Textual" }, { - "label": "Dots" + "label": "Pontos" } ] }, { - "label": "Pass percentage", - "description": "Percentage of Total score required for passing the quiz." + "label": "Percentagem de aprovação", + "description": "Percentagem necessária para aprovação no questionário." }, { - "label": "Questions", + "label": "Questões", "widgets": [ { - "label": "Default" + "label": "Por defeito" }, { "label": "Textual" } ], - "entity": "question", + "entity": "questão", "field": { - "label": "Question type", - "description": "Library for this question." + "label": "Tipo de questão", + "description": "Biblioteca para esta questão." } }, { - "label": "Interface texts in quiz", + "label": "Interface texts in quiz Textos do interface para o questionário", "fields": [ { - "label": "Back button", - "default": "Previous question" + "label": "Botão para questão anterior", + "default": "Questão anterior" }, { - "label": "Next button", - "default": "Next question" + "label": "Botão para questão seguinte", + "default": "Questão seguinte" }, { - "label": "Finish button", - "default": "Finish" + "label": "Botão para terminar", + "default": "Terminar" }, { - "label": "Progress text", - "description": "Text used if textual progress is selected.", - "default": "Question: @current of @total questions" + "label": "Texto do progresso", + "description": "Texto a utilizar se o progresso textual estiver ativo.", + "default": "Questão: @current de @total questões" }, { - "label": "Label for jumping to a certain question", - "description": "You must use the placeholder '%d' instead of the question number, and %total instead of total amount of questions.", - "default": "Question %d of %total" + "label": "Etiqueta para saltar para um questão", + "description": "Tem de utilizar o espaço reservado (placeholder) '%d' em vez de o número da questão, e %total em vez do total de questões.", + "default": "Questão %d de %total" }, { - "label": "Copyright dialog question label", - "default": "Question" + "label": "Etiqueta da caixa de diálogo para direitos de autor", + "default": "Questão" }, { - "label": "Readspeaker progress", - "description": "May use @current and @total question variables", - "default": "Question @current of @total" + "label": "Progresso em texto para voz", + "description": "Pode utilizar @current e @total como variáveis da questão", + "default": "Questão @current de @total" }, { - "label": "Unanswered question text", - "default": "Unanswered" + "label": "Texto para questões não respondidas", + "default": "Não respondida" }, { - "label": "Answered question text", - "default": "Answered" + "label": "Texto para questões respondidas", + "default": "Respondida" }, { - "label": "Current question text", - "default": "Current question" + "label": "Texto para pergunta atual", + "default": "Pergunta atual" } ] }, { - "label": "Disable backwards navigation", - "description": "This option will only allow you to move forward in Question Set" + "label": "Desativar a opção de navegar para trás", + "description": "Esta opção só lhe permitirá navegar para a frente numa Série de questões" }, { - "label": "Randomize questions", - "description": "Enable to randomize the order of questions on display." + "label": "Tornar aleatório", + "description": "Ative para tornar aletória a ordem das questões." }, { - "label": "Number of questions to be shown:", - "description": "Create a randomized batch of questions from the total." + "label": "Número de questões a mostrar:", + "description": "Criar um grupo de questões aleatório de entre o total" }, { - "label": "Quiz finished", + "label": "Questionário terminado", "fields": [ { - "label": "Display results" + "label": "Mostrar resultados" }, { - "label": "Display solution button" + "label": "Mostrar botão de solução" }, { - "label": "No results message", - "description": "Text displayed on end page when \"Display results\" is disabled", - "default": "Finished" + "label": "Mensagem quando não existem resultados", + "description": "Textos a exibir no final da página quando \"Mostrar resultados\" está desabilitado", + "default": "Terminado" }, { - "label": "Feedback heading", - "default": "Your result:", - "description": "This heading will be displayed at the end of the quiz when the user has answered all questions." + "label": "Cabeçalho do Feedback", + "default": "O seu resultado:", + "description": "Este cabeçalho será mostrado no final questionário assim que o utilizador tiver respondido a todas as questões." }, { - "label": "Overall Feedback", + "label": "Feedback Geral", "fields": [ { "widgets": [ { - "label": "Default" + "label": "Por defeito" } ], - "label": "Define custom feedback for any score range", - "description": "Example: 0-20% Bad score, 21-91% Average Score, 91-100% Great Score!", - "entity": "range", + "label": "Defina feedback personalizado para cada intervalo de pontuação", + "description": "Exemplo: 0-20% Mau, 21-91% Mediano, 91-100% Excelente!", + "entity": "intervalo", "field": { "fields": [ { - "label": "Score Range" + "label": "Intervalo de pontuação" }, {}, { - "label": "Feedback for defined score range", - "placeholder": "Fill in the feedback" + "label": "Feedback para o intervalo definido", + "placeholder": "Preencha com o feedback" } ] } @@ -167,88 +167,88 @@ ] }, { - "label": "Old Feedback", + "label": "Feedback antigo", "fields": [ { - "label": "Quiz passed greeting", - "description": "This text will be displayed above the score if the user has successfully passed the quiz." + "label": "Saudação por avaliação positiva", + "description": "Este texto vai ser mostrado acima do resultado obtido se o utilizador obtiver aproveitamento positivo no questionário." }, { - "label": "Passed comment", - "description": "This comment will be displayed after the score if the user has successfully passed the quiz." + "label": "Comentário para availiação positiva", + "description": "Este comentário vai ser mostrado depois do resultado se o utilizador obtiver aproveitamento positivo no questionário." }, { - "label": "Quiz failed title", - "description": "This text will be displayed above the score if the user has failed the quiz." + "label": "Título para avaliação negativa", + "description": "Este texto será mostrado acima do resultado obtido se o utilizador obtiver aproveitamento negativo no questionário." }, { - "label": "Failed comment", - "description": "This comment will be displayed after the score if the user has failed the quiz." + "label": "Comentário para availiação negativa", + "description": "Este comentário será mostrado depois do resultado se o utilizador obtiver aproveitamento negativo no questionário." } ] }, { - "label": "Solution button label", - "default": "Show solution", - "description": "Text for the solution button." + "label": "Etiqueta do botão de soluções", + "default": "Mostrar soluções", + "description": "Texto para o botão de soluções." }, { - "label": "Retry button label", - "default": "Retry", - "description": "Text for the retry button." + "label": "Etiqueta do botão de repetir", + "default": "Repetir", + "description": "Texto para o botão de repetir." }, { - "label": "Finish button text", - "default": "Finish" + "label": "Texto para o botão terminar", + "default": "Terminar" }, { - "label": "Display video before quiz results" + "label": "Mostrar video antes dos resultados do questionário" }, { - "label": "Enable skip video button" + "label": "Ativar botão de saltar vídeo" }, { - "label": "Skip video button label", - "default": "Skip video" + "label": "Etiqueta de botão de saltar vídeo", + "default": "Saltar vídeo" }, { - "label": "Passed video", - "description": "This video will be played if the user successfully passed the quiz." + "label": "Vídeo de sucesso", + "description": "Este vídeo vai ser apresentado se o utilizador obtiver avaliação positiva no questionário." }, { - "label": "Fail video", - "description": "This video will be played if the user failes the quiz." + "label": "Vídeo de insucesso", + "description": "Este vídeo vai ser apresentado se o utilizador obtiver avaliação negativa no questionário." } ] }, { - "label": "Settings for \"Show solution\" and \"Retry\" buttons", + "label": "Definições para os botões de \"Mostrar solução\" e \"Repetir\"", "fields": [ { - "label": "Show \"Check\" buttons", - "description": "This option determines if the \"Check\" button will be shown for all questions." + "label": "Mostrar botões de \"Verificar\"", + "description": "Esta opção determina se o botão \"Verificar\" será mostrado para todas as questões." }, { - "label": "Override \"Show Solution\" button", - "description": "This option determines if the \"Show Solution\" button will be shown for all questions, disabled for all or configured for each question individually.", + "label": "Sobrepor botão \"Mostrar solução\"", + "description": "Esta opção determina se o botão \"Mostrar solução\" será mostrado para todas as questões, desativado para todas ou configurado individualmente para cada questão.", "options": [ { - "label": "Enabled" + "label": "Ativado" }, { - "label": "Disabled" + "label": "Desativado" } ] }, { - "label": "Override \"Retry\" button", - "description": "This option determines if the \"Retry\" button will be shown for all questions, disabled for all or configured for each question individually.", + "label": "Sobrepor botão \"Repetir\"", + "description": "Esta opção determina se o botão \"Repetir\" será mostrado para todas as questões, desativado para todas ou configurado individualmente para cada questão.", "options": [ { - "label": "Enabled" + "label": "Ativado" }, { - "label": "Disabled" + "label": "Desativado" } ] } From 77d07aa34adfee48298e910f7afe2f027e85b9e3 Mon Sep 17 00:00:00 2001 From: Sandro Costa Date: Tue, 7 Aug 2018 16:26:05 +0100 Subject: [PATCH 09/15] Minor updates to the portuguese language translation --- language/pt.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/language/pt.json b/language/pt.json index 294410d..07d8ce2 100644 --- a/language/pt.json +++ b/language/pt.json @@ -61,7 +61,7 @@ } }, { - "label": "Interface texts in quiz Textos do interface para o questionário", + "label": "Textos do interface para o questionário", "fields": [ { "label": "Botão para questão anterior", From 4ee2a0b73575f68bb41019b21fdcab12cbd19066 Mon Sep 17 00:00:00 2001 From: Paal Joergensen Date: Tue, 21 Aug 2018 09:43:43 +0200 Subject: [PATCH 10/15] Rename InValid to Invalid --- presave.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/presave.js b/presave.js index 6727b1e..4c629b5 100644 --- a/presave.js +++ b/presave.js @@ -10,7 +10,7 @@ var H5PPresave = H5PPresave || {}; H5PPresave['H5P.QuestionSet'] = function (content, finished) { var presave = H5PEditor.Presave; - if (isContentInValid()) { + if (isContentInvalid()) { throw new presave.exceptions.InvalidContentSemanticsException('Invalid Question Set Error') } @@ -38,7 +38,7 @@ H5PPresave['H5P.QuestionSet'] = function (content, finished) { * Check if required parameters is present * @return {boolean} */ - function isContentInValid() { + function isContentInvalid() { return !presave.checkNestedRequirements(content, 'content.questions') || !Array.isArray(content.questions); } }; From 6f7c1b7fcc7e8cffaeaa9bd70c68dc0bdba3c1b4 Mon Sep 17 00:00:00 2001 From: Paal Joergensen Date: Tue, 21 Aug 2018 13:52:11 +0200 Subject: [PATCH 11/15] Clean up presave.js (Max score calculation) --- presave.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/presave.js b/presave.js index 4c629b5..97d2cac 100644 --- a/presave.js +++ b/presave.js @@ -11,7 +11,7 @@ H5PPresave['H5P.QuestionSet'] = function (content, finished) { var presave = H5PEditor.Presave; if (isContentInvalid()) { - throw new presave.exceptions.InvalidContentSemanticsException('Invalid Question Set Error') + throw new presave.exceptions.InvalidContentSemanticsException('Invalid Question Set Error'); } var score = content.questions @@ -30,9 +30,7 @@ H5PPresave['H5P.QuestionSet'] = function (content, finished) { presave.validateScore(score); - if (finished) { - finished({maxScore: score}); - } + finished({maxScore: score}); /** * Check if required parameters is present From 9a5cfddd1db85572e1143ba2bf104d111f67ef52 Mon Sep 17 00:00:00 2001 From: Paal Joergensen Date: Thu, 23 Aug 2018 13:41:13 +0200 Subject: [PATCH 12/15] Align minor versions across libraries --- library.json | 10 +++++----- semantics.json | 14 +++++++------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/library.json b/library.json index 4b09828..47fd5ab 100644 --- a/library.json +++ b/library.json @@ -3,8 +3,8 @@ "description": "Put together a set of different questions that has to be solved. (Quiz)", "contentType": "question", "majorVersion": 1, - "minorVersion": 15, - "patchVersion": 3, + "minorVersion": 16, + "patchVersion": 0, "embedTypes": [ "iframe" ], @@ -14,7 +14,7 @@ "author": "Joubel", "coreApi": { "majorVersion": 1, - "minorVersion": 14 + "minorVersion": 19 }, "license": "MIT", "preloadedJs": [ @@ -41,7 +41,7 @@ { "machineName": "H5P.Video", "majorVersion": 1, - "minorVersion": 4 + "minorVersion": 5 }, { "machineName": "H5P.JoubelUI", @@ -71,4 +71,4 @@ "minorVersion": 0 } ] -} \ No newline at end of file +} diff --git a/semantics.json b/semantics.json index 0ac055c..495baef 100644 --- a/semantics.json +++ b/semantics.json @@ -121,12 +121,12 @@ "importance": "high", "description": "Library for this question.", "options": [ - "H5P.MultiChoice 1.12", - "H5P.DragQuestion 1.12", - "H5P.Blanks 1.10", - "H5P.MarkTheWords 1.8", - "H5P.DragText 1.7", - "H5P.TrueFalse 1.4" + "H5P.MultiChoice 1.13", + "H5P.DragQuestion 1.13", + "H5P.Blanks 1.11", + "H5P.MarkTheWords 1.9", + "H5P.DragText 1.8", + "H5P.TrueFalse 1.5" ] } }, @@ -539,4 +539,4 @@ } ] } -] \ No newline at end of file +] From 5ed96a8a173e6d976cacef23b5f5df0bb05cb066 Mon Sep 17 00:00:00 2001 From: Paal Joergensen Date: Mon, 3 Sep 2018 15:00:54 +0200 Subject: [PATCH 13/15] Bump patch --- library.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/library.json b/library.json index 47fd5ab..5cf7943 100644 --- a/library.json +++ b/library.json @@ -4,7 +4,7 @@ "contentType": "question", "majorVersion": 1, "minorVersion": 16, - "patchVersion": 0, + "patchVersion": 1, "embedTypes": [ "iframe" ], @@ -71,4 +71,4 @@ "minorVersion": 0 } ] -} +} \ No newline at end of file From 0df99b3372776ef295b30b0559e4f7c86673fbd7 Mon Sep 17 00:00:00 2001 From: Paal Joergensen Date: Mon, 10 Sep 2018 09:42:11 +0200 Subject: [PATCH 14/15] HFP-2176 Get copyright from sub content --- js/questionset.js | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/js/questionset.js b/js/questionset.js index 3d65355..76f0565 100644 --- a/js/questionset.js +++ b/js/questionset.js @@ -108,8 +108,8 @@ H5P.QuestionSet = function (options, contentId, contentData) { ''; var solutionButtonTemplate = params.endGame.showSolutionButton ? - ' ': - ''; + ' ': + ''; var resulttemplate = '
' + @@ -161,7 +161,9 @@ H5P.QuestionSet = function (options, contentId, contentData) { var randomizeQuestionOrdering = function (questions) { // 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]; }); + var questionOrdering = questions.map(function (questionInstance, index) { + return [questionInstance, index]; + }); // Shuffle the multidimensional array questionOrdering = H5P.shuffleArray(questionOrdering); @@ -343,7 +345,7 @@ H5P.QuestionSet = function (options, contentId, contentData) { questionInstances[currentQuestion].hideButton('finish'); } } - }; + }; var _stopQuestion = function (questionNumber) { if (questionInstances[questionNumber]) { @@ -463,7 +465,7 @@ H5P.QuestionSet = function (options, contentId, contentData) { questionInstances[i].showSolutions(); questionInstances[i].toggleReadSpeaker(false); } - catch(error) { + catch (error) { H5P.error("subcontent does not contain a valid showSolutions function"); H5P.error(error); } @@ -515,7 +517,7 @@ H5P.QuestionSet = function (options, contentId, contentData) { questionInstances[i].hideButton('prev'); } } - catch(error) { + catch (error) { H5P.error("subcontent does not contain a valid resetTask function"); H5P.error(error); } @@ -553,7 +555,8 @@ H5P.QuestionSet = function (options, contentId, contentData) { // Update buttons initializeQuestion(); - } else if (params.randomQuestions) { + } + else if (params.randomQuestions) { randomizeQuestions(); } @@ -966,7 +969,7 @@ H5P.QuestionSet = function (options, contentId, contentData) { $('.questionset', $myDom).show(); _showQuestion(params.initialQuestion); event.preventDefault(); - } + } }); /** @@ -1084,7 +1087,8 @@ H5P.QuestionSet = function (options, contentId, contentData) { var questionCopyrights; for (var i = 0; i < questionInstances.length; i++) { var instance = questionInstances[i]; - var qParams = params.questions[i].params; + var instanceParams = params.questions[i].params; + questionCopyrights = undefined; if (instance.getCopyrights !== undefined) { @@ -1094,13 +1098,16 @@ H5P.QuestionSet = function (options, contentId, contentData) { if (questionCopyrights === undefined) { // Create a generic flat copyright list questionCopyrights = new H5P.ContentCopyrights(); - H5P.findCopyrights(questionCopyrights, qParams, contentId); + H5P.findCopyrights(questionCopyrights, instanceParams.params, contentId,{ + metadata: instanceParams.metadata, + machineName: instanceParams.library.split(' ')[0] + }); } // Determine label var label = (params.texts.questionLabel + ' ' + (i + 1)); - if (qParams.contentName !== undefined) { - label += ': ' + qParams.contentName; + if (instanceParams.params.contentName !== undefined) { + label += ': ' + instanceParams.params.contentName; } else if (instance.getTitle !== undefined) { label += ': ' + instance.getTitle(); From 21913d93d0c8a023e216e8674eac6cda90daf563 Mon Sep 17 00:00:00 2001 From: Paal Joergensen Date: Fri, 2 Nov 2018 08:49:56 +0100 Subject: [PATCH 15/15] Bump patch version --- library.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library.json b/library.json index 5cf7943..fca13a1 100644 --- a/library.json +++ b/library.json @@ -4,7 +4,7 @@ "contentType": "question", "majorVersion": 1, "minorVersion": 16, - "patchVersion": 1, + "patchVersion": 2, "embedTypes": [ "iframe" ],