Files
ave-cms-alt/admin/templates/modules/alias_history.tpl

261 lines
11 KiB
Smarty
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<div class="title">
<h5>{#MODULES_REDIRECT#} {$module_link_name}</h5>
</div>
<div class="breadCrumbHolder module">
<div class="breadCrumb module">
<ul>
<li>{#MODULES_MODULE_HIS#} <strong class="code">{$module_name}</strong></li>
<li>{#MODULES_SYSLINK_HIS#} <strong class="code">{$module_link}</strong></li>
<li>{#MODULES_MAIN_ALIASE_HIS#} <strong class="code">{$module_url}</strong></li>
</ul>
</div>
</div>
<div class="widget">
<div class="head">
<h5 class="iFrames">{#MODULES_REDIRECT_ACTIV_HIS#}</h5>
</div>
<form action="index.php?do=modules&action=alias_history_save&cp={$sess}" method="post" class="mainForm" id="HistoryForm-{$alias_id}">
<input type="hidden" name="alias_id" value="{$alias_id}">
<table cellpadding="0" cellspacing="0" width="100%" class="tableStatic">
<thead id="history_thead" {if !$history_list}style="display:none;"{/if}>
<tr>
<td width="20"><div align="center"><input type="checkbox" class="selall_history"></div></td>
<td style="padding-left: 10px;">{#MODULES_LIST_ALIAS_HIS#}</td>
<td width="80" align="center">{#MODULES_HTTP_CODE_HIS#}</td>
<td width="80" colspan="2" align="center">{#MODULES_ACTIONS_HIS#}</td>
</tr>
</thead>
<tbody id="history_items_container">
{foreach from=$history_list item=h}
<tr id="history-row-{$h.id}">
<td align="center">
<input type="checkbox" class="checkbox history_check" name="history_del[{$h.id}]" value="1">
</td>
<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 width="30" align="center">
<a href="/{$h.module_alias}" class="icon_sprite ico_globus topDir" target="_blank" title="{#MODULES_GO_LINK_HIS#}"></a>
</td>
<td width="30" align="center">
<a href="javascript:void(0);"
class="topDir icon_sprite ico_delete deleteHistory"
data-id="{$h.id}"
title="{#MODULES_DEL_LINK_HIS#}"></a>
</td>
</tr>
{foreachelse}
<tr id="no-history-row">
<td colspan="5" align="center">
<ul class="messages">
<li class="highlight yellow">{#MODULES_REDIRECT_NO_HIS#}</li>
</ul>
</td>
</tr>
{/foreach}
</tbody>
<thead>
<tr>
<td colspan="5">&nbsp;</td>
</tr>
</thead>
<tfoot>
<tr>
<td colspan="5" style="padding: 10px;">
<table cellpadding="0" cellspacing="0" width="auto">
<tr style=" border: none;">
<td style="padding-right: 10px; border: none;">
<input type="submit" id="btn_save_history" class="redBtn SaveHistoryBatch" value="{#MODULES_BTN_DEL_HIS#}" style="float: none; {if !$history_list}display:none;{/if}" />
</td>
<td style=" border: none;">
<a href="javascript:void(0);" class="button basicBtn CloseHistory" style="float: none; ">
{#MODULES_BTN_CLOSE_WIN_HIS#}
</a>
</td>
</tr>
</table>
</td>
</tr>
</tfoot>
</table>
</form>
</div>
<div class="widget first">
<div class="head">
<h5 class="iPlus">{#MODULES_ADD_NEW_REDIR_HIS#}</h5>
</div>
<table cellpadding="0" cellspacing="0" width="100%" class="tableStatic mainForm">
<tbody>
<tr style="background: #f9f9f9;">
<td style="padding: 15px;">
<input type="text" id="new_alias_input" placeholder="{#MODULES_PLC_NEW_REDIR_HIS#}" style="width: 96%;" />
</td>
<td width="100" align="center">
<select id="new_alias_code" style="width: 80px;">
<option value="301">301</option>
<option value="302">302</option>
</select>
</td>
<td width="50" align="center">
<a href="javascript:void(0);" class="button greenBtn addHistoryRecord" >{#MODULES_BTN_ADD_HIS#}</a>
</td>
</tr>
</tbody>
</table>
</div>
{literal}
<script type="text/javascript">
$(function(){
var a_id = '{/literal}{$alias_id}{literal}';
var sess = '{/literal}{$sess}{literal}';
var $dialog = $('#ajax-dialog-alias-history-' + a_id);
var $form = $('#HistoryForm-' + a_id);
// Инициализация стилей
$(".mainForm").jqTransform();
setTimeout(function() {
$('#new_alias_code').styler({
selectSmartPositioning: true,
selectVisibleOptions: 5,
selectSearch: false
});
}, 100);
function toggleHistoryVisibility() {
var rowsCount = $('#history_items_container tr').not('#no-history-row, :hidden').length;
var $thead = $('#history_thead');
var $btnSave = $('#btn_save_history');
var $tbody = $('#history_items_container');
if (rowsCount > 0) {
$thead.show();
$btnSave.show();
$('#no-history-row').remove();
} else {
$thead.hide();
$btnSave.hide();
if ($('#no-history-row').length == 0) {
$tbody.append('<tr id="no-history-row"><td colspan="5" align="center"><ul class="messages"><li class="highlight yellow">{/literal}{#MODULES_REDIRECT_NO_HIS#}{literal}</li></ul></td></tr>');
}
}
}
$dialog.find('.CloseHistory').off('click').on('click', function(e){
e.preventDefault();
$dialog.dialog('destroy').remove();
});
$form.on('change', '.selall_history', function(){
var checked = $(this).is(':checked');
var $checkboxes = $form.find('.history_check');
$checkboxes.each(function(){
$(this).prop('checked', checked);
var $anchor = $(this).parent().find('a.jqTransformCheckbox');
if(checked) {
$(this).addClass('jqTransformChecked');
$anchor.addClass('jqTransformChecked');
} else {
$(this).removeClass('jqTransformChecked');
$anchor.removeClass('jqTransformChecked');
}
});
});
$form.on('click', '.SaveHistoryBatch', function(e){
e.preventDefault();
var $checked = $form.find('.history_check:checked');
if($checked.length == 0) {
$.jGrowl("{/literal}{#MODULES_MES_NO_SELECT_HIS#}{literal}", {theme: 'error'});
return false;
}
jConfirm('{/literal}{#MODULES_MES_DEL_SELECT_HIS#}{literal}', '{/literal}{#MODULES_MES_DEL_CONFRM_HIS#}{literal}', function(r) {
if(r) {
$form.ajaxSubmit({
url: 'index.php?do=modules&action=alias_history_delete_batch&ajax=1&cp=' + sess,
dataType: 'json',
success: function(data){
if(data.status == 'success') {
$.jGrowl("{/literal}{#MODULES_MES_DEL_OK#}{literal}", {theme: 'accept'});
$checked.closest('tr').fadeOut(400, function(){
$(this).remove();
toggleHistoryVisibility();
});
}
}
});
}
});
});
$dialog.find('.addHistoryRecord').off('click').on('click', function(e){
e.preventDefault();
var $input = $dialog.find('#new_alias_input');
var new_val = $input.val().trim();
var h_code = $dialog.find('#new_alias_code').val();
if (new_val == '') {
$.jGrowl("{/literal}{#MODULES_MES_INS_ADR#}{literal}", {theme: 'error'});
return false;
}
$.post('index.php?do=modules&action=alias_history_add&ajax=1', {
alias_id: a_id,
new_alias: new_val,
code: h_code,
cp: sess
}, function(data) {
if (data && data.status == 'success') {
$.jGrowl("{/literal}{#MODULES_MES_ADD_HIS#}{literal}", {theme: 'accept'});
var $tbody = $('#history_items_container');
var newRow = '<tr id="history-row-' + data.id + '" style="display:none;">' +
'<td width="20" align="center"><input type="checkbox" class="checkbox history_check" name="history_del['+data.id+']" value="1"></td>' +
'<td style="padding-left: 10px;"><span class="dgrey">' + new_val + '</span></td>' +
'<td width="80" align="center"><span class="blue"><b>' + h_code + '</b></span></td>' +
'<td width="30" align="center"><a href="/' + new_val + '" class="icon_sprite ico_globus topDir" title="{/literal}{#MODULES_GO_LINK_HIS#}{literal}" target="_blank"></a></td>' +
'<td width="30" align="center"><a href="javascript:void(0);" class="topDir icon_sprite ico_delete deleteHistory" title="{/literal}{#MODULES_DEL_LINK_HIS#}{literal}" data-id="' + data.id + '"></a></td>' +
'</tr>';
var $rowObj = $(newRow);
$tbody.prepend($rowObj);
$rowObj.jqTransform();
$rowObj.fadeIn(400);
$input.val('');
toggleHistoryVisibility();
} else {
$.jGrowl(data.message || "{/literal}{#MODULES_MES_ERR_SAVE_HIS#}{literal}", {theme: 'error'});
}
}, 'json');
});
$dialog.find('tbody').off('click', '.deleteHistory').on('click', '.deleteHistory', function(){
var h_id = $(this).data('id');
var $row = $('#history-row-' + h_id);
jConfirm('{/literal}{#MODULES_MES_DEL_SEL_HIS#}{literal}', '{/literal}{#MODULES_MES_DEL_CONFRM_HIS#}{literal}', function(r) {
if(r) {
$.post('index.php?do=modules&action=alias_history_delete&ajax=1', { id: h_id, cp: sess }, function(data){
if(data && data.status == 'success') {
$row.fadeOut(400, function(){
$(this).remove();
toggleHistoryVisibility();
});
$.jGrowl("{/literal}{#MODULES_MES_DEL_ONE_OK#}{literal}", {theme: "accept"});
}
}, 'json');
}
});
});
});
</script>
{/literal}