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:
parent
3ce7dd3b16
commit
6b6e2bd6f7
4 changed files with 78 additions and 27 deletions
9
main.php
9
main.php
|
@ -140,7 +140,14 @@ $classWideContent = ($ACT === "show") ? "": "wide-content ";
|
||||||
|
|
||||||
<div class="menu-tool-select">
|
<div class="menu-tool-select">
|
||||||
<h5 class="sr-only" role="heading" aria-level="2"><?php echo tpl_getLang('head_menu_tool-select') ?></h5>
|
<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><!-- .menu-tool-select -->
|
||||||
</div><!-- .headings -->
|
</div><!-- .headings -->
|
||||||
</div><!-- .col -->
|
</div><!-- .col -->
|
||||||
|
|
|
@ -12,14 +12,19 @@
|
||||||
<div class="nav-panel level1">
|
<div class="nav-panel level1">
|
||||||
<ul id="sidebar-site-tools">
|
<ul id="sidebar-site-tools">
|
||||||
<?php
|
<?php
|
||||||
tpl_toolsevent(
|
if (file_exists(DOKU_INC . 'inc/Menu/SiteMenu.php')) {
|
||||||
'sitetools',
|
echo (new \dokuwiki\Menu\SiteMenu())->getListItems();
|
||||||
array(
|
} else {
|
||||||
'recent' => tpl_action('recent', 1, 'li', 1),
|
//Pre-Greebo Backwards compatibility
|
||||||
'media' => tpl_action('media', 1, 'li', 1),
|
tpl_toolsevent(
|
||||||
'index' => tpl_action('index', 1, 'li', 1),
|
'sitetools',
|
||||||
)
|
array(
|
||||||
);
|
'recent' => tpl_action('recent', 1, 'li', 1),
|
||||||
|
'media' => tpl_action('media', 1, 'li', 1),
|
||||||
|
'index' => tpl_action('index', 1, 'li', 1),
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
?>
|
?>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
@ -34,15 +39,20 @@
|
||||||
<div class="nav-panel level1">
|
<div class="nav-panel level1">
|
||||||
<ul id="sidebar-user-tools">
|
<ul id="sidebar-user-tools">
|
||||||
<?php /* dokuwiki user tools */
|
<?php /* dokuwiki user tools */
|
||||||
tpl_toolsevent(
|
if (file_exists(DOKU_INC . 'inc/Menu/UserMenu.php')) {
|
||||||
'usertools',
|
echo (new \dokuwiki\Menu\UserMenu())->getListItems();
|
||||||
array(
|
} else {
|
||||||
'login' => tpl_action('login', 1, 'li', 1),
|
//Pre-Greebo Backwards compatibility
|
||||||
'profile' => tpl_action('profile', 1, 'li', 1),
|
tpl_toolsevent(
|
||||||
'admin' => tpl_action('admin', 1, 'li', 1),
|
'usertools',
|
||||||
'register' => tpl_action('register', 1, 'li', 1),
|
array(
|
||||||
)
|
'login' => tpl_action('login', 1, 'li', 1),
|
||||||
);
|
'profile' => tpl_action('profile', 1, 'li', 1),
|
||||||
|
'admin' => tpl_action('admin', 1, 'li', 1),
|
||||||
|
'register' => tpl_action('register', 1, 'li', 1),
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
?>
|
?>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -11,12 +11,16 @@ if (!defined('DOKU_INC')) {
|
||||||
<?php include('nav-status.php'); ?>
|
<?php include('nav-status.php'); ?>
|
||||||
<ul>
|
<ul>
|
||||||
<?php
|
<?php
|
||||||
$data = dokuwiki\template\sprintdoc\tpl::assemblePageTools();
|
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) {
|
foreach ($data['items'] as $k => $html) {
|
||||||
echo $html;
|
echo $html;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -6,7 +6,19 @@
|
||||||
<nav id="dokuwiki__usertools" class="nav-usertools <?php echo $navClass?>">
|
<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>
|
<h6 class="sr-only" role="heading" aria-level="2"><?php echo $lang['user_tools']; ?></h6>
|
||||||
<ul>
|
<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
|
<?php
|
||||||
if (!empty($_SERVER['REMOTE_USER'])) {
|
if (!empty($_SERVER['REMOTE_USER'])) {
|
||||||
|
@ -14,10 +26,28 @@
|
||||||
}?>
|
}?>
|
||||||
|
|
||||||
<?php /* dokuwiki user tools */
|
<?php /* dokuwiki user tools */
|
||||||
tpl_toolsevent('usertools', array(
|
if (file_exists(DOKU_INC . 'inc/Menu/Item/Admin.php')) {
|
||||||
'admin' => tpl_action('admin', 1, 'li', 1),
|
try{
|
||||||
'register' => tpl_action('register', 1, 'li', 1),
|
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 */
|
<?php /* tasks do Plug-In */
|
||||||
/** @var \helper_plugin_do $doplugin */
|
/** @var \helper_plugin_do $doplugin */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue