1<?php 2/** 3 * functions for drupal-garland-for-dokuwiki theme 4 * License: GPL 2 (http://www.gnu.org/licenses/gpl.html) 5 * $Id$ 6 * 7 * @author: Michael Klier <chi@chimeric.de> 8 * @author: Xan <DXpublica@telefonica.net> 9 * @author: mirko.windhoff.net 10 */ 11 12/** 13 * fetches the sidebar-pages and displays the sidebar 14 */ 15function tpl_sidebar($side='left') { 16 global $ID, $REV, $INFO, $lang; 17 18 $svID = $ID; 19 $svREV = $REV; 20 21 $page_sidebar_name = $ID.'_'.tpl_getConf('sidebar_pagename').'_'.$side; 22 $namespace_sidebar_name = $INFO['namespace'].'_'.tpl_getConf('sidebar_pagename').'_'.$side; 23 $default_sidebar_name = tpl_getConf('default_'.$side.'sidebar_name'); 24 25 if (file_exists(wikiFN($page_sidebar_name))) 26 echo '<div class="'.$side.'bar">'.p_sidebar_xhtml($page_sidebar_name).'</div>'; 27 elseif (file_exists(wikiFN($namespace_sidebar_name))) 28 echo '<div class="'.$side.'bar">'.p_sidebar_xhtml($namespace_sidebar_name).'</div>'; 29 elseif (file_exists(wikiFN($default_sidebar_name))) 30 echo '<div class="'.$side.'bar">'.p_sidebar_xhtml($default_sidebar_name).'</div>'; 31 else 32 echo ' '; 33 34 $ID = $svID; 35 $REV = $svREV; 36 37} 38 39/** 40 * removes the TOC of the sidebar-pages and shows an edit-button if user has enough rights 41 */ 42function p_sidebar_xhtml($Sb) { 43 $data = p_wiki_xhtml($Sb,'',false); 44 if(auth_quickaclcheck($Sb) >= AUTH_EDIT) { 45 $data .= '<div class="secedit">'.html_btn('secedit',$Sb,'',array('do'=>'edit','rev'=>'','post')).'</div>'; 46 } 47 return preg_replace('/<div class="toc">.*?(<\/div>\n<\/div>)/s', '', $data); 48} 49 50/** 51 * prints a you are here string, without description 52 */ 53function tpl_youarehere2($sep=' » '){ 54 global $conf; 55 global $ID; 56 57 // check if enabled 58 if(!$conf['youarehere']) return false; 59 60 $parts = explode(':', $ID); 61 $count = count($parts); 62 63 if($GLOBALS['ACT'] == 'search') 64 { 65 $parts = array($conf['start']); 66 $count = 1; 67 } 68 69 // always print the startpage 70 $title = useHeading('navigation') ? p_get_first_heading($conf['start']) : $conf['start']; 71 if(!$title) $title = $conf['start']; 72 tpl_link(wl($conf['start']),hsc($title),'title="'.$conf['start'].'"'); 73 74 // print intermediate namespace links 75 $part = ''; 76 for($i=0; $i<$count - 1; $i++){ 77 $part .= $parts[$i].':'; 78 $page = $part; 79 resolve_pageid('',$page,$exists); 80 if ($page == $conf['start']) continue; // Skip startpage 81 82 // output 83 echo $sep; 84 if($exists){ 85 $title = useHeading('navigation') ? p_get_first_heading($page) : $parts[$i]; 86 tpl_link(wl($page),hsc($title),'title="'.$page.'"'); 87 }else{ 88 tpl_link(wl($page),$parts[$i],'title="'.$page.'" class="wikilink2" rel="nofollow"'); 89 } 90 } 91 92 // print current page, skipping start page, skipping for namespace index 93 if(isset($page) && $page==$part.$parts[$i]) return; 94 $page = $part.$parts[$i]; 95 if($page == $conf['start']) return; 96 echo $sep; 97 if(page_exists($page)){ 98 $title = useHeading('navigation') ? p_get_first_heading($page) : $parts[$i]; 99 tpl_link(wl($page),hsc($title),'title="'.$page.'"'); 100 }else{ 101 tpl_link(wl($page),$parts[$i],'title="'.$page.'" class="wikilink2" rel="nofollow"'); 102 } 103 return true; 104} 105 106?> 107