<?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' ); 
?>

<div style="text-align:center;color:red;font-size:15px;"><?php echo JText::_('RSFL_DLDFOLDER_WARNING'); ?></div>

<form action="index.php" method="post" name="adminForm" autocomplete="off">
<div style="text-align:right;">
<button type="button" onclick="window.parent.document.getElementById('sbox-window').close();"><?php echo JText::_('RSFL_CANCEL_BTN'); ?></button>
<button type="submit" onclick="if(!rsfl_checks()) { alert('<?php echo JText::_('RSFL_ERROR_DLD_FOLDER',true); ?>'); return false } else { parent.window.location='index.php?option=com_rsfiles&task=settings&tabposition=1';window.parent.document.getElementById('sbox-window').close(); }"><?php echo JText::_('RSFL_SAVE_BTN'); ?></button>
</div><br/><br/>
<fieldset>
<legend><?php echo JText::_('RSFL_SELECT_DEFAULT_FOLDER'); ?></legend>

<table class="adminform">
	<tr>
		<td style="text-align:center">
		<?php foreach ($this->elements as $element) { ?>
<a href="<?php echo JRoute::_('index.php?option=com_rsfiles&task=dldlocation&tmpl=component&folder='.$element->fullpath); ?>"><?php echo $element->name; ?></a> <?php echo DS; ?>
<?php } ?>
		</td>
	</tr>
</table>

<table class="adminlist">
		<td><a href="<?php echo JRoute::_('index.php?option=com_rsfiles&task=dldlocation&tmpl=component&folder='.$this->previous); ?>"><img src="<?php echo JURI::root().'administrator/components/com_rsfiles/assets/images/imgs/folder.gif'; ?>" /></a></td>
<?php foreach ($this->folders as $i => $folder) { ?>
		<tr>
			<td><input id="cb<?php echo $i; ?>" type="radio" name="default_folder" value="<?php echo $folder->fullpath; ?>" <?php echo ($this->rsfilesConfig['download_folder'] == urldecode($folder->fullpath)) ? 'checked="checked"' : ''; ?> /><img src="<?php echo JURI::root().'administrator/components/com_rsfiles/assets/images/imgs/folder.gif'; ?>" /> <a href="<?php echo JRoute::_('index.php?option=com_rsfiles&task=dldlocation&tmpl=component&folder='.$folder->fullpath); ?>"><?php echo $folder->name; ?></a></td>
		</tr>
	<?php } ?>
</table>

</fieldset>
<?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="rsfiles" />
<input type="hidden" name="task" value="savefolder" />

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