Merge branch 'master' of github.com:h5p/h5p-php-library
commit
92d5f71b6f
|
@ -37,6 +37,7 @@ var H5PLibraryList= H5PLibraryList || {};
|
||||||
$.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"/>',
|
||||||
library.numContent,
|
library.numContent,
|
||||||
library.numContentDependencies,
|
library.numContentDependencies,
|
||||||
library.numLibraryDependencies,
|
library.numLibraryDependencies,
|
||||||
|
@ -47,6 +48,8 @@ var H5PLibraryList= H5PLibraryList || {};
|
||||||
</div>'
|
</div>'
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
H5PLibraryList.addRestricted($('.h5p-admin-restricted', $libraryRow), library.restrictedUrl, library.restricted);
|
||||||
|
|
||||||
if (library.upgradeUrl === null) {
|
if (library.upgradeUrl === null) {
|
||||||
$('.h5p-admin-upgrade-library', $libraryRow).remove();
|
$('.h5p-admin-upgrade-library', $libraryRow).remove();
|
||||||
}
|
}
|
||||||
|
@ -82,6 +85,34 @@ var H5PLibraryList= H5PLibraryList || {};
|
||||||
return $table;
|
return $table;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
H5PLibraryList.addRestricted = function ($checkbox, url, selected) {
|
||||||
|
if (selected === null) {
|
||||||
|
$checkbox.remove();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$checkbox.change(function () {
|
||||||
|
$checkbox.attr('disabled', true);
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
dataType: 'json',
|
||||||
|
url: url,
|
||||||
|
cache: false
|
||||||
|
}).fail(function () {
|
||||||
|
$checkbox.attr('disabled', false);
|
||||||
|
|
||||||
|
// Reset
|
||||||
|
$checkbox.attr('checked', !$checkbox.is(':checked'));
|
||||||
|
}).done(function (result) {
|
||||||
|
url = result.url;
|
||||||
|
$checkbox.attr('disabled', false);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
if (selected) {
|
||||||
|
$checkbox.attr('checked', true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
// Initialize me:
|
// Initialize me:
|
||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
|
|
Loading…
Reference in New Issue