refactor: use the new menu classes from master if available

This is still fully compatible with the current stable Frusterick
Manners, however these old method calls should be removed after the
release of Greebo.
This commit is contained in:
Michael Große 2018-01-19 11:52:30 +01:00
commit 6b6e2bd6f7
No known key found for this signature in database
GPG key ID: 7E31028FBFEACC79
4 changed files with 78 additions and 27 deletions

View file

@ -140,7 +140,14 @@ $classWideContent = ($ACT === "show") ? "": "wide-content ";
<div class="menu-tool-select">
<h5 class="sr-only" role="heading" aria-level="2"><?php echo tpl_getLang('head_menu_tool-select') ?></h5>
<?php tpl_actiondropdown($lang['tools'], "test"); ?>
<?php
if (file_exists(DOKU_INC . 'inc/Menu/MobileMenu.php')) {
echo (new \dokuwiki\Menu\MobileMenu())->getDropdown();
} else {
//Pre-Greebo Backwards compatibility
tpl_actiondropdown($lang['tools'], "test");
}
?>
</div><!-- .menu-tool-select -->
</div><!-- .headings -->
</div><!-- .col -->

View file

@ -12,6 +12,10 @@
<div class="nav-panel level1">
<ul id="sidebar-site-tools">
<?php
if (file_exists(DOKU_INC . 'inc/Menu/SiteMenu.php')) {
echo (new \dokuwiki\Menu\SiteMenu())->getListItems();
} else {
//Pre-Greebo Backwards compatibility
tpl_toolsevent(
'sitetools',
array(
@ -20,6 +24,7 @@
'index' => tpl_action('index', 1, 'li', 1),
)
);
}
?>
</ul>
</div>
@ -34,6 +39,10 @@
<div class="nav-panel level1">
<ul id="sidebar-user-tools">
<?php /* dokuwiki user tools */
if (file_exists(DOKU_INC . 'inc/Menu/UserMenu.php')) {
echo (new \dokuwiki\Menu\UserMenu())->getListItems();
} else {
//Pre-Greebo Backwards compatibility
tpl_toolsevent(
'usertools',
array(
@ -43,6 +52,7 @@
'register' => tpl_action('register', 1, 'li', 1),
)
);
}
?>
</ul>
</div>

View file

@ -11,12 +11,16 @@ if (!defined('DOKU_INC')) {
<?php include('nav-status.php'); ?>
<ul>
<?php
if (file_exists(DOKU_INC . '/inc/Menu/PageMenu.php')) {
echo (new \dokuwiki\Menu\PageMenu())->getListItems();
} else {
//Pre-Greebo Backwards compatibility
$data = dokuwiki\template\sprintdoc\tpl::assemblePageTools();
foreach ($data['items'] as $k => $html) {
echo $html;
}
}
?>
</ul>
</div>

View file

@ -6,7 +6,19 @@
<nav id="dokuwiki__usertools" class="nav-usertools <?php echo $navClass?>">
<h6 class="sr-only" role="heading" aria-level="2"><?php echo $lang['user_tools']; ?></h6>
<ul>
<li class="log"><?php tpl_actionlink('login'); ?></li>
<li class="log"><?php
if (file_exists(DOKU_INC . 'inc/Menu/Item/Login.php')) {
if (empty($_SERVER['REMOTE_USER'])) {
echo (new \dokuwiki\Menu\Item\Login())->asHtmlLink();
} else {
echo (new \dokuwiki\Menu\Item\Login())->asHtmlButton();
}
} else {
//Pre-Greebo Backwards compatibility
tpl_actionlink('login');
}
?>
</li>
<?php
if (!empty($_SERVER['REMOTE_USER'])) {
@ -14,10 +26,28 @@
}?>
<?php /* dokuwiki user tools */
tpl_toolsevent('usertools', array(
if (file_exists(DOKU_INC . 'inc/Menu/Item/Admin.php')) {
try{
echo '<li class="admin">' . (new \dokuwiki\Menu\Item\Admin())->asHtmlLink() . '</li>';
} catch(\RuntimeException $ignored) {
// item not available
}
try{
echo '<li class="register">' . (new \dokuwiki\Menu\Item\Register())->asHtmlLink() . '</li>';
} catch(\RuntimeException $ignored) {
// item not available
}
} else {
//Pre-Greebo Backwards compatibility
tpl_toolsevent(
'usertools',
array(
'admin' => tpl_action('admin', 1, 'li', 1),
'register' => tpl_action('register', 1, 'li', 1),
)); ?>
)
);
}
?>
<?php /* tasks do Plug-In */
/** @var \helper_plugin_do $doplugin */