From 9ba8d1124cb8790d9412ec9d3534f20f218b8d95 Mon Sep 17 00:00:00 2001 From: Mirjan Hoffmann Date: Mon, 7 Nov 2022 09:12:21 +0100 Subject: [PATCH] added educational level --- i18n/de.json | 2 ++ i18n/educationalLevel-de.json | 14 ++++++++++++++ i18n/educationalLevel-en.json | 14 ++++++++++++++ i18n/en.json | 2 ++ metadata-generator.html | 25 ++++++++++++++++++++++++- vocabs/educationalLevel.json | 14 ++++++++++++++ 6 files changed, 70 insertions(+), 1 deletion(-) create mode 100644 i18n/educationalLevel-de.json create mode 100644 i18n/educationalLevel-en.json create mode 100644 vocabs/educationalLevel.json diff --git a/i18n/de.json b/i18n/de.json index 029b52e..0d7f776 100644 --- a/i18n/de.json +++ b/i18n/de.json @@ -9,6 +9,8 @@ "LABEL_CREATOR_LAST_NAME": "Nachname", "LABEL_CREATOR_REMOVE": "Autor entfernen", "LABEL_DESCRIPTION": "Zusammenfassung", + "LABEL_EDUCATIONALLEVEL": "Bildungsstufe", + "LABEL_EDUCATIONALLEVEL_CHOOSE": "Wähle eine Bildungsstufe ...", "LABEL_GENERATE": "Generieren", "LABEL_IMAGE_URL": "Vorschaubild URL", "LABEL_IMPORT": "Import", diff --git a/i18n/educationalLevel-de.json b/i18n/educationalLevel-de.json new file mode 100644 index 0000000..206357e --- /dev/null +++ b/i18n/educationalLevel-de.json @@ -0,0 +1,14 @@ +{ + "https://w3id.org/kim/educationalLevel/level_0": "Elementarbereich", + "https://w3id.org/kim/educationalLevel/level_1": "Primarbereich", + "https://w3id.org/kim/educationalLevel/level_2": "Sekundarbereich I", + "https://w3id.org/kim/educationalLevel/level_3": "Sekundarbereich II", + "https://w3id.org/kim/educationalLevel/level_4": "Postsekundarer nicht-tertiärer Bereich", + "https://w3id.org/kim/educationalLevel/level_5": "Kurzes tertiäres Bildungsprogramm", + "https://w3id.org/kim/educationalLevel/level_A": "Hochschule", + "https://w3id.org/kim/educationalLevel/level_6": "Bachelor oder äquivalent", + "https://w3id.org/kim/educationalLevel/level_7": "Master oder äquivalent", + "https://w3id.org/kim/educationalLevel/level_8": "Promotion oder äquivalent", + "https://w3id.org/kim/educationalLevel/level_B": "Vorbereitungsdienst", + "https://w3id.org/kim/educationalLevel/level_C": "Fortbildung" +} \ No newline at end of file diff --git a/i18n/educationalLevel-en.json b/i18n/educationalLevel-en.json new file mode 100644 index 0000000..a58f802 --- /dev/null +++ b/i18n/educationalLevel-en.json @@ -0,0 +1,14 @@ +{ + "https://w3id.org/kim/educationalLevel/level_0": "Early childhood education", + "https://w3id.org/kim/educationalLevel/level_1": "Primary education", + "https://w3id.org/kim/educationalLevel/level_2": "Lower secondary education", + "https://w3id.org/kim/educationalLevel/level_3": "Upper secondary education", + "https://w3id.org/kim/educationalLevel/level_4": "Post-secondary non-tertiary education", + "https://w3id.org/kim/educationalLevel/level_5": "Short-cycle tertiary education", + "https://w3id.org/kim/educationalLevel/level_A": "University", + "https://w3id.org/kim/educationalLevel/level_6": "Bachelor or equivalent", + "https://w3id.org/kim/educationalLevel/level_7": "Master or equivalent", + "https://w3id.org/kim/educationalLevel/level_8": "Doctoral or equivalent", + "https://w3id.org/kim/educationalLevel/level_B": "Preparatory service", + "https://w3id.org/kim/educationalLevel/level_C": "Advanced training" +} \ No newline at end of file diff --git a/i18n/en.json b/i18n/en.json index 98d0712..3354f8f 100644 --- a/i18n/en.json +++ b/i18n/en.json @@ -9,6 +9,8 @@ "LABEL_CREATOR_LAST_NAME": "Lastname", "LABEL_CREATOR_REMOVE": "remove Author", "LABEL_DESCRIPTION": "Abstract", + "LABEL_EDUCATIONALLEVEL": "Level", + "LABEL_EDUCATIONALLEVEL_CHOOSE": "Choose a level ...", "LABEL_GENERATE": "Generate", "LABEL_IMAGE_URL": "Thumbnail URL", "LABEL_IMPORT": "Import", diff --git a/metadata-generator.html b/metadata-generator.html index a09a7cc..a518079 100644 --- a/metadata-generator.html +++ b/metadata-generator.html @@ -119,6 +119,15 @@ data-i18n-placeholder="LABEL_KEYWORDS_PLACEHOLDER" value=""> +
+ +
+ +
+
Pflichtfeld
+
+
@@ -246,11 +255,18 @@ await i18nLoader(); chooseLicense(); addCreator(); + $("#inputEducationalLevel option[value='https://w3id.org/kim/educationalLevel/level_A']").attr("selected", "true"); + $('.selectpicker').selectpicker('refresh'); } let vocabInstitutions = [] function loadVocabs() { $(document).ready(function () { + $.getJSON("vocabs/educationalLevel.json", function (result) { + $.each(result, function (i, item) { + $("#inputEducationalLevel").append(''); + }); + }); $.getJSON("vocabs/hcrt.json", function (result) { $.each(result, function (i, item) { $("#inputResourceType").append(''); @@ -537,6 +553,7 @@ const selectedLanguages = $('#inputLanguage').val(); const selectedSubjects = $('#inputSubjectOf').val(); const selectedResourceTypes = $('#inputResourceType').val(); + const selectedEducationalLevel = $('#inputEducationalLevel').val(); let meta = { creativeWorkStatus: document.getElementById("inputStatus").value, id: document.getElementById("inputUrl").value, @@ -562,6 +579,9 @@ if (selectedResourceTypes.length > 0) { meta.learningResourceType = selectedResourceTypes.map((t) => ({id: t})) } + if (selectedEducationalLevel.length > 0) { + meta.educationalLevel = selectedEducationalLevel.map((t) => ({id: t})) + } document.getElementById("comment").value = jsyaml.dump(meta); } @@ -660,6 +680,9 @@ const jsons = await Promise.all( langs.map((l) => fetch("i18n/" + l + ".json").then((r) => r.json())) ); + const educationalLevelLabels = await Promise.all( + langs.map((l) => fetch("i18n/educationalLevel-" + l + ".json").then((r) => r.json())) + ); const hcrt = await Promise.all( langs.map((l) => fetch("i18n/hcrt-" + l + ".json").then((r) => r.json())) ); @@ -670,7 +693,7 @@ langs.map((l) => fetch("i18n/subject-" + l + ".json").then((r) => r.json())) ); const res = langs.reduce((acc, l, idx) => { - acc[l] = {translation: {...jsons[idx], ...hcrt[idx], ...languageLabels[idx], ...subjectLabels[idx]}}; + acc[l] = {translation: {...jsons[idx], ...educationalLevelLabels[idx], ...hcrt[idx], ...languageLabels[idx], ...subjectLabels[idx]}}; return acc; }, {}); await i18next.init({ diff --git a/vocabs/educationalLevel.json b/vocabs/educationalLevel.json new file mode 100644 index 0000000..eb21c6a --- /dev/null +++ b/vocabs/educationalLevel.json @@ -0,0 +1,14 @@ +[ + "https://w3id.org/kim/educationalLevel/level_0", + "https://w3id.org/kim/educationalLevel/level_1", + "https://w3id.org/kim/educationalLevel/level_2", + "https://w3id.org/kim/educationalLevel/level_3", + "https://w3id.org/kim/educationalLevel/level_4", + "https://w3id.org/kim/educationalLevel/level_5", + "https://w3id.org/kim/educationalLevel/level_A", + "https://w3id.org/kim/educationalLevel/level_6", + "https://w3id.org/kim/educationalLevel/level_7", + "https://w3id.org/kim/educationalLevel/level_8", + "https://w3id.org/kim/educationalLevel/level_B", + "https://w3id.org/kim/educationalLevel/level_C" +]