<?php
if(isset($_GET['id'])) {
require_once('../wu-engine/wu_init.php');
$ticket = intval($_GET['id']);
$now_ticket = mysqli_fetch_assoc(mysqli_query($connect_db, "SELECT id,th FROM `".DB_PREFIX."_tickets_main` WHERE id='$ticket' LIMIT 1"));
if (empty($now_ticket['id'])) {
$wie = explode('.php/', $_GET['id']); wu_log_act(2, 'Пытался открыть чужой или не существующий тикет с id'.wu_filter($wie['0']));
header ("Location: /account/support"); exit;
}
$page_name = 'Просмотр тикета';
$page_keys = 'поддержка, тикет';
$page_desc = 'Просмотр тикета';
$prevurl_1 = '/account/support';
$prevname_1 = 'Поддержка';
} else {
$page_name = 'Поддержка';
$page_keys = 'поддержка, тикет';
$page_desc = 'Ваши обращения в службу поддержки';
if (isset($_GET['type']) && $_GET['type'] == 'closed') { $ticket_t = 'Открытые тикеты'; $ticket_l = ''; } else { $ticket_t = 'Закрытые тикеты'; $ticket_l = '?type=closed'; }
$page_right = '<div class="header-buttons"><div class="collapse" id="header-buttons"><div class="well"><div class="btn-group"><a data-toggle="modal" role="button" href="#ticket_new" class="btn btn-primary">Новый тикет</a><a href="/account/support'.$ticket_l.'" class="btn btn-primary">'.$ticket_t.'</a></div></div></div></div>';
}
$online_title = 'На странице поддержки';
$online_url = '/account/support';
include('../wu-engine/wu_header.php');
include('../wu-engine/wu_account_menu.php');
if(!USER_LOGGED) { header ("Location: /"); exit; }
?>
<?php
//Список обращений
if(!isset($_GET['id'])) {
?>
<div id="ticket_new" class="modal fade" tabindex="-1" role="dialog">
<form action="#" id="wu-form-send">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h4 class="modal-title"><i class="icon-pencil"></i> Новый тикет</h4>
</div>
<div class="modal-body with-padding">
<input type="hidden" name="token" value="<?php echo $token; ?>" />
<div class="form-group">
<label>Категория обращения:</label><br />
<select class="form-control" name="cat">
<?php
$qin = mysqli_query($connect_db, "SELECT id,ti FROM ".DB_PREFIX."_tickets_cat ORDER BY pos ASC");
while($rowi = mysqli_fetch_assoc($qin)) {
?>
<option value="<?php echo $rowi['id']; ?>"<?php if (isset($_GET['cat']) && $_GET['cat'] == $rowi['id']) { echo ' selected=""'; } ?>><?php echo $rowi['ti']; ?></option>
<?php } ?>
</select>
</div>
<div class="form-group">
<label>Срочность:</label><br />
<select class="form-control" name="pr">
<option value="1">Низкая</option>
<option value="2" selected="">Средняя</option>
<option value="3">Высокая</option>
</select>
</div>
<div class="form-group">
<label>Тема обращения:</label>
<input type="text" class="form-control" placeholder="Введите тему" name="theme"<?php if (isset($_GET['theme'])) { echo ' value="'.strip_tags($_GET['theme']).'"'; } ?> maxlength="100" />
</div>
<div class="form-group">
<label>Ваше сообщение:</label>
<textarea rows="5" cols="5" class="form-control" placeholder="Введите текст обращения" id="msg_text" name="message"><?php if (isset($_GET['message'])) { echo htmlspecialchars($_GET['message']); } ?></textarea>
</div>
<center>
<div id="wu-files-output" class="margload"></div>
</center>
</div>
<div class="modal-footer">
<input type="file" id="wu-files" name="wu-files[]" multiple="" class="dnone" />
<label for="wu-files" class="btn btn-default btn-icon"><i class="icon-attachment"></i></label>
<div class="btn-group">
<button data-toggle="dropdown" data-play="bounceIn" class="btn btn-default btn-icon dropdown-toggle"><i class="icon-smiley"></i></button>
<ul class="dropdown-menu" style="width: 280px;">
<li></li>
<li>
<div class="emogiblc smile-main"><div class="webupper_smile"><div><i class="wu-smile wu-1"></i></div></div><div class="webupper_smile"><div><i class="wu-smile wu-2"></i></div></div><div class="webupper_smile"><div><i class="wu-smile wu-3"></i></div></div><div class="webupper_smile"><div><i class="wu-smile wu-4"></i></div></div><div class="webupper_smile"><div><i class="wu-smile wu-5"></i></div></div><div class="webupper_smile"><div><i class="wu-smile wu-6"></i></div></div><div class="webupper_smile"><div><i class="wu-smile wu-7"></i></div></div><div class="webupper_smile"><div><i class="wu-smile wu-8"></i></div></div><div class="webupper_smile"><div><i class="wu-smile wu-9"></i></div></div><div class="webupper_smile"><div><i class="wu-smile wu-10"></i></div></div><div class="webupper_smile"><div><i class="wu-smile wu-11"></i></div></div><div class="webupper_smile"><div><i class="wu-smile wu-12"></i></div></div><div class="webupper_smile"><div><i class="wu-smile wu-13"></i></div></div><div class="webupper_smile"><div><i class="wu-smile wu-14"></i></div></div><div class="webupper_smile"><div><i class="wu-smile wu-15"></i></div></div><div class="webupper_smile"><div><i class="wu-smile wu-16"></i></div></div><div class="webupper_smile"><div><i class="wu-smile wu-17"></i></div></div><div class="webupper_smile"><div><i class="wu-smile wu-18"></i></div></div><div class="webupper_smile"><div><i class="wu-smile wu-19"></i></div></div><div class="webupper_smile"><div><i class="wu-smile wu-20"></i></div></div><div class="webupper_smile"><div><i class="wu-smile wu-21"></i></div></div><div class="webupper_smile"><div><i class="wu-smile wu-22"></i></div></div><div class="webupper_smile"><div><i class="wu-smile wu-23"></i></div></div><div class="webupper_smile"><div><i class="wu-smile wu-24"></i></div></div><div class="webupper_smile"><div><i class="wu-smile wu-25"></i></div></div><div class="webupper_smile"><div><i class="wu-smile wu-26"></i></div></div><div class="webupper_smile"><div><i class="wu-smile wu-27"></i></div></div><div class="webupper_smile"><div><i class="wu-smile wu-28"></i></div></div><div class="webupper_smile"><div><i class="wu-smile wu-29"></i></div></div><div class="webupper_smile"><div><i class="wu-smile wu-30"></i></div></div><div class="webupper_smile"><div><i class="wu-smile wu-31"></i></div></div><div class="webupper_smile"><div><i class="wu-smile wu-32"></i></div></div><div class="webupper_smile"><div><i class="wu-smile wu-33"></i></div></div><div class="webupper_smile"><div><i class="wu-smile wu-34"></i></div></div><div class="webupper_smile"><div><i class="wu-smile wu-35"></i></div></div><div class="webupper_smile"><div><i class="wu-smile wu-36"></i></div></div><div class="webupper_smile"><div><i class="wu-smile wu-37"></i></div></div><div class="webupper_smile"><div><i class="wu-smile wu-38"></i></div></div><div class="webupper_smile"><div><i class="wu-smile wu-39"></i></div></div><div class="webupper_smile"><div><i class="wu-smile wu-40"></i></div></div><div class="webupper_smile"><div><i class="wu-smile wu-41"></i></div></div><div class="webupper_smile"><div><i class="wu-smile wu-42"></i></div></div><div class="webupper_smile"><div><i class="wu-smile wu-43"></i></div></div><div class="webupper_smile"><div><i class="wu-smile wu-44"></i></div></div><div class="webupper_smile"><div><i class="wu-smile wu-45"></i></div></div><div class="webupper_smile"><div><i class="wu-smile wu-46"></i></div></div><div class="webupper_smile"><div><i class="wu-smile wu-47"></i></div></div><div class="webupper_smile"><div><i class="wu-smile wu-48"></i></div></div><div class="webupper_smile"><div><i class="wu-smile wu-49"></i></div></div><div class="webupper_smile"><div><i class="wu-smile wu-50"></i></div></div><div class="webupper_smile"><div><i class="wu-smile wu-51"></i></div></div><div class="webupper_smile"><div><i class="wu-smile wu-52"></i></div></div><div class="webupper_smile"><div><i class="wu-smile wu-53"></i></div></div><div class="webupper_smile"><div><i class="wu-smile wu-54"></i></div></div><div class="webupper_smile"><div><i class="wu-smile wu-55"></i></div></div><div class="webupper_smile"><div><i class="wu-smile wu-56"></i></div></div><div class="webupper_smile"><div><i class="wu-smile wu-57"></i></div></div><div class="webupper_smile"><div><i class="wu-smile wu-58"></i></div></div><div class="webupper_smile"><div><i class="wu-smile wu-59"></i></div></div><div class="webupper_smile"><div><i class="wu-smile wu-60"></i></div></div><div class="webupper_smile"><div><i class="wu-smile wu-61"></i></div></div><div class="webupper_smile"><div><i class="wu-smile wu-62"></i></div></div><div class="webupper_smile"><div><i class="wu-smile wu-63"></i></div></div><div class="webupper_smile"><div><i class="wu-smile wu-64"></i></div></div><div class="webupper_smile"><div><i class="wu-smile wu-65"></i></div></div><div class="webupper_smile"><div><i class="wu-smile wu-66"></i></div></div><div class="webupper_smile"><div><i class="wu-smile wu-67"></i></div></div><div class="webupper_smile"><div><i class="wu-smile wu-68"></i></div></div><div class="webupper_smile"><div><i class="wu-smile wu-69"></i></div></div><div class="webupper_smile"><div><i class="wu-smile wu-70"></i></div></div><div class="webupper_smile"><div><i class="wu-smile wu-71"></i></div></div><div class="wu-smile-clear"></div></div>
</li>
</ul>
</div>
<button type="button" id="ticket_send" class="btn btn-success margl_5" data-loading-text="<i class='icon-spinner7 spin'></i> Создаём">Создать тикет</button>
<button class="btn btn-warning" data-dismiss="modal">Отмена</button>
</div>
</div>
</div>
</form>
</div>
<div class="alert alert-success fade in block-inner">
<i class="icon-phone2"></i> Поддержка онлайн
</div>
<div class="alert alert-info fade in block-inner">
<i class="icon-busy"></i> В данный момент поддержка офлайн
</div>
<?php
//Подключаем пагинацию и функции
include('../wu-engine/wu-functions/wu_pagination.php');
include('../wu-engine/wu-functions/wu_functions.php');
$num = 20; //Сколько выводить на странице
if (isset($_GET['type']) && $_GET['type'] == 'closed') { $where_add = "AND closed = '1'"; } else { $where_add = "AND closed = '0'"; }
if (isset($_GET['page'])) { $page = intval($_GET['page']); if ($page == 0) { $page = 1; } } else { $page = 1; }
$qu = mysqli_fetch_assoc(mysqli_query($connect_db, "SELECT count(`id`) AS `cnt` FROM ".DB_PREFIX."_tickets_main WHERE usr = '$u_id' $where_add"));
$co = $qu['cnt'];
$total = intval(($co - 1) / $num) + 1;
$page = intval($page);
if(empty($page) or $page < 0) $page = 1;
if($page > $total) $page = $total;
$start = $page * $num - $num;
$qt = mysqli_query($connect_db, "SELECT ".DB_PREFIX."_tickets_main.id,cat,pr,th,new_u,ti FROM `".DB_PREFIX."_tickets_main` INNER JOIN ".DB_PREFIX."_tickets_cat ON ".DB_PREFIX."_tickets_main.cat = ".DB_PREFIX."_tickets_cat.id WHERE usr = '$u_id' $where_add ORDER BY new_u DESC, dt DESC LIMIT $start, $num");
$ht = mysqli_num_rows($qt);
if ($ht > 0) {
?>
<div id="ticket_list">
<div class="panel panel-default">
<div class="panel-heading"><h6 class="panel-title"><i class="icon-bubbles4"></i> Мои обращения</h6></div>
<div class="table-responsive">
<table class="table table-hover">
<thead>
<tr align="center">
<th>#</th>
<th>Тема</th>
<th>Категория</th>
<th>Срочность</th>
<th>Статус</th>
<th>Действия</th>
</tr>
</thead>
<tbody>
<?php while($row = mysqli_fetch_assoc($qt)) { ?>
<tr class="mc_<?php echo $row['id']; if ($row['new_u'] == 1) { echo ' success'; } ?>">
<td><?php echo $row['id']; ?></td>
<td><a href="/account/support/<?php echo $row['id']; ?>"><?php echo htmlspecialchars($row['th']); ?></td>
<td><?php echo $row['ti']; ?></td>
<td><?php echo wu_urgency($row['pr']); ?></a></td>
<td>
<?php if (isset($_GET['type']) && $_GET['type'] == 'closed') { echo 'Закрыт'; } else {
if ($row['new_u'] == 0) { echo 'Открыт'; } else { echo '<span class="text-success">Отвечено</span>'; }
}
?>
</td>
<td>
<a href="javascript://" class="btn btn-icon btn-sm btn-default tip"<?php if (isset($_GET['type']) && $_GET['type'] == 'closed') { echo ' disabled="disabled"'; } ?> data-placement="bottom" data-original-title="Закрыть тикет" onclick="ticket_close('<?php echo $row['id']; ?>');"><i class="icon-lock"></i></a>
</td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
</div>
</div>
<div id="modal_ticket_close" class="modal fade" tabindex="-1" role="dialog">
<div class="modal-dialog modal-sm">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h4 class="modal-title"><i class="icon-lock"></i> Закрытие тикета #<font id="mtocl"></font></h4>
</div>
<div class="modal-body with-padding">
<div class="alert alert-danger"><center>Внимание! Тикет будет закрыт.</center></div>
</div>
<div class="modal-footer">
<button type="button" id="ticket_close" class="btn btn-danger" data-loading-text="<i class='icon-spinner7 spin'></i> Закрываем">Закрыть</button>
<button type="button" class="btn btn-warning" data-dismiss="modal">Отмена</button>
</div>
</div>
</div>
</div>
<script type="text/javascript">
//Предудаление сообщения
var ticket_to_close;
function ticket_close(id){
ticket_to_close = id;
$('#mtocl').text(id);
$('#modal_ticket_close').modal('show');
};
//Удаление сообщения
$('#ticket_close').click(function(){
var data = {'id': ticket_to_close};
wu_response('/wu-engine/wu-actions/acc_ticket_close.php', data, 'ticket_close', '1', function(wu_result) {
if (wu_result == '1') {
$('.mc_'+ticket_to_close).hide('slow', function(){ $('.mc_'+ticket_to_close).remove(); if ($('#ticket_list').height() < 100) { $('#ticket_list').html('<div class="alert alert-info fade in"><i class="icon-info"></i> Нет обращений</div>'); } });
$('#modal_ticket_close').modal('hide');
}
if (wu_result == '0') {
notif_e('Есть непрочитанные сообщения');
}
if (wu_result == '2') {
notif_e('Тикет уже закрыт');
}
if (wu_result == 'wu-error') {
wu_err();
}
});
});
</script>
<?php
$pageNav = new SimPageNav();
$pages = ceil($co/$num);
echo $pageNav->getLinks($pages, 1, $page, 10, 'page');
} else { if (isset($_GET['type']) && $_GET['type'] == 'closed') { $ticket_no = 'закрытых тикетов'; } else { $ticket_no = 'обращений'; } echo '<div class="alert alert-info fade in"><i class="icon-info"></i> Нет '.$ticket_no.'</div>'; } ?>
<link href="/wu-static/js/lightgallery/css/lightgallery.min.css" rel="stylesheet">
<script src="/wu-static/js/lightgallery/js/picturefill.min.js"></script>
<script src="/wu-static/js/lightgallery/js/lightgallery.min.js"></script>
<script src="/wu-static/js/lightgallery/js/lg-fullscreen.js"></script>
<script src="/wu-static/js/lightgallery/js/lg-thumbnail.js"></script>
<script src="/wu-static/js/lightgallery/js/lg-video.js"></script>
<script src="/wu-static/js/lightgallery/js/lg-autoplay.js"></script>
<script src="/wu-static/js/lightgallery/js/lg-zoom.js"></script>
<script src="/wu-static/js/lightgallery/js/lg-pager.js"></script>
<script src="/wu-static/js/lightgallery/js/jquery.mousewheel.min.js"></script>
<script src="/wu-static/js/bbeditor/jquery.wysibb.js"></script>
<script src="/wu-static/js/fileinput.js" type="text/javascript"></script>
<script src="/wu-static/js/fileinput_locale_ru.js" type="text/javascript"></script>
<script src="/wu-static/js/prettify.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$("#msg_text").wysibb();
<?php if (isset($_GET['new'])) { echo "$('#ticket_new').modal('show');"; } ?>
});
//Смайлы
$('.smile-main .wu-smile').click(function(){
var smile_c = $(this).attr('class');
var smile_c_e = smile_c.replace(/wu-smile wu-/gi, '');
$('#msg_text').execCommand('wu_smile',{seltext: smile_c_e});
});
/* $('.smile-main .wu-smile').click(function(){
var smile_c = $(this).attr('class');
var smile_c_e = smile_c.replace(/wu-smile wu-/gi, '');
var $txt = jQuery("#msg_text");
var caretPos = $txt[0].selectionStart;
var textAreaTxt = $txt.val();
$txt.val(textAreaTxt.substring(0, caretPos) + ' :smile_' + smile_c_e + ': ' + textAreaTxt.substring(caretPos) );
}); */
//Вывод прикрелений
function handleFileSelectMulti(evt) {
var files = evt.target.files;
document.getElementById('wu-files-output').innerHTML = "";
for (var i = 0, f; f = files[i]; i++) {
var reader = new FileReader();
reader.onload = (function(theFile) {
return function(e) {
var span = document.createElement('span');
if (theFile.type.match('image.*')) {
span.innerHTML = ['<div class="border-thumbnail-preview tip lightgallerys" data-placement="bottom" title="', theFile.name, '"><a href="', e.target.result, '"><img class="img-thumbnail-preview" src="', e.target.result, '" /></a></div>'].join('');
}
else
{
span.innerHTML = ['<span class="icon-thumbnail-preview tip" data-placement="bottom" title="', theFile.name, '"><i class="icon-file6 text-info"></i></span>'].join('');
}
document.getElementById('wu-files-output').insertBefore(span, null);
$('.lightgallerys').lightGallery();
$('.tip').tooltip();
};
})(f);
reader.readAsDataURL(f);
}
}
document.getElementById('wu-files').addEventListener('change', handleFileSelectMulti, false);
//Отправка нового тикета
$('#ticket_send').click(function(){
$("#msg_text").sync();
var data = new FormData($('#wu-form-send')[0]);
wu_response('/wu-engine/wu-actions/acc_ticket_new.php', data, 'ticket_send', '2', function(wu_result) {
if (wu_result == '0') {
notif_e('Не заполнены все необходимые поля');
}
if (wu_result == '1') {
$(location).attr('href','/account/support');
}
if (wu_result == '4') {
notif_e('Разрешённые форматы - gif, jpg, png, jpeg, doc, docx, rtf, rar, zip, 7z, pdf, ppt, pptx, txt, css');
}
if (wu_result == 'wu-error') {
wu_err();
}
});
});
</script>
<?php } else {
include('../wu-engine/wu-functions/wu_functions.php');
include('../wu-engine/wu-functions/bbdecoder/Parser.php');
//Онлайн
//$onl = mysqli_num_rows(mysqli_query($connect_db, "SELECT id FROM ".DB_PREFIX."_online WHERE usr='$usr' LIMIT 1"));
$ava_link_thumb_u = '/wu-static/img/avatar_default_adm.png'; $ava_link_full_u = '/wu-static/img/avatar_default_adm.png';
if (empty($nowuser['av'])) { $ava_link_thumb_my = '/wu-static/img/avatar_default.png'; $ava_link_full_my = '/wu-static/img/avatar_default.png'; } else { $ava_link_thumb_my = '/wu-uploads/avatars/thumbs/'.$nowuser['av']; $ava_link_full_my = '/wu-uploads/avatars/full/'.$nowuser['av']; }
//Запуск парсера
$parser = new JBBCode\Parser();
$parser->addCodeDefinitionSet(new JBBCode\DefaultCodeDefinitionSet());
?>
<div class="block">
<div class="chat-member-heading clearfix">
<h6 class="pull-left"><i class="icon-bubble6"></i> <?php echo htmlspecialchars($now_ticket['th']); ?> <small> / Поддержка <?php if ($onl == 0) { echo 'офлайн'; } else { echo 'онлайн'; } ?></small></h6>
</div>
<div class="chat" id="chat" style="padding: 10px 0;">
<?php
//Вывод сообщений
$qm = mysqli_query($connect_db, "SELECT * from (SELECT id,msg,files,frm,bb,sm,dt FROM `".DB_PREFIX."_tickets_msg` WHERE tid = '$ticket' ORDER BY id DESC) AS te ORDER BY te.id ASC");
$qh = mysqli_num_rows($qm);
if ($qh > 0) {
mysqli_query($connect_db, "UPDATE `".DB_PREFIX."_tickets_main` SET new_u = '0' WHERE id='$ticket' AND usr='$u_id' AND new_u = '1' LIMIT 1");
while($row = mysqli_fetch_assoc($qm)) {
//Вывод прикреплений
if (!empty($row['files'])) {
$images = array('gif','jpg', 'png', 'jpeg');
$files_e = '';
$files = explode('|', $row['files']);
foreach ($files as $file) {
$expl = explode(':', $file);
$ifile = $expl[0];
$iname = $expl[1];
$exp = explode('.', $ifile);
$exp_e = strtolower($exp[1]);
if (!empty($file)){
if (in_array($exp_e, $images)) {
$files_e .= '<div class="border-thumbnail-preview tip lightgallerys" data-placement="bottom" title="'.$iname.'"><a href="/wu-uploads/attach/full/'.$ifile.'"><img class="img-thumbnail-preview" src="/wu-uploads/attach/thumbs/'.$ifile.'" alt="'.$iname.'" /></a></div>';
} else {
if ($row['frm'] == 0) { $txti = ''; } else { $txti = ' text-info'; }
$files_e .= '<a href="/wu-engine/wu-actions/attach_download/'.strrev(base64_encode($ifile.'|'.$iname)).'" class="icon-thumbnail-preview tip" data-placement="bottom" title="'.$iname.'"><i class="icon-file6'.$txti.'"></i></a>';
}
}
}
} else { $files_e = ''; }
?>
<div class="mc_<?php echo $row['id']; ?> message<?php if ($row['frm'] == 1) { echo ' reversed'; } ?>" id="m_<?php echo $row['id']; ?>">
<div class="lightgallerys <?php if ($row['frm'] == 0) { echo 'flleft'; } else { echo 'flright'; } ?>">
<a href="<?php if ($row['frm'] == 0) { echo $ava_link_full_my; } else { echo $ava_link_full_u; } ?>"><img src="<?php if ($row['frm'] == 0) { echo $ava_link_thumb_my; } else { echo $ava_link_thumb_u; } ?>" class="media-object" /></a>
</div>
<div class="message-body<?php if ($row['frm'] == 0) { echo ' msg-link'; } ?>">
<?php
$parser->parse(htmlentities($row['msg']));
$parsered = $parser->getAsHtml();
echo wu_smile(nl2br($parsered));
if (!empty($row['files'])) {
if (!empty($row['msg'])) { echo '<br />'; }
echo '<div>Прикреплённые файлы:<br />'.$files_e.'</div>';
}
?>
<span class="attribution"><?php echo wudatenorm($row['dt']); ?></span>
</div>
</div>
<?php
}
} else { echo '<div class="alert alert-info fade in msgnone" id="m_0"><i class="icon-info"></i> Нет сообщений</div>'; }
?>
</div>
<form class="form-horizontal" role="form" method="post" id="wu-form-send">
<input type="hidden" name="to" value="<?php echo $ticket; ?>" />
<input type="hidden" name="token" value="<?php echo $token; ?>" />
<textarea name="msg_text" class="form-control" rows="3" cols="1" placeholder="Текст сообщения" id="msg_text"></textarea>
<div class="message-controls">
<center>
<div id="wu-files-output" class="margload"></div>
<input type="file" id="wu-files" name="wu-files[]" multiple="" class="dnone" />
<label for="wu-files" class="btn btn-default btn-icon"><i class="icon-attachment"></i></label>
<div class="btn-group">
<button data-toggle="dropdown" data-play="bounceIn" class="btn btn-default btn-icon dropdown-toggle"><i class="icon-smiley"></i></button>
<ul class="dropdown-menu" style="width: 280px;">
<li></li>
<li>
<div class="emogiblc smile-main"><div class="webupper_smile"><div><i class="wu-smile wu-1"></i></div></div><div class="webupper_smile"><div><i class="wu-smile wu-2"></i></div></div><div class="webupper_smile"><div><i class="wu-smile wu-3"></i></div></div><div class="webupper_smile"><div><i class="wu-smile wu-4"></i></div></div><div class="webupper_smile"><div><i class="wu-smile wu-5"></i></div></div><div class="webupper_smile"><div><i class="wu-smile wu-6"></i></div></div><div class="webupper_smile"><div><i class="wu-smile wu-7"></i></div></div><div class="webupper_smile"><div><i class="wu-smile wu-8"></i></div></div><div class="webupper_smile"><div><i class="wu-smile wu-9"></i></div></div><div class="webupper_smile"><div><i class="wu-smile wu-10"></i></div></div><div class="webupper_smile"><div><i class="wu-smile wu-11"></i></div></div><div class="webupper_smile"><div><i class="wu-smile wu-12"></i></div></div><div class="webupper_smile"><div><i class="wu-smile wu-13"></i></div></div><div class="webupper_smile"><div><i class="wu-smile wu-14"></i></div></div><div class="webupper_smile"><div><i class="wu-smile wu-15"></i></div></div><div class="webupper_smile"><div><i class="wu-smile wu-16"></i></div></div><div class="webupper_smile"><div><i class="wu-smile wu-17"></i></div></div><div class="webupper_smile"><div><i class="wu-smile wu-18"></i></div></div><div class="webupper_smile"><div><i class="wu-smile wu-19"></i></div></div><div class="webupper_smile"><div><i class="wu-smile wu-20"></i></div></div><div class="webupper_smile"><div><i class="wu-smile wu-21"></i></div></div><div class="webupper_smile"><div><i class="wu-smile wu-22"></i></div></div><div class="webupper_smile"><div><i class="wu-smile wu-23"></i></div></div><div class="webupper_smile"><div><i class="wu-smile wu-24"></i></div></div><div class="webupper_smile"><div><i class="wu-smile wu-25"></i></div></div><div class="webupper_smile"><div><i class="wu-smile wu-26"></i></div></div><div class="webupper_smile"><div><i class="wu-smile wu-27"></i></div></div><div class="webupper_smile"><div><i class="wu-smile wu-28"></i></div></div><div class="webupper_smile"><div><i class="wu-smile wu-29"></i></div></div><div class="webupper_smile"><div><i class="wu-smile wu-30"></i></div></div><div class="webupper_smile"><div><i class="wu-smile wu-31"></i></div></div><div class="webupper_smile"><div><i class="wu-smile wu-32"></i></div></div><div class="webupper_smile"><div><i class="wu-smile wu-33"></i></div></div><div class="webupper_smile"><div><i class="wu-smile wu-34"></i></div></div><div class="webupper_smile"><div><i class="wu-smile wu-35"></i></div></div><div class="webupper_smile"><div><i class="wu-smile wu-36"></i></div></div><div class="webupper_smile"><div><i class="wu-smile wu-37"></i></div></div><div class="webupper_smile"><div><i class="wu-smile wu-38"></i></div></div><div class="webupper_smile"><div><i class="wu-smile wu-39"></i></div></div><div class="webupper_smile"><div><i class="wu-smile wu-40"></i></div></div><div class="webupper_smile"><div><i class="wu-smile wu-41"></i></div></div><div class="webupper_smile"><div><i class="wu-smile wu-42"></i></div></div><div class="webupper_smile"><div><i class="wu-smile wu-43"></i></div></div><div class="webupper_smile"><div><i class="wu-smile wu-44"></i></div></div><div class="webupper_smile"><div><i class="wu-smile wu-45"></i></div></div><div class="webupper_smile"><div><i class="wu-smile wu-46"></i></div></div><div class="webupper_smile"><div><i class="wu-smile wu-47"></i></div></div><div class="webupper_smile"><div><i class="wu-smile wu-48"></i></div></div><div class="webupper_smile"><div><i class="wu-smile wu-49"></i></div></div><div class="webupper_smile"><div><i class="wu-smile wu-50"></i></div></div><div class="webupper_smile"><div><i class="wu-smile wu-51"></i></div></div><div class="webupper_smile"><div><i class="wu-smile wu-52"></i></div></div><div class="webupper_smile"><div><i class="wu-smile wu-53"></i></div></div><div class="webupper_smile"><div><i class="wu-smile wu-54"></i></div></div><div class="webupper_smile"><div><i class="wu-smile wu-55"></i></div></div><div class="webupper_smile"><div><i class="wu-smile wu-56"></i></div></div><div class="webupper_smile"><div><i class="wu-smile wu-57"></i></div></div><div class="webupper_smile"><div><i class="wu-smile wu-58"></i></div></div><div class="webupper_smile"><div><i class="wu-smile wu-59"></i></div></div><div class="webupper_smile"><div><i class="wu-smile wu-60"></i></div></div><div class="webupper_smile"><div><i class="wu-smile wu-61"></i></div></div><div class="webupper_smile"><div><i class="wu-smile wu-62"></i></div></div><div class="webupper_smile"><div><i class="wu-smile wu-63"></i></div></div><div class="webupper_smile"><div><i class="wu-smile wu-64"></i></div></div><div class="webupper_smile"><div><i class="wu-smile wu-65"></i></div></div><div class="webupper_smile"><div><i class="wu-smile wu-66"></i></div></div><div class="webupper_smile"><div><i class="wu-smile wu-67"></i></div></div><div class="webupper_smile"><div><i class="wu-smile wu-68"></i></div></div><div class="webupper_smile"><div><i class="wu-smile wu-69"></i></div></div><div class="webupper_smile"><div><i class="wu-smile wu-70"></i></div></div><div class="webupper_smile"><div><i class="wu-smile wu-71"></i></div></div><div class="wu-smile-clear"></div></div>
</li>
</ul>
</div>
<button type="button" id="msg_submit" class="btn btn-default" data-loading-text="<i class='icon-spinner7 spin'></i> Отправляем">Отправить сообщение</button>
<br />
<div class="checkbox">
<label>
<input type="checkbox" class="styled" id="audio_on">
Звуковые оповещения
</label>
</div>
<div class="checkbox">
<label>
<input type="checkbox" class="styled" id="enter_on">
Отправка клавишей Enter
</label>
</div>
</center>
</div>
</form>
</div>
<br />
<audio id="msg_sound" style="display:none" controls preload="auto">
<source src="/wu-static/audio/msg.mp3" controls></source>
<source src="/wu-static/audio/msg.ogg" controls></source>
</audio>
<link href="/wu-static/js/lightgallery/css/lightgallery.min.css" rel="stylesheet">
<script src="/wu-static/js/lightgallery/js/picturefill.min.js"></script>
<script src="/wu-static/js/lightgallery/js/lightgallery.min.js"></script>
<script src="/wu-static/js/lightgallery/js/lg-fullscreen.js"></script>
<script src="/wu-static/js/lightgallery/js/lg-thumbnail.js"></script>
<script src="/wu-static/js/lightgallery/js/lg-video.js"></script>
<script src="/wu-static/js/lightgallery/js/lg-autoplay.js"></script>
<script src="/wu-static/js/lightgallery/js/lg-zoom.js"></script>
<script src="/wu-static/js/lightgallery/js/lg-pager.js"></script>
<script src="/wu-static/js/lightgallery/js/jquery.mousewheel.min.js"></script>
<script src="/wu-static/js/bbeditor/jquery.wysibb.js"></script>
<script src="/wu-static/js/fileinput.js" type="text/javascript"></script>
<script src="/wu-static/js/fileinput_locale_ru.js" type="text/javascript"></script>
<script src="/wu-static/js/prettify.js"></script>
<script type="text/javascript">
//Скролл вниз
window.onload = function(){
window.scrollTo(0, 999999999999999);
var block = document.getElementById("chat");
block.scrollTop = block.scrollHeight;
}
$(document).ready(function() {
$("#msg_text").wysibb();
PR.prettyPrint();
$(".lightgallerys").lightGallery();
});
//Настройки чекбоксов
var msg_audio = 1;
var msg_enter = 1;
$(document).ready(function(){
if ($.cookie('audio_on')) {
if ($.cookie('audio_on') == 1) {
msg_audio = 1;
$("#audio_on").attr("checked","checked");
}
if ($.cookie('audio_on') == 0) {
msg_audio = 0;
}
} else {
msg_audio = 1;
$("#audio_on").attr("checked","checked");
}
if ($.cookie('enter_on')) {
if ($.cookie('enter_on') == 1) {
msg_enter = 1;
$("#enter_on").attr("checked","checked");
}
if ($.cookie('enter_on') == 0) {
msg_enter = 0;
}
} else {
msg_enter = 1;
$("#enter_on").attr("checked","checked");
}
});
$(function() {
var btnn = $('#audio_on');
btnn.click(function(){
var ison = btnn.prop('checked');
if (ison == true) {
msg_audio = 1;
$.cookie('audio_on', '1');
}
if (ison == false) {
msg_audio = 0;
$.cookie('audio_on', '0');
}
});
var btne = $('#enter_on');
btne.click(function(){
var isone = btne.prop('checked');
if (isone == true) {
msg_enter = 1;
$.cookie('enter_on', '1');
}
if (isone == false) {
msg_enter = 0;
$.cookie('enter_on', '0');
}
});
//Отправка сообщения
function msg_send(){
$("#msg_text").sync();
var data = new FormData($('#wu-form-send')[0]);
wu_response('/wu-engine/wu-actions/acc_ticket_send.php', data, 'msg_submit', '2', function(wu_result) {
if (wu_result == '0') {
notif_e('Вы не ввели сообщение');
}
if (wu_result == '1') {
$('#wu-files').val('');
$('#wu-files-output').text('');
$('#msg_text').val('');
$('.wysibb-text-editor').text('');
msg_load();
}
if (wu_result == '2') {
notif_e('Тикет не найден');
}
if (wu_result == '4') {
notif_e('Разрешённые форматы - gif, jpg, png, jpeg, doc, docx, rtf, rar, zip, 7z, pdf, ppt, pptx, txt, css');
}
if (wu_result == 'wu-error') {
wu_err();
}
});
}
//Отправка сообщения при нажатии на кнопку
var btns = $('#msg_submit');
btns.click(function() {
msg_send();
});
//Отправка сообщения при нажатии на Enter
$("#msg_text, .wysibb-text-editor").keydown(function(event) {
if (event.keyCode == 13 || event.charCode == 13) {
if (msg_enter == 1) {
msg_send();
return false;
}
}
});
});
//Проверка новых сообщений
function msg_last(){
var last = $('#chat').children().last().attr('id');
var data = {'id': '<?php echo $ticket; ?>', 'last': last};
wu_response('/wu-engine/wu-actions/acc_ticket_last.php', data, '', '1', function(wu_result) {
if (wu_result == '1') {
msg_load();
if (msg_audio == 1) {
var msg_sound = $("#msg_sound")[0];
msg_sound.pause();
msg_sound.play();
}
}
});
};
//Загрузка новых сообщений
function msg_load(){
var last = $('#chat').children().last().attr('id');
var data = {'id': '<?php echo $ticket; ?>', 'last': last};
wu_response('/wu-engine/wu-actions/acc_ticket_load.php', data, '', '1', function(wu_result) {
if (wu_result == 'wu-error') {
} else {
$('.msgnone').hide('');
var tobottom = 0;
var block = document.getElementById("chat");
if (block.scrollHeight - block.scrollTop === block.clientHeight) {
tobottom = 1;
}
$('#chat').append(wu_result);
PR.prettyPrint();
$('.tip').tooltip();
$(".lightgallerys").lightGallery();
if (tobottom === 1) { block.scrollTop = block.scrollHeight; }
$('#chat [id]').each(function() {
var idAttr = $(this).attr('id'),
selector = '[id=' + idAttr + ']';
if ($(selector).length > 1) {
$(selector).not(':first').remove();
}
});
}
});
};
setInterval(function() {
msg_last();
}, 5000);
//Смайлы
$('.smile-main .wu-smile').click(function(){
var smile_c = $(this).attr('class');
var smile_c_e = smile_c.replace(/wu-smile wu-/gi, '');
$('#msg_text').execCommand('wu_smile',{seltext: smile_c_e});
});
$('#modal_msg_edit .wu-smile').click(function(){
var smile_c = $(this).attr('class');
var smile_c_e = smile_c.replace(/wu-smile wu-/gi, '');
$('#msg_text_edit').execCommand('wu_smile',{seltext: smile_c_e});
});
/* $('.smile-main .wu-smile').click(function(){
var smile_c = $(this).attr('class');
var smile_c_e = smile_c.replace(/wu-smile wu-/gi, '');
var $txt = jQuery("#msg_text");
var caretPos = $txt[0].selectionStart;
var textAreaTxt = $txt.val();
$txt.val(textAreaTxt.substring(0, caretPos) + ' :smile_' + smile_c_e + ': ' + textAreaTxt.substring(caretPos) );
}); */
//Вывод прикрелений
function handleFileSelectMulti(evt) {
var files = evt.target.files;
document.getElementById('wu-files-output').innerHTML = "";
for (var i = 0, f; f = files[i]; i++) {
var reader = new FileReader();
reader.onload = (function(theFile) {
return function(e) {
var span = document.createElement('span');
if (theFile.type.match('image.*')) {
span.innerHTML = ['<div class="border-thumbnail-preview tip lightgallerys" data-placement="bottom" title="', theFile.name, '"><a href="', e.target.result, '"><img class="img-thumbnail-preview" src="', e.target.result, '" /></a></div>'].join('');
}
else
{
span.innerHTML = ['<span class="icon-thumbnail-preview tip" data-placement="bottom" title="', theFile.name, '"><i class="icon-file6 text-info"></i></span>'].join('');
}
document.getElementById('wu-files-output').insertBefore(span, null);
$('.lightgallerys').lightGallery();
$('.tip').tooltip();
};
})(f);
reader.readAsDataURL(f);
}
}
document.getElementById('wu-files').addEventListener('change', handleFileSelectMulti, false);
</script>
<?php } ?>
<?php include('../wu-engine/wu_footer.php'); ?>