Browse Source

added user page link

master
Anika Henke 14 years ago
parent
commit
5b4c3e6049
  1. 1
      conf/default.php
  2. 1
      conf/metadata.php
  3. 2
      lang/en/lang.php
  4. 1
      lang/en/settings.php
  5. 5
      main.php
  6. 20
      tpl_functions.php

1
conf/default.php

@ -6,5 +6,6 @@
$conf['tagline'] = 'This is the tagline - explaining what this site is about.';
$conf['discussionNS'] = 'discussion';
$conf['userNS'] = 'user';
$conf['sidebarID'] = 'sidebar';
$conf['hideTools'] = 0;

1
conf/metadata.php

@ -6,6 +6,7 @@
$meta['tagline'] = array('string');
$meta['discussionNS'] = array('string');
$meta['userNS'] = array('string');
$meta['sidebarID'] = array('string');
$meta['hideTools'] = array('onoff');

2
lang/en/lang.php

@ -5,3 +5,5 @@
*/
$lang['btn_discussion'] = "Discussion";
$lang['btn_back2article'] = "Back to article";
$lang['btn_userpage'] = "User page";

1
lang/en/settings.php

@ -6,5 +6,6 @@
$lang['foo'] = 'Tagline';
$lang['discussionNS'] = 'Discussion namespace (leave empty to disable discussions)';
$lang['userNS'] = 'User namespace (leave empty to disable user pages)';
$lang['sidebarID'] = 'page name of page included in sidebar';
$lang['hideTools'] = 'Hide tools when not logged in?';

5
main.php

@ -67,6 +67,11 @@ $showTools = !tpl_getConf('hideTools') || ( tpl_getConf('hideTools') && $_SERVER
tpl_action('admin', 1, 'li');
tpl_action('profile', 1, 'li', 0, '', '', $INFO['userinfo']['name'].' ('.$_SERVER['REMOTE_USER'].')');
// this partly replaces tpl_userinfo()
if (tpl_getConf('userNS') && $_SERVER['REMOTE_USER']) {
echo '<li>';
_tpl_userpage(tpl_getConf('userNS').':',1);
echo '</li>';
}
tpl_action('login', 1, 'li');
?>
</ul>

20
tpl_functions.php

@ -4,22 +4,34 @@
if (!defined('DOKU_INC')) die();
if (!defined('DOKU_LF')) define('DOKU_LF',"\n");
/* @todo: fix label of buttons */
/**
* Create link/button to discussion page and back
*/
function _tpl_discussion($discussNS='discussion:',$link=0) {
global $ID;
global $lang;
if(substr($ID,0,strlen($discussNS))==$discussNS) {
$backID = substr(strstr($ID,':'),1);
if ($link)
tpl_pagelink(':'.$backID,$lang['btn_back']);
tpl_link(wl($backID),tpl_getLang('btn_back2article'));
else
echo html_btn('back',$backID,'',array());
echo html_btn('back2article',$backID,'',array());
} else {
if ($link)
tpl_pagelink($discussNS.$ID,tpl_getLang('btn_discussion'));
tpl_link(wl($discussNS.$ID),tpl_getLang('btn_discussion'));
else
echo html_btn('discussion',$discussNS.$ID,'',array());
}
}
/**
* Create link/button to user page
*/
function _tpl_userpage($userNS='user:',$link=0) {
global $conf;
if ($link)
tpl_link(wl($userNS.$_SERVER['REMOTE_USER'].':'.$conf['start']),tpl_getLang('btn_userpage'));
else
echo html_btn('userpage',$userNS.$_SERVER['REMOTE_USER'].':'.$conf['start'],'',array());
}
Loading…
Cancel
Save