Amélioration du menu droit : classe php avec la méthode moderne de dokuwiki, affichage des svg, empêcher l'affichage de childrenpages ici.

This commit is contained in:
Zatalyz 2021-10-27 12:59:33 +02:00
parent aa2544e79f
commit dc9eb87cff
2 changed files with 43 additions and 38 deletions

View file

@ -28,13 +28,38 @@ So, navbar too, and breadcrumbs.
/*____________ Usertools ____________*/
/* Link to Connexion, userpage, administration, profil */
.dokuwiki__tools ul, {
.dokuwiki__tools ul {
margin: 0 auto;
padding: 0;
color: @ini_link;
}
.dokuwiki__tools {
li {
list-style: none;
margin: 0;
}
li a {
display: flex;
flex-direction: row-reverse;
justify-content: end;
span {
margin-left: 3px;
}
}
.user {
display: flex;
span {
margin-right: 0.3em;
margin-bottom: 0.5em;
}
}
}
/* highlight selected tool */
.mode_admin a.action.admin,
.mode_login a.action.login,
@ -104,4 +129,4 @@ form.search {
max-width : 1.5em;
}
}
}

View file

@ -177,62 +177,42 @@ $showSidebar = $hasSidebar && ($ACT=='show');
<!-- Page Actions -->
<div class="dokuwiki__tools nomobile">
<h3 class="a11y"><?php echo $lang['page_tools']; ?></h3>
<ul>
<?php
$data = array(
//'view' => 'main',
'items' => array(
'edit' => tpl_action('edit', true, 'li', true, '<span>', '</span>'),
'revert' => tpl_action('revert', true, 'li', true, '<span>', '</span>'),
'revisions' => tpl_action('revisions', true, 'li', true, '<span>', '</span>'),
'backlink' => tpl_action('backlink', true, 'li', true, '<span>', '</span>'),
'subscribe' => tpl_action('subscribe', true, 'li', true, '<span>', '</span>')
)
);
// the page tools can be amended through a custom plugin hook
$evt = new Doku_Event('TEMPLATE_PAGETOOLS_DISPLAY', $data);
if($evt->advise_before()){
foreach($evt->data['items'] as $k => $html) echo $html;
}
$evt->advise_after();
unset($data);
unset($evt);
?>
</ul>
<!-- Don't include childrenpage here -->
<?php
foreach ( (new \dokuwiki\Menu\PageMenu())->getItems() as $item ) {
if ( ! preg_match('/^childrenpages_/', $item->getType()) ) {
echo '<li>'.$item->asHtmlLink(false, true).'</li>';
}
}
?>
</div>
<hr class="nomobile">
<!-- usertools and sitetools -->
<div class="dokuwiki__tools nomobile">
<?php echo (new \dokuwiki\Menu\SiteMenu())->getListItems(); ?>
<hr class="nomobile">
<!-- Link interwiki of user -->
<?php if ($conf['useacl']): ?>
<h3 class="a11y"><?php echo $lang['user_tools']; ?></h3>
<ul><?php
// Afficher lien interwiki user
if (!empty($_SERVER['REMOTE_USER'])) {
echo '<li class="user">';
$loginname = $_SERVER["REMOTE_USER"];
$kh_userpage = tpl_getLang('kh_userpage');
echo "$kh_userpage ";
echo "<span>$kh_userpage </span>";
echo (tpl_getConf("khum1_userpage")
? html_wikilink(tpl_getConf("khum1_userpage_ns").$loginname, hsc($loginname))
: hsc($loginname));
echo '</li>';
}
// le reste des appels (pas mal de modif, attention aux comportements étranges ?)
tpl_toolsevent('tools', array(
tpl_action('admin', true, 'li', true),
tpl_action('profile', true, 'li', true),
tpl_action('media', true, 'li', true),
tpl_action('recent', true, 'li', true),
tpl_action('index', true, 'li', true),
tpl_action('register', true, 'li', true),
tpl_action('login', true, 'li', true),
));
?></ul>
<?php endif ?>
<!-- UserMenu -->
<?php echo (new \dokuwiki\Menu\UserMenu())->getListItems(); ?>
</div>
<hr class="nomobile">