Merge branches 'master' and 'stable' of https://github.com/h5p/h5p-php-library

pull/27/head
thomasmars 2016-12-06 11:35:24 +01:00
commit 47c35d5135
3 changed files with 23 additions and 7 deletions

View File

@ -1676,7 +1676,7 @@ class H5PCore {
public static $coreApi = array(
'majorVersion' => 1,
'minorVersion' => 10
'minorVersion' => 11
);
public static $styles = array(
'styles/h5p.css',
@ -3056,7 +3056,9 @@ class H5PContentValidator {
$function = null;
$field = null;
if (count($semantics->fields) == 1 && $flatten) {
$isSubContent = isset($semantics->isSubContent) && $semantics->isSubContent === TRUE;
if (count($semantics->fields) == 1 && $flatten && !$isSubContent) {
$field = $semantics->fields[0];
$function = $this->typeMap[$field->type];
$this->$function($group, $field);
@ -3064,7 +3066,7 @@ class H5PContentValidator {
else {
foreach ($group as $key => &$value) {
// If subContentId is set, keep value
if($key == 'subContentId' && $value == TRUE){
if($isSubContent && ($key == 'subContentId')){
continue;
}

View File

@ -182,7 +182,7 @@ H5P.ContentUpgradeProcess = (function (Version) {
break;
case 'group':
if (field.fields.length === 1) {
if (field.fields.length === 1 && field.isSubContent !== true) {
// Single field to process, wrapper will be skipped
self.processField(field.fields[0], params, function (err, upgradedParams) {
if (upgradedParams) {

View File

@ -477,6 +477,19 @@ H5P.communicator = (function () {
return (window.postMessage && window.addEventListener ? new Communicator() : undefined);
})();
/**
* Enter semi fullscreen for the given H5P instance
*
* @method semiFullScreen
* @param {H5P.jQuery} $element Content container.
* @param {Object} instance
* @param {function} exitCallback Callback function called when user exits fullscreen.
* @param {H5P.jQuery} $body For internal use. Gives the body of the iframe.
*/
H5P.semiFullScreen = function ($element, instance, exitCallback, body) {
H5P.fullScreen($element, instance, exitCallback, body, true);
};
/**
* Enter fullscreen for the given H5P instance.
*
@ -484,15 +497,16 @@ H5P.communicator = (function () {
* @param {Object} instance
* @param {function} exitCallback Callback function called when user exits fullscreen.
* @param {H5P.jQuery} $body For internal use. Gives the body of the iframe.
* @param {Boolean} forceSemiFullScreen
*/
H5P.fullScreen = function ($element, instance, exitCallback, body) {
H5P.fullScreen = function ($element, instance, exitCallback, body, forceSemiFullScreen) {
if (H5P.exitFullScreen !== undefined) {
return; // Cannot enter new fullscreen until previous is over
}
if (H5P.isFramed && H5P.externalEmbed === false) {
// Trigger resize on wrapper in parent window.
window.parent.H5P.fullScreen($element, instance, exitCallback, H5P.$body.get());
window.parent.H5P.fullScreen($element, instance, exitCallback, H5P.$body.get(), forceSemiFullScreen);
H5P.isFullscreen = true;
H5P.exitFullScreen = function () {
window.parent.H5P.exitFullScreen();
@ -572,7 +586,7 @@ H5P.fullScreen = function ($element, instance, exitCallback, body) {
};
H5P.isFullscreen = true;
if (H5P.fullScreenBrowserPrefix === undefined) {
if (H5P.fullScreenBrowserPrefix === undefined || forceSemiFullScreen === true) {
// Create semi fullscreen.
if (H5P.isFramed) {