commit
09bf13ee8f
|
@ -1154,7 +1154,7 @@ class H5PStorage {
|
||||||
|
|
||||||
if ($upgradeOnly) {
|
if ($upgradeOnly) {
|
||||||
// TODO - support translation
|
// TODO - support translation
|
||||||
$this->h5pF->setInfoMessage($upgradedLibsCount . ' libraries were upgraded!');
|
$this->h5pF->setInfoMessage($this->h5pF->t('@num libraries were upgraded!', array('@num' => $upgradedLibsCount)));
|
||||||
}
|
}
|
||||||
|
|
||||||
return $library_saved;
|
return $library_saved;
|
||||||
|
@ -1258,7 +1258,9 @@ Class H5PExport {
|
||||||
// Build h5p.json
|
// Build h5p.json
|
||||||
$h5pJson = array (
|
$h5pJson = array (
|
||||||
'title' => $content['title'],
|
'title' => $content['title'],
|
||||||
'language' => $content['language'],
|
// TODO - stop using 'und', this is not the preferred way.
|
||||||
|
// Either remove language from the json if not existing, or use "language": null
|
||||||
|
'language' => isset($content['language']) ? $content['language'] : 'und',
|
||||||
'mainLibrary' => $content['library']['name'],
|
'mainLibrary' => $content['library']['name'],
|
||||||
'embedTypes' => $embedTypes,
|
'embedTypes' => $embedTypes,
|
||||||
);
|
);
|
||||||
|
|
|
@ -23,9 +23,9 @@ var H5PLibraryList= H5PLibraryList || {};
|
||||||
* @param {object} libraries List of libraries and headers
|
* @param {object} libraries List of libraries and headers
|
||||||
*/
|
*/
|
||||||
H5PLibraryList.createLibraryList = function (libraries) {
|
H5PLibraryList.createLibraryList = function (libraries) {
|
||||||
|
var t = H5PIntegration.i18n.H5P;
|
||||||
if(libraries.listData === undefined || libraries.listData.length === 0) {
|
if(libraries.listData === undefined || libraries.listData.length === 0) {
|
||||||
return;
|
return $('<div>' + t.NA + '</div>');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create table
|
// Create table
|
||||||
|
@ -33,14 +33,22 @@ var H5PLibraryList= H5PLibraryList || {};
|
||||||
$table.addClass('libraries');
|
$table.addClass('libraries');
|
||||||
|
|
||||||
// Add libraries
|
// Add libraries
|
||||||
var t = H5PIntegration.i18n.H5P;
|
|
||||||
$.each (libraries.listData, function (index, library) {
|
$.each (libraries.listData, function (index, library) {
|
||||||
var $libraryRow = H5PUtils.createTableRow([
|
var $libraryRow = H5PUtils.createTableRow([
|
||||||
library.title,
|
library.title,
|
||||||
'<input class="h5p-admin-restricted" type="checkbox"/>',
|
'<input class="h5p-admin-restricted" type="checkbox"/>',
|
||||||
library.numContent,
|
{
|
||||||
library.numContentDependencies,
|
text: library.numContent,
|
||||||
library.numLibraryDependencies,
|
class: 'h5p-admin-center'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
text: library.numContentDependencies,
|
||||||
|
class: 'h5p-admin-center'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
text: library.numLibraryDependencies,
|
||||||
|
class: 'h5p-admin-center'
|
||||||
|
},
|
||||||
'<div class="h5p-admin-buttons-wrapper">\
|
'<div class="h5p-admin-buttons-wrapper">\
|
||||||
<button class="h5p-admin-upgrade-library"></button>\
|
<button class="h5p-admin-upgrade-library"></button>\
|
||||||
<button class="h5p-admin-view-library" title="' + t.viewLibrary + '"></button>\
|
<button class="h5p-admin-view-library" title="' + t.viewLibrary + '"></button>\
|
||||||
|
@ -50,10 +58,11 @@ var H5PLibraryList= H5PLibraryList || {};
|
||||||
|
|
||||||
H5PLibraryList.addRestricted($('.h5p-admin-restricted', $libraryRow), library.restrictedUrl, library.restricted);
|
H5PLibraryList.addRestricted($('.h5p-admin-restricted', $libraryRow), library.restrictedUrl, library.restricted);
|
||||||
|
|
||||||
|
var hasContent = !(library.numContent === '' || library.numContent === 0);
|
||||||
if (library.upgradeUrl === null) {
|
if (library.upgradeUrl === null) {
|
||||||
$('.h5p-admin-upgrade-library', $libraryRow).remove();
|
$('.h5p-admin-upgrade-library', $libraryRow).remove();
|
||||||
}
|
}
|
||||||
else if (library.upgradeUrl === false || library.numContent === 0) {
|
else if (library.upgradeUrl === false || !hasContent) {
|
||||||
$('.h5p-admin-upgrade-library', $libraryRow).attr('disabled', true);
|
$('.h5p-admin-upgrade-library', $libraryRow).attr('disabled', true);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -68,7 +77,7 @@ var H5PLibraryList= H5PLibraryList || {};
|
||||||
});
|
});
|
||||||
|
|
||||||
var $deleteButton = $('.h5p-admin-delete-library', $libraryRow);
|
var $deleteButton = $('.h5p-admin-delete-library', $libraryRow);
|
||||||
if (libraries.notCached !== undefined || library.numContent !== 0 || (library.numContentDependencies !== '' && library.numContentDependencies !== 0) || (library.numLibraryDependencies !== '' && library.numLibraryDependencies !== 0)) {
|
if (libraries.notCached !== undefined || hasContent || (library.numContentDependencies !== '' && library.numContentDependencies !== 0) || (library.numLibraryDependencies !== '' && library.numLibraryDependencies !== 0)) {
|
||||||
// Disabled delete if content.
|
// Disabled delete if content.
|
||||||
$deleteButton.attr('disabled', true);
|
$deleteButton.attr('disabled', true);
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,7 @@ var H5PUtils = H5PUtils || {};
|
||||||
$.each(headers, function (index, value) {
|
$.each(headers, function (index, value) {
|
||||||
if (!(value instanceof Object)) {
|
if (!(value instanceof Object)) {
|
||||||
value = {
|
value = {
|
||||||
text: value
|
html: value
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,7 +38,13 @@ var H5PUtils = H5PUtils || {};
|
||||||
var $tr = $('<tr></tr>');
|
var $tr = $('<tr></tr>');
|
||||||
|
|
||||||
$.each(rows, function (index, value) {
|
$.each(rows, function (index, value) {
|
||||||
$tr.append('<td>' + value + '</td>');
|
if (!(value instanceof Object)) {
|
||||||
|
value = {
|
||||||
|
html: value
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
$('<td/>', value).appendTo($tr);
|
||||||
});
|
});
|
||||||
|
|
||||||
return $tr;
|
return $tr;
|
||||||
|
|
Loading…
Reference in New Issue