update v3.32 (add module aliases)
This commit is contained in:
@@ -99,6 +99,18 @@
|
||||
}
|
||||
break;
|
||||
|
||||
case 'alias_history':
|
||||
if (check_permission_acp('modules_system')) {
|
||||
$AVE_Module->getAliasHistory((int)$_GET['id']);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'alias_history_delete':
|
||||
if (check_permission_acp('modules_system') && $_REQUEST['ajax']) {
|
||||
$AVE_Module->deleteAliasHistory((int)$_POST['id']);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'aliases_all':
|
||||
if (check_permission_acp('modules_system')) {
|
||||
$modules_list = array();
|
||||
|
||||
72
admin/templates/modules/alias_history.tpl
Normal file
72
admin/templates/modules/alias_history.tpl
Normal file
@@ -0,0 +1,72 @@
|
||||
<div class="widget first">
|
||||
<table cellpadding="0" cellspacing="0" width="100%" class="tableStatic mainForm">
|
||||
<thead>
|
||||
<tr>
|
||||
<td style="padding-left: 10px;">Старый URL (Алиас)</td>
|
||||
<td width="80" align="center">HTTP Код</td>
|
||||
<td width="40" align="center">Удал.</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{foreach from=$history_list item=h}
|
||||
<tr id="history-row-{$h.id}">
|
||||
<td style="padding-left: 10px;"><span class="dgrey">{$h.module_alias}</span></td>
|
||||
<td align="center"><span class="blue"><b>{$h.module_alias_header}</b></span></td>
|
||||
<td align="center">
|
||||
<a href="javascript:void(0);"
|
||||
class="icon_sprite ico_delete deleteHistory"
|
||||
data-id="{$h.id}"
|
||||
title="Удалить из истории"></a>
|
||||
</td>
|
||||
</tr>
|
||||
{foreachelse}
|
||||
<tr>
|
||||
<td colspan="3" align="center" style="padding: 30px;">
|
||||
<span class="lred">История редиректов пуста</span>
|
||||
</td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td colspan="3" style="padding: 15px 10px;">
|
||||
<a href="javascript:void(0);" class="button redBtn CloseHistory">Закрыть окно</a>
|
||||
</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
{literal}
|
||||
<script type="text/javascript">
|
||||
$(function(){
|
||||
var a_id = '{/literal}{$alias_id}{literal}';
|
||||
|
||||
$(document).off('click', '.CloseHistory').on('click', '.CloseHistory', function(e){
|
||||
e.preventDefault();
|
||||
$('#ajax-dialog-alias-history-' + a_id).dialog('destroy').remove();
|
||||
});
|
||||
|
||||
$('.deleteHistory').off('click').on('click', function(){
|
||||
var h_id = $(this).data('id');
|
||||
var $row = $('#history-row-' + h_id);
|
||||
|
||||
jConfirm('Удалить этот редирект из истории?', 'Подтверждение', function(r) {
|
||||
if(r) {
|
||||
$.post('index.php?do=modules&action=alias_history_delete&ajax=1', {
|
||||
id: h_id,
|
||||
cp: '{/literal}{$sess}{literal}'
|
||||
}, function(data){
|
||||
if(data && data.status == 'success') {
|
||||
$row.css("background-color", "#fee").fadeOut(400, function(){ $(this).remove(); });
|
||||
$.jGrowl("Запись удалена", {theme: "accept"});
|
||||
} else {
|
||||
$.jGrowl("Ошибка при удалении", {theme: "error"});
|
||||
}
|
||||
}, 'json');
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
{/literal}
|
||||
@@ -21,6 +21,7 @@
|
||||
<td>ЧПУ Алиас</td>
|
||||
<td>Документ (ID)</td>
|
||||
<td width="40" align="center">Меню</td>
|
||||
<td width="40" align="center">История</td>
|
||||
<td width="40" align="center">Правка</td>
|
||||
<td width="40" align="center">Удалить</td>
|
||||
</tr>
|
||||
@@ -45,12 +46,23 @@
|
||||
|
||||
<td align="center">
|
||||
{if $mod.module_admin == '1'}
|
||||
<span class="icon_sprite ico_ok" title="В меню"></span>
|
||||
<span class="icon_sprite ico_navigation" title="В меню"></span>
|
||||
{else}
|
||||
<span class="icon_sprite ico_ok_green" title="Скрыт"></span>
|
||||
<span class="icon_sprite ico_navigation_no" title="Скрыт"></span>
|
||||
{/if}
|
||||
</td>
|
||||
|
||||
<td align="center">
|
||||
<a href="index.php?do=modules&action=alias_history&id={$mod.id}&cp={$sess}&ajax=1&onlycontent=1"
|
||||
data-dialog="alias-history-{$mod.id}"
|
||||
data-height="400"
|
||||
data-width="600"
|
||||
data-modal="true"
|
||||
data-title="История алиасов: {$mod.module_link_name|default:$mod.sys_name}"
|
||||
class="openDialog icon_sprite ico_list topleftDir"
|
||||
title="История"></a>
|
||||
</td>
|
||||
|
||||
<td align="center">
|
||||
<a href="index.php?do=modules&action=aliases&id={$mod.id}&cp={$sess}&ajax=1&onlycontent=1"
|
||||
data-dialog="aliases-{$mod.id}"
|
||||
|
||||
@@ -779,5 +779,52 @@ public function moduleAliasDeleteById($id)
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Получение истории ЧПУ для модального окна
|
||||
*/
|
||||
public function getAliasHistory($id)
|
||||
{
|
||||
global $AVE_DB, $AVE_Template;
|
||||
$id = (int)$id;
|
||||
|
||||
// Получаем инфу по модулю
|
||||
$alias_info = $AVE_DB->Query("SELECT module_link_name, module_name FROM " . PREFIX . "_modules_aliases WHERE id = '{$id}' LIMIT 1")->FetchAssocArray();
|
||||
|
||||
// Берем историю
|
||||
$sql = "SELECT id, module_alias, module_alias_header
|
||||
FROM " . PREFIX . "_modules_aliases_history
|
||||
WHERE module_name = '" . addslashes($alias_info['module_name']) . "'
|
||||
ORDER BY id DESC";
|
||||
|
||||
$history = [];
|
||||
$query = $AVE_DB->Query($sql);
|
||||
if ($query) {
|
||||
while ($row = $query->FetchAssocArray()) {
|
||||
$history[] = $row;
|
||||
}
|
||||
}
|
||||
|
||||
$AVE_Template->assign('history_list', $history);
|
||||
$AVE_Template->assign('alias_id', $id);
|
||||
$AVE_Template->assign('alias_title', $alias_info['module_link_name'] ?? $alias_info['module_name']);
|
||||
|
||||
$AVE_Template->assign('content', $AVE_Template->fetch('modules/alias_history.tpl'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Удаление записи из истории
|
||||
*/
|
||||
public function deleteAliasHistory($h_id)
|
||||
{
|
||||
global $AVE_DB;
|
||||
$h_id = (int)$h_id;
|
||||
|
||||
$res = $AVE_DB->Query("DELETE FROM " . PREFIX . "_modules_aliases_history WHERE id = '{$h_id}'");
|
||||
|
||||
header('Content-Type: application/json');
|
||||
echo json_encode(['status' => ($res ? 'success' : 'error')]);
|
||||
exit;
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user