HFP-1905 Fix image in "rights of use" view

pull/52/head
Oliver Tacke 2018-04-05 17:17:56 +02:00
parent 83e3c58ba3
commit ef063ce5cb
1 changed files with 10 additions and 3 deletions

View File

@ -164,7 +164,7 @@ H5P.init = function (target) {
if (displayOptions.frame) { if (displayOptions.frame) {
// Special handling of copyrights // Special handling of copyrights
if (displayOptions.copyright) { if (displayOptions.copyright) {
var copyrights = H5P.getCopyrights(instance, library.params, library.metadata, contentId); var copyrights = H5P.getCopyrights(instance, library.params, contentId, library.metadata);
if (!copyrights) { if (!copyrights) {
displayOptions.copyright = false; displayOptions.copyright = false;
} }
@ -982,12 +982,13 @@ H5P.Dialog = function (name, title, content, $element) {
* Identifies the H5P content * Identifies the H5P content
* @returns {string} Copyright information. * @returns {string} Copyright information.
*/ */
H5P.getCopyrights = function (instance, parameters, metadata, contentId) { H5P.getCopyrights = function (instance, parameters, contentId, metadata) {
var copyrights; var copyrights;
if (instance.getCopyrights !== undefined) { if (instance.getCopyrights !== undefined) {
try { try {
// Use the instance's own copyright generator // Use the instance's own copyright generator
console.log('getCopyrights() of', instance.libraryInfo.machineName);
copyrights = instance.getCopyrights(); copyrights = instance.getCopyrights();
} }
catch (err) { catch (err) {
@ -1056,11 +1057,17 @@ H5P.findCopyrights = function (info, parameters, contentId) {
if (value.metadata) { if (value.metadata) {
var metadataCopyrights = H5P.buildMetadataCopyrights(value.metadata, lastContentTypeName); var metadataCopyrights = H5P.buildMetadataCopyrights(value.metadata, lastContentTypeName);
if (metadataCopyrights !== undefined) { if (metadataCopyrights !== undefined) {
if (value.params && value.params.contentName === 'Image' && value.params.file) {
var path = value.params.file.path;
var width = value.params.file.width;
var height = value.params.file.height;
metadataCopyrights.setThumbnail(new H5P.Thumbnail(H5P.getPath(path, contentId), width, height));
}
info.addMedia(metadataCopyrights); info.addMedia(metadataCopyrights);
} }
} }
// Check if object is a file with copyrights // Check if object is a file with copyrights (old core)
if (value.copyright === undefined || if (value.copyright === undefined ||
value.copyright.license === undefined || value.copyright.license === undefined ||
value.path === undefined || value.path === undefined ||