Merge branch 'release'
commit
cbbff0e296
|
@ -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}";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -2451,9 +2457,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) {
|
||||||
|
@ -2860,9 +2864,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;
|
||||||
|
|
|
@ -93,88 +93,83 @@ 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 () {
|
||||||
|
H5PLibraryDetails.$previous = $('<button type="button" class="previous h5p-admin"><</button>');
|
||||||
|
H5PLibraryDetails.$next = $('<button type="button" class="next h5p-admin">></button>');
|
||||||
|
|
||||||
// Only create pager if needed:
|
H5PLibraryDetails.$previous.on('click', function () {
|
||||||
if(H5PLibraryDetails.currentContent.length > H5PLibraryDetails.PAGER_SIZE) {
|
if(H5PLibraryDetails.$previous.hasClass('disabled')) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
H5PLibraryDetails.$previous = $('<button type="button" class="previous h5p-admin"><</button>');
|
H5PLibraryDetails.currentPage--;
|
||||||
H5PLibraryDetails.$next = $('<button type="button" class="next h5p-admin">></button>');
|
H5PLibraryDetails.updatePager();
|
||||||
|
H5PLibraryDetails.createContentTable();
|
||||||
|
});
|
||||||
|
|
||||||
H5PLibraryDetails.$previous.on('click', function () {
|
H5PLibraryDetails.$next.on('click', function () {
|
||||||
if(H5PLibraryDetails.$previous.hasClass('disabled')) {
|
if(H5PLibraryDetails.$next.hasClass('disabled')) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
H5PLibraryDetails.currentPage++;
|
||||||
|
H5PLibraryDetails.updatePager();
|
||||||
|
H5PLibraryDetails.createContentTable();
|
||||||
|
});
|
||||||
|
|
||||||
|
// This is the Page x of y widget:
|
||||||
|
H5PLibraryDetails.$pagerInfo = $('<span class="pager-info"></span>');
|
||||||
|
|
||||||
|
H5PLibraryDetails.$pager = $('<div class="h5p-content-pager"></div>').append(H5PLibraryDetails.$previous, H5PLibraryDetails.$pagerInfo, H5PLibraryDetails.$next);
|
||||||
|
H5PLibraryDetails.$content.append(H5PLibraryDetails.$pager);
|
||||||
|
|
||||||
|
H5PLibraryDetails.$pagerInfo.on('click', function () {
|
||||||
|
var width = H5PLibraryDetails.$pagerInfo.innerWidth();
|
||||||
|
H5PLibraryDetails.$pagerInfo.hide();
|
||||||
|
|
||||||
|
// User has updated the pageNumber
|
||||||
|
var pageNumerUpdated = function() {
|
||||||
|
var newPageNum = $gotoInput.val()-1;
|
||||||
|
var intRegex = /^\d+$/;
|
||||||
|
|
||||||
|
$goto.remove();
|
||||||
|
H5PLibraryDetails.$pagerInfo.css({display: 'inline-block'});
|
||||||
|
|
||||||
|
// Check if input value is valid, and that it has actually changed
|
||||||
|
if(!(intRegex.test(newPageNum) && newPageNum >= 0 && newPageNum < H5PLibraryDetails.getNumPages() && newPageNum != H5PLibraryDetails.currentPage)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
H5PLibraryDetails.currentPage--;
|
H5PLibraryDetails.currentPage = newPageNum;
|
||||||
H5PLibraryDetails.updatePager();
|
H5PLibraryDetails.updatePager();
|
||||||
H5PLibraryDetails.createContentTable();
|
H5PLibraryDetails.createContentTable();
|
||||||
});
|
};
|
||||||
|
|
||||||
H5PLibraryDetails.$next.on('click', function () {
|
// We create an input box where the user may type in the page number
|
||||||
if(H5PLibraryDetails.$next.hasClass('disabled')) {
|
// he wants to be displayed.
|
||||||
return;
|
// Reson for doing this is when user has ten-thousands of elements in list,
|
||||||
}
|
// this is the easiest way of getting to a specified page
|
||||||
|
var $gotoInput = $('<input/>', {
|
||||||
H5PLibraryDetails.currentPage++;
|
type: 'number',
|
||||||
H5PLibraryDetails.updatePager();
|
min : 1,
|
||||||
H5PLibraryDetails.createContentTable();
|
max: H5PLibraryDetails.getNumPages(),
|
||||||
});
|
on: {
|
||||||
|
// Listen to blur, and the enter-key:
|
||||||
// This is the Page x of y widget:
|
'blur': pageNumerUpdated,
|
||||||
H5PLibraryDetails.$pagerInfo = $('<span class="pager-info"></span>');
|
'keyup': function (event) {
|
||||||
|
if (event.keyCode === 13) {
|
||||||
H5PLibraryDetails.$pager = $('<div class="h5p-content-pager"></div>').append(H5PLibraryDetails.$previous, H5PLibraryDetails.$pagerInfo, H5PLibraryDetails.$next);
|
pageNumerUpdated();
|
||||||
H5PLibraryDetails.$content.append(H5PLibraryDetails.$pager);
|
|
||||||
|
|
||||||
H5PLibraryDetails.$pagerInfo.on('click', function () {
|
|
||||||
var width = H5PLibraryDetails.$pagerInfo.innerWidth();
|
|
||||||
H5PLibraryDetails.$pagerInfo.hide();
|
|
||||||
|
|
||||||
// User has updated the pageNumber
|
|
||||||
var pageNumerUpdated = function() {
|
|
||||||
var newPageNum = $gotoInput.val()-1;
|
|
||||||
var intRegex = /^\d+$/;
|
|
||||||
|
|
||||||
$goto.remove();
|
|
||||||
H5PLibraryDetails.$pagerInfo.css({display: 'inline-block'});
|
|
||||||
|
|
||||||
// Check if input value is valid, and that it has actually changed
|
|
||||||
if(!(intRegex.test(newPageNum) && newPageNum >= 0 && newPageNum < H5PLibraryDetails.getNumPages() && newPageNum != H5PLibraryDetails.currentPage)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
H5PLibraryDetails.currentPage = newPageNum;
|
|
||||||
H5PLibraryDetails.updatePager();
|
|
||||||
H5PLibraryDetails.createContentTable();
|
|
||||||
};
|
|
||||||
|
|
||||||
// We create an input box where the user may type in the page number
|
|
||||||
// he wants to be displayed.
|
|
||||||
// Reson for doing this is when user has ten-thousands of elements in list,
|
|
||||||
// this is the easiest way of getting to a specified page
|
|
||||||
var $gotoInput = $('<input/>', {
|
|
||||||
type: 'number',
|
|
||||||
min : 1,
|
|
||||||
max: H5PLibraryDetails.getNumPages(),
|
|
||||||
on: {
|
|
||||||
// Listen to blur, and the enter-key:
|
|
||||||
'blur': pageNumerUpdated,
|
|
||||||
'keyup': function (event) {
|
|
||||||
if (event.keyCode === 13) {
|
|
||||||
pageNumerUpdated();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}).css({width: width});
|
}
|
||||||
var $goto = $('<span/>', {
|
}).css({width: width});
|
||||||
'class': 'h5p-pager-goto'
|
var $goto = $('<span/>', {
|
||||||
}).css({width: width}).append($gotoInput).insertAfter(H5PLibraryDetails.$pagerInfo);
|
'class': 'h5p-pager-goto'
|
||||||
|
}).css({width: width}).append($gotoInput).insertAfter(H5PLibraryDetails.$pagerInfo);
|
||||||
|
|
||||||
$gotoInput.focus();
|
$gotoInput.focus();
|
||||||
});
|
});
|
||||||
|
|
||||||
H5PLibraryDetails.updatePager();
|
H5PLibraryDetails.updatePager();
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
13
js/h5p.js
13
js/h5p.js
|
@ -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.
|
||||||
|
@ -1271,8 +1271,13 @@ H5P.MediaCopyright = function (copyright, labels, order, extraFields) {
|
||||||
|
|
||||||
// Check for version info
|
// Check for version info
|
||||||
var versionInfo;
|
var versionInfo;
|
||||||
if (version && copyrightLicense.versions[version]) {
|
if (copyrightLicense.versions) {
|
||||||
versionInfo = copyrightLicense.versions[version];
|
if (copyrightLicense.versions.default && (!version || !copyrightLicense.versions[version])) {
|
||||||
|
version = copyrightLicense.versions.default;
|
||||||
|
}
|
||||||
|
if (version && copyrightLicense.versions[version]) {
|
||||||
|
versionInfo = copyrightLicense.versions[version];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (versionInfo) {
|
if (versionInfo) {
|
||||||
|
@ -2030,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'),
|
||||||
|
@ -2083,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')
|
||||||
|
|
Loading…
Reference in New Issue