commit
9672986112
|
@ -15,7 +15,6 @@ interface H5PFrameworkInterface {
|
|||
*/
|
||||
public function getPlatformInfo();
|
||||
|
||||
|
||||
/**
|
||||
* Fetches a file from a remote server using HTTP GET
|
||||
*
|
||||
|
@ -1602,6 +1601,22 @@ class H5PCore {
|
|||
|
||||
private $exportEnabled;
|
||||
|
||||
// Disable flags
|
||||
const DISABLE_NONE = 0;
|
||||
const DISABLE_FRAME = 1;
|
||||
const DISABLE_DOWNLOAD = 2;
|
||||
const DISABLE_EMBED = 4;
|
||||
const DISABLE_COPYRIGHT = 8;
|
||||
const DISABLE_ABOUT = 16;
|
||||
|
||||
// Map flags to string
|
||||
public static $disable = array(
|
||||
self::DISABLE_FRAME => 'frame',
|
||||
self::DISABLE_DOWNLOAD => 'download',
|
||||
self::DISABLE_EMBED => 'embed',
|
||||
self::DISABLE_COPYRIGHT => 'copyright'
|
||||
);
|
||||
|
||||
/**
|
||||
* Constructor for the H5PCore
|
||||
*
|
||||
|
@ -2271,11 +2286,59 @@ class H5PCore {
|
|||
}
|
||||
}
|
||||
if($platformInfo['uuid'] === '' && isset($json->uuid)) {
|
||||
$this->h5pF->setOption('h5p_site_uuid', $json->uuid);
|
||||
$this->h5pF->setOption('site_uuid', $json->uuid);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function getGlobalDisable() {
|
||||
$disable = self::DISABLE_NONE;
|
||||
|
||||
// Allow global settings to override and disable options
|
||||
if (!$this->h5pF->getOption('frame', TRUE)) {
|
||||
$disable |= self::DISABLE_FRAME;
|
||||
}
|
||||
else {
|
||||
if (!$this->h5pF->getOption('export', TRUE)) {
|
||||
$disable |= self::DISABLE_DOWNLOAD;
|
||||
}
|
||||
if (!$this->h5pF->getOption('embed', TRUE)) {
|
||||
$disable |= self::DISABLE_EMBED;
|
||||
}
|
||||
if (!$this->h5pF->getOption('copyright', TRUE)) {
|
||||
$disable |= self::DISABLE_COPYRIGHT;
|
||||
}
|
||||
if (!$this->h5pF->getOption('icon', TRUE)) {
|
||||
$disable |= self::DISABLE_ABOUT;
|
||||
}
|
||||
}
|
||||
|
||||
return $disable;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine disable state from sources.
|
||||
*
|
||||
* @param array $sources
|
||||
* @return int
|
||||
*/
|
||||
public static function getDisable(&$sources) {
|
||||
$disable = H5PCore::DISABLE_NONE;
|
||||
if (!$sources['frame']) {
|
||||
$disable |= H5PCore::DISABLE_FRAME;
|
||||
}
|
||||
if (!$sources['download']) {
|
||||
$disable |= H5PCore::DISABLE_DOWNLOAD;
|
||||
}
|
||||
if (!$sources['copyright']) {
|
||||
$disable |= H5PCore::DISABLE_COPYRIGHT;
|
||||
}
|
||||
if (!$sources['embed']) {
|
||||
$disable |= H5PCore::DISABLE_EMBED;
|
||||
}
|
||||
return $disable;
|
||||
}
|
||||
|
||||
// Cache for getting library ids
|
||||
private $libraryIdMap = array();
|
||||
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
(function ($) {
|
||||
$(document).ready(function () {
|
||||
var $inputs = $('.h5p-action-bar-settings input');
|
||||
var $frame = $inputs.filter('input[name="frame"], input[name="h5p_frame"]');
|
||||
var $others = $inputs.filter(':not(input[name="frame"], input[name="h5p_frame"])');
|
||||
|
||||
var toggle = function () {
|
||||
if ($frame.is(':checked')) {
|
||||
$others.attr('disabled', false);
|
||||
}
|
||||
else {
|
||||
$others.attr('disabled', true);
|
||||
}
|
||||
};
|
||||
|
||||
$frame.change(toggle);
|
||||
toggle();
|
||||
});
|
||||
})(jQuery);
|
58
js/h5p.js
58
js/h5p.js
|
@ -30,7 +30,29 @@ else if (document.documentElement.msRequestFullscreen) {
|
|||
H5P.fullScreenBrowserPrefix = 'ms';
|
||||
}
|
||||
|
||||
// Keep track of when the H5Ps where started
|
||||
/** @const {Number} */
|
||||
H5P.DISABLE_NONE = 0;
|
||||
|
||||
/** @const {Number} */
|
||||
H5P.DISABLE_FRAME = 1;
|
||||
|
||||
/** @const {Number} */
|
||||
H5P.DISABLE_DOWNLOAD = 2;
|
||||
|
||||
/** @const {Number} */
|
||||
H5P.DISABLE_EMBED = 4;
|
||||
|
||||
/** @const {Number} */
|
||||
H5P.DISABLE_COPYRIGHT = 8;
|
||||
|
||||
/** @const {Number} */
|
||||
H5P.DISABLE_ABOUT = 16;
|
||||
|
||||
/**
|
||||
* Keep track of when the H5Ps where started.
|
||||
*
|
||||
* @type {Array}
|
||||
*/
|
||||
H5P.opened = {};
|
||||
|
||||
/**
|
||||
|
@ -72,21 +94,23 @@ H5P.init = function (target) {
|
|||
});
|
||||
}
|
||||
|
||||
// Create action bar
|
||||
var $actions = H5P.jQuery('<ul class="h5p-actions"></ul>');
|
||||
if (contentData.exportUrl !== '') {
|
||||
// Display export button
|
||||
|
||||
if (!(contentData.disable & H5P.DISABLE_DOWNLOAD)) {
|
||||
// Add export button
|
||||
H5P.jQuery('<li class="h5p-button h5p-export" role="button" tabindex="1" title="' + H5P.t('downloadDescription') + '">' + H5P.t('download') + '</li>').appendTo($actions).click(function () {
|
||||
window.location.href = contentData.exportUrl;
|
||||
});
|
||||
}
|
||||
|
||||
// Display copyrights button
|
||||
H5P.jQuery('<li class="h5p-button h5p-copyrights" role="button" tabindex="1" title="' + H5P.t('copyrightsDescription') + '">' + H5P.t('copyrights') + '</li>').appendTo($actions).click(function () {
|
||||
H5P.openCopyrightsDialog($actions, instance, library.params, contentId);
|
||||
});
|
||||
|
||||
if (contentData.embedCode !== undefined) {
|
||||
// Display embed button
|
||||
if (!(contentData.disable & H5P.DISABLE_COPYRIGHT) && instance.getCopyrights !== undefined) {
|
||||
// Add copyrights button
|
||||
H5P.jQuery('<li class="h5p-button h5p-copyrights" role="button" tabindex="1" title="' + H5P.t('copyrightsDescription') + '">' + H5P.t('copyrights') + '</li>').appendTo($actions).click(function () {
|
||||
H5P.openCopyrightsDialog($actions, instance, library.params, contentId);
|
||||
});
|
||||
}
|
||||
if (!(contentData.disable & H5P.DISABLE_EMBED)) {
|
||||
// Add embed button
|
||||
H5P.jQuery('<li class="h5p-button h5p-embed" role="button" tabindex="1" title="' + H5P.t('embedDescription') + '">' + H5P.t('embed') + '</li>').appendTo($actions).click(function () {
|
||||
H5P.openEmbedDialog($actions, contentData.embedCode, contentData.resizeCode, {
|
||||
width: $container.width(),
|
||||
|
@ -94,10 +118,18 @@ H5P.init = function (target) {
|
|||
});
|
||||
});
|
||||
}
|
||||
if (contentData.showH5PIconInActionBar) {
|
||||
if (!(contentData.disable & H5P.DISABLE_ABOUT)) {
|
||||
// Add about H5P button icon
|
||||
H5P.jQuery('<li><a class="h5p-link" href="http://h5p.org" target="_blank" title="' + H5P.t('h5pDescription') + '"></a></li>').appendTo($actions);
|
||||
}
|
||||
$actions.insertAfter($container);
|
||||
|
||||
// Insert action bar if it has any content
|
||||
if ($actions.children().length) {
|
||||
$actions.insertAfter($container);
|
||||
}
|
||||
else {
|
||||
$element.addClass('h5p-no-frame');
|
||||
}
|
||||
|
||||
// Keep track of when we started
|
||||
H5P.opened[contentId] = new Date();
|
||||
|
|
|
@ -36,7 +36,9 @@ html.h5p-iframe .h5p-content {
|
|||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
.h5p-fullscreen .h5p-content, .h5p-semi-fullscreen .h5p-content {
|
||||
.h5p-content.h5p-no-frame,
|
||||
.h5p-fullscreen .h5p-content,
|
||||
.h5p-semi-fullscreen .h5p-content {
|
||||
border: 0;
|
||||
}
|
||||
.h5p-container {
|
||||
|
|
Loading…
Reference in New Issue