<ul id="nav_secondary">
	<li id="folder_actions" class="nav-category"><span><?php print $this->translate('Folders')?></span>
		<span class="folder-remove" title="<?php echo $this->translate('Delete Current Folder')?>"><?php echo $this->translate('Delete Current Folder')?></span>
		<span class="folder-add" title="<?php echo $this->translate('Add New Folder')?>"><?php echo $this->translate('Add New Folder')?></span>
	</li>	
	<li class='files'>
		<div class='current'>
			<a href="#" title='/' class='webdavFolder webdavRoot'>
				<span class="label"><?php print $this->translate('Home')?></span>
			</a>
		</div>
		
<?php
	
function printList(array $dirs) {
	
echo "<ul class='subfolder'>";

foreach($dirs as $dir) {
	printItem($dir);	
}

echo "</ul>";

}

function printItem(Atmail_Files_FileObject $dir) {

$dirName = htmlspecialchars($dir->displayname, ENT_QUOTES, 'UTF-8');
$dirPath = htmlspecialchars(preg_replace('/^\//', '', $dir->path), ENT_QUOTES, 'UTF-8');

echo "
<li>
	<div>
		<a href='#' title='$dirPath' class='webdavFolder'>
			<span class='label'>$dirName</span>
		</a>
	</div>";

if ($dir->children) 
	printList($dir->children);
	
echo "</li>";
}

printList($this->directoryList);
		
?>

	</li>
</ul>

<ul id="folder_actions">
	<li title="Add New Folder" id="folder_add"><a><?php echo $this->translate('Add New Folder') ?></a></li>
	<li title="Delete Folder" id="folder_remove"><a class='enabled'><?php echo $this->translate('Delete Folder') ?></a></li>
</ul>