{include file="left.tpl"}

<script src="../modules/editors/tinymce/tinymce.min.js"></script>
<script>
	jQuery(document).ready(function($)
	{
		<? if(isset($sessionid)) {?>
			init_tinymce('text', 'lite', '{file_manager_theme}', '{file_manager}', '<? echo md5($conf->code); ?>');

			$('#msgsmile').popover({html: true, animation: true, trigger: 'click'});
			$('#msgsmile').on('show.bs.popover', function()
			{
				$(document).mouseup(function(e)
				{
					var container = $('.popover-content');

					if(container.has(e.target).length === 0)
					{
						$('#msgsmile').popover('hide');

						selected = 'gcms_smiles';
					}
				});
			});

			get_smiles('#msgsmile');
		<? } ?>

		load_new_comments('{id}');
	});

	<? if(isset($sessionid)) {?>
		function set_sticker(elem)
		{
			new_comment_send('{id}', encodeURIComponent('sticker'+$(elem).attr('src')));

			$('#msgsmile').popover('hide');

			selected = 'gcms_smiles';
		}

		function set_smile(elem)
		{
			var smile = '<img src="'+$(elem).attr('src')+'" class="g_smile" height="20px" width="20px"> ';

			tinymce.activeEditor.insertContent(smile);

			selected = 'gcms_smiles';
		}

		function answer_comment(login)
		{
			var login = login+', ';tinymce.activeEditor.insertContent(login);

			return false;
		}
	<? } ?>
</script>

<div class="content float-right">
	<? if(strripos($users_groups[$sessionrights]['rights'], "q") !== false){ ?>
		<a class="button-big float-left" href="../news/change_new?id={id}"><i class="fa fa-pencil-square-o"></i> Редактировать новость</a>
		<a class="button-big active float-right" href="#" onclick="return remove_news('{id}', '2');" target="_blank"><i class="fa fa-times-circle-o"></i> Удалить новость</a>
	<? } ?>

	<div class="clear"></div>

	<div class="block">
		<div class="header">{name}</div>
		<div class="block-content">
			{text}
		</div>
	</div>

	<? if(isset($sessionid)) {?>
		<link href="{site_host}templates/SquareLine/css/_small.css" rel="stylesheet">

		<div class="space"></div>

		<div class="block">
			<div class="header">Оставить комментарий</div>
			<div class="block-content">
				<textarea id="text" maxlenght="500"></textarea>

				<div class="message-send">
					<i class="fa fa-smile-o" data-container="body" data-content="empty" data-placement="top" data-toggle="popover" id="msgsmile"></i>

					<div class="btn float-right" onclick="new_comment_send('{id}')">Отправить</div>
				</div>
			</div>
		</div>
		<div class="clear"></div>
	<? } ?>

	<div class="block">
		<div class="header">Комментарии пользователей</div>
		<div class="block-content">
			<div id="comments"></div>
		</div>
	</div>
</div>