diff --git a/package-lock.json b/package-lock.json index 8384fdc5817aeb0d0324d50c577d77c9008115e0..b91083d58adfdf9bedf1a504f5c814f38827fb94 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "epoc-editor", - "version": "0.1.5-beta", + "version": "0.1.6-beta", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "epoc-editor", - "version": "0.1.5-beta", + "version": "0.1.6-beta", "license": "CeCILL-B", "dependencies": { "@epoc/epoc-types": "git+https://gitlab.inria.fr/learninglab/epoc/epoc-types.git", @@ -287,8 +287,8 @@ } }, "node_modules/@epoc/epoc-types": { - "version": "2.0.0-beta.7", - "resolved": "git+https://gitlab.inria.fr/learninglab/epoc/epoc-types.git#a5ba071f37736b019aa325fe88ad0f4e87eda22d", + "version": "2.0.0-beta.9", + "resolved": "git+https://gitlab.inria.fr/learninglab/epoc/epoc-types.git#45703d42f147b1abf80f217f958a65447de5aa36", "license": "CeCILL-B" }, "node_modules/@esbuild/android-arm": { @@ -13427,7 +13427,7 @@ } }, "@epoc/epoc-types": { - "version": "git+https://gitlab.inria.fr/learninglab/epoc/epoc-types.git#a5ba071f37736b019aa325fe88ad0f4e87eda22d", + "version": "git+https://gitlab.inria.fr/learninglab/epoc/epoc-types.git#45703d42f147b1abf80f217f958a65447de5aa36", "from": "@epoc/epoc-types@git+https://gitlab.inria.fr/learninglab/epoc/epoc-types.git" }, "@esbuild/android-arm": { diff --git a/src/shared/classes/epoc-v1.ts b/src/shared/classes/epoc-v1.ts index f28f2e166764e00f6899be4edd557d645a71e381..988e57390a72eb4436521f2b16a2197d31ac5b5f 100644 --- a/src/shared/classes/epoc-v1.ts +++ b/src/shared/classes/epoc-v1.ts @@ -1,7 +1,7 @@ import { Chapter, Content, Epoc, html, Parameters, uid } from '@epoc/epoc-types/src/v1'; import { Question } from '@epoc/epoc-types/src/v1/question'; import { Author } from '@epoc/epoc-types/src/v1/author'; -import { Badge } from '@/src/shared/interfaces'; +import { Badge } from '@epoc/epoc-types/src/v1/badge'; export class EpocV1 implements Epoc { id: string; @@ -26,11 +26,16 @@ export class EpocV1 implements Epoc { questions: Record<uid, Question>; badges: Record<uid, Badge>; certificateBadgeCount: number; + license: { + name: string; + url: string; + content: string; + }; constructor( id: string, title: string, image: string, objectives: string[], summary: html, teaser: string, thumbnail: string, edition: string, certificateScore: number, certificateBadgeCount: number, authors: Author[], - plugins: string[], chapterParameter: string, lastModif: string + plugins: string[], chapterParameter: string, lastModif: string, license: { name: string; url: string; content: string; } ) { this.version = '1'; this.id = id; @@ -53,6 +58,7 @@ export class EpocV1 implements Epoc { this.badges = {}; this.questions = {}; this.lastModif = lastModif; + this.license = license; } addChapter(id: uid, chapter: Chapter) { diff --git a/src/shared/data/forms/nodeForm.data.ts b/src/shared/data/forms/nodeForm.data.ts index f2210583e999e800ecf1bb8d44363faf281a855c..a5bfe3379196aad523dc358b52466ac5c01669ac 100644 --- a/src/shared/data/forms/nodeForm.data.ts +++ b/src/shared/data/forms/nodeForm.data.ts @@ -310,6 +310,25 @@ export const epocForm: Form = { } ] }, + { + name: 'Licence', + inputs: [ + { + id: 'licenceName', + type: 'text', + label: 'Nom', + placeholder: 'CC-BY 4.0', + value: '' + }, + { + id: 'licenceUrl', + type: 'text', + label: 'URL', + placeholder: 'https://creativecommons.org/licenses/by/4.0/deed', + value: '' + } + ] + } ], }; diff --git a/src/shared/services/graph.service.ts b/src/shared/services/graph.service.ts index dcbe4f641ffb1c0050d3d876cc426f6395a1a71b..0008146f928f187a7042fbf3e723897d444fa2cf 100644 --- a/src/shared/services/graph.service.ts +++ b/src/shared/services/graph.service.ts @@ -62,6 +62,8 @@ function createContentJSON() : EpocV1 { const validBadges = getValidBadges(); const ePocValues = ePocNode.data.formValues; + + console.log('epocValues', ePocValues); const epoc = new EpocV1( ePocValues.id || 'E000XX', @@ -77,7 +79,12 @@ function createContentJSON() : EpocV1 { ePocValues.authors || {}, ePocValues.plugins, ePocValues.chapterParameter, - new Date().toISOString() + new Date().toISOString(), + { + name: ePocValues.licenceName || '', + url: ePocValues.licenceUrl || '', + content: '' + } ); chapterNodes.forEach(chapter => {