From 903cbdcff34dd9138f82cee2887d7a69704c46da Mon Sep 17 00:00:00 2001
From: Rasmus Fuhse <fuhse@data-quest.de>
Date: Mon, 8 Apr 2024 10:29:15 +0000
Subject: [PATCH] Resolve "Wikiseite angeblich vom 1.1.1970"

Closes #3973

Merge request studip/studip!2825
---
 app/controllers/course/wiki.php | 55 +++++++++++++++++----------------
 1 file changed, 29 insertions(+), 26 deletions(-)

diff --git a/app/controllers/course/wiki.php b/app/controllers/course/wiki.php
index ac478c1ddb4..8c891ba200c 100644
--- a/app/controllers/course/wiki.php
+++ b/app/controllers/course/wiki.php
@@ -117,8 +117,9 @@ class Course_WikiController extends AuthenticatedController
         $startPage = WikiPage::find($this->range->getConfiguration()->WIKI_STARTPAGE_ID);
         $this->contentbar = ContentBar::get()
             ->setTOC(CoreWiki::getTOC($this->page))
-            ->setIcon(Icon::create('wiki'))
-            ->setInfo(sprintf(
+            ->setIcon(Icon::create('wiki'));
+        if (!$this->page->isNew()) {
+            $this->contentbar->setInfo(sprintf(
                 _('Version %1$s, geändert von %2$s <br> am %3$s'),
                 $this->page->versionnumber,
                 sprintf(
@@ -128,33 +129,35 @@ class Course_WikiController extends AuthenticatedController
                 ),
                 date('d.m.Y H:i:s', $this->page['chdate'])
             ));
-        $action_menu = ActionMenu::get();
-        if ($this->page->isEditable()) {
-            $action_menu->addLink(
-                $this->editURL($this->page),
-                _('Bearbeiten'),
-                Icon::create('edit')
-            );
+            $action_menu = ActionMenu::get();
+            if ($this->page->isEditable()) {
+                $action_menu->addLink(
+                    $this->editURL($this->page),
+                    _('Bearbeiten'),
+                    Icon::create('edit')
+                );
+                $action_menu->addLink(
+                    $this->pagesettingsURL($this->page->id),
+                    _('Seiteneinstellungen'),
+                    Icon::create('settings'),
+                    ['data-dialog' => 'width=700']
+                );
+                $action_menu->addButton(
+                    'delete',
+                    _('Seite löschen'),
+                    Icon::create('trash'),
+                    ['data-confirm' => _('Wollen Sie wirklich die komplette Seite löschen?'), 'form' => 'delete_page']
+                );
+            }
             $action_menu->addLink(
-                $this->pagesettingsURL($this->page->id),
-                _('Seiteneinstellungen'),
-                Icon::create('settings'),
-                ['data-dialog' => 'width=700']
-            );
-            $action_menu->addButton(
-                'delete',
-                _('Seite löschen'),
-                Icon::create('trash'),
-                ['data-confirm' => _('Wollen Sie wirklich die komplette Seite löschen?'), 'form' => 'delete_page']
+                '#',
+                _('Als Vollbild anzeigen'),
+                Icon::create('screen-full'),
+                ['class' => 'fullscreen-trigger hidden-medium-down']
             );
+            $this->contentbar->setActionMenu($action_menu);
         }
-        $action_menu->addLink(
-            '#',
-            _('Als Vollbild anzeigen'),
-            Icon::create('screen-full'),
-            ['class' => 'fullscreen-trigger hidden-medium-down']
-        );
-        $this->contentbar->setActionMenu($action_menu);
+
     }
 
     public function pagesettings_action(WikiPage $page)
-- 
GitLab