2bb13d2e8c
revert debugging
127 lines
5.5 KiB
PHP
127 lines
5.5 KiB
PHP
<?php
|
|
$user = $user ?? null;
|
|
if (!isset($_SESSION["user"])) {
|
|
header("Location: index.php?pfad=login");
|
|
exit();
|
|
}
|
|
include_once 'php/controller/showArticle-controller.php';
|
|
?>
|
|
<!--
|
|
Seite: Beitrag erstellen
|
|
Inhalt: Formular für die Erstellung eines neuen Beitrags
|
|
-->
|
|
<form method="post" action="php/controller/updateArticle-controller.php?id=<?php if(isset($id) && !empty($id)){echo htmlspecialchars($id);}else{$_SESSION["message"] = "missing_id";} ?>" id="editor-form" enctype="multipart/form-data" 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
|
|
if (isset($_SESSION['old_title']) && !empty($_SESSION['old_title'])){
|
|
echo htmlspecialchars($_SESSION['old_title']);
|
|
unset($_SESSION['old_title']);
|
|
}elseif (isset($title) && !empty($title)){
|
|
echo htmlspecialchars($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="article-editor-scope add-block-control">
|
|
<button type="button" id="plus-button" class="article-editor-scope plus-button">+</button>
|
|
<div id="block-popup" class="article-editor-scope 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']);
|
|
}elseif (isset($content) && !empty($content)){
|
|
echo htmlspecialchars($content);
|
|
} else {
|
|
echo '[]';
|
|
}
|
|
?></textarea>
|
|
|
|
<!-- unsichtbares Input, um die zu löschenden Bilder zu übergeben-->
|
|
<input type="hidden" id="deleted-images" name="deleted_images" value="[]">
|
|
</main>
|
|
|
|
<!-- Seitenleiste -->
|
|
<aside class="editor-sidebar">
|
|
|
|
<div class="sidebar-block">
|
|
<button type="submit" id="editor-button" class="button">Änderungen speichern</button>
|
|
</div>
|
|
|
|
<div class="sidebar-block">
|
|
<label for="category">Kategorie <span class="required">*</span></label>
|
|
<select id="category" name="category" required>
|
|
<option 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
|
|
if (isset($_SESSION['old_tags']) && !empty($_SESSION['old_tags'])){
|
|
echo htmlspecialchars($_SESSION['old_tags']);
|
|
unset($_SESSION['old_tags']);
|
|
} elseif (isset($tags) && !empty($tags)){
|
|
echo htmlspecialchars($tags);
|
|
}
|
|
?>"
|
|
placeholder="z.B. Technik, IT (mit Komma trennen)">
|
|
</div>
|
|
|
|
</aside>
|
|
|
|
</form>
|