Merge branch 'master' of github.com:h5p/h5p-php-library

pull/42/head
Frode Petterson 2017-08-28 10:49:57 +02:00
commit 500c264b88
3 changed files with 83 additions and 80 deletions

View File

@ -1715,6 +1715,12 @@ abstract class H5PDisplayOptionBehaviour {
abstract class H5PHubEndpoints { abstract class H5PHubEndpoints {
const CONTENT_TYPES = 'api.h5p.org/v1/content-types/'; const CONTENT_TYPES = 'api.h5p.org/v1/content-types/';
const SITES = 'api.h5p.org/v1/sites';
public static function createURL($endpoint) {
$protocol = (extension_loaded('openssl') ? 'https' : 'http');
return "{$protocol}://{$endpoint}";
}
} }
/** /**
@ -2465,9 +2471,7 @@ class H5PCore {
// Register site if it is not registered // Register site if it is not registered
if (empty($uuid)) { if (empty($uuid)) {
$protocol = (extension_loaded('openssl') ? 'https' : 'http'); $registration = $this->h5pF->fetchExternalData(H5PHubEndpoints::createURL(H5PHubEndpoints::SITES), $registrationData);
$endpoint = 'api.h5p.org/v1/sites';
$registration = $this->h5pF->fetchExternalData("{$protocol}://{$endpoint}", $registrationData);
// Failed retrieving uuid // Failed retrieving uuid
if (!$registration) { if (!$registration) {
@ -2874,9 +2878,7 @@ class H5PCore {
$postData['current_cache'] = $this->h5pF->getOption('content_type_cache_updated_at', 0); $postData['current_cache'] = $this->h5pF->getOption('content_type_cache_updated_at', 0);
$protocol = (extension_loaded('openssl') ? 'https' : 'http'); $data = $interface->fetchExternalData(H5PHubEndpoints::createURL(H5PHubEndpoints::CONTENT_TYPES), $postData);
$endpoint = H5PHubEndpoints::CONTENT_TYPES;
$data = $interface->fetchExternalData("{$protocol}://{$endpoint}", $postData);
if (! $this->h5pF->getOption('hub_is_enabled', TRUE)) { if (! $this->h5pF->getOption('hub_is_enabled', TRUE)) {
return TRUE; return TRUE;

View File

@ -93,10 +93,6 @@ var H5PLibraryDetails= H5PLibraryDetails || {};
* Creates the pager element on the bottom of the list * Creates the pager element on the bottom of the list
*/ */
H5PLibraryDetails.createPagerElement = function () { H5PLibraryDetails.createPagerElement = function () {
// Only create pager if needed:
if(H5PLibraryDetails.currentContent.length > H5PLibraryDetails.PAGER_SIZE) {
H5PLibraryDetails.$previous = $('<button type="button" class="previous h5p-admin"><</button>'); H5PLibraryDetails.$previous = $('<button type="button" class="previous h5p-admin"><</button>');
H5PLibraryDetails.$next = $('<button type="button" class="next h5p-admin">></button>'); H5PLibraryDetails.$next = $('<button type="button" class="next h5p-admin">></button>');
@ -174,7 +170,6 @@ var H5PLibraryDetails= H5PLibraryDetails || {};
}); });
H5PLibraryDetails.updatePager(); H5PLibraryDetails.updatePager();
}
}; };
/** /**

View File

@ -247,7 +247,7 @@ H5P.init = function (target) {
if (H5P.externalEmbed === false) { if (H5P.externalEmbed === false) {
// Internal embed // Internal embed
// Make it possible to resize the iframe when the content changes size. This way we get no scrollbars. // Make it possible to resize the iframe when the content changes size. This way we get no scrollbars.
var iframe = window.parent.document.getElementById('h5p-iframe-' + contentId); var iframe = window.frameElement;
var resizeIframe = function () { var resizeIframe = function () {
if (window.parent.H5P.isFullscreen) { if (window.parent.H5P.isFullscreen) {
return; // Skip if full screen. return; // Skip if full screen.
@ -501,8 +501,7 @@ H5P.fullScreen = function ($element, instance, exitCallback, body, forceSemiFull
// We're called from an iframe. // We're called from an iframe.
$body = H5P.jQuery(body); $body = H5P.jQuery(body);
$classes = $body.add($element.get()); $classes = $body.add($element.get());
var contentId = $element.closest('[data-content-id]').data('content-id'); var iframeSelector = '#h5p-iframe-' + $element.parent().data('content-id');
var iframeSelector = '#h5p-iframe-' + contentId;
$iframe = H5P.jQuery(iframeSelector); $iframe = H5P.jQuery(iframeSelector);
$element = $iframe.parent(); // Put iframe wrapper in fullscreen, not container. $element = $iframe.parent(); // Put iframe wrapper in fullscreen, not container.
} }
@ -1272,9 +1271,14 @@ H5P.MediaCopyright = function (copyright, labels, order, extraFields) {
// Check for version info // Check for version info
var versionInfo; var versionInfo;
if (copyrightLicense.versions) {
if (copyrightLicense.versions.default && (!version || !copyrightLicense.versions[version])) {
version = copyrightLicense.versions.default;
}
if (version && copyrightLicense.versions[version]) { if (version && copyrightLicense.versions[version]) {
versionInfo = copyrightLicense.versions[version]; versionInfo = copyrightLicense.versions[version];
} }
}
if (versionInfo) { if (versionInfo) {
// Add license version // Add license version
@ -2031,6 +2035,7 @@ H5P.createTitle = function (rawTitle, maxLength) {
$(document).ready(function () { $(document).ready(function () {
var ccVersions = { var ccVersions = {
'default': '4.0',
'4.0': H5P.t('licenseCC40'), '4.0': H5P.t('licenseCC40'),
'3.0': H5P.t('licenseCC30'), '3.0': H5P.t('licenseCC30'),
'2.5': H5P.t('licenseCC25'), '2.5': H5P.t('licenseCC25'),
@ -2084,6 +2089,7 @@ H5P.createTitle = function (rawTitle, maxLength) {
'v1': '1.0' 'v1': '1.0'
}, },
versions: { versions: {
'default': 'v3',
'v3': H5P.t('licenseV3'), 'v3': H5P.t('licenseV3'),
'v2': H5P.t('licenseV2'), 'v2': H5P.t('licenseV2'),
'v1': H5P.t('licenseV1') 'v1': H5P.t('licenseV1')