Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 09f8b11f36 | |||
| cc4cebdb45 | |||
| 96f38ce72e | |||
| b81f0c9e5c | |||
| f8aed4283e | |||
| afd90086d8 | |||
| a7a54f877c |
Generated
+1
-1
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="dataSourceStorageLocal" created-in="IU-261.24374.151">
|
||||
<component name="dataSourceStorageLocal" created-in="IU-253.32098.101">
|
||||
<data-source name="articles" uuid="315cb5c9-2b0f-435b-b602-59823b160908">
|
||||
<database-info product="SQLite" version="3.51.1" jdbc-version="4.2" driver-name="SQLite JDBC" driver-version="3.51.1.0" dbms="SQLITE" exact-version="3.51.1" exact-driver-version="3.51">
|
||||
<identifier-quote-string>"</identifier-quote-string>
|
||||
|
||||
+1
-1
@@ -84,7 +84,7 @@ $isEditMode = (isset($_GET["edit"]) && $_GET["edit"] === "1") || !empty($error);
|
||||
<form action="php/controller/deleteAccount-controller.php" method="POST">
|
||||
<button type="submit"
|
||||
class="button"
|
||||
onclick="return confirm('Möchtest du deinen Account wirklich unwiderruflich löschen?');">
|
||||
onclick="return confirm('Möchtest du deinen Account und alle deine Beiträge wirklich unwiderruflich löschen?');">
|
||||
Account löschen
|
||||
</button>
|
||||
</form>
|
||||
|
||||
@@ -137,6 +137,17 @@ $categories = [
|
||||
<p class="s-res-meta"><span id="s-res-result-count"><?php echo $totalResultsCount; ?></span> Treffer für Ihre Suchanfrage "<?php echo htmlspecialchars($query); ?>"</p>
|
||||
</div>
|
||||
|
||||
<p
|
||||
id="results-loading"
|
||||
class="results-loading"
|
||||
role="status"
|
||||
aria-live="polite"
|
||||
hidden
|
||||
>
|
||||
<span class="results-spinner" aria-hidden="true"></span>
|
||||
Suchergebnisse werden geladen …
|
||||
</p>
|
||||
|
||||
<!-- Ergebnisliste -->
|
||||
<div class="s-res-list">
|
||||
<?php if (!empty($results)): ?>
|
||||
|
||||
@@ -457,6 +457,18 @@ if ($replyAuthor === null) {
|
||||
<button type="submit" class="button">
|
||||
Kommentar senden
|
||||
</button>
|
||||
|
||||
<p
|
||||
id="comment-loading"
|
||||
class="comment-loading"
|
||||
role="status"
|
||||
aria-live="polite"
|
||||
hidden
|
||||
>
|
||||
<span class="comment-spinner" aria-hidden="true"></span>
|
||||
Kommentar wird gesendet …
|
||||
</p>
|
||||
|
||||
</form>
|
||||
<?php else: ?>
|
||||
<div class="comment-login-hint">
|
||||
|
||||
@@ -113,6 +113,17 @@ $resultCount = count($results);
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<p
|
||||
id="results-loading"
|
||||
class="results-loading"
|
||||
role="status"
|
||||
aria-live="polite"
|
||||
hidden
|
||||
>
|
||||
<span class="results-spinner" aria-hidden="true"></span>
|
||||
Kategoriebeiträge werden geladen …
|
||||
</p>
|
||||
|
||||
<!-- Ergebnisliste -->
|
||||
<div class="s-res-list">
|
||||
<?php if (!empty($results)): ?>
|
||||
|
||||
@@ -226,3 +226,33 @@ h1 {
|
||||
text-decoration: none;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.comment-loading {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
.comment-loading[hidden] {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.comment-spinner {
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
border: 2px solid #cbd5e1;
|
||||
border-top-color: #1f2937;
|
||||
border-radius: 50%;
|
||||
animation: comment-spinner-rotation 0.8s linear infinite;
|
||||
}
|
||||
|
||||
@keyframes comment-spinner-rotation {
|
||||
to {
|
||||
transform: rotate(360deg);
|
||||
}
|
||||
}
|
||||
|
||||
#comment-form button[type="submit"]:disabled {
|
||||
cursor: wait;
|
||||
opacity: 0.65;
|
||||
}
|
||||
@@ -271,4 +271,33 @@ CSS für die Suchergebnis-Seite
|
||||
align-items: flex-start;
|
||||
}
|
||||
}
|
||||
/* Ladeanzeige beim Nachladen von Such- und Kategorieergebnissen */
|
||||
.results-loading {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
margin: 15px 0;
|
||||
color: #4a5568;
|
||||
font-size: 0.95rem;
|
||||
}
|
||||
|
||||
.results-loading[hidden] {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.results-spinner {
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
flex-shrink: 0;
|
||||
border: 2px solid #cbd5e1;
|
||||
border-top-color: #3182ce;
|
||||
border-radius: 50%;
|
||||
animation: results-spinner-rotation 0.8s linear infinite;
|
||||
}
|
||||
|
||||
@keyframes results-spinner-rotation {
|
||||
to {
|
||||
transform: rotate(360deg);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+38
-1
@@ -11,7 +11,19 @@ document.addEventListener("DOMContentLoaded", function () {
|
||||
const parentCommentInput = document.getElementById("parent-comment-id");
|
||||
const replyInfo = document.getElementById("reply-info");
|
||||
|
||||
if (!form || !commentsList || !commentContent || !parentCommentInput) {
|
||||
const submitButton = form
|
||||
? form.querySelector('button[type="submit"]')
|
||||
: null;
|
||||
|
||||
const loadingMessage = document.getElementById("comment-loading");
|
||||
|
||||
if (
|
||||
!form
|
||||
|| !commentsList
|
||||
|| !commentContent
|
||||
|| !parentCommentInput
|
||||
|| !submitButton
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -53,6 +65,23 @@ document.addEventListener("DOMContentLoaded", function () {
|
||||
form.addEventListener("submit", function (event) {
|
||||
event.preventDefault();
|
||||
|
||||
/*
|
||||
* Verhindert einen erneuten Submit, während der vorherige
|
||||
* Kommentar noch gespeichert wird.
|
||||
*/
|
||||
if (submitButton.disabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
const originalButtonText = submitButton.textContent;
|
||||
|
||||
submitButton.disabled = true;
|
||||
submitButton.textContent = "Wird gesendet …";
|
||||
|
||||
if (loadingMessage) {
|
||||
loadingMessage.hidden = false;
|
||||
}
|
||||
|
||||
const formData = new FormData(form);
|
||||
const parentCommentId = parentCommentInput.value;
|
||||
|
||||
@@ -269,6 +298,14 @@ document.addEventListener("DOMContentLoaded", function () {
|
||||
.catch(function (error) {
|
||||
console.error(error);
|
||||
alert("Kommentar konnte nicht gesendet werden.");
|
||||
})
|
||||
.finally(function () {
|
||||
submitButton.disabled = false;
|
||||
submitButton.textContent = originalButtonText;
|
||||
|
||||
if (loadingMessage) {
|
||||
loadingMessage.hidden = true;
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
+23
-4
@@ -25,6 +25,7 @@
|
||||
|
||||
let listContainer, sortRadios, categorySelect, limitSelect;
|
||||
let prevBtn, nextBtn, numbersContainer, jsNav, resultCountEl;
|
||||
let loadingElement;
|
||||
|
||||
function init() {
|
||||
listContainer = document.querySelector('.s-res-list');
|
||||
@@ -38,23 +39,41 @@
|
||||
numbersContainer = document.getElementById('dynamic-page-numbers');
|
||||
jsNav = document.getElementById('js-page-navigation');
|
||||
resultCountEl = document.getElementById('s-res-result-count');
|
||||
loadingElement = document.getElementById('results-loading');
|
||||
|
||||
const checkedRadio = document.querySelector('.sort-radio:checked');
|
||||
state.sort = checkedRadio ? checkedRadio.value : 'alphabet';
|
||||
state.category = categorySelect ? categorySelect.value : 'all';
|
||||
state.itemsPerPage = limitSelect ? (parseInt(limitSelect.value, 10) || 10) : 10;
|
||||
|
||||
if (loadingElement) {
|
||||
loadingElement.hidden = false;
|
||||
}
|
||||
|
||||
fetchFullDataset()
|
||||
.then(function (data) {
|
||||
state.allItems = data.results || [];
|
||||
attachEvents();
|
||||
render();
|
||||
if (jsNav) jsNav.style.display = 'flex';
|
||||
|
||||
if (jsNav) {
|
||||
jsNav.style.display = 'flex';
|
||||
}
|
||||
})
|
||||
.catch(function (err) {
|
||||
// JSON-Endpoint nicht erreichbar: die serverseitig gerenderte
|
||||
// (No-JS-)Ansicht bleibt sichtbar und funktioniert weiter.
|
||||
console.error('Suchergebnisse konnten nicht nachgeladen werden:', err);
|
||||
/*
|
||||
* Falls das Nachladen nicht funktioniert, bleibt die bereits
|
||||
* serverseitig ausgegebene Ergebnisliste sichtbar.
|
||||
*/
|
||||
console.error(
|
||||
'Suchergebnisse konnten nicht nachgeladen werden:',
|
||||
err
|
||||
);
|
||||
})
|
||||
.finally(function () {
|
||||
if (loadingElement) {
|
||||
loadingElement.hidden = true;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
+23
-4
@@ -21,6 +21,7 @@
|
||||
|
||||
let listContainer, sortRadios, searchInput, limitSelect;
|
||||
let prevBtn, nextBtn, numbersContainer, jsNav, resultCountEl;
|
||||
let loadingElement;
|
||||
let searchDebounceTimer;
|
||||
|
||||
function init() {
|
||||
@@ -35,23 +36,41 @@
|
||||
numbersContainer = document.getElementById('dynamic-page-numbers');
|
||||
jsNav = document.getElementById('js-page-navigation');
|
||||
resultCountEl = document.getElementById('s-res-result-count');
|
||||
loadingElement = document.getElementById('results-loading');
|
||||
|
||||
const checkedRadio = document.querySelector('.sort-radio:checked');
|
||||
state.sort = checkedRadio ? checkedRadio.value : 'alphabet';
|
||||
state.query = searchInput ? searchInput.value : '';
|
||||
state.itemsPerPage = limitSelect ? (parseInt(limitSelect.value, 10) || 10) : 10;
|
||||
|
||||
if (loadingElement) {
|
||||
loadingElement.hidden = false;
|
||||
}
|
||||
|
||||
fetchFullDataset()
|
||||
.then(function (data) {
|
||||
state.allItems = data.results || [];
|
||||
attachEvents();
|
||||
render();
|
||||
if (jsNav) jsNav.style.display = 'flex';
|
||||
|
||||
if (jsNav) {
|
||||
jsNav.style.display = 'flex';
|
||||
}
|
||||
})
|
||||
.catch(function (err) {
|
||||
// JSON-Endpoint nicht erreichbar: die serverseitig gerenderte
|
||||
// (No-JS-)Ansicht bleibt sichtbar und funktioniert weiter.
|
||||
console.error('Kategorie-Beiträge konnten nicht nachgeladen werden:', err);
|
||||
/*
|
||||
* Falls das Nachladen nicht funktioniert, bleibt die bereits
|
||||
* serverseitig ausgegebene Kategorieansicht sichtbar.
|
||||
*/
|
||||
console.error(
|
||||
'Kategorie-Beiträge konnten nicht nachgeladen werden:',
|
||||
err
|
||||
);
|
||||
})
|
||||
.finally(function () {
|
||||
if (loadingElement) {
|
||||
loadingElement.hidden = true;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -315,16 +315,15 @@ class DatabaseArticleManager implements ArticleManagerDAO {
|
||||
FROM articles
|
||||
WHERE title LIKE :keyword
|
||||
OR content LIKE :keyword
|
||||
OR tags LIKE :keyword";
|
||||
OR tags LIKE :keyword;";
|
||||
|
||||
$command = $db->prepare($sql);
|
||||
if (!$command) {
|
||||
throw new InternalServerErrorException("internal_error");
|
||||
}
|
||||
|
||||
// Wildcards für die Suche hinzufügen
|
||||
// Wildcards für die SQL-Suche hinzufügen
|
||||
$searchParam = '%' . $cleankeyword . '%';
|
||||
|
||||
$success = $command->execute([
|
||||
":keyword" => $searchParam
|
||||
]);
|
||||
@@ -337,10 +336,11 @@ class DatabaseArticleManager implements ArticleManagerDAO {
|
||||
$filteredArticles = [];
|
||||
|
||||
foreach ($rows as $row) {
|
||||
$likes = $this->getLikesForArticle(intval($row['id']));
|
||||
$articleId = intval($row['id']);
|
||||
$likes = $this->getLikesForArticle($articleId);
|
||||
|
||||
$filteredArticles[] = new Article(
|
||||
intval($row['id']),
|
||||
$articleId,
|
||||
$row['title'] ?? '',
|
||||
$row['content'] ?? '',
|
||||
$row['author'] ?? '',
|
||||
@@ -358,6 +358,7 @@ class DatabaseArticleManager implements ArticleManagerDAO {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Holt alle User-IDs, die einen bestimmten Beitrag geliked haben.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user