0){
// Determine Page Title from first heading
$firstHeading = p_get_first_heading($startPageID);
if($conf['useheading'] && !empty($firstHeading)){
$linkName = $firstHeading;
}else{
$linkName = $startPageName;
}
// echo "" . $conf['useheading'] ."";
tpl_pageLinkCreate($startPageID, $linkName, "tpl_processStartPage:$context");
}
}
}
function tpl_pageLinkCreate($fileToLinkID, $linkName, $calledFrom) {
global $ID;
echo "
";
if($fileToLinkID == $ID){
// highlight current page
echo "";
}
if($_REQUEST["do"] == "admin" && $_REQUEST["page"] == "acl"){
$path = wl($fileToLinkID, "do=admin&page=acl");
}else{
$path = wl($fileToLinkID);
}
// echo "$fileToLinkID, $linkName, $calledFrom";
tpl_link($path,$linkName);
if($fileToLinkID == $ID){
// current page
echo "";
}
}
function tpl_list_folder($dataList, $findAndProcessStartpage){
global $conf;
global $ID;
global $INFO;
require_once(DOKU_INC.'inc/auth.php');
$currentLevel = 1;
$pathinfo = pathinfo($_SERVER['REQUEST_URI']);
$url = $pathinfo['dirname'];
echo "\n";
tpl_processStartPage("","tof");
for($i=0; $i 0){
// don't show start page in normal order
if (noNS($dataList[$i]["id"]) != $conf['start']) {
// FIXME not sure if this is actually needed
// Could we not use noNS($dataList[$i]["id"]) instead???
$pageFileName = split(":", $dataList[$i]["id"]);
$pageFileName = $pageFileName[count($pageFileName) - 1];
$pageFileName = str_replace("_", " ", $pageFileName);
// Determine Page Title from first heading
$firstHeading = p_get_first_heading($dataList[$i]["id"]);
if($conf['useheading'] && $dataList[$i]["type"] == "f" && !empty($firstHeading)){
$linkName = $firstHeading;
}else{
$linkName = $pageFileName;
}
// Adjust the level. If level of page is higher than current level
// close list-item and list
// FIXME: Why is this needed when the same happens down below?
if($currentLevel > $dataList[$i]["level"]){
echo str_repeat("
\n", $currentLevel - $dataList[$i]["level"]);
$currentLevel = $dataList[$i]["level"];
}
// if entry is a folder
if($dataList[$i]["type"] == "d"){
if($dataList[$i]["open"]){
echo "";
}else{
echo "";
}
if($_REQUEST["do"] == "admin" && $_REQUEST["page"] == "acl"){
$path = wl($dataList[$i]["id"].":".$conf['start'], "do=admin&page=acl");
}else{
$path = wl($dataList[$i]["id"].":".$conf['start']);
}
// echo "Path: $path, LinkName: $linkName
";
tpl_link($path,$linkName);
}else{
// entry is a file
// echo "Path: $path, LinkName: $linkName, id: ". $dataList[$i]["id"] . "
";
tpl_pageLinkCreate ($dataList[$i]["id"], $linkName, "direkt:tpl_list_folder" );
}
if($dataList[$i+1]["level"] == $currentLevel){
// current folder (just close list-item)
echo "\n";
}else if($dataList[$i+1]["level"] > $currentLevel){
// new sub-folder (start new sub-list)
echo "\n";
// Check if a start page exists and add it first
tpl_processStartPage($dataList[$i]["id"],"");
}else if($dataList[$i+1]["level"] < $currentLevel){
// end of sub-folder (close open sublists)
if(!empty($dataList[$i+1]["level"])){
echo str_repeat("
\n", $currentLevel - $dataList[$i+1]["level"]);
}
}
$currentLevel = $dataList[$i+1]["level"];
}
}
}
echo "\n";
}
global $ID;
global $ACT;
global $conf;
$folder = getNS($ID);
require_once(DOKU_INC.'inc/search.php');
require_once(DOKU_INC.'inc/html.php');
$ns = cleanID($ID);
if(empty($ns)){
$ns = dirname(str_replace(':','/',$ID));
if($ns == '.') $ns ='';
}
$ns = utf8_encodeFN(str_replace(':','/',$ns));
$list = array();
search($list,$conf['datadir'],'search_index',array('ns' => $ns));
tpl_list_folder($list,true);
?>