в админку добавлен поиск и сортировка
This commit is contained in:
@@ -1278,7 +1278,24 @@ function commentAdminDelete($comment_id)
|
||||
}
|
||||
|
||||
$session_id = SESSION ?? '';
|
||||
header("Location: index.php?do=modules&action=modedit&mod=comment&moduleaction=1&cp=" . $session_id);
|
||||
// --- Сохраняем состояние фильтров ---
|
||||
$s_query = $_REQUEST['search_query'] ?? '';
|
||||
$s_order = $_REQUEST['sort_order'] ?? 'new';
|
||||
$f_type = $_REQUEST['filter_type'] ?? '';
|
||||
$v_mode = $_REQUEST['view_mode'] ?? 'flat';
|
||||
$p_page = $_REQUEST['per_page'] ?? '15';
|
||||
$d_from = $_REQUEST['date_from'] ?? '';
|
||||
$d_to = $_REQUEST['date_to'] ?? '';
|
||||
|
||||
header("Location: index.php?do=modules&action=modedit&mod=comment&moduleaction=1" .
|
||||
"&cp=" . $session_id .
|
||||
"&search_query=" . urlencode($s_query) .
|
||||
"&sort_order=" . $s_order .
|
||||
"&filter_type=" . $f_type .
|
||||
"&view_mode=" . $v_mode .
|
||||
"&per_page=" . $p_page .
|
||||
"&date_from=" . $d_from .
|
||||
"&date_to=" . $d_to);
|
||||
exit;
|
||||
}
|
||||
|
||||
@@ -1479,26 +1496,96 @@ function commentAdminListShow($tpl_dir)
|
||||
break;
|
||||
}
|
||||
|
||||
header("Location: index.php?do=modules&action=modedit&mod=comment&moduleaction=1&cp=" . $session_id);
|
||||
// 1. Сначала вытаскиваем текущие настройки из запроса
|
||||
$s_query = $_GET['search_query'] ?? '';
|
||||
$s_order = $_GET['sort_order'] ?? 'new';
|
||||
$f_type = $_GET['filter_type'] ?? '';
|
||||
$v_mode = $_GET['view_mode'] ?? 'flat';
|
||||
$p_page = $_GET['per_page'] ?? '15';
|
||||
$d_from = $_GET['date_from'] ?? '';
|
||||
$d_to = $_GET['date_to'] ?? '';
|
||||
|
||||
// 2. Формируем строку возврата (редирект), чтобы настройки НЕ СЛЕТЕЛИ
|
||||
header("Location: index.php?do=modules&action=modedit&mod=comment&moduleaction=1" .
|
||||
"&cp=" . $session_id .
|
||||
"&search_query=" . urlencode($s_query) .
|
||||
"&sort_order=" . $s_order .
|
||||
"&filter_type=" . $f_type .
|
||||
"&view_mode=" . $v_mode .
|
||||
"&per_page=" . $p_page .
|
||||
"&date_from=" . $d_from .
|
||||
"&date_to=" . $d_to);
|
||||
exit;
|
||||
}
|
||||
|
||||
// --- ЛОГИКА ВЫВОДА (С ПАГИНАЦИЕЙ) ---
|
||||
$num = $AVE_DB->Query("SELECT COUNT(*) FROM " . PREFIX . "_module_comment_info")->GetCell();
|
||||
$limit = $this->_limit;
|
||||
|
||||
|
||||
|
||||
|
||||
// --- ПАРАМЕТРЫ ФИЛЬТРАЦИИ ---
|
||||
$search = $_GET['search_query'] ?? '';
|
||||
$sort = $_GET['sort_order'] ?? 'new';
|
||||
$filter = $_GET['filter_type'] ?? '';
|
||||
$view_mode = $_GET['view_mode'] ?? 'flat';
|
||||
$per_page = isset($_GET['per_page']) ? (int)$_GET['per_page'] : 15;
|
||||
$date_from = $_GET['date_from'] ?? '';
|
||||
$date_to = $_GET['date_to'] ?? '';
|
||||
|
||||
$where = ["1=1"];
|
||||
|
||||
// Поиск
|
||||
if ($search) {
|
||||
$s = $AVE_DB->Escape($search);
|
||||
$where[] = "(cmnt.comment_author_name LIKE '%$s%' OR cmnt.comment_author_ip LIKE '%$s%' OR cmnt.comment_text LIKE '%$s%')";
|
||||
}
|
||||
|
||||
// Даты
|
||||
if ($date_from) $where[] = "cmnt.comment_published >= " . strtotime($date_from);
|
||||
if ($date_to) $where[] = "cmnt.comment_published <= " . (strtotime($date_to) + 86399);
|
||||
|
||||
// Спец. фильтры
|
||||
if ($filter == 'with_files') $where[] = "cmnt.comment_file != ''";
|
||||
if ($filter == 'hidden') $where[] = "cmnt.comment_status = '0'";
|
||||
|
||||
$where_sql = implode(" AND ", $where);
|
||||
|
||||
// Сортировка
|
||||
switch ($sort) {
|
||||
case 'old': $order_sql = "cmnt.comment_published ASC"; break;
|
||||
case 'popular': $order_sql = "cmnt.rating_sum DESC, cmnt.rating_count DESC"; break;
|
||||
case 'discussed': $order_sql = "(SELECT COUNT(*) FROM " . PREFIX . "_module_comment_info WHERE parent_id = cmnt.Id) DESC"; break;
|
||||
case 'user_rating': $order_sql = "cmnt.user_rating DESC"; break;
|
||||
default: $order_sql = "cmnt.comment_published DESC"; break;
|
||||
}
|
||||
|
||||
// --- ПАГИНАЦИЯ ---
|
||||
$num = $AVE_DB->Query("SELECT COUNT(*) FROM " . PREFIX . "_module_comment_info AS cmnt WHERE $where_sql")->GetCell();
|
||||
$limit = $per_page;
|
||||
$seiten = ceil($num / $limit);
|
||||
$start = get_current_page() * $limit - $limit;
|
||||
$page = get_current_page();
|
||||
$start = ($page * $limit) - $limit;
|
||||
|
||||
$sql = $AVE_DB->Query("
|
||||
SELECT cmnt.*, doc.document_title, doc.document_alias
|
||||
FROM " . PREFIX . "_module_comment_info AS cmnt
|
||||
LEFT JOIN " . PREFIX . "_documents AS doc ON doc.Id = cmnt.document_id
|
||||
ORDER BY cmnt.comment_published DESC
|
||||
WHERE $where_sql
|
||||
ORDER BY $order_sql
|
||||
LIMIT " . (int)$start . "," . (int)$limit
|
||||
);
|
||||
|
||||
$all_items = array();
|
||||
$format = "%d %B %Y, %H:%M";
|
||||
$format = "%d %B %Y, %H:%M";
|
||||
|
||||
|
||||
|
||||
|
||||
// --- ПЕРЕД ЦИКЛОМ: Получаем список всех скрытых ID в системе ---
|
||||
$locked_ids = [];
|
||||
$res_locked = $AVE_DB->Query("SELECT Id FROM " . PREFIX . "_module_comment_info WHERE comment_status = '0'");
|
||||
if ($res_locked) {
|
||||
while ($rl = $res_locked->FetchAssocArray()) { $locked_ids[] = (int)$rl['Id']; }
|
||||
}
|
||||
|
||||
while ($row = $sql->FetchAssocArray()) {
|
||||
$name = !empty($row['comment_author_name']) ? stripslashes($row['comment_author_name']) : 'Guest';
|
||||
@@ -1533,6 +1620,11 @@ function commentAdminListShow($tpl_dir)
|
||||
}
|
||||
|
||||
$row['CId'] = $row['Id'];
|
||||
|
||||
// ДОБАВЛЯЕМ ПРОВЕРКУ РОДИТЕЛЯ (для линейного вида):
|
||||
// Если parent_id этого комментария есть в списке скрытых ($locked_ids)
|
||||
$row['parent_locked'] = (in_array((int)$row['parent_id'], $locked_ids)) ? 1 : 0;
|
||||
|
||||
$row['comment_text'] = stripslashes($row['comment_text']);
|
||||
$ts_pub = (int)$row['comment_published'];
|
||||
$row['date_pub'] = ($ts_pub > 0) ? pretty_date(ave_date_format($format, $ts_pub)) : '—';
|
||||
@@ -1561,6 +1653,10 @@ function commentAdminListShow($tpl_dir)
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// --- ПОСТРОЕНИЕ ДЕРЕВА ---
|
||||
$child_map = [];
|
||||
foreach ($all_items as $id => $item) {
|
||||
@@ -1573,45 +1669,56 @@ function commentAdminListShow($tpl_dir)
|
||||
}
|
||||
unset($item_for_check);
|
||||
|
||||
$docs = [];
|
||||
$docs = [];
|
||||
$processed = [];
|
||||
|
||||
// Универсальная функция с наследованием блокировки parent_locked
|
||||
$buildTree = function($parent_id, $level, $is_parent_hidden) use (&$buildTree, &$docs, &$processed, &$all_items, &$child_map) {
|
||||
if (isset($child_map[$parent_id])) {
|
||||
foreach ($child_map[$parent_id] as $child_id) {
|
||||
if (!in_array($child_id, $processed)) {
|
||||
$item = $all_items[$child_id];
|
||||
$item['depth_level'] = $level;
|
||||
|
||||
// Блокируем ребенка, если скрыт его родитель или кто-то выше по дереву
|
||||
$item['parent_locked'] = ($is_parent_hidden || $all_items[$parent_id]['comment_status'] == '0') ? 1 : 0;
|
||||
|
||||
$docs[] = $item;
|
||||
$processed[] = $child_id;
|
||||
$buildTree($child_id, $level + 1, $item['parent_locked']);
|
||||
// Если выбран линейный вид — просто выводим список без иерархии
|
||||
if ($view_mode == 'flat') {
|
||||
foreach ($all_items as $item) {
|
||||
$item['depth_level'] = 0;
|
||||
// Теперь мы берем parent_locked, который вычислили выше
|
||||
$docs[] = $item;
|
||||
}
|
||||
}
|
||||
// Если вид древовидный — используем твою отлаженную логику
|
||||
else {
|
||||
// Универсальная функция с наследованием блокировки parent_locked
|
||||
$buildTree = function($parent_id, $level, $is_parent_hidden) use (&$buildTree, &$docs, &$processed, &$all_items, &$child_map) {
|
||||
if (isset($child_map[$parent_id])) {
|
||||
foreach ($child_map[$parent_id] as $child_id) {
|
||||
if (!in_array($child_id, $processed)) {
|
||||
$item = $all_items[$child_id];
|
||||
$item['depth_level'] = $level;
|
||||
|
||||
// Блокируем ребенка, если скрыт его родитель или кто-то выше по дереву
|
||||
$item['parent_locked'] = ($is_parent_hidden || $all_items[$parent_id]['comment_status'] == '0') ? 1 : 0;
|
||||
|
||||
$docs[] = $item;
|
||||
$processed[] = $child_id;
|
||||
$buildTree($child_id, $level + 1, $item['parent_locked']);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
// Собираем дерево, начиная с корней
|
||||
foreach ($all_items as $id => $item) {
|
||||
if ($item['parent_id'] == 0 && !in_array($id, $processed)) {
|
||||
$item['depth_level'] = 0;
|
||||
$item['parent_locked'] = 0;
|
||||
$docs[] = $item;
|
||||
$processed[] = $id;
|
||||
$buildTree($id, 1, false);
|
||||
// Собираем дерево, начиная с корней
|
||||
foreach ($all_items as $id => $item) {
|
||||
if ($item['parent_id'] == 0 && !in_array($id, $processed)) {
|
||||
$item['depth_level'] = 0;
|
||||
$item['parent_locked'] = 0;
|
||||
$docs[] = $item;
|
||||
$processed[] = $id;
|
||||
$buildTree($id, 1, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Добираем то, что не попало в иерархию (битые связи)
|
||||
foreach ($all_items as $id => $item) {
|
||||
if (!in_array($id, $processed)) {
|
||||
$item['depth_level'] = 0;
|
||||
$item['parent_locked'] = 0;
|
||||
$docs[] = $item;
|
||||
// Добираем то, что не попало в иерархию (битые связи)
|
||||
foreach ($all_items as $id => $item) {
|
||||
if (!in_array($id, $processed)) {
|
||||
$item['depth_level'] = 0;
|
||||
$item['parent_locked'] = 0;
|
||||
$docs[] = $item;
|
||||
}
|
||||
}
|
||||
}
|
||||
// --- КОНЕЦ ПОСТРОЕНИЯ ДЕРЕВА ---
|
||||
@@ -1625,15 +1732,25 @@ function commentAdminListShow($tpl_dir)
|
||||
$AVE_Template->assign('comment_rating_type', (int)$comment_rating_type);
|
||||
|
||||
|
||||
$AVE_Template->assign([
|
||||
'docs' => $docs,
|
||||
'page_nav' => ($num > $limit) ? get_pagination($seiten, 'page', ' <a class="pnav" href="index.php?do=modules&action=modedit&mod=comment&moduleaction=1&cp=' . $session_id . '&page={s}">{t}</a> ') : '',
|
||||
'sess' => $session_id
|
||||
]);
|
||||
// Собираем все текущие GET-параметры, кроме страницы
|
||||
$current_params = $_GET;
|
||||
unset($current_params['page']);
|
||||
$query_string = http_build_query($current_params);
|
||||
|
||||
$AVE_Template->assign([
|
||||
'docs' => $docs,
|
||||
'page_nav' => ($num > $limit) ? get_pagination($seiten, 'page', ' <a class="pnav" href="index.php?' . $query_string . '&page={s}">{t}</a> ') : '',
|
||||
'sess' => $session_id
|
||||
]);
|
||||
|
||||
$AVE_Template->assign('content', $AVE_Template->fetch($tpl_dir . $this->_admin_comments_tpl));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Метод, предназначенный для редактирования комментариев в Административной части.
|
||||
*
|
||||
|
||||
@@ -15,11 +15,18 @@
|
||||
.mod_comment_avatar_letter { width: 34px; height: 34px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: bold; color: #fff; text-transform: uppercase; font-size: 14px !important; }
|
||||
|
||||
/* Цвета для букв аватара */
|
||||
.av-c1 { background-color: #6c5ce7; } .av-c2 { background-color: #2ecc71; }
|
||||
.av-c3 { background-color: #e67e22; } .av-c4 { background-color: #e91e63; }
|
||||
.av-c5 { background-color: #00cec9; } .av-c6 { background-color: #0984e3; }
|
||||
.av-c7 { background-color: #d63031; } .av-c8 { background-color: #636e72; }
|
||||
.av-c9 { background-color: #fdcb6e; } .av-c10 { background-color: #fd79a8; }
|
||||
.av-c1 { background-color: #6c5ce7; }
|
||||
.av-c2 { background-color: #2ecc71; }
|
||||
.av-c3 { background-color: #e67e22; }
|
||||
.av-c4 { background-color: #e91e63; }
|
||||
.av-c5 { background-color: #00cec9; }
|
||||
.av-c6 { background-color: #0984e3; }
|
||||
.av-c7 { background-color: #d63031; }
|
||||
.av-c8 { background-color: #636e72; }
|
||||
.av-c9 { background-color: #fdcb6e; }
|
||||
.av-c10 { background-color: #fd79a8; }
|
||||
.av-c11 { background-color: #a29bfe; }
|
||||
.av-c12 { background-color: #273c75; }
|
||||
|
||||
/* ЗВЕЗДЫ РЕЙТИНГА АВТОРА (справа от имени) */
|
||||
.author-stars { color: #ff9800; font-size: 14px; letter-spacing: 0px; display: inline-block; margin-left: 8px; }
|
||||
@@ -135,7 +142,91 @@
|
||||
.comm-stars { color: #f1c40f; font-size: 13px; text-align: center; }
|
||||
.comm-likes { color: #e74c3c; font-size: 13px; font-weight: bold; display: flex; align-items: center; gap: 4px; justify-content: center; }
|
||||
.rating-count-box { font-size: 10px; color: #999; font-weight: normal; margin-top: -2px; }
|
||||
.bi-heart-fill { font-size: 12px; }
|
||||
.bi-heart-fill { font-size: 12px; }
|
||||
|
||||
/* Направляющие для дерева ответов */
|
||||
.tree-branch {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
align-self: stretch;
|
||||
position: relative;
|
||||
}
|
||||
.branch-line {
|
||||
border-left: 1px solid #c8d6e5;
|
||||
border-bottom: 1px solid #c8d6e5;
|
||||
width: 12px;
|
||||
height: 14px;
|
||||
margin-right: 8px;
|
||||
margin-top: -10px; /* Поднимаем к центру текста */
|
||||
flex-shrink: 0;
|
||||
border-bottom-left-radius: 4px;
|
||||
}
|
||||
.depth-1 { margin-left: 15px; }
|
||||
.depth-2 { margin-left: 30px; }
|
||||
.depth-3 { margin-left: 45px; }
|
||||
.depth-4 { margin-left: 60px; }
|
||||
.depth-5 { margin-left: 75px; }
|
||||
|
||||
/* в линейном виде отступ */
|
||||
.depth-0 { margin-left: 0; }
|
||||
.tree-branch { min-height: 20px; }
|
||||
|
||||
/* элементы выравниваем по центру*/
|
||||
.searchLine .grid-container {
|
||||
display: flex !important;
|
||||
flex-wrap: wrap;
|
||||
align-items: center !important;
|
||||
gap: 15px;
|
||||
}
|
||||
|
||||
/* Label и Инпут внутри групп стояли рядом */
|
||||
.searchLine .form-group {
|
||||
display: flex !important;
|
||||
align-items: center !important;
|
||||
gap: 8px;
|
||||
margin: 0 !important;
|
||||
}
|
||||
|
||||
/* Убираем вертикальные отступы у меток, чтобы они не тянули линию вверх */
|
||||
.searchLine .form-group label {
|
||||
margin-bottom: 0 !important;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
/* выравнивание для FormStyler и кнопок */
|
||||
.searchLine .jq-selectbox,
|
||||
.searchLine .jq-selectbox__select,
|
||||
.searchLine input[type="text"],
|
||||
.searchLine input[type="date"],
|
||||
.searchLine .blueBtn,
|
||||
.searchLine .redBtn {
|
||||
vertical-align: middle !important;
|
||||
margin: 0 !important;
|
||||
}
|
||||
|
||||
/* Кнопки: убираем лишний внешний отступ сверху у контейнера кнопок */
|
||||
.searchLine .buttons-container {
|
||||
margin-top: 0 !important;
|
||||
display: flex;
|
||||
gap: 10px;
|
||||
align-items: center;
|
||||
}
|
||||
.searchLine input[type="date"]::-webkit-calendar-picker-indicator {
|
||||
cursor: pointer !important;
|
||||
display: block; /* Иногда помогает "проявить" элемент для CSS */
|
||||
}
|
||||
/* Делаем дату максимально похожей на стилизованный Поиск */
|
||||
.searchLine input[type="date"] {
|
||||
border: 1px solid #c5cdd4 !important;
|
||||
background: #fff url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAAUCAYAAAB9S9CDAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAACpJREFUeNpi/P//PwMTAwMDIwMDEwMDEyMTAyMTEyMTExMTIxMTYyADAgwA7ncD8e89v98AAAAASUVORK5CYII=') repeat-x !important; /* Легкий градиент как у селектов */
|
||||
height: 16pt !important;
|
||||
font-size: 12px !important;
|
||||
border-radius: 3px !important;
|
||||
width: 130px;
|
||||
color: #444444 !important;
|
||||
font-family: 'Cuprum', sans-serif;
|
||||
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
@@ -146,7 +237,78 @@
|
||||
<h5 class="iFrames">{#COMMENT_MODULE_COMENTS#}</h5>
|
||||
<div class="num"><a class="basicNum" href="index.php?do=modules&action=modedit&mod=comment&moduleaction=settings&cp={$sess}">{#COMMENT_MODULE_SETTINGS#}</a></div>
|
||||
</div>
|
||||
{if !empty($docs)}
|
||||
<div class="searchLine" style="padding: 15px; background: #f9f9f9; border: 1px solid #dcdcdc; border-bottom: none; border-radius: 4px 4px 0 0;">
|
||||
<form method="GET" action="" id="filterForm" class="mainForm">
|
||||
<input type="hidden" name="do" value="modules">
|
||||
<input type="hidden" name="action" value="modedit">
|
||||
<input type="hidden" name="mod" value="comment">
|
||||
<input type="hidden" name="moduleaction" value="1">
|
||||
<input type="hidden" name="cp" value="{$sess}">
|
||||
|
||||
<div class="grid-container">
|
||||
<div class="form-group">
|
||||
<label style="font-weight:bold;">Поиск:</label>
|
||||
<input type="text" name="search_query" value="{$smarty.get.search_query|default:''|escape}" placeholder="Имя, IP или текст..." style="width:160px; padding:5px; border:1px solid #ccc; border-radius:3px;">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label style="font-weight:bold;">Сортировка:</label>
|
||||
<select name="sort_order" style="width:180px; padding:5px;">
|
||||
{assign var="get_sort" value=$smarty.get.sort_order|default:'new'}
|
||||
<option value="new" {if $get_sort == 'new'}selected{/if}>Сначала новые</option>
|
||||
<option value="old" {if $get_sort == 'old'}selected{/if}>Сначала старые</option>
|
||||
<option value="popular" {if $get_sort == 'popular'}selected{/if}>Популярные (Рейтинг)</option>
|
||||
<option value="discussed" {if $get_sort == 'discussed'}selected{/if}>Обсуждаемые (Ответы)</option>
|
||||
<option value="user_rating" {if $get_sort == 'user_rating'}selected{/if}>Оценка автора</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label style="font-weight:bold;">Фильтр:</label>
|
||||
<select name="filter_type" style="width:150px; padding:5px;">
|
||||
{assign var="get_filter" value=$smarty.get.filter_type|default:''}
|
||||
<option value="" {if $get_filter == ''}selected{/if}>Все сообщения</option>
|
||||
<option value="with_files" {if $get_filter == 'with_files'}selected{/if}>Только с файлами</option>
|
||||
<option value="hidden" {if $get_filter == 'hidden'}selected{/if}>Скрытые</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label style="font-weight:bold;">Вид / Лимит:</label>
|
||||
<div style="display:flex; gap:5px; align-items: center;">
|
||||
{assign var="get_view" value=$smarty.get.view_mode|default:'flat'}
|
||||
{assign var="get_limit" value=$smarty.get.per_page|default:'15'}
|
||||
<select name="view_mode" style="width:100px; padding:5px;">
|
||||
<option value="flat" {if $get_view == 'flat'}selected{/if}>Линейный</option>
|
||||
<option value="tree" {if $get_view != 'flat'}selected{/if}>Древовидный</option>
|
||||
</select>
|
||||
<select name="per_page" style="width:60px; padding:5px;">
|
||||
<option value="5" {if $get_limit == '5'}selected{/if}>5</option>
|
||||
<option value="15" {if $get_limit == '15'}selected{/if}>15</option>
|
||||
<option value="50" {if $get_limit == '50'}selected{/if}>50</option>
|
||||
<option value="100" {if $get_limit == '100'}selected{/if}>100</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label style="font-weight:bold;">Период:</label>
|
||||
<div style="display:flex; align-items:center; gap:5px;">
|
||||
<input type="date" name="date_from" value="{$smarty.get.date_from|default:''}" style="padding:4px; width: 135px;">
|
||||
<span>—</span>
|
||||
<input type="date" name="date_to" value="{$smarty.get.date_to|default:''}" style="padding:4px; width: 135px;">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="buttons-container">
|
||||
<input type="submit" value="Найти" class="blueBtn" style="height: 28px; line-height: 1;">
|
||||
<input type="button" value="Сброс" class="redBtn" style="height: 28px; line-height: 1;" onclick="window.location.href='index.php?do=modules&action=modedit&mod=comment&moduleaction=1&cp={$sess}'">
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
{/if}
|
||||
<table cellpadding="0" cellspacing="0" width="100%" class="tableStatic">
|
||||
<thead>
|
||||
<tr>
|
||||
@@ -215,29 +377,39 @@
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<div style="display: flex; flex-direction: column; gap: 4px;">
|
||||
<div style="display: flex; flex-direction: column; gap: 4px; {if $row.depth_level > 0}padding-left: 5px;{/if}">
|
||||
{if $row.depth_level == 0}
|
||||
<div style="margin-bottom: 2px;">
|
||||
<a href="{$row.document_link}" target="_blank" style="color:#2980b9; font-weight:bold; text-decoration:none; border-bottom: 1px solid #d1d1d1; font-size: 12px;">
|
||||
{* Ссылка на документ оставляем без отступа или с минимальным, чтобы не «ломать» таблицу *}
|
||||
<a href="{$row.document_link}" target="_blank" style="color:#2980b9; font-weight:bold; text-decoration:none; border-bottom: 1px solid #d1d1d1; font-size: 11px; opacity: 0.7;">
|
||||
{$row.document_title|default:"Документ #`$row.document_id`"}
|
||||
</a>
|
||||
</div>
|
||||
<div style="display: flex; align-items: center; gap: 8px;">
|
||||
{if $row.parent_id > 0}
|
||||
<span style="background:#e1f5fe; color:#0288d1; padding:1px 5px; border-radius:3px; font-weight:bold; font-size: 10px !important;">{#COMMENT_ANSWER_ADM#} #{$row.parent_id} »</span>
|
||||
{/if}
|
||||
<div class="tree-branch depth-{$row.depth_level}">
|
||||
{if $row.depth_level > 0}
|
||||
<div class="branch-line"></div>
|
||||
{/if}
|
||||
<div class="comment-text-cell">
|
||||
{if $row.comment_text == '__DEL_BY_ADM__'}
|
||||
<div class="comment-deleted-info del-adm">
|
||||
<span style="font-size:14px;">🚫</span> {#COMMENT_DEL_ADM_ADM#}
|
||||
</div>
|
||||
{elseif $row.comment_text == '__DEL_BY_AUT__'}
|
||||
<div class="comment-deleted-info del-aut">
|
||||
<span style="font-size:14px;">🗑️</span> {#COMMENT_DEL_AVT_ADM#}
|
||||
</div>
|
||||
{else}
|
||||
{$row.comment_text|strip_tags|truncate:130}
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
<div style="display: flex; align-items: center; gap: 8px;">
|
||||
{if $row.parent_id > 0}
|
||||
<span style="background:#e1f5fe; color:#0288d1; padding:1px 4px; border-radius:3px; font-weight:bold; font-size: 10px !important; white-space: nowrap;">#{$row.parent_id} »</span>
|
||||
{/if}
|
||||
|
||||
<div class="comment-text-cell">
|
||||
{if $row.comment_text == '__DEL_BY_ADM__'}
|
||||
<div class="comment-deleted-info del-adm">
|
||||
<span style="font-size:14px;">🚫</span> {#COMMENT_DEL_ADM_ADM#}
|
||||
</div>
|
||||
{elseif $row.comment_text == '__DEL_BY_AUT__'}
|
||||
<div class="comment-deleted-info del-aut">
|
||||
<span style="font-size:14px;">🗑️</span> {#COMMENT_DEL_AVT_ADM#}
|
||||
</div>
|
||||
{else}
|
||||
<span style="{if $row.depth_level > 0}color: #555;{/if}">{$row.comment_text|strip_tags|truncate:130}</span>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
@@ -315,35 +487,40 @@
|
||||
{else}
|
||||
{* Обычные кнопки, если родитель активен *}
|
||||
{if $row.comment_status == '1'}
|
||||
<a class="icon_sprite ico_unlock_no" title="{#COMMENT_ICON_HIDE_ADM#}" href="index.php?do=modules&action=modedit&mod=comment&moduleaction=1&admin_action=set_status_0&id={$row.CId}&cp={$sess}"></a>
|
||||
{* ИЗМЕНЕНО: Добавлены параметры в href *}
|
||||
<a class="icon_sprite ico_unlock_no" title="{#COMMENT_ICON_HIDE_ADM#}" href="index.php?do=modules&action=modedit&mod=comment&moduleaction=1&admin_action=set_status_0&id={$row.CId}&cp={$sess}&sort_order={$smarty.get.sort_order|default:'new'}&view_mode={$smarty.get.view_mode|default:'flat'}&filter_type={$smarty.get.filter_type|default:''}&per_page={$smarty.get.per_page|default:'15'}"></a>
|
||||
{else}
|
||||
<a class="icon_sprite ico_unlock" title="{#COMMENT_ICON_SHOW_ADM#}" href="index.php?do=modules&action=modedit&mod=comment&moduleaction=1&admin_action=set_status_1&id={$row.CId}&cp={$sess}"></a>
|
||||
{* ИЗМЕНЕНО: Добавлены параметры в href *}
|
||||
<a class="icon_sprite ico_unlock" title="{#COMMENT_ICON_SHOW_ADM#}" href="index.php?do=modules&action=modedit&mod=comment&moduleaction=1&admin_action=set_status_1&id={$row.CId}&cp={$sess}&sort_order={$smarty.get.sort_order|default:'new'}&view_mode={$smarty.get.view_mode|default:'flat'}&filter_type={$smarty.get.filter_type|default:''}&per_page={$smarty.get.per_page|default:'15'}"></a>
|
||||
{/if}
|
||||
{/if}
|
||||
|
||||
{* --- ОСТАЛЬНЫЕ КНОПКИ ОСТАЮТСЯ ВНУТРИ ПРОВЕРКИ --- *}
|
||||
{if !$is_deleted}
|
||||
{* ИЗМЕНЕНО: Добавлены параметры в href *}
|
||||
<a data-dialog="edit-comment-{$row.CId}"
|
||||
href="index.php?do=modules&action=modedit&mod=comment&moduleaction=admin_edit&Id={$row.CId}&cp={$sess}&pop=1&onlycontent=1"
|
||||
href="index.php?do=modules&action=modedit&mod=comment&moduleaction=admin_edit&Id={$row.CId}&cp={$sess}&pop=1&onlycontent=1&sort_order={$smarty.get.sort_order|default:'new'}&view_mode={$smarty.get.view_mode|default:'flat'}&filter_type={$smarty.get.filter_type|default:''}&per_page={$smarty.get.per_page|default:'15'}"
|
||||
data-width="1180" data-height="700" data-modal="true" data-title="{#COMMENT_ICON_EDIT_ADM#}"
|
||||
class="openDialog icon_sprite ico_edit" title="{#COMMENT_ICON_EDIT_ADM#}"></a>
|
||||
|
||||
{if $row.has_children}
|
||||
{* ИЗМЕНЕНО: Добавлены параметры в href *}
|
||||
<a class="icon_sprite ico_delete ConfirmDelete" title="{#COMMENT_ICON_DEL_SOFT#}" dir="{#COMMENT_CONFIRM_ADM_DIR_SOFT#}" name="{#COMMENT_CONFIRM_ADM_NAME_SOFT#}"
|
||||
href="index.php?do=modules&action=modedit&mod=comment&moduleaction=admin_del&admin_action_type=soft&Id={$row.CId}&cp={$sess}"></a>
|
||||
href="index.php?do=modules&action=modedit&mod=comment&moduleaction=admin_del&admin_action_type=soft&Id={$row.CId}&cp={$sess}&sort_order={$smarty.get.sort_order|default:'new'}&view_mode={$smarty.get.view_mode|default:'flat'}&filter_type={$smarty.get.filter_type|default:''}&per_page={$smarty.get.per_page|default:'15'}"></a>
|
||||
{/if}
|
||||
{/if}
|
||||
|
||||
{* Полное удаление всегда снаружи *}
|
||||
{* ИЗМЕНЕНО: Добавлены параметры в href *}
|
||||
<a class="icon_sprite ico_delete ico_delete_all ConfirmDelete" title="{#COMMENT_ICON_DEL_HARD#}" dir="{#COMMENT_CONFIRM_ADM_DIR#}" name="{#COMMENT_CONFIRM_ADM_NAME#}"
|
||||
href="index.php?do=modules&action=modedit&mod=comment&moduleaction=admin_del&admin_action_type=full&Id={$row.CId}&cp={$sess}"></a>
|
||||
href="index.php?do=modules&action=modedit&mod=comment&moduleaction=admin_del&admin_action_type=full&Id={$row.CId}&cp={$sess}&sort_order={$smarty.get.sort_order|default:'new'}&view_mode={$smarty.get.view_mode|default:'flat'}&filter_type={$smarty.get.filter_type|default:''}&per_page={$smarty.get.per_page|default:'15'}"></a>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
{else}
|
||||
<tr>
|
||||
<td colspan="9">
|
||||
<td colspan="10">
|
||||
<ul class="messages">
|
||||
<li class="highlight yellow"><strong>{#COMMENT_NOT_COOMENTS_MES#}</strong><br />{#COMMENT_NOT_COOMENTS_MES_A#}</li>
|
||||
</ul>
|
||||
@@ -352,7 +529,7 @@
|
||||
{/if}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
{if !empty($docs)}
|
||||
<div class="tfoot">
|
||||
<div class="left" style="padding:15px;">
|
||||
<select id="mass_action_select">
|
||||
@@ -364,6 +541,7 @@
|
||||
<input type="button" value="{#COMMENT_BUTTON_APPLY#}" class="blueBtn" onclick="runMassAction()" style="margin-left:10px;" />
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
{if $page_nav}
|
||||
@@ -371,6 +549,21 @@
|
||||
{/if}
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
function refreshStyles() {
|
||||
// Стилизуем селект массовых действий
|
||||
$('#mass_action_select').styler('destroy').styler();
|
||||
|
||||
// Если решили стилизовать и дату (многие версии FormStyler это умеют вручную)
|
||||
$('.searchLine input[type="date"]').styler('destroy').styler();
|
||||
|
||||
}
|
||||
|
||||
// Запускаем при загрузке
|
||||
$(document).ready(function() {
|
||||
refreshStyles();
|
||||
});
|
||||
|
||||
function checkAll(master) {
|
||||
var checkboxes = document.getElementsByClassName('row-checkbox');
|
||||
for (var i = 0; i < checkboxes.length; i++) { checkboxes[i].checked = master.checked; }
|
||||
@@ -380,7 +573,6 @@ function runMassAction() {
|
||||
var select = document.getElementById('mass_action_select');
|
||||
var action = select.value;
|
||||
|
||||
// уведомление, если не выбрали действие
|
||||
if (!action) {
|
||||
jAlert('{#COMMENT_ACT_DEL_SEL#}', '{#COMMENT_ACT_DEL_WAR#}');
|
||||
return;
|
||||
@@ -392,23 +584,29 @@ function runMassAction() {
|
||||
if (checkboxes[i].checked) ids.push(checkboxes[i].value);
|
||||
}
|
||||
|
||||
// уведомление, если не выбрали чекбоксы
|
||||
if (ids.length === 0) {
|
||||
jAlert('{#COMMENT_ACT_DEL_SEL_A#}', '{#COMMENT_ACT_DEL_WAR_A#}');
|
||||
return;
|
||||
}
|
||||
|
||||
var cp = '{$sess}';
|
||||
|
||||
// Собираем все настройки фильтра
|
||||
var filterParams = '&sort_order={$smarty.get.sort_order|default:"new"}' +
|
||||
'&view_mode={$smarty.get.view_mode|default:"flat"}' +
|
||||
'&filter_type={$smarty.get.filter_type|default:""}' +
|
||||
'&per_page={$smarty.get.per_page|default:"15"}' +
|
||||
'&search_query=' + encodeURIComponent('{$smarty.get.search_query|default:""}');
|
||||
|
||||
var url = '';
|
||||
|
||||
if (action === 'delete') {
|
||||
var idParams = ids.map(function(id) { return 'id[]=' + id; }).join('&');
|
||||
url = 'index.php?do=modules&action=modedit&mod=comment&moduleaction=admin_del&' + idParams + '&cp=' + cp;
|
||||
url = 'index.php?do=modules&action=modedit&mod=comment&moduleaction=admin_del&' + idParams + '&cp=' + cp + filterParams;
|
||||
} else {
|
||||
url = 'index.php?do=modules&action=modedit&mod=comment&moduleaction=1&admin_action=' + action + '&ids=' + ids.join(',') + '&cp=' + cp;
|
||||
url = 'index.php?do=modules&action=modedit&mod=comment&moduleaction=1&admin_action=' + action + '&ids=' + ids.join(',') + '&cp=' + cp + filterParams;
|
||||
}
|
||||
|
||||
// подтверждение
|
||||
jConfirm('{#COMMENT_ACT_DEL_SEL_B#} ' + ids.length + ' {#COMMENT_ACT_DEL_WAR_B#}', '{#COMMENT_ACT_DEL_WAR_C#}', function(r) {
|
||||
if(r) window.location.href = url;
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user