<?php
/**
 * @version $Id$
 * @package    Contact_Enhanced
 * @subpackage Templates
 * @author     Douglas Machado {@link http://ideal.fok.com.br}
 * @author     Created on 28-Jul-09
 * @license		GNU/GPL, see license.txt
 * Contact Enhanced  is free software. This version may have been modified pursuant
 * to the GNU General Public License, and as distributed it includes or
 * is derivative of works licensed under the GNU General Public License or
 * other free or open source software licenses.
 */

//--No direct access
defined('_JEXEC') or die('Direct Access NOT Allowed. Please try to access the main page');

JHTML::_('behavior.tooltip');
global $mainframe;
$templateType	= JRequest::getVar('templateType','email');

JHTML::_('behavior.tooltip');
jimport('joomla.html.pane');
// TODO: allowAllClose should default true in J!1.6, so remove the array when it does.
$pane = &JPane::getInstance('sliders', array('allowAllClose' => true));

?>

	
	<form action="index.php" method="post" name="adminForm">

		<?php if($this->ftp): ?>
		<fieldset title="<?php echo JText::_('DESCFTPTITLE'); ?>" class="adminform">
			<legend><?php echo JText::_('DESCFTPTITLE'); ?></legend>

			<?php echo JText::_('DESCFTP'); ?>

			<?php if(JError::isError($this->ftp)): ?>
				<p><?php echo JText::_($this->ftp->message); ?></p>
			<?php endif; ?>

			<table class="adminform nospace">
			<tbody>
			<tr>
				<td width="120">
					<label for="username"><?php echo JText::_('Username'); ?>:</label>
				</td>
				<td>
					<input type="text" id="username" name="username" class="input_box" size="70" value="" />
				</td>
			</tr>
			<tr>
				<td width="120">
					<label for="password"><?php echo JText::_('Password'); ?>:</label>
				</td>
				<td>
					<input type="password" id="password" name="password" class="input_box" size="70" value="" />
				</td>
			</tr>
			</tbody>
			</table>
		</fieldset>
		<?php endif; ?>

		<div class="col width-50">
			<fieldset class="adminform">
				<legend><?php echo JText::_( 'Details' ); ?></legend>

				<table class="admintable">
				<tr>
					<td valign="top" class="key">
						<?php echo JText::_( 'Name' ); ?>:
					</td>
					<td>
						<strong>
							<?php echo JText::_($this->row->name); ?>
						</strong>
					</td>
				</tr>
				<tr>
					<td valign="top" class="key">
						<?php echo JText::_( 'Description' ); ?>:
					</td>
					<td>
						<?php echo JText::_($this->row->description); ?>
					</td>
				</tr>
				<tr>
					<td valign="top" class="key">
						<?php echo JText::_( 'Directory' ); ?>:
					</td>
					<td>
						[Path to Joomla]/components/com_contact_enhanced/templates/<?php echo $templateType.'/'.$this->template; ?>/
					</td>
				</tr>
				</table>
			</fieldset>

			<fieldset class="adminform">
				<legend><?php echo JText::_( 'Edit Template' ); ?></legend>
				
				<table class="adminform">
					<tr>
						<th>
							<?php 
								$templatefile = $this->template.DS.'index.html';
								echo is_writable($this->tBaseDir.DS.$templatefile) ? JText::sprintf('TEMPLATEFILESWRITABLE', $templatefile):JText::sprintf('TEMPLATEFILESUNWRITABLE', $templatefile);
								//echo '<br />'.$this->tBaseDir.DS.$templatefile; 
							?>
						</th>
					</tr>
					<tr>
						<td>
							<?php 
							$editor = &JFactory::getEditor();
							
							// parameters : areaname, content, width, height, cols, rows
							echo $editor->display( 'filecontent',  $this->content , '95%', '400', '110', '25') ;
							?>
							
						</td>
					</tr>
				</table>
			</fieldset>
		</div>

		<div class="col width-50">
			<?php 
			echo $pane->startPane("ce-template-options");
			echo $pane->startPanel( JText::_('Parameters'),  'parameters');

				$templatefile = $this->template.DS.'params.ini';
				echo is_writable($this->tBaseDir.DS.$templatefile) ? JText::sprintf('PARAMSWRITABLE', $templatefile):JText::sprintf('PARAMSUNWRITABLE', $templatefile); ?>
				<table class="admintable">
				<tr>
					<td>
						<?php

		if (!is_null($this->params)) {
			echo $this->params->render();
		} else {
			echo '<i>' . JText :: _('No Parameters') . '</i>';
		}
?>
					</td>
				</tr>
				</table>
			<?php 
			echo $pane->endPanel();
			echo $pane->startPanel( JText::_('How to use with Joom!Fish?'),  'joomfish');
			?>
			
			<table class="admintable"  style="width:100%;padding:0 5px 0 10px">
				<tr>
					<td valign="top">
						<?php echo JText::_( 'TEMPLATE_JOOMFISH_INSTRUCTIONS' ); ?>
					</td>
				</tr>
			</table>
			<?php 
			echo $pane->endPanel();
			echo $pane->startPanel( JText::_('Available syntaxes'),  'sintaxes');
			?>
			
			<table class="admintable"  style="width:100%;padding:0 5px 0 10px">
				<tr>
					<td valign="top" class="key">
						{name}
					</td>
					<td valign="top">
						[<?php echo JText::_( "The User's name" ); ?>]
					</td>
				
				</tr><tr>
					<td valign="top" class="key">
						{email}
					</td>
					<td valign="top">
						[<?php echo JText::_( "The User's email" ); ?>]
					</td>
				</tr><tr>
					<td valign="top" class="key">
						{subject}
					</td>
					<td valign="top">
						[<?php echo JText::_( "The subject of the message" ); ?>]
					</td>
				</tr>
				<tr>
					<td valign="top" class="key">
						{site_url}
					</td>
					<td valign="top">
						<?php echo JURI::root(); ?>
					</td>
				</tr><tr>
					<td valign="top" class="key">
				
						{site_name}
					</td>
					<td valign="top">
						<?php echo $mainframe->getCfg('sitename'); ?>
					</td>
				</tr><tr>
					<td valign="top" class="key">
						{site_link}
					</td>
					<td valign="top">
						<?php 
						$site_link	= JHTML::_('link', JURI::root(),$mainframe->getCfg('sitename')); 
						echo $site_link; ?>
					</td>
				</tr><tr>
					<td valign="top" class="key">
						{contact_url}
					</td>
					<td valign="top">
						[<?php echo JText::_( "URL of the contact" ); ?>]
					</td>
				</tr><tr>
					<td valign="top" class="key">
						{contact_link}
					</td>
					<td valign="top">
						[<?php echo JText::_( "Link to the contact" ); ?>]		
					</td>
				</tr>
				<tr>
					<td valign="top" class="key">
						{custom_fields}
					</td>
					<td valign="top">
						[<?php echo JText::_( "Displays all custom fields" ); ?>	]
					</td>
				</tr><tr>
					<td valign="top" class="key">
						{enquiry}
					</td>
					<td valign="top">
						<?php echo JText::sprintf( "ENQUIRY_TEXT", $site_link ).'<br />User Name < useremail@domain.com >'; ?>
					</td>
				</tr>
				<tr>
					<td valign="top" class="key">
						{system_info}
					</td>
					<td valign="top">
						<?php echo ceHelper::getSystemInfo($this->params);?>
					</td>
				</tr><tr>
					<td valign="top" class="key">
						{timestamp}
					</td>
					<td valign="top">
						<?php 
						$date			=& JFactory::getDate(time());
						echo $date->toFormat(JText::_('DATE_FORMAT_LC2'));
						?>
					</td>
				</tr>
				
				<tr>
					<td valign="top" class="key">
						{templateURI}
					</td>
					<td valign="top">
						<?php echo JURI::root().'components/com_contact_enhanced/templates/email/'.$this->template.'/';
						?>
					</td>
				</tr>
				<tr>
					<td valign="top" class="key">
						{contact_id}
					</td>
					<td valign="top">
						[<?php echo JText::_( "The contact's id" ); ?>]
					</td>
				</tr><tr>
					<td valign="top" class="key">
						{contact_name}
					</td><td valign="top">
						[[<?php echo JText::_( "Contact Name" ); ?>]
					</td>
				</tr><tr>
					<td valign="top" class="key">
				
						{contact_con_position}
					</td>
					<td valign="top">
						[<?php echo JText::_( "Contact Position" ); ?>]
					</td>
				</tr><tr>
					<td valign="top" class="key">
						{contact_address}
					</td>
					<td valign="top">
						[<?php echo JText::_( "Contact's Mail address" ); ?>]
					</td>
				</tr><tr>
					<td valign="top" class="key">
						{contact_suburb}
					</td>
					<td valign="top">
						
					</td>
				</tr><tr>
					<td valign="top" class="key">
						{contact_state}
					</td>
					<td valign="top">
				
						
					</td>
				</tr><tr>
					<td valign="top" class="key">
						{contact_country}
					</td>
					<td valign="top">
						
					</td>
				</tr><tr>
					<td valign="top" class="key">
						{contact_postcode}
					</td>
				
					<td valign="top">
						
					</td>
				</tr><tr>
					<td valign="top" class="key">
						{contact_telephone}
					</td>
					<td valign="top">
						
					</td>
				</tr><tr>
					<td valign="top" class="key">
				
						{contact_fax}
					</td>
					<td valign="top">
						
					</td>
				</tr><tr>
					<td valign="top" class="key">
						{contact_misc}
					</td>
					<td valign="top">
						
					</td>
				
				</tr><tr>
					<td valign="top" class="key">
						{contact_sidebar}
					</td>
					<td valign="top">
						
					</td>
				</tr><tr>
					<td valign="top" class="key">
						{contact_image}
					</td>
					<td valign="top">
						[<?php echo JText::_( "The file name of the contact's image" ); ?>]
					</td>
				</tr><tr>
					<td valign="top" class="key">
						{contact_email_to}
					</td>
					<td valign="top">
						[<?php echo JText::_( "The contact's email" ); ?>]
					</td>
				</tr>
				<tr>
					<td valign="top" class="key">
						{contact_mobile}
					</td>
					<td valign="top">
						
					</td>
				</tr><tr>
					<td valign="top" class="key">
						{contact_webpage}
					</td>
					<td valign="top">
						
					</td>
				</tr><tr>
					<td valign="top" class="key">
						{contact_lat}
					</td>
					<td valign="top">
						[<?php echo JText::_( "Latitude of the contact's address" ); ?>]
					</td>
				</tr><tr>
					<td valign="top" class="key">
						{contact_lng}
					</td>
					<td valign="top">
						[<?php echo JText::_( "longitude of the contact's address" ); ?>]
					</td>
				</tr>
				<tr>
					<td valign="top" class="key">
						{contact_extra_field_1}
					</td>
					<td valign="top">
						[<?php echo JText::_( "The content of the Contact 'Extra field 1'" ); ?>]
					</td>
				</tr><tr>
					<td valign="top" class="key">
						{contact_extra_field_2}
					</td>
					<td valign="top">
				
						
					</td>
				</tr><tr>
					<td valign="top" class="key">
						{contact_extra_field_3}
					</td>
					<td valign="top">
						
					</td>
				</tr><tr>
					<td valign="top" class="key">
						{contact_extra_field_4}
					</td>
				
					<td valign="top">
						
					</td>
				</tr><tr>
					<td valign="top" class="key">
						{contact_extra_field_5}
					</td>
					<td valign="top">
						
					</td>
				</tr><tr>
					<td valign="top" class="key">
				
						{contact_extra_field_6}
					</td>
					<td valign="top">
						
					</td>
				</tr><tr>
					<td valign="top" class="key">
						{contact_extra_field_7}
					</td>
					<td valign="top">
						
					</td>
				
				</tr><tr>
					<td valign="top" class="key">
						{contact_extra_field_8}
					</td>
					<td valign="top">
						
					</td>
				</tr><tr>
					<td valign="top" class="key">
						{contact_extra_field_9}
					</td>
					<td valign="top">
				
						
					</td>
				</tr><tr>
					<td valign="top" class="key">
						{contact_extra_field_10}
					</td>
					<td valign="top">
						
					</td>
				</tr><tr>
					<td valign="top" class="key">
						{contact_category_name}
					</td>
				
					<td valign="top">
						
					</td>
				</tr>
				<tr>
					<td valign="top" class="key">
						{DATE_FORMAT_LC}
					</td>
					<td valign="top">
						<?php echo $date->toFormat(JText::_('DATE_FORMAT_LC')); ?>
					</td>
				</tr><tr>
					<td valign="top" class="key">
						{DATE_FORMAT_LC1}
					</td>
					<td valign="top">
						<?php echo $date->toFormat(JText::_('DATE_FORMAT_LC1')); ?>
					</td>
				</tr><tr>
					<td valign="top" class="key">
						{DATE_FORMAT_LC2}
					</td>
					<td valign="top">
					<?php echo $date->toFormat(JText::_('DATE_FORMAT_LC2')); ?>	
					</td>
				</tr><tr>
					<td valign="top" class="key">
						{DATE_FORMAT_LC3}
					</td>
					<td valign="top">
						<?php echo $date->toFormat(JText::_('DATE_FORMAT_LC3')); ?>
					</td>
				</tr><tr>
					<td valign="top" class="key">
						{DATE_FORMAT_LC4}
					</td>
					<td valign="top">
						<?php echo $date->toFormat(JText::_('DATE_FORMAT_LC4')); ?>
					</td>
				</tr>
				</table>
			<?php 
			echo $pane->endPanel();
			echo $pane->endPane();
			?>
		</div>
		<div class="clr"></div>

		<input type="hidden" name="id" value="<?php echo $this->row->directory; ?>" />
		<input type="hidden" name="option" value="com_contact_enhanced" />
		<input type="hidden" name="task" value="" />
		<input type="hidden" name="controller" value="templates" />
		<input type="hidden" name="templateType" value="<?php echo $templateType; ?>" />
		<?php echo JHTML::_( 'form.token' ); ?>
		</form>