Merge branch 'master' into adaptivity
commit
e12ba70b95
|
@ -1,13 +1,12 @@
|
|||
This folder contains the h5p general library. The files within this folder are not specific to any framework.
|
||||
|
||||
Any interaction with LMS, CMS or other frameworks is done through interfaces. Plattforms needs to implement
|
||||
the following interfaces in order for the h5p libraries to work:
|
||||
|
||||
- TODO: Fill in here
|
||||
|
||||
In addition frameworks need to do the following:
|
||||
the H5PFrameworkInterface(in h5p.classes.php) and also do the following:
|
||||
|
||||
- Provide a form for uploading h5p packages.
|
||||
- Place the uploaded h5p packages in a temporary directory
|
||||
+++
|
||||
|
||||
See existing implementations for details. For instance the Drupal h5p module located on drupal.org/project/h5p
|
||||
|
||||
We will make available documentations and tutorials for creating platform integrations in the future
|
||||
|
|
|
@ -1305,7 +1305,7 @@ class H5PStorage {
|
|||
|
||||
// Find out which libraries are used by this package/content
|
||||
$librariesInUse = array();
|
||||
$this->h5pC->findLibraryDependencies($librariesInUse, $this->h5pC->mainJsonData);
|
||||
$nextWeight = $this->h5pC->findLibraryDependencies($librariesInUse, $this->h5pC->mainJsonData);
|
||||
|
||||
// Save content
|
||||
if ($content === NULL) {
|
||||
|
@ -1837,9 +1837,12 @@ class H5PCore {
|
|||
*
|
||||
* @param array $librariesUsed Flat list of all dependencies.
|
||||
* @param array $library To find all dependencies for.
|
||||
* @param bool $editor Used interally to force all preloaded sub dependencies of an editor dependecy to be editor dependencies.
|
||||
* @param int $nextWeight An integer determining the order of the libraries
|
||||
* when they are loaded
|
||||
* @param bool $editor Used interally to force all preloaded sub dependencies
|
||||
* of an editor dependecy to be editor dependencies.
|
||||
*/
|
||||
public function findLibraryDependencies(&$dependencies, $library, $editor = FALSE) {
|
||||
public function findLibraryDependencies(&$dependencies, $library, $nextWeight = 1, $editor = FALSE) {
|
||||
foreach (array('dynamic', 'preloaded', 'editor') as $type) {
|
||||
$property = $type . 'Dependencies';
|
||||
if (!isset($library[$property])) {
|
||||
|
@ -1863,7 +1866,8 @@ class H5PCore {
|
|||
'library' => $dependencyLibrary,
|
||||
'type' => $type
|
||||
);
|
||||
$this->findLibraryDependencies($dependencies, $dependencyLibrary, $type === 'editor');
|
||||
$nextWeight = $this->findLibraryDependencies($dependencies, $dependencyLibrary, $nextWeight, $type === 'editor');
|
||||
$dependencies[$dependencyKey]['weight'] = $nextWeight++;
|
||||
}
|
||||
else {
|
||||
// This site is missing a dependency!
|
||||
|
@ -1871,6 +1875,7 @@ class H5PCore {
|
|||
}
|
||||
}
|
||||
}
|
||||
return $nextWeight;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2221,8 +2226,7 @@ class H5PCore {
|
|||
class H5PContentValidator {
|
||||
public $h5pF;
|
||||
public $h5pC;
|
||||
private $typeMap;
|
||||
private $libraries, $dependencies;
|
||||
private $typeMap, $libraries, $dependencies, $nextWeight;
|
||||
|
||||
/**
|
||||
* Constructor for the H5PContentValidator
|
||||
|
@ -2248,6 +2252,7 @@ class H5PContentValidator {
|
|||
'select' => 'validateSelect',
|
||||
'library' => 'validateLibrary',
|
||||
);
|
||||
$this->nextWeight = 1;
|
||||
|
||||
// Keep track of the libraries we load to avoid loading it multiple times.
|
||||
$this->libraries = array();
|
||||
|
@ -2640,7 +2645,8 @@ class H5PContentValidator {
|
|||
'type' => 'preloaded'
|
||||
);
|
||||
|
||||
$this->h5pC->findLibraryDependencies($this->dependencies, $library);
|
||||
$this->nextWeight = $this->h5pC->findLibraryDependencies($this->dependencies, $library, $this->nextWeight);
|
||||
$this->dependencies[$depkey]['weight'] = $this->nextWeight++;
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
|
Loading…
Reference in New Issue