diff --git a/h5p.classes.php b/h5p.classes.php
index 060c1f1..e9ef67c 100644
--- a/h5p.classes.php
+++ b/h5p.classes.php
@@ -1154,7 +1154,7 @@ class H5PStorage {
if ($upgradeOnly) {
// 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;
@@ -1258,7 +1258,9 @@ Class H5PExport {
// Build h5p.json
$h5pJson = array (
'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'],
'embedTypes' => $embedTypes,
);
diff --git a/js/h5p-library-list.js b/js/h5p-library-list.js
index a11e477..ed5a035 100644
--- a/js/h5p-library-list.js
+++ b/js/h5p-library-list.js
@@ -23,9 +23,9 @@ var H5PLibraryList= H5PLibraryList || {};
* @param {object} libraries List of libraries and headers
*/
H5PLibraryList.createLibraryList = function (libraries) {
-
+ var t = H5PIntegration.i18n.H5P;
if(libraries.listData === undefined || libraries.listData.length === 0) {
- return;
+ return $('
' + t.NA + '
');
}
// Create table
@@ -33,14 +33,22 @@ var H5PLibraryList= H5PLibraryList || {};
$table.addClass('libraries');
// Add libraries
- var t = H5PIntegration.i18n.H5P;
$.each (libraries.listData, function (index, library) {
var $libraryRow = H5PUtils.createTableRow([
library.title,
'',
- library.numContent,
- library.numContentDependencies,
- library.numLibraryDependencies,
+ {
+ text: library.numContent,
+ class: 'h5p-admin-center'
+ },
+ {
+ text: library.numContentDependencies,
+ class: 'h5p-admin-center'
+ },
+ {
+ text: library.numLibraryDependencies,
+ class: 'h5p-admin-center'
+ },
'\
\
\
@@ -50,10 +58,11 @@ var H5PLibraryList= H5PLibraryList || {};
H5PLibraryList.addRestricted($('.h5p-admin-restricted', $libraryRow), library.restrictedUrl, library.restricted);
+ var hasContent = !(library.numContent === '' || library.numContent === 0);
if (library.upgradeUrl === null) {
$('.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);
}
else {
@@ -68,7 +77,7 @@ var H5PLibraryList= H5PLibraryList || {};
});
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.
$deleteButton.attr('disabled', true);
}
diff --git a/js/h5p-utils.js b/js/h5p-utils.js
index 3004c95..26ffa1d 100644
--- a/js/h5p-utils.js
+++ b/js/h5p-utils.js
@@ -16,7 +16,7 @@ var H5PUtils = H5PUtils || {};
$.each(headers, function (index, value) {
if (!(value instanceof Object)) {
value = {
- text: value
+ html: value
};
}
@@ -38,7 +38,13 @@ var H5PUtils = H5PUtils || {};
var $tr = $('
');
$.each(rows, function (index, value) {
- $tr.append('' + value + ' | ');
+ if (!(value instanceof Object)) {
+ value = {
+ html: value
+ };
+ }
+
+ $(' | ', value).appendTo($tr);
});
return $tr;