Merge branch 'master' into improved-file-handling

Conflicts:
	h5p-default-storage.class.php
	h5p-file-storage.interface.php
pull/22/head
Frode Petterson 2016-04-25 14:34:05 +02:00
commit c9349b8e26
4 changed files with 42 additions and 19 deletions

View File

@ -2470,7 +2470,7 @@ class H5PCore {
// Determine remote/visitor origin // Determine remote/visitor origin
if ($type === 'network' || if ($type === 'network' ||
($type === 'local' && !preg_match('/^localhost$|^127(?:\.[0-9]+){0,2}\.[0-9]+$|^(?:0*\:)*?:?0*1$/i', $_SERVER['REMOTE_ADDR']))) { ($type === 'local' && !preg_match('/^localhost$|^127(?:\.[0-9]+){0,2}\.[0-9]+$|^(?:0*\:)*?:?0*1$/i', $_SERVER['REMOTE_ADDR']))) {
if (filter_var($_SERVER['REMOTE_ADDR'], FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE)) { if (isset($_SERVER['REMOTE_ADDR']) && filter_var($_SERVER['REMOTE_ADDR'], FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE)) {
// Internet // Internet
$this->h5pF->setOption('site_type', 'internet'); $this->h5pF->setOption('site_type', 'internet');
} }

View File

@ -6,6 +6,7 @@ H5P.ConfirmationDialog = (function (EventDispatcher) {
* Create a confirmation dialog * Create a confirmation dialog
* *
* @param [options] Options for confirmation dialog * @param [options] Options for confirmation dialog
* @param [options.instance] Instance that uses confirmation dialog
* @param [options.headerText] Header text * @param [options.headerText] Header text
* @param [options.dialogText] Dialog text * @param [options.dialogText] Dialog text
* @param [options.cancelText] Cancel dialog button text * @param [options.cancelText] Cancel dialog button text
@ -27,6 +28,9 @@ H5P.ConfirmationDialog = (function (EventDispatcher) {
var exitButtonOffset = 2 * 16; var exitButtonOffset = 2 * 16;
var shadowOffset = 8; var shadowOffset = 8;
// Determine if we are too large for our container and must resize
var resizeIFrame = false;
// Create background // Create background
var popupBackground = document.createElement('div'); var popupBackground = document.createElement('div');
popupBackground.classList popupBackground.classList
@ -156,11 +160,14 @@ H5P.ConfirmationDialog = (function (EventDispatcher) {
// Overflows height // Overflows height
if (popupOffsetTop + popup.offsetHeight > wrapperElement.offsetHeight) { if (popupOffsetTop + popup.offsetHeight > wrapperElement.offsetHeight) {
popupOffsetTop = wrapperElement.offsetHeight - popup.offsetHeight; popupOffsetTop = wrapperElement.offsetHeight - popup.offsetHeight - shadowOffset;
} }
if (popupOffsetTop - exitButtonOffset <= 0) { if (popupOffsetTop - exitButtonOffset <= 0) {
popupOffsetTop = exitButtonOffset; popupOffsetTop = exitButtonOffset + shadowOffset;
// We are too big and must resize
resizeIFrame = true;
} }
popup.style.top = popupOffsetTop + 'px'; popup.style.top = popupOffsetTop + 'px';
}; };
@ -177,6 +184,18 @@ H5P.ConfirmationDialog = (function (EventDispatcher) {
setTimeout(function () { setTimeout(function () {
popup.classList.remove('hidden'); popup.classList.remove('hidden');
popupBackground.classList.remove('hiding'); popupBackground.classList.remove('hiding');
// Resize iFrame if necessary
if (resizeIFrame && options.instance) {
setTimeout(function () {
var minHeight = parseInt(popup.offsetHeight, 10) +
exitButtonOffset + (2 * shadowOffset);
wrapperElement.style.minHeight = minHeight + 'px';
options.instance.trigger('resize');
resizeIFrame = false;
}, 100);
}
}, 0); }, 0);
// Programmatically focus popup // Programmatically focus popup

View File

@ -81,12 +81,9 @@
float: right; float: right;
} }
.h5p-confirmation-dialog-exit:focus, a.h5p-confirmation-dialog-exit:visited,
.h5p-confirmation-dialog-exit:hover { a.h5p-confirmation-dialog-exit:link,
color: #555; a.h5p-confirmation-dialog-exit {
}
.h5p-confirmation-dialog-exit {
position: absolute; position: absolute;
background: none; background: none;
border: none; border: none;
@ -98,6 +95,11 @@
text-decoration: none; text-decoration: none;
} }
a.h5p-confirmation-dialog-exit:focus,
a.h5p-confirmation-dialog-exit:hover {
color: #555;
}
.h5p-confirmation-dialog-exit:before { .h5p-confirmation-dialog-exit:before {
font-family: "H5P"; font-family: "H5P";
content: "\e890"; content: "\e890";

View File

@ -1,4 +1,6 @@
.h5p-core-button { a.h5p-core-button:visited,
a.h5p-core-button:link,
a.h5p-core-button {
font-size: 1em; font-size: 1em;
line-height: 1.2; line-height: 1.2;
padding: 0.5em 1.25em; padding: 0.5em 1.25em;
@ -18,15 +20,15 @@
vertical-align: baseline; vertical-align: baseline;
text-decoration: none; text-decoration: none;
} }
.h5p-core-button:hover, a.h5p-core-button:hover,
.h5p-core-button:focus { a.h5p-core-button:focus {
background: #1356a3; background: #1356a3;
color: #fff; color: #fff;
text-decoration: none; text-decoration: none;
-webkit-transition: initial; -webkit-transition: initial;
transition: initial; transition: initial;
} }
.h5p-core-button:active { a.h5p-core-button:active {
position: relative; position: relative;
background: #104888; background: #104888;
@ -35,7 +37,7 @@
box-shadow: inset 0 4px 0 #0e407a; box-shadow: inset 0 4px 0 #0e407a;
} }
.h5p-core-button:before { a.h5p-core-button:before {
font-family: 'H5P'; font-family: 'H5P';
padding-right: 0.15em; padding-right: 0.15em;
font-size: 1.5em; font-size: 1.5em;
@ -43,18 +45,18 @@
line-height: 0.7; line-height: 0.7;
} }
.h5p-core-cancel-button { a.h5p-core-cancel-button:visited,
cursor: pointer; a.h5p-core-cancel-button:link,
a.h5p-core-cancel-button {
background: none; background: none;
border: none;
color: #a00; color: #a00;
margin-right: 1em; margin-right: 1em;
font-size: 1em; font-size: 1em;
text-decoration: none; text-decoration: none;
} }
.h5p-core-cancel-button:hover, a.h5p-core-cancel-button:hover,
.h5p-core-cancel-button:focus { a.h5p-core-cancel-button:focus {
background: none; background: none;
border: none; border: none;
color: #e40000; color: #e40000;