<?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');
?>
<!-- tab -->
<script type="text/javascript">
function submitbutton(task)
{
	if (task == 'cancel')
	{
		submitform(task);
		return false;
	}
	
	if (task == 'apply')
	{
		var dt = $('content-pane').getElements('dt');

		for (var i=0; i<dt.length; i++)
		{
			if (dt[i].className == 'open')
			$('tabposition').value = i;
		}
	}
	
	if ($('rsfl_htaccess').checked)
	{
		if(confirm('<?php echo JText::_('RSFL_HTACCESS_WARNING',true); ?>'))
			submitform(task);
		else
		{
			$('rsfl_htaccess').checked = false;
			submitform(task);
		}
	} else  submitform(task);
}
</script>
<form action="index.php" method="post" name="adminForm">
<?php echo $this->tabs->startPane('content-pane'); ?>
<?php echo $this->tabs->startPanel(JText::_('RSFL_GENERAL_CONFIG'),"general-config"); ?>
<table cellspacing="0" cellpadding="0" border="0" width="100%">
		<tr>
			<td valign="top">
				<table  class="adminform">
					<tr>
						<td width="200">
							<label for="license">
								<?php echo JText::_( 'RSFL_LICENSE' ); ?>
							</label>
						</td>
						<td>
							<input type="text" name="rsfilesConfig[license_code]" value="<?php echo $this->rsfilesConfig['license_code'];  ?>" size="55" maxlength="50">
						</td>
					</tr>
					<tr>
						<td width="200">
							<label for="date">
								<?php echo JText::_( 'RSFL_DATE_FORMAT' ).':'; ?>
							</label>
						</td>
						<td>
							<input type="text" name="rsfilesConfig[global_date]" value="<?php echo $this->rsfilesConfig['global_date'];  ?>" size="55" maxlength="50">
						</td>
					</tr>
				</table>
			</td>
		</tr>
	</table>
<?php echo $this->tabs->endPanel(); ?>
<?php echo $this->tabs->startPanel(JText::_('RSFL_FILES_CONFIG'),"files-config"); ?>
<table cellspacing="0" cellpadding="0" border="0" width="100%">
		<tr>
			<td valign="top">
				<table  class="adminform">
					<tr>
						<td width="200">
							<label for="downloadFolder">
								<?php echo JText::_( 'RSFL_DOWNLOAD_FOLDER' ); ?>
							</label>
						</td>
						<td>
							<?php 
							$elements = explode(DS, $this->rsfilesConfig['download_folder']);
							if (count($elements) > 1)
								array_pop($elements);
							$folder = empty($this->rsfilesConfig['download_folder']) ? '' : '&folder='.implode(DS, $elements) ; 
							?>
							<div class="button2-left">
								<div class="blank">
									<a id="valuesChange" rel="{handler: 'iframe', size: {x: 660, y: 475}}" href="index.php?option=com_rsfiles&task=dldlocation&tmpl=component<?php echo $folder; ?>" class="modal"><?php echo JText::_('RSFL_SET_DLD_FOLDER'); ?></a>
								</div>
							</div>
						</td>
					</tr>
					<tr>
						<td width="200">
							<label for="allowedFiles">
								<?php echo JText::_( 'RSFL_CREATE_HTACCESS' ).':'; ?>
							</label>
						</td>
						<td>
							<input type="checkbox" id="rsfl_htaccess" name="rsfl_htaccess" value="1" />
							<?php
								jimport('joomla.filesystem.file');
								echo (JFile::exists($this->rsfilesConfig['download_folder'].DS.'.htaccess')) ? JText::_('RSFL_HTACCESS_OK') : JText::_('RSFL_HTACCESS_NOTOK') ;
							?>
						</td>
					</tr>
					<tr>
						<td width="200">
							<label for="allowedFiles">
								<?php echo JText::_( 'RSFL_ALLOWED_FILES' ).':'; ?>
							</label>
						</td>
						<td>
							<textarea name="rsfilesConfig[allowed_files]" cols="48" rows="7" ><?php echo $this->rsfilesConfig['allowed_files']; ?></textarea>
						</td>
					</tr>
					<tr>
						<td width="100">
							<label for="image">
								<?php echo JText::_( 'RSFL_THUMB_WIDTH' ).':'; ?>
							</label>
						</td>
						<td>
							<input type="text" name="rsfilesConfig[thumb_width]" value="<?php echo $this->rsfilesConfig['thumb_width'];  ?>" size="5" /> px
						</td>
					</tr>
					<tr>
						<td width="200">
							<label for="enableUpload">
								<?php echo JText::_( 'RSFL_ENABLE_FLASH_UPLOAD' ).':'; ?>
							</label>
						</td>
						<td>
							<?php echo JHTML::_('select.booleanlist','rsfilesConfig[enable_flash_upload]','class="inputbox"',$this->rsfilesConfig['enable_flash_upload']); ?>
						</td>
					</tr>
					<tr>
						<td width="200">
							<label for="enableUpload">
								<?php echo JText::_( 'RSFL_ENABLE_UPLOAD_F' ).':'; ?>
							</label>
						</td>
						<td>
							<?php echo JHTML::_('select.booleanlist','rsfilesConfig[enable_upload]','class="inputbox"',$this->rsfilesConfig['enable_upload']); ?>
						</td>
					</tr>
					<tr>
						<td width="200">
							<label for="maxSize">
								<?php echo JText::_( 'RSFL_MAX_FILE_SIZE' ).':'; ?>
								<br/>
							</label>
						</td>
						<td>
							<input type="text" name="rsfilesConfig[max_upl_size]" value="<?php echo $this->rsfilesConfig['max_upl_size'];  ?>" size="55" /> 
							  <?php echo JText::_('RSFL_MAX_IN_PHP').' '.ini_get('upload_max_filesize'); ?>
						</td>
					</tr>
				</table>
			</td>
		</tr>
	</table>
<?php echo $this->tabs->endPanel(); ?>
<?php echo $this->tabs->startPanel(JText::_('RSFL_FRONTEND_CONFIG'),"frontend-config"); ?>
<table cellspacing="0" cellpadding="0" border="0" width="100%">
		<tr>
			<td valign="top">
				<table  class="adminform">
					<tr>
						<td width="200">
							<label for="viewFiles">
								<?php echo JText::_( 'RSFL_COMPONENT_TITLE' ).':'; ?>
							</label>
						</td>
						<td>
							<?php echo JHTML::_('select.booleanlist','rsfilesConfig[component_title]','class="inputbox"',$this->rsfilesConfig['component_title']); ?>
						</td>
					</tr>
					<tr>
						<td width="200">
							<label for="viewFiles">
								<?php echo JText::_( 'RSFL_ENABLE_FILE_PATH' ).':'; ?>
							</label>
						</td>
						<td>
							<?php echo JHTML::_('select.booleanlist','rsfilesConfig[file_path]','class="inputbox"',$this->rsfilesConfig['file_path']); ?>
						</td>
					</tr>
					<tr>
						<td width="200">
							<label for="viewFiles">
								<?php echo JText::_( 'RSFL_ENABLE_RSS' ).':'; ?>
							</label>
						</td>
						<td>
							<?php echo JHTML::_('select.booleanlist','rsfilesConfig[enable_rss]','class="inputbox"',$this->rsfilesConfig['enable_rss']); ?>
						</td>
					</tr>
					<tr>
						<td width="200">
							<label for="viewFiles">
								<?php echo JText::_( 'RSFL_PREVIEW_FILES' ).':'; ?>
							</label>
						</td>
						<td>
							<input type="text" name="rsfilesConfig[preview_files]" value="<?php echo $this->rsfilesConfig['preview_files'];  ?>" size="55" />
						</td>
					</tr>
					<tr>
						<td width="200">
							<label for="viewFiles">
								<?php echo JText::_( 'RSFL_DEFAULT_ORDER' ).':'; ?>
							</label>
						</td>
						<td>
							<?php echo $this->lists['ordering'].' '.$this->lists['ordering_way']; ?>
						</td>
					</tr>
					<tr>
						<td width="200">
							<label for="pagination">
								<?php echo JText::_( 'RSFL_SHOW_PAGINATION' ).':'; ?>
							</label>
						</td>
						<td>
							<?php echo $this->lists['paginationp']; ?>
						</td>
					</tr>
					<tr>
						<td width="200">
							<label for="search">
								<?php echo JText::_( 'RSFL_SHOW_SEARCH' ).':'; ?>
							</label>
						</td>
						<td>
							<?php echo JHTML::_('select.booleanlist','rsfilesConfig[show_search]','class="inputbox"',$this->rsfilesConfig['show_search']); ?>
						</td>
					</tr>
					<tr>
						<td width="200">
							<label for="description">
								<?php echo JText::_( 'RSFL_SHOW_DESCRIPTION' ).':'; ?>
							</label>
						</td>
						<td>
							<?php echo JHTML::_('select.booleanlist','rsfilesConfig[show_descriptions]','class="inputbox"',$this->rsfilesConfig['show_descriptions']); ?>
						</td>
					</tr>
					<tr>
						<td width="200">
							<label for="numberFiles">
								<?php echo JText::_( 'RSFL_NUMBER_FILES_PER_PAGE' ).':'; ?>
							</label>
						</td>
						<td>
							<input type="text" name="rsfilesConfig[nr_per_page]" value="<?php echo $this->rsfilesConfig['nr_per_page'];  ?>" size="3" maxlength="2"  />
						</td>
					</tr>
				</table>
			</td>
		</tr>
	</table>
<?php echo $this->tabs->endPanel(); ?>
<?php echo $this->tabs->startPanel(JText::_('RSFL_EMAILS_CONFIG'),"emails-config"); ?>

<table cellspacing="0" cellpadding="0" border="0" width="100%">
		<tr>
			<td valign="top">
				<table  class="adminform">
					<tr>
						<td width="100">
							<label for="from">
								<?php echo JText::_( 'RSFL_EMAIL_FROM' ).':'; ?>
							</label>
						</td>
						<td>
							<input type="text" name="rsfilesConfig[email_from]" value="<?php echo $this->rsfilesConfig['email_from'];  ?>" size="55" />
						</td>
					</tr>
					<tr>
						<td width="100">
							<label for="fromName">
								<?php echo JText::_( 'RSFL_EMAIL_FROM_NAME' ).':'; ?>
							</label>
						</td>
						<td>
							<input type="text" name="rsfilesConfig[email_from_name]" value="<?php echo $this->rsfilesConfig['email_from_name'];  ?>" size="55" />
						</td>
					</tr>
					<tr>
						<td width="100">
							<label for="reply">
								<?php echo JText::_( 'RSFL_EMAIL_REPLY' ).':'; ?>
							</label>
						</td>
						<td>
							<input type="text" name="rsfilesConfig[email_reply]" value="<?php echo $this->rsfilesConfig['email_reply'];  ?>" size="55" />
						</td>
					</tr>
					<tr>
						<td width="100">
							<label for="reply">
								<?php echo JText::_( 'RSFL_EMAIL_REPLY_NAME' ).':'; ?>
							</label>
						</td>
						<td>
							<input type="text" name="rsfilesConfig[email_reply_name]" value="<?php echo $this->rsfilesConfig['email_reply_name'];  ?>" size="55" />
						</td>
					</tr>
					<tr>
						<td width="100">
							<label for="cc">
								<?php echo JText::_( 'CC' ).':'; ?>
							</label>
						</td>
						<td>
							<input type="text" name="rsfilesConfig[email_cc]" value="<?php echo $this->rsfilesConfig['email_cc'];  ?>" size="55" />
						</td>
					</tr>
					<tr>
						<td width="100">
							<label for="cc">
								<?php echo JText::_( 'BCC' ).':'; ?>
							</label>
						</td>
						<td>
							<input type="text" name="rsfilesConfig[email_bcc]" value="<?php echo $this->rsfilesConfig['email_bcc'];  ?>" size="55" />
						</td>
					</tr>
				</table>
			</td>
		</tr>
	</table>


	<?php echo $this->slider->startPane("content-emails"); ?>
<?php echo $this->slider->startPanel(JText::_('RSFL_ADMIN_EMAIL'),"emails-admin"); ?>
<table cellspacing="0" cellpadding="0" border="0" width="100%">
		<tr>
			<td valign="top">
				<table  class="adminform">
					<tr>
						<td width="100">
							<label for="enableA">
								<?php echo JText::_( 'RSFL_ENABLE_ADMIN_EMAIL' ).':'; ?>
							</label>
						</td>
						<td>
							<?php echo JHTML::_('select.booleanlist','rsfilesConfig[email_admin_enable]','class="inputbox"',$this->rsfilesConfig['email_admin_enable']); ?>
						</td>
					</tr>
					<tr>
						<td width="100">
							<label for="to">
								<?php echo JText::_( 'RSFL_TO' ).':'; ?>
							</label>
						</td>
						<td>
							<input type="text" name="rsfilesConfig[email_admin_to]" value="<?php echo $this->rsfilesConfig['email_admin_to'];  ?>" size="55" />
						</td>
					</tr>
					<tr>
						<td width="100">
							<label for="subject">
								<?php echo JText::_( 'RSFL_SUBJECT' ).':'; ?>
							</label>
						</td>
						<td>
							<input type="text" name="rsfilesConfig[email_admin_subject]" value="<?php echo $this->rsfilesConfig['email_admin_subject'];  ?>" size="55" />
						</td>
					</tr>
					<tr>
						<td width="100">
							<label for="">
								<?php echo JText::_( 'RSFL_MODE' ).':'; ?>
							</label>
						</td>
						<td>
							<?php echo JHTML::_('select.booleanlist','rsfilesConfig[email_admin_mode]','class="inputbox"',$this->rsfilesConfig['email_admin_mode'],JText::_('HTML'),JText::_('TEXT')); ?>
						</td>
					</tr>
					<tr>
						<td width="100">
							<label for="reply">
								<?php echo JText::_( 'RSFL_MESSAGE' ).':'; ?>
							</label>
						</td>
						<td>
						<table>
							<tr>
								<td>
									<?php if($this->rsfilesConfig['email_admin_mode'] == 1) 					
										echo $this->editor->display('rsfilesConfig[email_admin_message]',$this->rsfilesConfig['email_admin_message'],550,400,70,10,false);
										else
										{
									?>
										<textarea name="rsfilesConfig[email_admin_message]" rows="10" cols="100%"><?php echo $this->rsfilesConfig['email_admin_message'];  ?></textarea>
									<?php } ?>
								</td>
								<td>
									<?php echo JText::_('RSFL_ADMIN_EMAIL_PLACEHOLDERS'); ?>
								</td>
							</tr>
						</table>
						</td>
					</tr>
				</table>
			</td>
		</tr>
</table>
<?php echo $this->slider->endPanel(); ?>

<?php echo $this->slider->startPanel(JText::_('RSFL_DOWNLOAD_EMAIL'),"emails-download"); ?>
<table cellspacing="0" cellpadding="0" border="0" width="100%">
		<tr>
			<td valign="top">
				<table  class="adminform">
					<tr>
						<td width="100">
							<label for="subject">
								<?php echo JText::_( 'RSFL_SUBJECT' ).':'; ?>
							</label>
						</td>
						<td>
							<input type="text" name="rsfilesConfig[email_download_subject]" value="<?php echo $this->rsfilesConfig['email_download_subject'];  ?>" size="55" />
						</td>
					</tr>
					<tr>
						<td width="100">
							<label for="">
								<?php echo JText::_( 'RSFL_MODE' ).':'; ?>
							</label>
						</td>
						<td>
							<?php echo JHTML::_('select.booleanlist','rsfilesConfig[email_download_mode]','class="inputbox"',$this->rsfilesConfig['email_download_mode'],JText::_('HTML'),JText::_('TEXT')); ?>
						</td>
					</tr>
					<tr>
						<td width="100">
							<label for="reply">
								<?php echo JText::_( 'RSFL_MESSAGE' ).':'; ?>
							</label>
						</td>
						<td>
							<table>
								<tr>
									<td>
										<?php if($this->rsfilesConfig['email_download_mode'] == 1) 					
											echo $this->editor->display('rsfilesConfig[email_download_message]',$this->rsfilesConfig['email_download_message'],550,400,70,10,false);
											else
											{
										?>
											<textarea name="rsfilesConfig[email_download_message]" rows="10" cols="100%"><?php echo $this->rsfilesConfig['email_download_message'];  ?></textarea>
										<?php } ?>
									</td>
									<td>
										<?php echo JText::_('RSFL_DOWNLOAD_EMAIL_PLACEHOLDERS'); ?>
									</td>
								</tr>
							</table>
						</td>
					</tr>
				</table>
			</td>
		</tr>
</table>
<?php echo $this->slider->endPanel(); ?>

<?php echo $this->slider->startPanel(JText::_('RSFL_UPLOAD_EMAIL'),"emails-upload"); ?>

<table cellspacing="0" cellpadding="0" border="0" width="100%">
		<tr>
			<td valign="top">
				<table  class="adminform">
					<tr>
						<td width="100">
							<label for="enableA">
								<?php echo JText::_( 'RSFL_ENABLE_UPLOAD_EMAIL' ).':'; ?>
							</label>
						</td>
						<td>
							<?php echo JHTML::_('select.booleanlist','rsfilesConfig[email_upload_enable]','class="inputbox"',$this->rsfilesConfig['email_upload_enable']); ?>
						</td>
					</tr>
					<tr>
						<td width="100">
							<label for="to">
								<?php echo JText::_( 'RSFL_TO' ).':'; ?>
							</label>
						</td>
						<td>
							<input type="text" name="rsfilesConfig[email_upload_to]" value="<?php echo $this->rsfilesConfig['email_upload_to'];  ?>" size="55" />
						</td>
					</tr>
					<tr>
						<td width="100">
							<label for="subject">
								<?php echo JText::_( 'RSFL_SUBJECT' ).':'; ?>
							</label>
						</td>
						<td>
							<input type="text" name="rsfilesConfig[email_upload_subject]" value="<?php echo $this->rsfilesConfig['email_upload_subject'];  ?>" size="55" />
						</td>
					</tr>
					<tr>
						<td width="100">
							<label for="">
								<?php echo JText::_( 'RSFL_MODE' ).':'; ?>
							</label>
						</td>
						<td>
							<?php echo JHTML::_('select.booleanlist','rsfilesConfig[email_upload_mode]','class="inputbox"',$this->rsfilesConfig['email_upload_mode'],JText::_('HTML'),JText::_('TEXT')); ?>
						</td>
					</tr>
					<tr>
						<td width="100">
							<label for="reply">
								<?php echo JText::_( 'RSFL_MESSAGE' ).':'; ?>
							</label>
						</td>
						<td>
							<table>
								<tr>
									<td>
										<?php if($this->rsfilesConfig['email_upload_mode'] == 1) 					
											echo $this->editor->display('rsfilesConfig[email_upload_message]',$this->rsfilesConfig['email_upload_message'],550,400,70,10,false);
											else
											{
										?>
											<textarea name="rsfilesConfig[email_upload_message]" rows="10" cols="100%"><?php echo $this->rsfilesConfig['email_upload_message'];  ?></textarea>
										<?php } ?>
									</td>
									<td>
										<?php echo JText::_('RSFL_UPLOAD_EMAIL_PLACEHOLDERS'); ?>
									</td>
								</tr>
							</table>
						</td>
					</tr>
				</table>
			</td>
		</tr>
</table>

<?php echo $this->slider->endPanel(); ?>

<?php echo $this->slider->startPanel(JText::_('RSFL_REPORT_EMAIL'),"emails-reports"); ?>

<table cellspacing="0" cellpadding="0" border="0" width="100%">
		<tr>
			<td valign="top">
				<table  class="adminform">
					<tr>
						<td width="100">
							<label for="enableA">
								<?php echo JText::_( 'RSFL_ENABLE_REPORT_EMAIL' ).':'; ?>
							</label>
						</td>
						<td>
							<?php echo JHTML::_('select.booleanlist','rsfilesConfig[email_report_enable]','class="inputbox"',$this->rsfilesConfig['email_report_enable']); ?>
						</td>
					</tr>
					<tr>
						<td width="100">
							<label for="to">
								<?php echo JText::_( 'RSFL_TO' ).':'; ?>
							</label>
						</td>
						<td>
							<input type="text" name="rsfilesConfig[email_report_to]" value="<?php echo $this->rsfilesConfig['email_report_to'];  ?>" size="55" />
						</td>
					</tr>
					<tr>
						<td width="100">
							<label for="subject">
								<?php echo JText::_( 'RSFL_SUBJECT' ).':'; ?>
							</label>
						</td>
						<td>
							<input type="text" name="rsfilesConfig[email_report_subject]" value="<?php echo $this->rsfilesConfig['email_report_subject'];  ?>" size="55" />
						</td>
					</tr>
					<tr>
						<td width="100">
							<label for="">
								<?php echo JText::_( 'RSFL_MODE' ).':'; ?>
							</label>
						</td>
						<td>
							<?php echo JHTML::_('select.booleanlist','rsfilesConfig[email_report_mode]','class="inputbox"',$this->rsfilesConfig['email_report_mode'],JText::_('HTML'),JText::_('TEXT')); ?>
						</td>
					</tr>
					<tr>
						<td width="100">
							<label for="reply">
								<?php echo JText::_( 'RSFL_MESSAGE' ).':'; ?>
							</label>
						</td>
						<td>
							<table>
								<tr>
									<td>
										<?php if($this->rsfilesConfig['email_report_mode'] == 1) 					
											echo $this->editor->display('rsfilesConfig[email_report_message]',$this->rsfilesConfig['email_report_message'],550,400,70,10,false);
											else
											{
										?>
											<textarea name="rsfilesConfig[email_report_message]" rows="10" cols="100%"><?php echo $this->rsfilesConfig['email_report_message'];  ?></textarea>
										<?php } ?>
									</td>
									<td>
										<?php echo JText::_('RSFL_REPORT_EMAIL_PLACEHOLDERS'); ?>
									</td>
								</tr>
							</table>
						</td>
					</tr>
				</table>
			</td>
		</tr>
</table>

<?php echo $this->slider->endPanel(); ?>

<?php echo $this->slider->endPane(); ?>

<?php echo $this->tabs->endPanel(); ?>
<?php echo $this->tabs->endPane(); ?>
	
<input type="hidden" name="task" value="save" />
<input type="hidden" name="option" value="com_rsfiles" />
<input type="hidden" name="view" value="rsfiles" />
<input type="hidden" name="controller" value="rsfiles" />
<input type="hidden" name="tabposition" value="0" id="tabposition" />
</form>

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