Skip to content
Snippets Groups Projects
Commit 18574e3e authored by André Noack's avatar André Noack
Browse files

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

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