added educational level

This commit is contained in:
Mirjan Hoffmann 2022-11-07 09:12:21 +01:00
parent ca736d99c7
commit 9ba8d1124c
6 changed files with 70 additions and 1 deletions

View file

@ -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",

View file

@ -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"
}

View file

@ -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"
}

View file

@ -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",

View file

@ -119,6 +119,15 @@
data-i18n-placeholder="LABEL_KEYWORDS_PLACEHOLDER" value="">
</div>
</div>
<div class="form-group row">
<label for="inputEducationalLevel" class="col-sm-2 col-form-label" data-i18n="LABEL_EDUCATIONALLEVEL">Bildungsstufe</label>
<div class="col-sm-10">
<select data-style="input-dropdown" data-width="100%" class="selectpicker" id="inputEducationalLevel" data-i18n-title="LABEL_EDUCATIONALLEVEL_CHOOSE" required multiple>
</select>
<div class="valid-feedback"></div>
<div class="invalid-feedback" data-i18n="LABEL_MANDATORY_FIELD">Pflichtfeld</div>
</div>
</div>
<div class="form-group row">
<label for="inputResourceType" class="col-sm-2 col-form-label" data-i18n="LABEL_LEARNINGRESOURCETYPE">Materialart</label>
<div class="col-sm-10">
@ -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('<option value="' + item + '" data-i18n="' + item + '"></option>');
});
});
$.getJSON("vocabs/hcrt.json", function (result) {
$.each(result, function (i, item) {
$("#inputResourceType").append('<option value="' + item + '" data-i18n="' + item + '"></option>');
@ -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({

View file

@ -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"
]