<?php
// namespace components\com_jchat\views\attachments;
/**
 * @package JCHAT::ATTACHMENTS::components::com_jchat
 * @subpackage views
 * @subpackage attachments
 * @subpackage tmpl
 * @author Joomla! Extensions Store
 * @Copyright (C) 2015 - Joomla! Extensions Store
 * @license GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html
 */
defined('_JEXEC') or die('Restricted access');
use Joomla\CMS\Language\Text;
?>

<script type="text/javascript"<?php echo $this->nonce;?> src="<?php echo $this->liveSite;?>components/com_jchat/js/jquery.js"></script>
<script type="text/javascript"<?php echo $this->nonce;?>>
	jQuery(function() {
		jQuery('div.closemsgbtn').on('click', function(){
			jQuery(this).parent().css('display', 'none')
		});
		setTimeout(function(){
			jQuery('div.upload_usermessage').fadeOut();
		}, 1000);

		<?php if($this->app->input->get('form', null) == 'pm'):?>
		jQuery('#uploadform').on('submit', function(jqEvent){
			window.parent.JChatMessaging.appendFileMessage(jQuery('#newfile').val().replace('C:\\fakepath\\', ''));
		});
		<?php endif; ?>
	})
</script>
<?php if($this->baseTemplate == 'custom.css'): ?>
	<link type="text/css"<?php echo $this->nonce;?> rel="stylesheet" href="<?php echo $this->liveSite;?>templates/<?php echo $this->joomlaTemplate;?>/css/com_jchat/css/templates/default.css"/>
<?php else: ?>
	<link type="text/css"<?php echo $this->nonce;?> rel="stylesheet" href="<?php echo $this->liveSite;?>components/com_jchat/css/templates/<?php echo $this->baseTemplate;?>"/>
<?php endif;?>
<?php if($this->chatTemplate):?>
	<link type="text/css"<?php echo $this->nonce;?> rel="stylesheet" href="<?php echo $this->liveSite;?>components/com_jchat/css/templates/<?php echo $this->chatTemplate;?>"/>
<?php endif;?>

<div class="upload_usermessage <?php echo $this->visibleClass . $this->success;?>"><?php echo $this->modelMessage;?><div class="closemsgbtn"></div></div>
<form name="uploadform" enctype="multipart/form-data" id="uploadform" method="post" action="index.php">
	<input type="file" id="newfile" name="newfile" />
	<div class="formbutton">
		<div class="attachment_button_container"><input id="file_upload_button" type="submit" value="" /><label class="buttonlabel" for="file_upload_button"><?php echo Text::_('COM_JCHAT_UPLOAD');?></label></div>
	</div>
	<input type="hidden" name="option" value="<?php echo $this->option;?>" />
	<input type="hidden" name="task" value="attachments.saveEntity" />
	<input type="hidden" name="format" value="raw" />
	<input type="hidden" name="to" value="<?php echo $this->to;?>" />
	<input type="hidden" name="tologged" value="<?php echo $this->tologged;?>" />
</form> 