Merge branch 'master' into lars

This commit is contained in:
Lars van Hijfte
2017-02-03 11:19:02 +01:00
16 changed files with 219 additions and 28 deletions

View File

@@ -21,6 +21,8 @@ require_once "../queries/alerts.php";
include("../views/main.php");
$alertClass;
$alertMessage;
// Select which button has been pressed.
if ($_SERVER["REQUEST_METHOD"] == "POST") {
try {
switch ($_POST["form"]) {
@@ -44,6 +46,15 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
}
upgradeUser($_POST["groupID"], $_POST["userID"], "admin");
break;
case "deadmin":
if (!array_key_exists("userID", $_POST)) {
throw new AngryAlert("Geen gebruiker geselecteerd.");
}
upgradeUser($_POST["groupID"], $_POST["userID"], "member");
break;
case "delete":
deleteGroup();
break;
}
} catch (AlertMessage $w) {
$alertClass = $w->getClass();

View File

@@ -24,12 +24,14 @@ $(window).on("load", function () {
});
});
// Toggles all checkboxes based on one.
function checkAll() {
$('.checkbox-list').each(function () {
$(this).prop('checked', $('#checkall').prop('checked'));
});
}
// Simple function that checks if checkall should stay checked.
function checkCheckAll() {
var checked = true;
@@ -43,6 +45,7 @@ function checkCheckAll() {
$('#checkall').prop('checked', checked);
}
// Toggle of filter options.
function changeFilter() {
if ($('#pagetype').find(":selected").val() == "group") {
document.getElementById('admin-filter').style.display = 'none';
@@ -59,11 +62,13 @@ function changeFilter() {
}
}
// Sets the search page to one, relevant when changing filter or search.
function searchFromOne() {
$('#currentpage').prop('value', 1);
adminSearch();
}
// AJAX live search.
function adminSearch() {
$.post(
"API/adminSearchUsers.php",
@@ -74,6 +79,7 @@ function adminSearch() {
})
}
// AJAX live update.
function adminUpdate(form) {
$.post(
"API/adminChangeUser.php",
@@ -83,6 +89,7 @@ function adminUpdate(form) {
})
}
// AJAX pagenumber functionality.
function updatePageN() {
$.post(
"API/adminPageNumber.php",
@@ -92,11 +99,13 @@ function updatePageN() {
})
}
// Intended for the edit button to show a form.
function toggleBancomment(button) {
$(button).siblings("div").toggle();
$(button).toggle();
}
// AJAX value editing.
function editComment(form) {
$.post(
"API/adminChangeUser.php",

View File

@@ -91,6 +91,21 @@ $(window).on("load", function() {
loadMorePosts(userID, groupID, postAmount, postLimit);
}
};
$(document).keyup(function(e) {
if (e.keyCode == 27) {
closeModal();
}
});
$('.modal').click(function() {
closeModal();
});
$('.modal-content').click(function(event){
event.stopPropagation();
});
});
function closeModal() {

View File

@@ -14,6 +14,8 @@
<?php
$alertClass;
$alertMessage;
// Select which button has been pressed.
if ($_SERVER["REQUEST_METHOD"] == "POST") {
try {
switch ($_POST["form"]) {
@@ -29,7 +31,6 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
case "picture":
updateAvatar();
break;
}
} catch (AlertMessage $w) {
$alertClass = $w->getClass();

View File

@@ -36,9 +36,10 @@
width: 100%;
}
.usertable .table-username {width: 150px}
.usertable .table-status {width: 100px}
.usertable .table-action {width: 200px}
.table-checkbox {width: 20px}
.table-username {width: 150px}
.table-status {width: 100px}
.table-action {width: 200px}
.usertable th, td {
border-bottom: 1px solid #ddd;
@@ -54,6 +55,10 @@
background-color: #f5f5f5;
}
.bancomment {
width: 80%;
}
.bancommentedit {
display: none;
}