diff --git a/webseite/classes/TopicData.php b/webseite/classes/TopicData.php index fde0cc2..af0192c 100644 --- a/webseite/classes/TopicData.php +++ b/webseite/classes/TopicData.php @@ -487,6 +487,11 @@ class TopicData public function setId(string $id): void { + rename( + Config::getTopicDirectory($this->getSubjectId(), $this->getId()), + Config::getTopicDirectory($this->getSubjectId(), $id) + ); + $this->id = $id; } @@ -497,6 +502,11 @@ class TopicData public function setSubjectId(string $subjectId): void { + rename( + Config::getTopicDirectory($this->getSubjectId(), $this->getId()), + Config::getTopicDirectory($subjectId, $this->getId()) + ); + $this->subjectId = $subjectId; } diff --git a/webseite/topicEditor.php b/webseite/topicEditor.php index b3669cd..135eb37 100644 --- a/webseite/topicEditor.php +++ b/webseite/topicEditor.php @@ -191,9 +191,10 @@ if ($_SERVER['REQUEST_METHOD'] == 'POST') { $article = preg_replace("/^[ \r\n\t]*

/", "

", $article); $article = preg_replace("#

[ \r\n\t]*$#", "

", $article); - if (isset($allSubjects[$_POST['subjectId']]->getTopics()[$_POST['id']])) { - $newTopic = $allSubjects[$_POST['subjectId']]->getTopics()[$_POST['id']]; + if (isset($allSubjects[$_POST['oldSubjectId']]->getTopics()[$_POST['oldTopicId']])) { + $newTopic = $allSubjects[$_POST['oldSubjectId']]->getTopics()[$_POST['oldTopicId']]; + $newTopic->setId($_POST['id']); $newTopic->setDisplayName($_POST['displayName']); $newTopic->setSubjectId($_POST['subjectId']); $newTopic->setDescription($_POST['description']); @@ -289,6 +290,8 @@ if ($_SERVER['REQUEST_METHOD'] == 'POST') { class="w-full px-4 py-3 border rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 text-lg enabled:hover:border-gray-400" required value=""> + +
@@ -312,6 +315,8 @@ if ($_SERVER['REQUEST_METHOD'] == 'POST') {
+ +