Merge branch 'release' of github.com:h5p/h5p-php-library into release
commit
0d6fac4099
|
@ -1055,24 +1055,27 @@ class H5PValidator {
|
||||||
$valid = $this->isValidRequiredH5pData($h5pData, $required, $library_name);
|
$valid = $this->isValidRequiredH5pData($h5pData, $required, $library_name);
|
||||||
$valid = $this->isValidOptionalH5pData($h5pData, $optional, $library_name) && $valid;
|
$valid = $this->isValidOptionalH5pData($h5pData, $optional, $library_name) && $valid;
|
||||||
|
|
||||||
// Test library core version requirement. If no requirement is set,
|
// Check the library's required API version of Core.
|
||||||
// this implicitly means 1.0, which shall work on newer versions
|
// If no requirement is set this implicitly means 1.0.
|
||||||
// too.
|
|
||||||
if (isset($h5pData['coreApi']) && !empty($h5pData['coreApi'])) {
|
if (isset($h5pData['coreApi']) && !empty($h5pData['coreApi'])) {
|
||||||
if (($h5pData['coreApi']['majorVersion'] > H5PCore::$coreApi['majorVersion']) ||
|
if (($h5pData['coreApi']['majorVersion'] > H5PCore::$coreApi['majorVersion']) ||
|
||||||
( ($h5pData['coreApi']['majorVersion'] == H5PCore::$coreApi['majorVersion']) &&
|
( ($h5pData['coreApi']['majorVersion'] == H5PCore::$coreApi['majorVersion']) &&
|
||||||
($h5pData['coreApi']['minorVersion'] > H5PCore::$coreApi['minorVersion'])))
|
($h5pData['coreApi']['minorVersion'] > H5PCore::$coreApi['minorVersion']) )) {
|
||||||
{
|
|
||||||
$this->h5pF->setErrorMessage(
|
$this->h5pF->setErrorMessage(
|
||||||
$this->h5pF->t('The library "%libraryName" requires H5P %requiredVersion, but only H5P %coreApi is installed.',
|
$this->h5pF->t('The system was unable to install the <em>%component</em> component from the package, it requires a newer version of the H5P plugin. This site is currently running version %current, whereas the required version is %required or higher. You should consider upgrading and then try again.',
|
||||||
array(
|
array(
|
||||||
'%libraryName' => $library_name,
|
'%component' => (isset($h5pData['title']) ? $h5pData['title'] : $library_name),
|
||||||
'%requiredVersion' => $h5pData['coreApi']['majorVersion'] . '.' . $h5pData['coreApi']['minorVersion'],
|
'%current' => H5PCore::$coreApi['majorVersion'] . '.' . H5PCore::$coreApi['minorVersion'],
|
||||||
'%coreApi' => H5PCore::$coreApi['majorVersion'] . '.' . H5PCore::$coreApi['minorVersion']
|
'%required' => $h5pData['coreApi']['majorVersion'] . '.' . $h5pData['coreApi']['minorVersion']
|
||||||
)));
|
)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
$valid = false;
|
$valid = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $valid;
|
return $valid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -141,22 +141,24 @@ H5P.ConfirmationDialog = (function (EventDispatcher) {
|
||||||
var wrapperElement;
|
var wrapperElement;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Append confirmation dialog
|
* Set parent of confirmation dialog
|
||||||
* @param {HTMLElement} wrapper
|
* @param {HTMLElement} wrapper
|
||||||
* @returns {H5P.ConfirmationDialog}
|
* @returns {H5P.ConfirmationDialog}
|
||||||
*/
|
*/
|
||||||
this.appendTo = function (wrapper) {
|
this.appendTo = function (wrapper) {
|
||||||
wrapper.appendChild(popupBackground);
|
|
||||||
wrapperElement = wrapper;
|
wrapperElement = wrapper;
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fit popup to container. Makes sure it doesn't overflow.
|
* Fit popup to container. Makes sure it doesn't overflow.
|
||||||
|
* @params {number} [offsetTop] Offset of popup
|
||||||
*/
|
*/
|
||||||
var fitToContainer = function () {
|
var fitToContainer = function (offsetTop) {
|
||||||
var popupOffsetTop = parseInt(popup.style.top, 10);
|
var popupOffsetTop = parseInt(popup.style.top, 10);
|
||||||
|
if (offsetTop) {
|
||||||
|
popupOffsetTop = offsetTop;
|
||||||
|
}
|
||||||
|
|
||||||
// Overflows height
|
// Overflows height
|
||||||
if (popupOffsetTop + popup.offsetHeight > wrapperElement.offsetHeight) {
|
if (popupOffsetTop + popup.offsetHeight > wrapperElement.offsetHeight) {
|
||||||
|
@ -178,30 +180,28 @@ H5P.ConfirmationDialog = (function (EventDispatcher) {
|
||||||
* @returns {H5P.ConfirmationDialog}
|
* @returns {H5P.ConfirmationDialog}
|
||||||
*/
|
*/
|
||||||
this.show = function (offsetTop) {
|
this.show = function (offsetTop) {
|
||||||
popup.style.top = offsetTop + 'px';
|
wrapperElement.appendChild(popupBackground);
|
||||||
popupBackground.classList.remove('hidden');
|
popupBackground.classList.remove('hidden');
|
||||||
fitToContainer();
|
fitToContainer(offsetTop);
|
||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
popup.classList.remove('hidden');
|
popup.classList.remove('hidden');
|
||||||
popupBackground.classList.remove('hiding');
|
popupBackground.classList.remove('hiding');
|
||||||
|
|
||||||
|
setTimeout(function () {
|
||||||
|
// Focus confirm button
|
||||||
|
confirmButton.focus();
|
||||||
|
|
||||||
// Resize iFrame if necessary
|
// Resize iFrame if necessary
|
||||||
if (resizeIFrame && options.instance) {
|
if (resizeIFrame && options.instance) {
|
||||||
setTimeout(function () {
|
|
||||||
var minHeight = parseInt(popup.offsetHeight, 10) +
|
var minHeight = parseInt(popup.offsetHeight, 10) +
|
||||||
exitButtonOffset + (2 * shadowOffset);
|
exitButtonOffset + (2 * shadowOffset);
|
||||||
wrapperElement.style.minHeight = minHeight + 'px';
|
wrapperElement.style.minHeight = minHeight + 'px';
|
||||||
options.instance.trigger('resize');
|
options.instance.trigger('resize');
|
||||||
resizeIFrame = false;
|
resizeIFrame = false;
|
||||||
}, 100);
|
|
||||||
}
|
}
|
||||||
|
}, 100);
|
||||||
}, 0);
|
}, 0);
|
||||||
|
|
||||||
// Programmatically focus popup
|
|
||||||
popup.setAttribute('tabindex', '-1');
|
|
||||||
popup.focus();
|
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -214,6 +214,7 @@ H5P.ConfirmationDialog = (function (EventDispatcher) {
|
||||||
popup.classList.add('hidden');
|
popup.classList.add('hidden');
|
||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
popupBackground.classList.add('hidden');
|
popupBackground.classList.add('hidden');
|
||||||
|
wrapperElement.removeChild(popupBackground);
|
||||||
}, 100);
|
}, 100);
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
|
|
Loading…
Reference in New Issue