Merge branch 'master' of github.com:h5p/h5p-php-library

pull/21/head
Frode Petterson 2016-04-22 11:36:07 +02:00
commit db6f18c984
4 changed files with 30 additions and 6 deletions

View File

@ -116,10 +116,13 @@ class H5PDefaultStorage implements \H5PFileStorage {
* Library properties
* @param string $target
* Where the library folder will be saved
* @param string $developmentPath
* Folder that library resides in
*/
public function exportLibrary($library, $target) {
public function exportLibrary($library, $target, $developmentPath=NULL) {
$folder = \H5PCore::libraryToString($library, TRUE);
self::copyFileTree("{$this->path}/libraries/{$folder}", "{$target}/{$folder}");
$srcPath = ($developmentPath === NULL ? "/libraries/{$folder}" : $developmentPath);
self::copyFileTree("{$this->path}{$srcPath}", "{$target}/{$folder}");
}
/**
@ -263,6 +266,8 @@ class H5PDefaultStorage implements \H5PFileStorage {
* To path
* @return boolean
* Indicates if the directory existed.
*
* @throws Exception Unable to copy the file
*/
private static function copyFileTree($source, $destination) {
if (!self::dirReady($destination)) {

View File

@ -1550,8 +1550,25 @@ Class H5PExport {
$library = $dependency['library'];
try {
$exportFolder = NULL;
// Determine path of export library
if (isset($this->h5pC) && isset($this->h5pC->h5pD)) {
// Tries to find library in development folder
$isDevLibrary = $this->h5pC->h5pD->getLibrary(
$library['machineName'],
$library['majorVersion'],
$library['minorVersion']
);
if ($isDevLibrary !== NULL) {
$exportFolder = "/" . $library['path'];
}
}
// Export required libraries
$this->h5pC->fs->exportLibrary($library, $tmpPath);
$this->h5pC->fs->exportLibrary($library, $tmpPath, $exportFolder);
}
catch (Exception $e) {
$this->h5pF->setErrorMessage($this->h5pF->t($e->getMessage()));

View File

@ -174,8 +174,10 @@ H5P.ConfirmationDialog = (function (EventDispatcher) {
popup.style.top = offsetTop + 'px';
popupBackground.classList.remove('hidden');
fitToContainer();
popupBackground.classList.remove('hiding');
setTimeout(function () {
popup.classList.remove('hidden');
popupBackground.classList.remove('hiding');
}, 0);
// Programmatically focus popup
popup.setAttribute('tabindex', '-1');

View File

@ -1503,7 +1503,7 @@ H5P.Coords = function (x, y, w, h) {
* return false if the library parameter is invalid
*/
H5P.libraryFromString = function (library) {
var regExp = /(.+)\s(\d)+\.(\d)$/g;
var regExp = /(.+)\s(\d+)\.(\d+)$/g;
var res = regExp.exec(library);
if (res !== null) {
return {