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

$doc =& JFactory::getDocument();
$script	= 'window.addEvent(\'domready\', function() {
		document.emailForm.screen_resolution.value=screen.width +"x"+ screen.height;
	});
	';
$doc->addScriptDeclaration( $script );


		$limitstart = JRequest :: getVar('limitstart', '0', '', 'int');

		$user = & JFactory :: getUser();

		if (isset ($this->row->authorUrl) && $this->row->authorUrl != '') {
			$this->row->authorUrl = str_replace('http://', '', $this->row->authorUrl);
		}

		JHTML::_('behavior.tooltip');
		
		
$templateType	= JRequest::getVar('templateType','email');
$link	= 'index.php?option=com_contact_enhanced&controller=templates&task=view&templateType=';
?>
<div  style="">
		
		<ul class="ce-submenu">
			<li><?php echo ($templateType == 'email' 		? '<span class="nolink">'.JText::_('Email').'</span>' : JHTML::_('link',$link.'email', JText::_('Email'))); ?></li>
			<li><?php echo ($templateType == 'resultPage' 	? '<span class="nolink">'.JText::_('Thank you page').'</span>' : JHTML::_('link',$link.'resultPage', JText::_('Thank you page'))); ?></li>
		</ul>
	</div>	
	<br style="clear:both" />
		<form action="index.php" method="post" name="adminForm">

			<table class="adminlist">
			<thead>
				<tr>
					<th width="5" class="title">
						<?php echo JText::_( 'Num' ); ?>
					</th>
					<th class="title" colspan="2">
						<?php echo JText::_( 'Template Name' ); ?>
					</th>
					<th width="10%" align="center">
						<?php echo JText::_( 'Version' ); ?>
					</th>
					<th width="15%" class="title">
						<?php echo JText::_( 'Date' ); ?>
					</th>
					<th width="25%"  class="title">
						<?php echo JText::_( 'Author' ); ?>
					</th>
				</tr>
			</thead>
			<tfoot>
				<tr>
					<td colspan="6">
						<?php echo $this->page->getListFooter(); ?>
					</td>
				</tr>
			</tfoot>
			<tbody>
			<?php

		$k = 0;
		for ($i = 0, $n = count($this->rows); $i < $n; $i++) {
			$this->row = & $this->rows[$i];

			$author_info = @ $this->row->authorEmail . '<br />' . @ $this->row->authorUrl;
?>
				<tr class="<?php echo 'row'. $k; ?>">
					<td>
						<?php echo $this->page->getRowOffset( $i ); ?>
					</td>
					<td width="5">
						<input type="radio" id="cb<?php echo $i;?>" name="cid[]" value="<?php echo $this->row->directory; ?>" onclick="isChecked(this.checked);" />
					</td>
					<td><?php $img_path = JURI::root().'components/com_contact_enhanced/templates/email/'.$this->row->directory.'/template_thumbnail.png'; ?>
						<span class="editlinktip hasTip" title="<?php echo $this->row->name;?>::
<img border=&quot;1&quot; src=&quot;<?php echo $img_path; ?>&quot; name=&quot;imagelib&quot; alt=&quot;<?php echo JText::_( 'No preview available' ); ?>&quot; width=&quot;206&quot; height=&quot;145&quot; />">
<a href="index.php?option=com_contact_enhanced&controller=templates&task=edit&templateType=<?php echo $templateType;?>&cid[]=<?php echo $this->row->directory;?>">
							<?php echo $this->row->name;?></a></span>
					</td>
					<td align="center">
						<?php echo $this->row->version; ?>
					</td>
					<td>
						<?php echo $this->row->creationdate; ?>
					</td>
					<td>
						<span class="editlinktip hasTip" title="<?php echo JText::_( 'Author Information' );?>::<?php echo $author_info; ?>">
							<?php echo @$this->row->author != '' ? $this->row->author : '&nbsp;'; ?>
						</span>
					</td>
				</tr>
				<?php

		}
?>
			</tbody>
			</table>

	<input type="hidden" name="option" value="com_contact_enhanced" />
	<input type="hidden" name="controler" value="templates" />
	<input type="hidden" name="task" value="" />
	<input type="hidden" name="screen_resolution" value="" />
	<input type="hidden" name="templateType" value="<?php echo $templateType; ?>" />
	
	<input type="hidden" name="boxchecked" value="0" />
	<?php echo JHTML::_( 'form.token' ); ?>
	</form>