<?php
/**
* @version 1.0.0
* @package RSFiles! 1.0.0
* @copyright (C) 2009 www.rsjoomla.com
* @license GPL, http://www.gnu.org/copyleft/gpl.html
*/

defined('_JEXEC') or die('Restricted access');
$db = JFactory::getDBO();
?>
<form action="index.php" method="post" name="adminForm">

<div id="editcell1">
		<table class="adminlist">
			<thead>
			<tr>
				<th width="20">&nbsp;</th>
				<th><?php echo JText::_('RSFL_FILES'); ?></th>
			</tr>
			</thead>
			<?php if($this->current != $this->rsfilesConfig['download_folder']) { ?>
			<tr>
				<td>&nbsp;</td>
				<td><a href="<?php echo JRoute::_('index.php?option=com_rsfiles&task=showfiles&folder='.$this->previous.'&tmpl=component'); ?>"><img src="<?php echo JURI::root().'administrator/components/com_rsfiles/assets/images/imgs/folder.gif'; ?>" />...</a></td>
			</tr>
			<?php } ?>
	<?php
	$i = 0;
	foreach ($this->folders as $folder)
	{
	$folder_path = str_replace(urlencode($this->rsfilesConfig['download_folder']),'',$folder->fullpath);
	$folder_path = urldecode(ltrim($folder_path,urlencode(DS)));
	?>
		<tr>
			<td><a href="index.php?option=com_rsfiles&task=showfiles&folder=<?php echo $folder->fullpath; ?>&tmpl=component"><img src="<?php echo JURI::root().'administrator/components/com_rsfiles/assets/images/imgs/folder.gif'; ?>" /></a></td>
			<td><a href="javascript:void(0);" onclick="window.parent.rsf_placeholder('<?php echo $db->getEscaped($folder_path); ?>','<?php echo $this->template; ?>')"><?php echo $folder->name; ?></a></td>
		</tr>
	<?php
		$i++;
	}
		$j = $i;
		foreach ($this->files as $file)
		{
		$file_path = str_replace(urlencode($this->rsfilesConfig['download_folder']),'',$file->fullpath);
		$file_path = urldecode(ltrim($file_path,urlencode(DS)));
		?>
			<tr>
				<td><img src="<?php echo JURI::root().'administrator/components/com_rsfiles/assets/images/imgs/file.png'; ?>" /></td>
				<td><a href="javascript:void(0);" onclick="window.parent.rsf_placeholder('<?php echo $db->getEscaped($file_path); ?>','<?php echo $this->template; ?>')"><?php echo $file->name; ?></a></td>
			</tr>
		<?php
			$j++;
		}
	?>
		</table>
	</div>

<?php echo JHTML::_( 'form.token' ); ?>
<input type="hidden" name="option" value="com_rsfiles" />
<input type="hidden" name="component" value="com_rsfiles" />
<input type="hidden" name="controller" value="files" />
<input type="hidden" name="task" value="showfiles" />

<?php
//keep session alive while editing
JHTML::_('behavior.keepalive');
?>
</form>
