Merge branch 'master' of github.com:h5p/h5p-php-library
commit
568637a718
|
@ -96,6 +96,7 @@ class H5PDevelopment {
|
||||||
foreach ($this->libraries as $library) {
|
foreach ($this->libraries as $library) {
|
||||||
$this->h5pF->deleteLibraryDependencies($library['libraryId']);
|
$this->h5pF->deleteLibraryDependencies($library['libraryId']);
|
||||||
// This isn't optimal, but without it we would get duplicate warnings.
|
// This isn't optimal, but without it we would get duplicate warnings.
|
||||||
|
// TODO: You might get PDOExceptions if two or more requests does this at the same time!!
|
||||||
$types = array('preloaded', 'dynamic', 'editor');
|
$types = array('preloaded', 'dynamic', 'editor');
|
||||||
foreach ($types as $type) {
|
foreach ($types as $type) {
|
||||||
if (isset($library[$type . 'Dependencies'])) {
|
if (isset($library[$type . 'Dependencies'])) {
|
||||||
|
|
|
@ -495,14 +495,13 @@ class H5PValidator {
|
||||||
|
|
||||||
$libraryH5PData = $this->getLibraryData($file, $filePath, $tmpDir);
|
$libraryH5PData = $this->getLibraryData($file, $filePath, $tmpDir);
|
||||||
|
|
||||||
/* library's directory name and machineName in library.json must match */
|
if ($libraryH5PData !== FALSE) {
|
||||||
if($libraryH5PData['machineName'] !== $file) {
|
// Library's directory name and machineName in library.json must match
|
||||||
|
if ($libraryH5PData['machineName'] !== $file) {
|
||||||
$this->h5pF->setErrorMessage($this->h5pF->t('Library directory name must match machineName in library.json. (Directory: %directoryName , machineName: %machineName)', array('%directoryName' => $file, '%machineName' => $libraryH5PData['machineName'])));
|
$this->h5pF->setErrorMessage($this->h5pF->t('Library directory name must match machineName in library.json. (Directory: %directoryName , machineName: %machineName)', array('%directoryName' => $file, '%machineName' => $libraryH5PData['machineName'])));
|
||||||
$valid = FALSE;
|
$valid = FALSE;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($libraryH5PData) {
|
|
||||||
$libraries[$libraryH5PData['machineName']] = $libraryH5PData;
|
$libraries[$libraryH5PData['machineName']] = $libraryH5PData;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -1397,7 +1396,7 @@ class H5PCore {
|
||||||
$files['scripts'][] = $dependency['path'] . '/' . trim(is_array($file) ? $file['path'] : $file);
|
$files['scripts'][] = $dependency['path'] . '/' . trim(is_array($file) ? $file['path'] : $file);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($dependency['dropCss'] !== '1' && !empty($dependency['preloadedCss']) && $dependency['preloadedCss'][0] !== '') {
|
if ((!isset($dependency['dropCss']) || $dependency['dropCss'] !== '1') && !empty($dependency['preloadedCss']) && $dependency['preloadedCss'][0] !== '') {
|
||||||
foreach ($dependency['preloadedCss'] as $file) {
|
foreach ($dependency['preloadedCss'] as $file) {
|
||||||
$files['styles'][] = $dependency['path'] . '/' . trim(is_array($file) ? $file['path'] : $file);
|
$files['styles'][] = $dependency['path'] . '/' . trim(is_array($file) ? $file['path'] : $file);
|
||||||
}
|
}
|
||||||
|
@ -1478,12 +1477,18 @@ class H5PCore {
|
||||||
}
|
}
|
||||||
|
|
||||||
$dependencyLibrary = $this->loadLibrary($dependency['machineName'], $dependency['majorVersion'], $dependency['minorVersion']);
|
$dependencyLibrary = $this->loadLibrary($dependency['machineName'], $dependency['majorVersion'], $dependency['minorVersion']);
|
||||||
|
if ($dependencyLibrary) {
|
||||||
$dependencies[$dependencyKey] = array(
|
$dependencies[$dependencyKey] = array(
|
||||||
'library' => $dependencyLibrary,
|
'library' => $dependencyLibrary,
|
||||||
'type' => $type
|
'type' => $type
|
||||||
);
|
);
|
||||||
$this->findLibraryDependencies($dependencies, $dependencyLibrary, $type === 'editor');
|
$this->findLibraryDependencies($dependencies, $dependencyLibrary, $type === 'editor');
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
// This site is missing a dependency!
|
||||||
|
$this->h5pF->setErrorMessage($this->h5pF->t('Missing dependency @dep required by @lib.', array('@dep' => H5PCore::libraryToString($dependency), '@lib' => H5PCore::libraryToString($library))));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -40,6 +40,9 @@ H5P.init = function () {
|
||||||
var $container = H5P.jQuery('<div class="h5p-container"></div>').appendTo($element);
|
var $container = H5P.jQuery('<div class="h5p-container"></div>').appendTo($element);
|
||||||
var contentId = $element.data('content-id');
|
var contentId = $element.data('content-id');
|
||||||
var contentData = H5PIntegration.getContentData(contentId);
|
var contentData = H5PIntegration.getContentData(contentId);
|
||||||
|
if (contentData === undefined) {
|
||||||
|
return H5P.error('No data for content id ' + contentId + '. Perhaps the library is gone?');
|
||||||
|
}
|
||||||
var library = {
|
var library = {
|
||||||
library: contentData.library,
|
library: contentData.library,
|
||||||
params: H5P.jQuery.parseJSON(contentData.jsonContent)
|
params: H5P.jQuery.parseJSON(contentData.jsonContent)
|
||||||
|
|
Loading…
Reference in New Issue