80f92a384e
content ist nun im json-Format Bilder können hochgeladen werden Textblöcke können im Editor angehangen werden
107 lines
4.6 KiB
PHP
107 lines
4.6 KiB
PHP
<?php
|
|
$user = $user ?? null;
|
|
if (!isset($_SESSION["user"])) {
|
|
header("Location: index.php?pfad=login");
|
|
exit();
|
|
}
|
|
?>
|
|
<!--
|
|
Seite: Beitrag erstellen
|
|
Inhalt: Formular für die Erstellung eines neuen Beitrags
|
|
-->
|
|
<form method="post" action="php/controller/createArticle-controller.php" id="editor-form" class="article-editor-scope.editor-container article-editor-scope editor-container">
|
|
|
|
<main class="editor-main">
|
|
<?php include_once "includes/alertMessages.php"?>
|
|
|
|
<input type="text" id="title" name="title"
|
|
value="<?php echo htmlspecialchars($_SESSION['old_title'] ?? ''); unset($_SESSION['old_title']); ?>"
|
|
placeholder="Titel hier eingeben" required>
|
|
|
|
<!-- Hier werden die dynamischen divs via JavaScript eingefügt -->
|
|
<div id="block-container"></div>
|
|
|
|
<!-- Plus-Button und das Pop-up-Menü -->
|
|
<div id="add-block-control" class="add-block-control">
|
|
<button type="button" id="plus-button" class="plus-button">+</button>
|
|
<div id="block-popup" class="block-popup hidden">
|
|
<button type="button" data-type="text">Textblock</button>
|
|
<button type="button" data-type="image">Bild einfügen</button>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Unsichtbares Textfeld, das die JSON-Daten hält und an den Controller postet -->
|
|
<textarea id="content" name="content" style="display:none;">
|
|
<?php
|
|
if (isset($_SESSION['old_content']) && !empty($_SESSION['old_content'])){
|
|
echo htmlspecialchars($_SESSION['old_content']);
|
|
unset($_SESSION['old_content']);
|
|
} else {
|
|
echo '[]'; // Standardmäßig ein leeres JSON-Array
|
|
}?>
|
|
</textarea>
|
|
</main>
|
|
|
|
<!-- Seitenleiste -->
|
|
<aside class="editor-sidebar">
|
|
|
|
<div class="sidebar-block">
|
|
<button type="submit" id="editor-button" class="button">Veröffentlichen</button>
|
|
</div>
|
|
|
|
<div class="sidebar-block">
|
|
<label for="category">Kategorie <span class="required">*</span></label>
|
|
<select id="category" name="category" required>
|
|
<option value="" disabled selected>Kategorie wählen...</option>
|
|
|
|
<optgroup label="Sprachen">
|
|
<option value="deutsch">Deutsch</option>
|
|
<option value="englisch">Englisch</option>
|
|
<option value="franzoesisch">Französisch</option>
|
|
<option value="latein">Latein</option>
|
|
<option value="literatur">Literatur</option>
|
|
</optgroup>
|
|
|
|
<optgroup label="MINT">
|
|
<option value="mathe">Mathematik</option>
|
|
<option value="biologie">Biologie</option>
|
|
<option value="chemie">Chemie</option>
|
|
<option value="physik">Physik</option>
|
|
<option value="informatik">Informatik</option>
|
|
<option value="astronomie">Astronomie</option>
|
|
</optgroup>
|
|
|
|
<optgroup label="Gesellschaft & Werte">
|
|
<option value="geschichte">Geschichte</option>
|
|
<option value="erdkunde">Erdkunde</option>
|
|
<option value="sozialkunde">Sozialkunde</option>
|
|
<option value="wirtschaft">Wirtschaftskunde</option>
|
|
<option value="religion">Religion</option>
|
|
<option value="ethik">Ethikunterricht</option>
|
|
<option value="philosophie">Philosophie</option>
|
|
<option value="psychologie">Psychologie</option>
|
|
<option value="kunst">Kunst</option>
|
|
<option value="musik">Musik</option>
|
|
<option value="theater">Theater</option>
|
|
</optgroup>
|
|
|
|
<optgroup label="Technik & Praxis">
|
|
<option value="technik">Technik</option>
|
|
<option value="werken">Werken</option>
|
|
<option value="hauswirtschaft">Hauswirtschaft</option>
|
|
<option value="sport">Sport</option>
|
|
</optgroup>
|
|
</select>
|
|
</div>
|
|
|
|
<div class="sidebar-block">
|
|
<label for="tags">Schlagwörter</label>
|
|
<input type="text" id="tags" name="tags"
|
|
value="<?php echo htmlspecialchars($_SESSION['old_tags'] ?? ''); unset($_SESSION['old_tags']); ?>"
|
|
placeholder="z.B. Technik, IT (mit Komma trennen)">
|
|
</div>
|
|
|
|
</aside>
|
|
|
|
</form>
|