some cleanup in the usertool handling
do not display unavailable actions
This commit is contained in:
parent
80e39be048
commit
621124b325
1 changed files with 48 additions and 43 deletions
|
@ -1,54 +1,59 @@
|
||||||
<?php
|
<?php
|
||||||
if (!defined('DOKU_INC')) die();
|
|
||||||
|
|
||||||
if ($conf['useacl']): ?>
|
use dokuwiki\Menu\Item\AbstractItem;
|
||||||
|
use dokuwiki\Menu\Item\Admin;
|
||||||
|
use dokuwiki\Menu\Item\Login;
|
||||||
|
use dokuwiki\Menu\Item\Register;
|
||||||
|
|
||||||
<nav id="dokuwiki__usertools" class="nav-usertools <?php echo $navClass?>">
|
if (!defined('DOKU_INC')) die();
|
||||||
<h6 class="sr-only" role="heading" aria-level="2"><?php echo $lang['user_tools']; ?></h6>
|
|
||||||
<ul>
|
|
||||||
<li class="log"><?php
|
|
||||||
try {
|
|
||||||
if (empty($_SERVER['REMOTE_USER'])) {
|
|
||||||
echo (new \dokuwiki\Menu\Item\Login())->asHtmlLink();
|
|
||||||
} else {
|
|
||||||
echo (new \dokuwiki\Menu\Item\Login())->asHtmlButton();
|
|
||||||
}
|
|
||||||
} catch (\RuntimeException $ignored) {
|
|
||||||
// item not available
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
</li>
|
|
||||||
|
|
||||||
<?php
|
if ($conf['useacl']): ?>
|
||||||
if (!empty($_SERVER['REMOTE_USER'])) {
|
|
||||||
echo '<li class="user"><span class="sr-only">'.$lang['loggedinas'].' </span>'.userlink().'</li>';
|
|
||||||
}?>
|
|
||||||
|
|
||||||
<?php /* dokuwiki user tools */
|
<nav id="dokuwiki__usertools" class="nav-usertools <?php echo $navClass ?>">
|
||||||
try{
|
<h6 class="sr-only" role="heading" aria-level="2"><?php echo $lang['user_tools']; ?></h6>
|
||||||
echo '<li class="admin">' . (new \dokuwiki\Menu\Item\Admin())->asHtmlLink() . '</li>';
|
<ul>
|
||||||
} catch(\RuntimeException $ignored) {
|
<?php
|
||||||
// item not available
|
try {
|
||||||
|
$item = new Login();
|
||||||
|
if ($item->visibleInContext(AbstractItem::CTX_DESKTOP))
|
||||||
|
echo '<li class="log">' . $item->asHtmlButton() . '</li>';
|
||||||
|
} catch (RuntimeException $ignored) {
|
||||||
|
// item not available
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($_SERVER['REMOTE_USER'])) {
|
||||||
|
echo '<li class="user"><span class="sr-only">' . $lang['loggedinas'] . ' </span>' . userlink() . '</li>';
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
$item = new Admin();
|
||||||
|
if ($item->visibleInContext(AbstractItem::CTX_DESKTOP)) {
|
||||||
|
echo '<li class="admin">' . $item->asHtmlLink() . '</li>';
|
||||||
}
|
}
|
||||||
try{
|
} catch (RuntimeException $ignored) {
|
||||||
echo '<li class="register">' . (new \dokuwiki\Menu\Item\Register())->asHtmlLink() . '</li>';
|
// item not available
|
||||||
} catch(\RuntimeException $ignored) {
|
}
|
||||||
// item not available
|
|
||||||
|
try {
|
||||||
|
$item = new Register();
|
||||||
|
if ($item->visibleInContext(AbstractItem::CTX_DESKTOP)) {
|
||||||
|
echo '<li class="register">' . $item->asHtmlLink() . '</li>';
|
||||||
}
|
}
|
||||||
?>
|
} catch (RuntimeException $ignored) {
|
||||||
|
// item not available
|
||||||
|
}
|
||||||
|
|
||||||
<?php /* tasks do Plug-In */
|
/** @var helper_plugin_do $doplugin */
|
||||||
/** @var \helper_plugin_do $doplugin */
|
$doplugin = plugin_load('helper', 'do');
|
||||||
$doplugin = plugin_load('helper','do');
|
if ($doplugin !== null && isset($_SERVER['REMOTE_USER'])) {
|
||||||
if ($doplugin !== null && isset($_SERVER['REMOTE_USER'])) {
|
$icon = $doplugin->tpl_getUserTasksIconHTML();
|
||||||
$icon = $doplugin->tpl_getUserTasksIconHTML();
|
if ($icon) {
|
||||||
if ($icon) {
|
echo '<li class="user-task">' . $icon . '</li>';
|
||||||
echo '<li class="user-task">' . $icon . '</li>';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
?>
|
}
|
||||||
|
?>
|
||||||
|
|
||||||
</ul>
|
</ul>
|
||||||
</nav><!-- #dokuwiki__usertools -->
|
</nav><!-- #dokuwiki__usertools -->
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue