Merge branch 'master' of github.com:h5p/h5p-php-library
commit
db6f18c984
|
@ -116,10 +116,13 @@ class H5PDefaultStorage implements \H5PFileStorage {
|
||||||
* Library properties
|
* Library properties
|
||||||
* @param string $target
|
* @param string $target
|
||||||
* Where the library folder will be saved
|
* 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);
|
$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
|
* To path
|
||||||
* @return boolean
|
* @return boolean
|
||||||
* Indicates if the directory existed.
|
* Indicates if the directory existed.
|
||||||
|
*
|
||||||
|
* @throws Exception Unable to copy the file
|
||||||
*/
|
*/
|
||||||
private static function copyFileTree($source, $destination) {
|
private static function copyFileTree($source, $destination) {
|
||||||
if (!self::dirReady($destination)) {
|
if (!self::dirReady($destination)) {
|
||||||
|
|
|
@ -1550,8 +1550,25 @@ Class H5PExport {
|
||||||
$library = $dependency['library'];
|
$library = $dependency['library'];
|
||||||
|
|
||||||
try {
|
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
|
// Export required libraries
|
||||||
$this->h5pC->fs->exportLibrary($library, $tmpPath);
|
$this->h5pC->fs->exportLibrary($library, $tmpPath, $exportFolder);
|
||||||
}
|
}
|
||||||
catch (Exception $e) {
|
catch (Exception $e) {
|
||||||
$this->h5pF->setErrorMessage($this->h5pF->t($e->getMessage()));
|
$this->h5pF->setErrorMessage($this->h5pF->t($e->getMessage()));
|
||||||
|
|
|
@ -174,8 +174,10 @@ H5P.ConfirmationDialog = (function (EventDispatcher) {
|
||||||
popup.style.top = offsetTop + 'px';
|
popup.style.top = offsetTop + 'px';
|
||||||
popupBackground.classList.remove('hidden');
|
popupBackground.classList.remove('hidden');
|
||||||
fitToContainer();
|
fitToContainer();
|
||||||
popupBackground.classList.remove('hiding');
|
setTimeout(function () {
|
||||||
popup.classList.remove('hidden');
|
popup.classList.remove('hidden');
|
||||||
|
popupBackground.classList.remove('hiding');
|
||||||
|
}, 0);
|
||||||
|
|
||||||
// Programmatically focus popup
|
// Programmatically focus popup
|
||||||
popup.setAttribute('tabindex', '-1');
|
popup.setAttribute('tabindex', '-1');
|
||||||
|
|
|
@ -1503,7 +1503,7 @@ H5P.Coords = function (x, y, w, h) {
|
||||||
* return false if the library parameter is invalid
|
* return false if the library parameter is invalid
|
||||||
*/
|
*/
|
||||||
H5P.libraryFromString = function (library) {
|
H5P.libraryFromString = function (library) {
|
||||||
var regExp = /(.+)\s(\d)+\.(\d)$/g;
|
var regExp = /(.+)\s(\d+)\.(\d+)$/g;
|
||||||
var res = regExp.exec(library);
|
var res = regExp.exec(library);
|
||||||
if (res !== null) {
|
if (res !== null) {
|
||||||
return {
|
return {
|
||||||
|
|
Loading…
Reference in New Issue