Add summary field to knowledgecenter posts

- ALTER TABLE knowledgecenter_post_versions ADD COLUMN summary TEXT NULL AFTER content
- Add summary textarea to post edit form (after Quill editor)
- Include summary in insert_post_version() and update_post_version()

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-06-22 11:59:31 +02:00
parent 952b3e2efc
commit 833c3718cf
2 changed files with 33 additions and 26 deletions

View File

@@ -707,6 +707,7 @@ function update_post_version()
$image = mysqli_real_escape_string($GLOBALS['mysql_con'], $_POST['image'][$langId] ?? '');
$teaser = mysqli_real_escape_string($GLOBALS['mysql_con'], $_POST['teaser'][$langId] ?? '');
$content = mysqli_real_escape_string($GLOBALS['mysql_con'], $_POST['content'][$langId] ?? '');
$summary = mysqli_real_escape_string($GLOBALS['mysql_con'], $_POST['summary'][$langId] ?? '');
$author_id = isset($_POST['author_id'][$langId]) ? (int) $_POST['author_id'][$langId] : 0;
$link = mysqli_real_escape_string($GLOBALS['mysql_con'], $_POST['link'][$langId] ?? '');
$link_label = mysqli_real_escape_string($GLOBALS['mysql_con'], $_POST['link_label'][$langId] ?? '');
@@ -752,11 +753,11 @@ function update_post_version()
$insertQuery = "
INSERT INTO knowledgecenter_post_versions
(post_id, language_id, version_number,
title, image, link, link_label, teaser, content, author_id, state,
title, image, link, link_label, teaser, content, summary, author_id, state,
modified_at, valid_from, valid_until, background_color, text_color)
VALUES
($postId, $langId, $newVersion,
'$title', '$image', '$link', '$link_label', '$teaser', '$content', $author_id, $state,
'$title', '$image', '$link', '$link_label', '$teaser', '$content', '$summary', $author_id, $state,
$insertModifiedAtSql, $valid_from_sql, $valid_until_sql, '$backgroundColor', '$textColor')
";
if (!mysqli_query($GLOBALS['mysql_con'], $insertQuery)) {
@@ -775,6 +776,7 @@ function update_post_version()
link_label = '$link_label',
teaser = '$teaser',
content = '$content',
summary = '$summary',
author_id = $author_id,
state = $state,
valid_from = $valid_from_sql,
@@ -855,6 +857,7 @@ function insert_post_version()
$image = mysqli_real_escape_string($GLOBALS['mysql_con'], $_POST['image'][$langId] ?? '');
$teaser = mysqli_real_escape_string($GLOBALS['mysql_con'], $_POST['teaser'][$langId] ?? '');
$content = mysqli_real_escape_string($GLOBALS['mysql_con'], $_POST['content'][$langId] ?? '');
$summary = mysqli_real_escape_string($GLOBALS['mysql_con'], $_POST['summary'][$langId] ?? '');
$link = mysqli_real_escape_string($GLOBALS['mysql_con'], $_POST['link'][$langId] ?? '');
$link_label = mysqli_real_escape_string($GLOBALS['mysql_con'], $_POST['link_label'][$langId] ?? '');
$author_id = isset($_POST['author_id'][$langId]) ? (int) $_POST['author_id'][$langId] : 0;
@@ -891,8 +894,8 @@ function insert_post_version()
}
$insertQuery = "INSERT INTO knowledgecenter_post_versions
(post_id, language_id, version_number, title, image, link, link_label, teaser, content, author_id, state, modified_at, valid_from, valid_until, background_color, text_color)
VALUES ($postId, $langId, $newVersion, '$title', '$image', '$link', '$link_label', '$teaser', '$content', $author_id, $state, $insertModifiedAtSql, $valid_from_sql, $valid_until_sql, '$backgroundColor', '$textColor')";
(post_id, language_id, version_number, title, image, link, link_label, teaser, content, summary, author_id, state, modified_at, valid_from, valid_until, background_color, text_color)
VALUES ($postId, $langId, $newVersion, '$title', '$image', '$link', '$link_label', '$teaser', '$content', '$summary', $author_id, $state, $insertModifiedAtSql, $valid_from_sql, $valid_until_sql, '$backgroundColor', '$textColor')";
if (!mysqli_query($GLOBALS['mysql_con'], $insertQuery)) {
echo json_encode(['error' => "Fehler beim Einfügen für Sprache $langId: " . mysqli_error($GLOBALS['mysql_con'])]);
exit;

View File

@@ -34,7 +34,7 @@
<div class="edit-main">
<?php foreach ($allLanguages as $lang):
$langId = $lang['id'];
$trans = isset($translations[$langId]) ? $translations[$langId] : ['title' => '', 'image' => '', 'teaser' => '', 'content' => ''];
$trans = isset($translations[$langId]) ? $translations[$langId] : ['title' => '', 'image' => '', 'teaser' => '', 'content' => '', 'summary' => ''];
?>
<div class="lang-form" id="lang_<?= $langId ?>" data-lang="<?= $langId ?>"
style="<?= ($langId == $languageId) ? '' : 'display: none;' ?>">
@@ -65,6 +65,10 @@
<div id="editor_<?= $langId ?>" class="editor">
<?= $translations[$langId]['content'] ?>
</div>
<hr>
<label for="summary_<?= $langId ?>">Zusammenfassung (Summary)</label>
<textarea id="summary_<?= $langId ?>" name="summary[<?= $langId ?>]" rows="4"
placeholder="Kurze Zusammenfassung des Artikelinhalts..."><?= htmlspecialchars($trans['summary'] ?? '') ?></textarea>
</div>
<?php endforeach; ?>
</div>
@@ -80,7 +84,7 @@
<?php foreach ($allLanguages as $lang):
$langId = $lang['id'];
$trans = isset($translations[$langId]) ? $translations[$langId] : ['title' => '', 'image' => '', 'teaser' => '', 'content' => ''];
$trans = isset($translations[$langId]) ? $translations[$langId] : ['title' => '', 'image' => '', 'teaser' => '', 'content' => '', 'summary' => ''];
?>
<div class="lang-form-meta" data-lang="<?= $langId ?>"
style="<?= ($langId == $languageId) ? '' : 'display: none;' ?>">