diff --git a/helper.php b/helper.php index 03caa52..30c02a8 100644 --- a/helper.php +++ b/helper.php @@ -11,23 +11,47 @@ if(!defined('DOKU_INC')) die(); class helper_plugin_userhomepage extends DokuWiki_Plugin { - function getPrivateNs() { + function getPrivateID() { if ($this->getConf('group_by_name')) { - // private:s:simon + // private:s:simon or private:s:simon_delage $this->private_ns = cleanID($this->getConf('users_namespace').':'.strtolower(substr($this->privateNamespace(), 0, 1)).':'. $this->privateNamespace()); } else { - // private:simon + // private:simon or private:simon_delage $this->private_ns = cleanID($this->getConf('users_namespace').':'. $this->privateNamespace()); } - // private:simon:start.txt - return $this->private_page = cleanID($this->private_ns . ':' . $this->privatePage()); + // ...:start.txt + return $this->private_page = cleanID($this->private_ns.':'.$this->privateStart()); } - function getPublicPage() { + function getPublicID() { return $this->public_page = cleanID($this->getConf('public_pages_ns').':'. $_SERVER['REMOTE_USER']); } + function getPrivateLink($param=null) { + global $INFO; + global $lang; + if ($param == "loggedinas") { + return '
  • '.$lang['loggedinas'].' : '.$INFO['userinfo']['name'].' ('.$_SERVER['REMOTE_USER'].')
  • '; + } elseif ($param != null) { + return ''.$param.''; + } else { + return ''.$this->getLang('privatenamespace').''; + } + } + + function getPublicLink($param=null) { + global $INFO; + global $lang; + if ($param == "loggedinas") { + return '
  • '.$lang['loggedinas'].' : '.$INFO['userinfo']['name'].' ('.$_SERVER['REMOTE_USER'].')
  • '; + } elseif ($param != null) { + return ''.$param.''; + } else { + return ''.$this->getLang('publicpage').''; + } + } + function privateNamespace() { if ( $this->getConf('use_name_string')) { global $INFO; @@ -40,7 +64,7 @@ class helper_plugin_userhomepage extends DokuWiki_Plugin { } } - function privatePage() { + function privateStart() { if ( $this->getConf('use_start_page')) { global $conf; return $conf['start']; @@ -49,20 +73,4 @@ class helper_plugin_userhomepage extends DokuWiki_Plugin { } } -// //draws a home button, used by calls from main.php in template folder -// function homeButton() { -// $this->init(); -// if ($_SERVER['REMOTE_USER']!=null) { -// echo '
    '; -// } -// } -// //draws a home link, used by calls from main.php in template folder -// function privateLink() { -// $this->init(); -// if ($_SERVER['REMOTE_USER']!=null) { -// echo '
  • '.$lang['loggedinas'].' : '.$INFO['userinfo']['name'].' ('.$_SERVER['REMOTE_USER'].')
  • '; -// echo 'Home'; -// } -// } - } diff --git a/images/ns.png b/images/ns.png new file mode 100644 index 0000000..37c04c7 Binary files /dev/null and b/images/ns.png differ diff --git a/images/user.png b/images/user.png new file mode 100644 index 0000000..0a3a305 Binary files /dev/null and b/images/user.png differ diff --git a/lang/en/lang.php b/lang/en/lang.php index 7fc1def..93778c1 100644 --- a/lang/en/lang.php +++ b/lang/en/lang.php @@ -6,3 +6,5 @@ */ $lang['created'] = 'Created from template by Userhompage plugin'; +$lang['privatenamespace'] = 'Private Namespace'; +$lang['publicpage'] = 'Public Page'; diff --git a/style.css b/style.css new file mode 100644 index 0000000..1e7ae9a --- /dev/null +++ b/style.css @@ -0,0 +1,7 @@ +/******************************************************************** +Screen Styles for the Userhomepage Plugin (additional to all.css) +********************************************************************/ + +a.uhp_private,a.uhp_public { padding-left:19px; } +a.uhp_private { background:url(images/ns.png) no-repeat left; } +a.uhp_public { background:url(images/user.png) no-repeat left; }