summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnika Henke <anika@selfthinker.org>2010-11-05 10:34:56 +0000
committerAnika Henke <anika@selfthinker.org>2010-11-05 10:34:56 +0000
commit5b4c3e60499b9ce847a755833ee8041800e0fcdb (patch)
tree91032dbb1e14b7ab6d9d0c7cc07e48a471a0cb17
parentf4d27201048c83c893d9476dd80a89bbce29a1c6 (diff)
downloadrpg-5b4c3e60499b9ce847a755833ee8041800e0fcdb.tar.gz
rpg-5b4c3e60499b9ce847a755833ee8041800e0fcdb.tar.bz2
added user page link
-rw-r--r--conf/default.php1
-rw-r--r--conf/metadata.php1
-rw-r--r--lang/en/lang.php4
-rw-r--r--lang/en/settings.php1
-rw-r--r--main.php17
-rw-r--r--tpl_functions.php20
6 files changed, 33 insertions, 11 deletions
diff --git a/conf/default.php b/conf/default.php
index 7f1fbb246..7c60e665e 100644
--- a/conf/default.php
+++ b/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;
diff --git a/conf/metadata.php b/conf/metadata.php
index 591053e7e..c6ebe1638 100644
--- a/conf/metadata.php
+++ b/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');
diff --git a/lang/en/lang.php b/lang/en/lang.php
index 1b04113c8..5496cbe86 100644
--- a/lang/en/lang.php
+++ b/lang/en/lang.php
@@ -4,4 +4,6 @@
*
*/
-$lang['btn_discussion'] = "Discussion";
+$lang['btn_discussion'] = "Discussion";
+$lang['btn_back2article'] = "Back to article";
+$lang['btn_userpage'] = "User page";
diff --git a/lang/en/settings.php b/lang/en/settings.php
index 78fbbb280..66c9c4486 100644
--- a/lang/en/settings.php
+++ b/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?';
diff --git a/main.php b/main.php
index 338907a19..65d964cee 100644
--- a/main.php
+++ b/main.php
@@ -64,10 +64,15 @@ $showTools = !tpl_getConf('hideTools') || ( tpl_getConf('hideTools') && $_SERVER
<ul>
<?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') */
- tpl_action('admin', 1, 'li');
- tpl_action('profile', 1, 'li', 0, '', '', $INFO['userinfo']['name'].' ('.$_SERVER['REMOTE_USER'].')');
- // this partly replaces tpl_userinfo()
- tpl_action('login', 1, 'li');
+ 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>
<!-- <div class="user"><?php tpl_userinfo() /* 'Logged in as ...' */ ?></div> -->
@@ -80,8 +85,8 @@ $showTools = !tpl_getConf('hideTools') || ( tpl_getConf('hideTools') && $_SERVER
<?php tpl_searchform(); ?>
<ul>
<?php
- tpl_action('recent', 1, 'li');
- tpl_action('index', 1, 'li');
+ tpl_action('recent', 1, 'li');
+ tpl_action('index', 1, 'li');
?>
</ul>
</div>
diff --git a/tpl_functions.php b/tpl_functions.php
index 58f9ab4f9..6dc9e4bc2 100644
--- a/tpl_functions.php
+++ b/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());
+}