Add disable support for uploads as well

semantics-font
Svein-Tore Griff With 2015-04-15 13:54:46 +02:00
parent 09c6d5c4f8
commit cf7ae066ad
2 changed files with 10 additions and 3 deletions

View File

@ -1240,7 +1240,7 @@ class H5PStorage {
* TRUE if one or more libraries were updated * TRUE if one or more libraries were updated
* FALSE otherwise * FALSE otherwise
*/ */
public function savePackage($content = NULL, $contentMainId = NULL, $skipContent = FALSE) { public function savePackage($content = NULL, $contentMainId = NULL, $skipContent = FALSE, $options = array()) {
if ($this->h5pF->mayUpdateLibraries()) { if ($this->h5pF->mayUpdateLibraries()) {
// Save the libraries we processed during validation // Save the libraries we processed during validation
$this->saveLibraries(); $this->saveLibraries();
@ -1268,6 +1268,10 @@ class H5PStorage {
} }
$content['params'] = file_get_contents($current_path . DIRECTORY_SEPARATOR . 'content.json'); $content['params'] = file_get_contents($current_path . DIRECTORY_SEPARATOR . 'content.json');
if (isset($options['disable'])) {
$content['disable'] = $options['disable'];
}
$contentId = $this->h5pC->saveContent($content, $contentMainId); $contentId = $this->h5pC->saveContent($content, $contentMainId);
$this->contentId = $contentId; $this->contentId = $contentId;
@ -1413,9 +1417,9 @@ class H5PStorage {
* TRUE if one or more libraries were updated * TRUE if one or more libraries were updated
* FALSE otherwise * FALSE otherwise
*/ */
public function updatePackage($contentId, $contentMainId = NULL) { public function updatePackage($contentId, $contentMainId = NULL, $options) {
$this->deletePackage($contentId); $this->deletePackage($contentId);
return $this->savePackage($contentId, $contentMainId); return $this->savePackage($contentId, $contentMainId, FALSE, $options);
} }
/** /**

View File

@ -1525,6 +1525,9 @@ H5P.createUUID = function() {
}; };
H5P.createTitle = function(rawTitle, maxLength) { H5P.createTitle = function(rawTitle, maxLength) {
if (!rawTitle) {
return '';
}
if (maxLength === undefined) { if (maxLength === undefined) {
maxLength = 60; maxLength = 60;
} }