Add storing of content type title in metadata

HFP-2095-Fix-table-styling
Frode Petterson 2018-09-24 11:03:10 +02:00
parent cb2acb21c8
commit 7762f903c8
2 changed files with 7 additions and 15 deletions

View File

@ -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'),
);
}
}

View File

@ -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++) {