Merge conflicts

namespaces
Svein-Tore Griff With 2013-03-07 04:19:22 +01:00
commit c5f3b92245
2 changed files with 38 additions and 4 deletions

View File

@ -102,7 +102,7 @@ interface H5PFrameworkInterface {
* @param int $contentMainId
* Any contentMainId defined by the framework, for instance to support revisioning
*/
public function saveContentData($contentId, $contentJson, $mainJsonData, $contentMainId = NULL);
public function saveContentData($contentId, $contentJson, $mainJsonData, $mainLibraryId, $contentMainId = NULL);
/**
* Copies content data
@ -686,17 +686,30 @@ class H5PStorage {
$this->h5pC->delTree($destination_path);
rename($current_path, $destination_path);
}
foreach ($this->h5pC->librariesJsonData as $key => &$library) {
// All libraries have been saved, we now save all the dependencies
if (isset($library['preloadedDependencies'])) {
$this->h5pF->saveLibraryDependencies($library['libraryId'], $library['preloadedDependencies'], 'preloaded');
}
if (isset($library['dynamicDependencies'])) {
$this->h5pF->saveLibraryDependencies($library['libraryId'], $library['dynamicDependencies'], 'dynamic');
}
if (isset($library['editorDependencies'])) {
$this->h5pF->saveLibraryDependencies($library['libraryId'], $library['editorDependencies'], 'editor');
}
}
$current_path = $this->h5pF->getUploadedH5pFolderPath() . DIRECTORY_SEPARATOR . 'content';
$destination_path = $this->h5pF->getH5pPath() . DIRECTORY_SEPARATOR . 'content' . DIRECTORY_SEPARATOR . $contentId;
rename($current_path, $destination_path);
$contentJson = file_get_contents($destination_path . DIRECTORY_SEPARATOR . 'content.json');
$this->h5pF->saveContentData($contentId, $contentJson, $this->h5pC->mainJsonData, $contentMainId);
$librariesInUse = array();
$this->getLibraryUsage($librariesInUse, $this->h5pC->mainJsonData);
$this->h5pF->saveLibraryUsage($contentId, $librariesInUse);
$this->h5pC->delTree($this->h5pF->getUploadedH5pFolderPath());
$contentJson = file_get_contents($destination_path . DIRECTORY_SEPARATOR . 'content.json');
$mainLibraryId = $librariesInUse[$this->h5pC->mainJsonData['mainLibrary']]['library']['libraryId'];
$this->h5pF->saveContentData($contentId, $contentJson, $this->h5pC->mainJsonData, $mainLibraryId, $contentMainId);
}
public function deletePackage($contentId) {

View File

@ -58,6 +58,27 @@ H5P.Coords = function(x, y, w, h) {
return this;
};
/**
*@param {string} library
* library in the format machineName majorVersion.minorVersion
* @returns
* library as an object with machineName, majorVersion and minorVersion properties
* return false if the library parameter is invalid
*/
H5P.libraryFromString = function (library) {
var regExp = /(.+)\s(\d)+\.(\d)$/g;
var res = regExp.exec(library);
if (res !== null) {
return {
'machineName': res[1],
'majorVersion': res[2],
'minorVersion': res[3]
};
}
else {
return false;
}
};
// Play a video. $target is jQuery object to attach video to. (Appended).
// Params are video-params from content. cp is content path. onEnded is
// function to call when finished.