Skip to content
Snippets Groups Projects
Commit a9b3e142 authored by André Noack's avatar André Noack Committed by Jan-Hendrik Willms
Browse files

Resolve "Wiki: Jede Seite hat als Titel "WikiWikiWeb" in der Kopfzeile"

parent ec8a2742
No related branches found
No related tags found
No related merge requests found
......@@ -289,4 +289,23 @@ class WikiPage extends SimpleORMap implements PrivacyObject
return $descendants;
}
/**
* @param string $other_keyword
* @return bool
*/
public function isDescendantOf(string $other_keyword): bool
{
if ($other_keyword === $this->keyword) {
return false;
}
$other_page = WikiPage::findLatestPage($this->range_id, $other_keyword);
if ($other_page) {
foreach ($other_page->getDescendants() as $descendant) {
if ($descendant->keyword === $this->keyword) {
return true;
}
}
}
return false;
}
}
......@@ -173,7 +173,7 @@ class CoreWiki extends CorePlugin implements StudipModule
*/
public static function getTOC($startPage): TOCItem
{
$root = new TOCItem($startPage->keyword);
$root = new TOCItem($startPage->keyword === 'WikiWikiWeb' ? _('Wiki-Startseite') : $startPage->keyword);
$root->setURL(URLHelper::getURL('wiki.php', ['keyword' => $startPage->keyword]))
->setActive($startPage->keyword == Request::get('keyword') ||
$startPage->keyword == 'WikiWikiWeb' && !Request::get('keyword'));
......
......@@ -995,6 +995,13 @@ function wikiEdit($keyword, $wikiData, $user_id, $backpage=NULL, $ancestor=NULL)
$page->version, $editor);
$page_string .= '<br>';
$page_string .= strftime(_('am %x, %X'), $page->chdate);
if ($page->keyword === 'WikiWikiWeb' || $page->isDescendantOf('WikiWikiWeb')) {
$toc = CoreWiki::getTOC(WikiPage::getStartPage(Context::getId()));
} else {
$toc = new TOCItem($page->keyword);
}
} else {
$toc = new TOCItem($keyword === 'WikiWikiWeb' ? _('Wiki-Startseite') : $keyword);
}
// Action menu for content bar.
......@@ -1027,7 +1034,7 @@ function wikiEdit($keyword, $wikiData, $user_id, $backpage=NULL, $ancestor=NULL)
}
// Create content bar.
$contentBar = new ContentBar(CoreWiki::getTOC(WikiPage::getStartPage(Context::getId())),
$contentBar = new ContentBar($toc,
$page_string, Icon::create('wiki'), $actionMenu);
$template = $GLOBALS['template_factory']->open('wiki/edit.php');
......@@ -1540,6 +1547,13 @@ function showWikiPage($keyword, $version, $special="", $show_comments="icon", $h
$page->version, $editor);
$page_string .= '<br>';
$page_string .= strftime(_('am %x, %X'), $page->chdate);
if ($page->keyword === 'WikiWikiWeb' || $page->isDescendantOf('WikiWikiWeb')) {
$toc = CoreWiki::getTOC(WikiPage::getStartPage(Context::getId()));
} else {
$toc = new TOCItem($page->keyword);
}
} else {
$toc = new TOCItem($keyword === 'WikiWikiWeb' ? _('Wiki-Startseite') : $keyword);
}
// Action menu for content bar.
......@@ -1577,7 +1591,7 @@ function showWikiPage($keyword, $version, $special="", $show_comments="icon", $h
}
// Create content bar.
$contentBar = new ContentBar(CoreWiki::getTOC(WikiPage::getStartPage(Context::getId())),
$contentBar = new ContentBar($toc,
$page_string, Icon::create('wiki'), $actionMenu);
if ($hilight) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment