Commit c83bdc2a authored by paalj's avatar paalj

Updated libraries

parent d910668d
......@@ -282,6 +282,8 @@ class H5PDefaultStorage implements \H5PFileStorage {
throw new \Exception('unabletocopy');
}
$ignoredFiles = self::getIgnoredFiles("{$source}/.h5pignore");
$dir = opendir($source);
if ($dir === FALSE) {
trigger_error('Unable to open directory ' . $source, E_USER_WARNING);
......@@ -289,7 +291,7 @@ class H5PDefaultStorage implements \H5PFileStorage {
}
while (false !== ($file = readdir($dir))) {
if (($file != '.') && ($file != '..') && $file != '.git' && $file != '.gitignore') {
if (($file != '.') && ($file != '..') && $file != '.git' && $file != '.gitignore' && !in_array($file, $ignoredFiles)) {
if (is_dir("{$source}/{$file}")) {
self::copyFileTree("{$source}/{$file}", "{$destination}/{$file}");
}
......@@ -301,6 +303,25 @@ class H5PDefaultStorage implements \H5PFileStorage {
closedir($dir);
}
/**
* Retrieve array of file names from file.
*
* @param string $file
* @return array Array with files that should be ignored
*/
private static function getIgnoredFiles($file) {
if (file_exists($file) === FALSE) {
return array();
}
$contents = file_get_contents($file);
if ($contents === FALSE) {
return array();
}
return preg_split('/\s+/', $contents);
}
/**
* Recursive function that makes sure the specified directory exists and
* is writable.
......
This diff is collapsed.
(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();
});
})(H5P.jQuery);
H5P.ActionBar = (function ($, EventDispatcher) {
"use strict";
function ActionBar(displayOptions) {
EventDispatcher.call(this);
var self = this;
var hasActions = false;
// Create action bar
var $actions = H5P.jQuery('<ul class="h5p-actions"></ul>');
/**
* Helper for creating action bar buttons.
*
* @private
* @param {string} type
* @param {string} customClass Instead of type class
*/
var addActionButton = function (type, customClass) {
var handler = function () {
self.trigger(type);
};
H5P.jQuery('<li/>', {
'class': 'h5p-button h5p-' + (customClass ? customClass : type),
role: 'button',
tabindex: 0,
title: H5P.t(type + 'Description'),
html: H5P.t(type),
on: {
click: handler,
keypress: function (e) {
if (e.which === 32) {
handler();
e.preventDefault(); // (since return false will block other inputs)
}
}
},
appendTo: $actions
});
hasActions = true;
};
// Register action bar buttons
if (displayOptions.export) {
// Add export button
addActionButton('download', 'export');
}
if (displayOptions.copyright) {
addActionButton('copyrights');
}
if (displayOptions.embed) {
addActionButton('embed');
}
if (displayOptions.icon) {
// 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);
hasActions = true;
}
/**
* Returns a reference to the dom element
*
* @method getDOMElement
* @return {H5P.jQuery}
*/
self.getDOMElement = function () {
return $actions;
};
/**
* Does the actionbar contain actions?
*
* @method hasActions
* @return {Boolean}
*/
self.hasActions = function () {
return hasActions;
}
};
ActionBar.prototype = Object.create(EventDispatcher.prototype);
ActionBar.prototype.constructor = ActionBar;
return ActionBar;
})(H5P.jQuery, H5P.EventDispatcher);
......@@ -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) {
......
/**
* Utility that makes it possible to hide fields when a checkbox is unchecked
*/
(function ($) {
function setupHiding () {
var $toggler = $(this);
// Getting the field which should be hidden:
var $subject = $($toggler.data('h5p-visibility-subject-selector'));
var toggle = function () {
$subject.toggle($toggler.is(':checked'));
};
$toggler.change(toggle);
toggle();
}
$(document).ready(function () {
// Get the checkboxes making other fields being hidden:
$('.h5p-visibility-toggler').each(setupHiding);
});
})(H5P.jQuery);
This diff is collapsed.
......@@ -5,7 +5,7 @@
left: 0;
top: 0;
background: rgba(255, 255, 255, 0.85);
background: rgba(28, 34, 41, 0.9);
opacity: 1;
visibility: visible;
-webkit-transition: opacity 0.1s, linear 0s, visibility 0s linear 0s;
......@@ -46,7 +46,7 @@
transform: translate(-50%, 0%);
color: #555;
box-shadow: 0 0 6px 1px #ddd;
box-shadow: 0 0 6px 6px rgba(10,10,10,0.3);
-webkit-transition: transform 0.1s ease-in;
transition: transform 0.1s ease-in;
......@@ -61,7 +61,7 @@
.h5p-confirmation-dialog-header {
padding: 1.5em;
background: #fff;
color: #1a73d9;
color: #356593;
}
.h5p-confirmation-dialog-header-text {
......@@ -69,8 +69,9 @@
}
.h5p-confirmation-dialog-body {
background: #fafbfc;
border-top: solid 1px #dde0e9;
padding: 1.25em 1.5em;
background: #fafafa;
}
.h5p-confirmation-dialog-text {
......@@ -90,14 +91,14 @@ button.h5p-confirmation-dialog-exit {
font-size: 2.5em;
top: -0.9em;
right: -1.15em;
color: #777;
color: #fff;
cursor: pointer;
text-decoration: none;
}
button.h5p-confirmation-dialog-exit:focus,
button.h5p-confirmation-dialog-exit:hover {
color: #555;
color: #E4ECF5;
}
.h5p-confirmation-dialog-exit:before {
......
button.h5p-core-button:visited,
button.h5p-core-button:link,
button.h5p-core-button {
font-family: "Open Sans", sans-serif;
font-weight: 600;
font-size: 1em;
line-height: 1.2;
padding: 0.5em 1.25em;
border-radius: 2em;
background: #1a73d9;
color: #ffffff;
background: #488ac9;
color: #fff;
cursor: pointer;
border: none;
......@@ -22,7 +24,7 @@ button.h5p-core-button {
}
button.h5p-core-button:hover,
button.h5p-core-button:focus {
background: #1356a3;
background: #3b71a5;
color: #fff;
text-decoration: none;
-webkit-transition: initial;
......
......@@ -3,11 +3,11 @@
/* Custom H5P font to use for icons. */
@font-face {
font-family: 'h5p';
src: url('../fonts/h5p-core-14.eot?inh2er');
src: url('../fonts/h5p-core-14.eot?inh2er#iefix') format('embedded-opentype'),
url('../fonts/h5p-core-14.ttf?inh2er') format('truetype'),
url('../fonts/h5p-core-14.woff?inh2er') format('woff'),
url('../fonts/h5p-core-14.svg?inh2er#h5p-core-14') format('svg');
src: url('../fonts/h5p-core-16.eot?80e76o');
src: url('../fonts/h5p-core-16.eot?80e76o#iefix') format('embedded-opentype'),
url('../fonts/h5p-core-16.ttf?80e76o') format('truetype'),
url('../fonts/h5p-core-16.woff?80e76o') format('woff'),
url('../fonts/h5p-core-16.svg?80e76o#h5p-core-15') format('svg');
font-weight: normal;
font-style: normal;
}
......@@ -235,6 +235,7 @@ div.h5p-fullscreen {
}
.h5p-actions > li {
margin: 0;
list-style: none;
}
.h5p-popup-dialog {
position: absolute;
......
......@@ -243,7 +243,9 @@ class H5peditor {
case 'group':
if (isset($params)) {
if (count($field->fields) == 1) {
$isSubContent = isset($field->isSubContent) && $field->isSubContent == TRUE;
if (count($field->fields) == 1 && !$isSubContent) {
$params = (object) array($field->fields[0]->name => $params);
}
$this->processSemantics($files, $field->fields, $params);
......
H5PEditor.language.core = {
"missingTranslation": "[Fehlende \u00dcbersetzung :key]",
"loading": "L\u00e4dt :type, bitte warten...",
"selectLibrary": "Ausw\u00e4hlen der Bibliothek, die f\u00fcr den Inhalt verwendet werden soll.",
"unknownFieldPath": "\":path\" kann nicht gefunden werden.",
"notImageField": "\":path\" ist kein Bild.",
"notImageOrDimensionsField": "\":path\" ist kein Bild oder Dimensionsfeld.",
"requiredProperty": "Die :property wird ben\u00f6tigt und muss einen Wert besitzen.",
"onlyNumbers": "Der :property Wert kann nur Nummern beinhalten.",
"exceedsMax": "Der :property Wert \u00fcbersteigt das Maximum von :max.",
"belowMin": "Der :property Wert liegt unter dem Minimum von :min.",
"outOfStep": "Der :property Wert kann nur in Schritten von :step ge\u00e4ndert werden.",
"addFile": "Datei hinzuf\u00fcgen",
"removeFile": "Datei entfernen",
"confirmRemoval": "Diesen :type ganz sicher entfernen?",
"removeImage": "Bild entfernen",
"confirmImageRemoval": "Dies wird das Bild entfernen. Ganz sicher fortfahren?",
"changeFile": "Datei \u00e4ndern",
"changeLibrary": "Inhaltstyp \u00e4ndern?",
"semanticsError": "Semantischer Fehler: :error",
"missingProperty": "Im Feld :index fehlt :property property.",
"expandCollapse": "Erweitern\/Verkleinern",
"addEntity": ":entity hinzuf\u00fcgen",
"tooLong": "Wert des Feldes ist zu lang. Es sollte :max Buchstaben oder weniger beinhalten.",
"invalidFormat": "Der Feldwert beinhaltet ein ung\u00fcltiges Format oder verbotene Zeichen.",
"confirmChangeLibrary": "Wenn dies ausgef\u00fchrt wird, dann geht alles verloren, was mit dem aktuellen Inhaltstyp erstellt wurde. Ganz sicher den Inhaltstyp wechseln?",
"moreLibraries": "Nach <a href=\"http:\/\/h5p.org\/content-types-and-applications\" target=\"_blank\">more content types<\/a> auf h5p.org Ausschau halten",
"commonFields": "Einstellungen und Texte",
"commonFieldsDescription": "Hier k\u00f6nnen Einstellungen bearbeitet oder Texte \u00fcbersetzt werden, die in diesem Inhalt Verwendung finden.",
"uploading": "L\u00e4dt hoch, bitte warten...",
"noFollow": "Dem Feld \":path\" kann nicht gefolgt werden.",
"editCopyright": "Urheberrecht bearbeiten",
"close": "Schlie\u00dfen",
"tutorialAvailable": "Anleitung verf\u00fcgbar",
"editMode": "Bearbeitungsmodus",
"listLabel": "Liste",
"uploadError": "Datenuploadfehler",
"fileToLarge": "Die Datei, die hochgeladen werden soll, k\u00f6nnte zu gro\u00df sein.",
"noSemantics": "Fehler, das Formular des Inhaltstypen konnte nicht geladen werden.",
"editImage": "Bild bearbeiten",
"saveLabel": "Speichern",
"cancelLabel": "Abbrechen",
"resetToOriginalLabel": "Auf Original zur\u00fccksetzen",
"loadingImageEditor": "Bildeditor l\u00e4dt, bitte warten...",
"add": "Add",
"unknownFileUploadError": "Unknown file upload error",
"selectFiletoUpload": "Select file to upload",
"or": "or",
"enterAudioUrl": "Enter audio source URL",
"enterVideoUrl": "Enter video source URL or YouTube link",
"addVideoDescription": "H5P supports all external video sources formatted as mp4, webm or ogv, like Vimeo Pro, and has support for YouTube links.",
"insert": "Insert",
"cancel": "Cancel",
"height": "height",
"width": "width",
"textField": "text field",
"numberField": "number field",
"orderItemUp": "Order item up",
"orderItemDown": "Order item down",
"removeItem": "Remove item"
}
H5PEditor.language.core = {
missingTranslation: '[Missing translation :key]',
loading: 'Loading :type, please wait...',
loading: 'Loading, please wait...',
selectLibrary: 'Select the library you wish to use for your content.',
unknownFieldPath: 'Unable to find ":path".',
notImageField: '":path" is not an image.',
......@@ -10,6 +10,7 @@ H5PEditor.language.core = {
exceedsMax: 'The :property value exceeds the maximum of :max.',
belowMin: 'The :property value is below the minimum of :min.',
outOfStep: 'The :property value can only be changed in steps of :step.',
add: 'Add',
addFile: 'Add file',
removeFile: 'Remove file',
confirmRemoval: 'Are you sure you wish to remove this :type?',
......@@ -53,5 +54,8 @@ H5PEditor.language.core = {
height: 'height',
width: 'width',
textField: 'text field',
numberField: 'number field'
numberField: 'number field',
orderItemUp: 'Order item up',
orderItemDown: 'Order item down',
removeItem: 'Remove item'
};
H5PEditor.language.core = {
missingTranslation: '[Falta la traducción :key]',
loading: 'Cargando :type, por favor espera...',
loading: 'Cargando, por favor espera...',
selectLibrary: 'Selecciona la librería que quieres usar con tu contenido.',
unknownFieldPath: 'No se puede encontrar ":path".',
notImageField: '":path" no es una imagen.',
......@@ -10,6 +10,7 @@ H5PEditor.language.core = {
exceedsMax: 'El valor de :property excede el máximo de :max.',
belowMin: 'El valor de :property excede el mínimo de :min.',
outOfStep: 'El valor de :property solo puede ser cambiado en pasos de :step.',
add: 'Add',
addFile: 'Añadir archivo',
removeFile: 'Eliminar archivo',
changeLibrary: 'Cambiar el tipo de contenido',
......@@ -52,5 +53,8 @@ H5PEditor.language.core = {
height: 'height',
width: 'width',
textField: 'text field',
numberField: 'number field'
numberField: 'number field',
orderItemUp: 'Order item up',
orderItemDown: 'Order item down',
removeItem: 'Remove item'
};
......@@ -10,6 +10,7 @@ H5PEditor.language.core = {
exceedsMax: 'La :property dépasse le maximum de :max.',
belowMin: 'La :property dépasse le minimum de :min.',
outOfStep: 'La :property ne peut être effectuée que par étape :step.',
add: 'Add',
addFile: 'Ajouter un fichier',
removeFile: 'Supprimer un fichier',
confirmRemoval: 'Voulez-vous vraiment supprimer :type?',
......@@ -52,5 +53,8 @@ H5PEditor.language.core = {
height: 'height',
width: 'width',
textField: 'text field',
numberField: 'number field'
numberField: 'number field',
orderItemUp: 'Order item up',
orderItemDown: 'Order item down',
removeItem: 'Remove item'
};
H5PEditor.language.core = {
missingTranslation: "[Traduzione mancante :key]",
loading: "Caricamento :type, si prega di attendere...",
loading: "Caricamento, si prega di attendere...",
selectLibrary: "Seleziona la libreria che userai per i tuoi contenuti.",
unknownFieldPath: "Impossibibile trovare :path.",
notImageField: ":path non è un'immagine.",
......@@ -10,6 +10,7 @@ H5PEditor.language.core = {
exceedsMax: "Il valore di :property eccede il massimo di :max.",
belowMin: "Il valore di :property eccede il minimo di :min.",
outOfStep: "Il valore di :property può essere modificato solo negli step di :step.",
add: 'Add',
addFile: "Aggiungi file",
removeFile: "Rimuovi file",
confirmRemoval: "Sei sicuro di voler rimuovere questo :type?",
......@@ -52,5 +53,8 @@ H5PEditor.language.core = {
height: 'height',
width: 'width',
textField: 'text field',
numberField: 'number field'
numberField: 'number field',
orderItemUp: 'Order item up',
orderItemDown: 'Order item down',
removeItem: 'Remove item'
};
H5PEditor.language.core = {
missingTranslation: '[Mangler oversettelse :key]',
loading: 'Laster :type, vennligst vent...',
loading: 'Laster, vennligst vent...',
selectLibrary: 'Velg biblioteket du ønsker å bruke for innholdet ditt.',
unknownFieldPath: 'Kan ikke finne ":path".',
notImageField: '":path" er ikke et bilde.',
......@@ -10,6 +10,7 @@ H5PEditor.language.core = {
exceedsMax: '":property" overstiger maksverdien på :max.',
belowMin: '":property" er mindre enn minimumsverdien på :min.',
outOfStep: '":property" kan bare endres i steg på :step.',
add: 'Add',
addFile: 'Legg til fil',
removeFile: 'Fjern fil',
confirmRemoval: 'Er du sikker på at du ønsker å fjerne denne :type?',
......@@ -52,5 +53,8 @@ H5PEditor.language.core = {
height: 'Høyde',
width: 'Bredde',
textField: 'Tekstfelt',
numberField: 'Nummerfelt'
numberField: 'Nummerfelt',
orderItemUp: 'Flytt element opp',
orderItemDown: 'Flytt element ned',
removeItem: 'Fjern element'
};
H5PEditor.language.core = {
missingTranslation: '[Manglar oversettelse :key]',
loading: 'Lastar :type, ver venleg og vent...',
loading: 'Lastar, ver venleg og vent...',
selectLibrary: 'Vel biblioteket du ønskjer å bruke for innhaldet ditt.',
unknownFieldPath: 'Kan ikkje finne ":path".',
notImageField: '":path" er ikkje eit bilete.',
......@@ -10,6 +10,7 @@ H5PEditor.language.core = {
exceedsMax: '":property" overstig maksverdien på :max.',
belowMin: '":property" er mindre enn minimumsverdien på :min.',
outOfStep: '":property" kan berre endrast i steg på :step.',
add: 'Add',
addFile: 'Legg til fil',
removeFile: 'Fjern fil',
confirmRemoval: 'Er du sikker på at du ønskjer å fjerne denne :type?',
......@@ -52,5 +53,8 @@ H5PEditor.language.core = {
height: 'Høyde',
width: 'Bredde',
textField: 'Tekstfelt',
numberField: 'Nummerfelt'
numberField: 'Nummerfelt',
orderItemUp: 'Flytt element opp',
orderItemDown: 'Flytt element ned',
removeItem: 'Fjern element'
};
......@@ -10,6 +10,7 @@ H5PEditor.language.core = {
exceedsMax: 'The :property value exceeds the maximum of :max.',
belowMin: 'The :property value is below the minimum of :min.',
outOfStep: 'The :property value can only be changed in steps of :step.',
add: 'Add',
addFile: 'Dodaj plik',
removeFile: 'Usuń plik',
confirmRemoval: 'Czy jesteś pewny, że chcesz to usunąć? :type?',
......@@ -53,5 +54,8 @@ H5PEditor.language.core = {
height: 'height',
width: 'width',
textField: 'text field',
numberField: 'number field'
numberField: 'number field',
orderItemUp: 'Order item up',
orderItemDown: 'Order item down',
removeItem: 'Remove item'
};
......@@ -10,6 +10,7 @@ H5PEditor.language.core = {
exceedsMax: ':property değeri :max değerini aşıyor.',
belowMin: ':property değeri :min değerinin altında.',
outOfStep: ':property değeri yalnızca :step aşamalarıyla değiştirilebilir.',
add: 'Add',
addFile: 'Dosya ekle',
removeFile: 'Dosya kaldır',
confirmRemoval: ':type kaldırılacak, emin misiniz?',
......@@ -53,5 +54,8 @@ H5PEditor.language.core = {
height: 'height',
width: 'width',
textField: 'text field',
numberField: 'number field'
numberField: 'number field',
orderItemUp: 'Order item up',
orderItemDown: 'Order item down',
removeItem: 'Remove item'
};
......@@ -85,7 +85,7 @@ ns.Editor = function (library, defaultParams, replace) {
ns.wrap('<link rel="stylesheet" href="', ns.assets.css, '">') +
ns.wrap('<script src="', ns.assets.js, '"></script>') +
'</head><body>' +
'<div class="h5p-editor">' + ns.t('core', 'loading', {':type': 'libraries'}) + '</div>' +
'<div class="h5p-editor">' + ns.t('core', 'loading') + '</div>' +
'</body></html>');
iframe.contentDocument.close();
iframe.contentDocument.documentElement.style.overflow = 'hidden';
......
......@@ -117,6 +117,7 @@ ns.File.prototype.appendTo = function ($wrapper) {
var html = ns.createItem(this.field.type, label + description + fileHtml);
var $container = ns.$(html).appendTo($wrapper);
this.$copyrightButton = $container.find('.h5p-copyright-button');
this.$file = $container.find('.file');
this.$errors = $container.find('.h5p-errors');
this.addFile();
......@@ -159,10 +160,15 @@ ns.File.prototype.addFile = function () {
var that = this;
if (this.params === undefined) {
this.$file.html('<a href="#" class="add" title="' + ns.t('core', 'addFile') + '"></a>').children('.add').click(function () {
this.$file.html(
'<a href="#" class="add" title="' + ns.t('core', 'addFile') + '">' +
'<div class="h5peditor-field-file-upload-text">' + ns.t('core', 'add') + '</div>' +
'</a>'
).children('.add').click(function () {
that.openFileSelector();
return false;
});
this.$copyrightButton.addClass('hidden');
return;
}
......@@ -186,6 +192,7 @@ ns.File.prototype.addFile = function () {
that.confirmRemovalDialog.show(H5P.jQuery(this).offset().top);
return false;
});
that.$copyrightButton.removeClass('hidden');
};
/**
......
......@@ -17,6 +17,9 @@ ns.Form = function () {
this.$common.prev().click(function () {
self.$common.parent().toggleClass('collapsed');
});
// Alternate background colors
this.zebra = "odd";
};
/**
......
......@@ -49,7 +49,7 @@ ns.Group = function (parent, field, params, setValue) {
}
if (this.field.optional === true) {
// If this field is optional, make sure child fields are aswell
// If this field is optional, make sure child fields are as well
for (var j = 0; j < this.field.fields.length; j++) {
this.field.fields[j].optional = true;
}
......@@ -77,7 +77,7 @@ ns.Group.prototype.appendTo = function ($wrapper) {
// Add fieldset wrapper for group
this.$group = ns.$('<fieldset/>', {
'class': 'field group',
'class': 'field group ' + H5PEditor.createImportance(this.field.importance) + ' ' + 'collection',
appendTo: $wrapper
});
......@@ -94,6 +94,7 @@ ns.Group.prototype.appendTo = function ($wrapper) {
keypress: function (event) {
if ((event.charCode || event.keyCode) === 32) {
that.toggle();
event.preventDefault();
}
}
},
......@@ -106,7 +107,7 @@ ns.Group.prototype.appendTo = function ($wrapper) {
appendTo: this.$group
});
if (this.field.fields.length === 1) {
if (this.hasSingleChild() && !this.isSubContent()) {
$content.addClass('h5peditor-single');
this.children = [];
var field = this.field.fields[0];
......@@ -121,6 +122,9 @@ ns.Group.prototype.appendTo = function ($wrapper) {
this.params = {};
this.setValue(this.field, this.params);
}
this.params = this.initSubContent(this.params);
ns.processSemanticsChunk(this.field.fields, this.params, $content, this);
}
......@@ -134,10 +138,52 @@ ns.Group.prototype.appendTo = function ($wrapper) {
}
};
/**
* Return whether this group is Sub Content
*
* @private
* @return {boolean}
*/
ns.Group.prototype.hasSingleChild = function () {
return this.field.fields.length === 1;
};
/**
* Add generated 'subContentId' attribute, if group is "sub content (library-like embedded structure)"
*
* @param {object} params
*
* @private
* @return {object}
*/
ns.Group.prototype.initSubContent = function (params) {
// If group contains library-like sub content that needs UUIDs
if(this.isSubContent()){
params['subContentId'] = params['subContentId'] || H5P.createUUID();
}
return params;
};
/**
* Return whether this group is Sub Content
*
* @private
* @return {boolean}
*/
ns.Group.prototype.isSubContent = function () {
return this.field.isSubContent === true;
};
/**