Add path fixes

semantics-font
Svein-Tore Griff With 2015-04-07 19:30:46 +02:00
parent 61a8e7e9e9
commit cfa747f20c
2 changed files with 9 additions and 9 deletions

View File

@ -9,7 +9,7 @@ class H5PDevelopment {
const MODE_CONTENT = 1; const MODE_CONTENT = 1;
const MODE_LIBRARY = 2; const MODE_LIBRARY = 2;
private $h5pF, $libraries, $language; private $h5pF, $libraries, $language, $filesPath;
/** /**
* Constructor. * Constructor.
@ -23,6 +23,7 @@ class H5PDevelopment {
public function __construct($H5PFramework, $filesPath, $language, $libraries = NULL) { public function __construct($H5PFramework, $filesPath, $language, $libraries = NULL) {
$this->h5pF = $H5PFramework; $this->h5pF = $H5PFramework;
$this->language = $language; $this->language = $language;
$this->filesPath = $filesPath;
if ($libraries !== NULL) { if ($libraries !== NULL) {
$this->libraries = $libraries; $this->libraries = $libraries;
} }
@ -86,7 +87,7 @@ class H5PDevelopment {
$library['libraryId'] = $this->h5pF->getLibraryId($library['machineName'], $library['majorVersion'], $library['minorVersion']); $library['libraryId'] = $this->h5pF->getLibraryId($library['machineName'], $library['majorVersion'], $library['minorVersion']);
$this->h5pF->saveLibraryData($library, $library['libraryId'] === FALSE); $this->h5pF->saveLibraryData($library, $library['libraryId'] === FALSE);
$library['path'] = $path . '/' . $contents[$i]; $library['path'] = 'development/' . $contents[$i];
$this->libraries[H5PDevelopment::libraryToString($library['machineName'], $library['majorVersion'], $library['minorVersion'])] = $library; $this->libraries[H5PDevelopment::libraryToString($library['machineName'], $library['majorVersion'], $library['minorVersion'])] = $library;
} }
@ -142,8 +143,7 @@ class H5PDevelopment {
if (isset($this->libraries[$library]) === FALSE) { if (isset($this->libraries[$library]) === FALSE) {
return NULL; return NULL;
} }
return $this->getFileContents($this->filesPath . $this->libraries[$library]['path'] . '/semantics.json');
return $this->getFileContents($this->libraries[$library]['path'] . '/semantics.json');
} }
/** /**
@ -161,7 +161,7 @@ class H5PDevelopment {
return NULL; return NULL;
} }
return $this->getFileContents($this->libraries[$library]['path'] . '/language/' . $language . '.json'); return $this->getFileContents($this->filesPath . $this->libraries[$library]['path'] . '/language/' . $language . '.json');
} }
/** /**

View File

@ -1492,7 +1492,7 @@ Class H5PExport {
$library = $dependency['library']; $library = $dependency['library'];
// Copy library to h5p // Copy library to h5p
$source = isset($library['path']) ? $library['path'] : $h5pDir . 'libraries' . DIRECTORY_SEPARATOR . H5PCore::libraryToString($library, TRUE); $source = $h5pDir . (isset($library['path']) ? $library['path'] : 'libraries' . DIRECTORY_SEPARATOR . H5PCore::libraryToString($library, TRUE));
$destination = $tempPath . DIRECTORY_SEPARATOR . $library['machineName']; $destination = $tempPath . DIRECTORY_SEPARATOR . $library['machineName'];
$this->h5pC->copyFileTree($source, $destination); $this->h5pC->copyFileTree($source, $destination);
@ -1644,7 +1644,7 @@ class H5PCore {
$this->development_mode = $development_mode; $this->development_mode = $development_mode;
if ($development_mode & H5PDevelopment::MODE_LIBRARY) { if ($development_mode & H5PDevelopment::MODE_LIBRARY) {
$this->h5pD = new H5PDevelopment($this->h5pF, $path, $language); $this->h5pD = new H5PDevelopment($this->h5pF, $path . '/', $language);
} }
} }
@ -1787,7 +1787,7 @@ class H5PCore {
} }
foreach ($dependency[$type] as $file) { foreach ($dependency[$type] as $file) {
$assets[] = (object) array( $assets[] = (object) array(
'path' => /*$prefix .*/ $dependency['path'] . '/' . trim(is_array($file) ? $file['path'] : $file), 'path' => $prefix . '/' . $dependency['path'] . '/' . trim(is_array($file) ? $file['path'] : $file),
'version' => $dependency['version'] 'version' => $dependency['version']
); );
} }
@ -1835,7 +1835,7 @@ class H5PCore {
); );
foreach ($dependencies as $dependency) { foreach ($dependencies as $dependency) {
if (isset($dependency['path']) === FALSE) { if (isset($dependency['path']) === FALSE) {
$dependency['path'] = '/libraries/' . H5PCore::libraryToString($dependency, TRUE); $dependency['path'] = 'libraries/' . H5PCore::libraryToString($dependency, TRUE);
$dependency['preloadedJs'] = explode(',', $dependency['preloadedJs']); $dependency['preloadedJs'] = explode(',', $dependency['preloadedJs']);
$dependency['preloadedCss'] = explode(',', $dependency['preloadedCss']); $dependency['preloadedCss'] = explode(',', $dependency['preloadedCss']);
} }