<?php
/**
 * @version $Id$
 * @package    Contact_Enhanced
 * @subpackage Views
 * @author     Douglas Machado {@link http://ideal.fok.com.br}
 * @author     Created on 04-Dec-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('=;)');

JHTML::_('behavior.tooltip');
JHTML::_('behavior.modal');
$doc =& JFactory::getDocument();
//$doc->addScript( 	JURI::root(). 'components/com_contact_enhanced/assets/js/validate.js' );
//$doc->addStyleSheet(JURI::root(). 'components/com_contact_enhanced/assets/css/validate.css');
$doc->addStyleSheet(JURI::base(). 'components/com_contact_enhanced/assets/css/contact_enhanced.css'); //administrator

?>
<form  enctype="multipart/form-data" action="<?php echo JRoute::_( 'index.php' );?>" method="post" name="adminForm" id="emailForm" class="form-validate">
		
			<div class="col width-45"><!--
				<fieldset class="adminform">
					<legend><?php echo JText::_( 'Custom Fields' ); ?></legend>
					
					<?php // echo ceHelper::loadCustomFields($this->customfields,$this->params, true);  ?>
				</fieldset>
			--></div>
			<div class="col width-55" style="overflow:auto">
				<fieldset class="adminform" >
					<legend><?php echo JText::_( 'Original Message' ); ?></legend>
					<div class="message-header">
						<span class="message-name"><?php echo $this->item->from_name; ?> </span>
						<span class="message-email"> &laquo;<?php echo $this->item->from_email; ?>&raquo; </span>
						
					<?php if(count($this->attachments) > 0): 
						$fileList = ''; //'<ul>';
						foreach($this->attachments as $attachments){
							$attachments	= explode('|',$attachments->value);
							foreach($attachments as $attachment){
								$attachment	= trim($attachment);
								//$fileList .= '<li>'.$attachment.'</li>';
								$fileList .= ''.ceHelper::removePrefix($attachment,$this->item->id.'_').'<br />';
							}
						}
						//$fileList .= '</ul>';
						
						$attachments	= JHTML::_('image',JURI::root().'components/'.COMPONENT_FOLDER.'/assets/images/attachment.png', JText::_('Attachments'));
						$attachments	= JHTML::_('link','#attachments'.$this->item->id, $attachments);
						
					?>	
						<span class="message-attachment">
							<span style="text-decoration: none; color: rgb(51, 51, 51)" class="editlinktip hasTip" title="<?php  echo $fileList; ?>">
								<?php echo $attachments; //JHTML::_('tooltip',$fileList,JText::_('Attachments'), '',$attachments ); ?>
							</span>
						</span>
					<?php  endif; ?>
					<?php 
						$date			=& JFactory::getDate($this->item->date);
					?>
						<span class="editlinktip hasTip" title="<?php  echo $date->toFormat(JText::_('DATE_FORMAT_LC2')); ?>">
							<span class="message-date"><?php echo ceHelper::timeDifference($this->item->date,'full'); ?></span>
						</span>
					</div>
					<pre class="message"><?php echo $this->item->message; ?></pre>
					<a name="attachments<?php echo $this->item->id; ?>"> </a>
					<?php echo ceHelper::formatAttachmentList($this->attachments,$this->item->id); ?>
					<div id="reply-actions">
						<a class="reply modal" rel="{handler:'iframe',size:{x:850,y:500}}"  
							href="index.php?option=<?php echo COMPONENT_FOLDER; ?>&controller=messages&task=reply&tmpl=component&cid[]=<?php echo $this->item->id; ?>"><?php echo JText::_( 'Reply' ); ?></a>
					</div>
				</fieldset>
				<fieldset>
					<legend><?php echo JText::_( 'Replies' ); ?></legend>
					<?php 
						foreach($this->replies as $message){
							$this->assignRef('message',			$message);
							echo $this->loadTemplate('message');
						}
					?>
				</fieldset>
			</div>
		<input type="hidden" name="cid[]" value="<?php echo $this->item->id; ?>" />
		<input type="hidden" name="catid" value="<?php echo $this->item->category_id; ?>" />
		<input type="hidden" name="option" value="com_contact_enhanced" />
		<input type="hidden" name="task" value="" />
		<input type="hidden" name="controller" value="messages" />
	</form>
