added event to all tools menues
This commit is contained in:
parent
554591bef7
commit
157cb5bae6
2 changed files with 67 additions and 45 deletions
46
main.php
46
main.php
|
|
@ -63,19 +63,23 @@ $showSidebar = page_findnearest($conf['sidebar']) && ($ACT=='show');
|
||||||
<div id="dokuwiki__usertools">
|
<div id="dokuwiki__usertools">
|
||||||
<h3 class="a11y"><?php echo $lang['user_tools'] ?></h3>
|
<h3 class="a11y"><?php echo $lang['user_tools'] ?></h3>
|
||||||
<ul>
|
<ul>
|
||||||
<?php /* the optional second parameter of tpl_action() switches between a link and a button,
|
<?php
|
||||||
e.g. a button inside a <li> would be: tpl_action('edit', 0, 'li') */
|
|
||||||
if (!empty($_SERVER['REMOTE_USER'])) {
|
if (!empty($_SERVER['REMOTE_USER'])) {
|
||||||
echo '<li class="user">';
|
echo '<li class="user">';
|
||||||
tpl_userinfo(); /* 'Logged in as ...' */
|
tpl_userinfo(); /* 'Logged in as ...' */
|
||||||
echo '</li>';
|
echo '</li>';
|
||||||
}
|
}
|
||||||
tpl_action('admin', 1, 'li');
|
|
||||||
_tpl_action('userpage', 1, 'li');
|
|
||||||
tpl_action('profile', 1, 'li');
|
|
||||||
tpl_action('register', 1, 'li'); /* DW versions < 2011-02-20 need to use _tpl_action('register', 1, 'li') */
|
|
||||||
tpl_action('login', 1, 'li');
|
|
||||||
?>
|
?>
|
||||||
|
<?php /* the optional second parameter of tpl_action() switches between a link and a button,
|
||||||
|
e.g. a button inside a <li> would be: tpl_action('edit', 0, 'li') */
|
||||||
|
?>
|
||||||
|
<?php _tpl_toolsevent('usertools', array(
|
||||||
|
'admin' => tpl_action('admin', 1, 'li', 1),
|
||||||
|
'userpage' => _tpl_action('userpage', 1, 'li', 1),
|
||||||
|
'profile' => tpl_action('profile', 1, 'li', 1),
|
||||||
|
'register' => tpl_action('register', 1, 'li', 1), /* DW versions < 2011-02-20 need to use _tpl_action('register', 1, 'li') */
|
||||||
|
'login' => tpl_action('login', 1, 'li', 1),
|
||||||
|
)); ?>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
|
|
@ -85,11 +89,11 @@ $showSidebar = page_findnearest($conf['sidebar']) && ($ACT=='show');
|
||||||
<h3 class="a11y"><?php echo $lang['site_tools'] ?></h3>
|
<h3 class="a11y"><?php echo $lang['site_tools'] ?></h3>
|
||||||
<?php tpl_searchform() ?>
|
<?php tpl_searchform() ?>
|
||||||
<ul>
|
<ul>
|
||||||
<?php
|
<?php _tpl_toolsevent('sitetools', array(
|
||||||
tpl_action('recent', 1, 'li');
|
'recent' => tpl_action('recent', 1, 'li', 1),
|
||||||
tpl_action('media', 1, 'li');
|
'media' => tpl_action('media', 1, 'li', 1),
|
||||||
tpl_action('index', 1, 'li');
|
'index' => tpl_action('index', 1, 'li', 1),
|
||||||
?>
|
)); ?>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
@ -145,15 +149,15 @@ $showSidebar = page_findnearest($conf['sidebar']) && ($ACT=='show');
|
||||||
<div id="dokuwiki__pagetools">
|
<div id="dokuwiki__pagetools">
|
||||||
<h3 class="a11y"><?php echo $lang['page_tools'] ?></h3>
|
<h3 class="a11y"><?php echo $lang['page_tools'] ?></h3>
|
||||||
<ul>
|
<ul>
|
||||||
<?php
|
<?php _tpl_toolsevent('pagetools', array(
|
||||||
tpl_action('edit', 1, 'li');
|
'edit' => tpl_action('edit', 1, 'li', 1),
|
||||||
_tpl_action('discussion', 1, 'li');
|
'discussion'=> _tpl_action('discussion', 1, 'li', 1),
|
||||||
tpl_action('revisions', 1, 'li');
|
'revisions' => tpl_action('revisions', 1, 'li', 1),
|
||||||
tpl_action('backlink', 1, 'li');
|
'backlink' => tpl_action('backlink', 1, 'li', 1),
|
||||||
tpl_action('subscribe', 1, 'li');
|
'subscribe' => tpl_action('subscribe', 1, 'li', 1),
|
||||||
tpl_action('revert', 1, 'li');
|
'revert' => tpl_action('revert', 1, 'li', 1),
|
||||||
tpl_action('top', 1, 'li');
|
'top' => tpl_action('top', 1, 'li', 1),
|
||||||
?>
|
)); ?>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
|
|
||||||
|
|
@ -62,30 +62,6 @@ function _tpl_userpage($userPage, $title, $link=0, $wrapper=0) {
|
||||||
if ($wrapper) echo "</$wrapper>";
|
if ($wrapper) echo "</$wrapper>";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Create link/button to register page
|
|
||||||
* @deprecated DW versions > 2011-02-20 can use the core function tpl_action('register')
|
|
||||||
*
|
|
||||||
* @author Anika Henke <anika@selfthinker.org>
|
|
||||||
*/
|
|
||||||
function _tpl_register($link=0, $wrapper=0) {
|
|
||||||
global $conf;
|
|
||||||
global $lang;
|
|
||||||
global $ID;
|
|
||||||
$lang_register = !empty($lang['btn_register']) ? $lang['btn_register'] : $lang['register'];
|
|
||||||
|
|
||||||
if (!empty($_SERVER['REMOTE_USER']) || !$conf['useacl'] || !actionOK('register')) return;
|
|
||||||
|
|
||||||
if ($wrapper) echo "<$wrapper>";
|
|
||||||
|
|
||||||
if ($link)
|
|
||||||
tpl_link(wl($ID, 'do=register'), $lang_register, 'class="action register" rel="nofollow"');
|
|
||||||
else
|
|
||||||
echo html_btn('register', $ID, '', array('do'=>'register'), 'get', 0, $lang_register);
|
|
||||||
|
|
||||||
if ($wrapper) echo "</$wrapper>";
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Wrapper around custom template actions
|
* Wrapper around custom template actions
|
||||||
*
|
*
|
||||||
|
|
@ -109,6 +85,24 @@ function _tpl_action($type, $link=0, $wrapper=0) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create event for tools menues
|
||||||
|
*
|
||||||
|
* @author Anika Henke <anika@selfthinker.org>
|
||||||
|
*/
|
||||||
|
function _tpl_toolsevent($toolsname, $items, $view='main') {
|
||||||
|
$data = array(
|
||||||
|
'view' => $view,
|
||||||
|
'items' => $items
|
||||||
|
);
|
||||||
|
|
||||||
|
$hook = 'TEMPLATE_'.strtoupper($toolsname).'_DISPLAY';
|
||||||
|
$evt = new Doku_Event($hook, $data);
|
||||||
|
if($evt->advise_before()){
|
||||||
|
foreach($evt->data['items'] as $k => $html) echo $html;
|
||||||
|
}
|
||||||
|
$evt->advise_after();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* fallbacks for things missing in older DokuWiki versions
|
/* fallbacks for things missing in older DokuWiki versions
|
||||||
|
|
@ -282,3 +276,27 @@ if (!function_exists('tpl_classes')) {
|
||||||
return join(' ', $classes);
|
return join(' ', $classes);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create link/button to register page
|
||||||
|
* @deprecated DW versions > 2011-02-20 can use the core function tpl_action('register')
|
||||||
|
*
|
||||||
|
* @author Anika Henke <anika@selfthinker.org>
|
||||||
|
*/
|
||||||
|
function _tpl_register($link=0, $wrapper=0) {
|
||||||
|
global $conf;
|
||||||
|
global $lang;
|
||||||
|
global $ID;
|
||||||
|
$lang_register = !empty($lang['btn_register']) ? $lang['btn_register'] : $lang['register'];
|
||||||
|
|
||||||
|
if (!empty($_SERVER['REMOTE_USER']) || !$conf['useacl'] || !actionOK('register')) return;
|
||||||
|
|
||||||
|
if ($wrapper) echo "<$wrapper>";
|
||||||
|
|
||||||
|
if ($link)
|
||||||
|
tpl_link(wl($ID, 'do=register'), $lang_register, 'class="action register" rel="nofollow"');
|
||||||
|
else
|
||||||
|
echo html_btn('register', $ID, '', array('do'=>'register'), 'get', 0, $lang_register);
|
||||||
|
|
||||||
|
if ($wrapper) echo "</$wrapper>";
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue