From 7762f903c8d00081d002947cc4d117adeb818c2f Mon Sep 17 00:00:00 2001 From: Frode Petterson Date: Mon, 24 Sep 2018 11:03:10 +0200 Subject: [PATCH] Add storing of content type title in metadata --- h5p.classes.php | 5 ++++- js/h5p.js | 17 +++-------------- 2 files changed, 7 insertions(+), 15 deletions(-) diff --git a/h5p.classes.php b/h5p.classes.php index 6c525b3..79111ba 100644 --- a/h5p.classes.php +++ b/h5p.classes.php @@ -3307,7 +3307,10 @@ class H5PCore { 'licensePD' => $this->h5pF->t('Public Domain'), 'licenseCC010' => $this->h5pF->t('CC0 1.0 Universal (CC0 1.0) Public Domain Dedication'), 'licensePDM' => $this->h5pF->t('Public Domain Mark'), - 'licenseC' => $this->h5pF->t('Copyright') + 'licenseC' => $this->h5pF->t('Copyright'), + 'contentType' => $this->h5pF->t('Content Type'), + 'licenseExtras' => $this->h5pF->t('License Extras'), + 'changes' => $this->h5pF->t('Changelog'), ); } } diff --git a/js/h5p.js b/js/h5p.js index c97fe1e..db262d8 100644 --- a/js/h5p.js +++ b/js/h5p.js @@ -1108,6 +1108,7 @@ H5P.findCopyrights = function (info, parameters, contentId, extras) { H5P.buildMetadataCopyrights = function (metadata, contentTypeName) { if (metadata && metadata.license !== undefined && metadata.license !== 'U') { var dataset = { + contentType: metadata.contentType, title: metadata.title, author: (metadata.authors && metadata.authors.length > 0) ? metadata.authors.map(function(author) { return (author.role) ? author.name + ' (' + author.role + ')' : author.name; @@ -1122,19 +1123,7 @@ H5P.buildMetadataCopyrights = function (metadata, contentTypeName) { }).join(' / ') : undefined }; - if (contentTypeName) { - contentTypeName = contentTypeName - .split(' ')[0] - .replace(/^H5P\./, '') - .replace(/([a-z])([A-Z])/g, '$1' + ' ' + '$2'); - } - - return new H5P.MediaCopyright( - dataset, - {type: 'Content Type', licenseExtras: 'License Extras', changes: 'Changelog'}, - ['type', 'title', 'license', 'author', 'year', 'source', 'licenseExtras', 'changes'], - {type: contentTypeName} - ); + return new H5P.MediaCopyright(dataset); } }; @@ -1424,7 +1413,7 @@ H5P.MediaCopyright = function (copyright, labels, order, extraFields) { if (order === undefined) { // Set default order - order = ['title', 'author', 'year', 'source', 'license']; + order = ['contentType', 'title', 'license', 'author', 'year', 'source', 'licenseExtras', 'changes']; } for (var i = 0; i < order.length; i++) {