commit 9e05ff01496d077c07649361920dbe86a6fdec0e
parent 6c2a3e575d7f47215934c39e49eb15c2c5149120
Author: JayVii <jayvii[AT]posteo[DOT]de>
Date: Thu, 24 Oct 2024 16:31:17 +0200
feat: add function to edit notes
Diffstat:
2 files changed, 26 insertions(+), 0 deletions(-)
diff --git a/data/.empty b/data/.empty
diff --git a/lib/edit.sh b/lib/edit.sh
@@ -0,0 +1,26 @@
+/* SPDX-License-Identifier: AGPL-3.0-or-later
+ * SPDX-FileCopyrightText: 2021-2024 JayVii <jayvii[AT]posteo[DOT]de>
+ */
+
+<?php
+
+function edit_note(
+ string $user,
+ string $category,
+ string $filename
+) {
+
+ /* Read Note: if it does not exist yet, use empty string */
+ $content = read_note($user, $category, $filename) || "";
+
+?>
+
+<!-- Show Text Note Form -->
+<form action="/" target="_self" method="post" enctype="multipart/form-data">
+ <label for="note"><?php echo $GLOBALS["i18n_note"]; ?></label>
+ <textarea id="note" name="note"><?php echo $content; ?></textarea>
+ <label for="category"><?php echo $GLOBALS["i18n_category"]; ?></label>
+ <input id="category" name="category" value="<?php echo $category"; ?>">
+ <label for="visibility"><?php echo $GLOBALS["i18n_visibility"]; ?></label>
+ <input type="submit" value="<?php echo $GLOBALS["i18n_save"]; ?>">
+</form>