116 lines
5.1 KiB
Smarty
116 lines
5.1 KiB
Smarty
<div class="widget first">
|
|
<form action="index.php?do=modules&action=aliases&id={$alias_id}&cp={$sess}&ajax=1&onlycontent=1" method="post" id="AliasForm">
|
|
<input type="hidden" name="save_aliases" value="1" />
|
|
|
|
<table cellpadding="0" cellspacing="0" width="100%" class="tableStatic mainForm">
|
|
<tr>
|
|
<td width="150">Системное имя модуля:</td>
|
|
<td><input type="text" name="module_name" value="{$alias_data.module_name|default:''}" style="width: 95%;" placeholder="Например: search" /></td>
|
|
</tr>
|
|
<tr>
|
|
<td width="150">Название ссылки:</td>
|
|
<td><input type="text" name="module_link_name" value="{$alias_data.module_link_name|default:''}" style="width: 95%;" /></td>
|
|
</tr>
|
|
<tr>
|
|
<td>Системный Action:</td>
|
|
<td><input type="text" name="module_action" value="{$alias_data.module_action|default:''}" style="width: 95%;" /></td>
|
|
</tr>
|
|
<tr>
|
|
<td>Оригинальный URL:</td>
|
|
<td><input type="text" name="module_link" value="{$alias_data.module_link|default:''}" style="width: 95%;" /></td>
|
|
</tr>
|
|
<tr>
|
|
<td><strong>ЧПУ Алиас:</strong></td>
|
|
<td><input type="text" name="module_url" value="{$alias_data.module_url|default:''}" style="width: 95%; font-weight: bold;" /></td>
|
|
</tr>
|
|
<tr>
|
|
<td>Привязка к документу:</td>
|
|
<td>
|
|
<select name="document_id" style="width: 98%;">
|
|
<option value="0">-- Без привязки --</option>
|
|
{foreach from=$all_docs key=d_id item=d_title}
|
|
<option value="{$d_id}" {if $d_id == ($alias_data.document_id|default:0)}selected="selected"{/if}>{$d_title}</option>
|
|
{/foreach}
|
|
</select>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td>Доступ в админке:</td>
|
|
<td>
|
|
<input type="checkbox" name="module_admin" value="1" {if ($alias_data.module_admin|default:'1') == '1'}checked="checked"{/if} />
|
|
<label>Отображать в меню модулей</label>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td colspan="2" style="padding: 15px 10px;">
|
|
<input type="submit" class="basicBtn SaveAlias" value="Сохранить изменения" />
|
|
|
|
<a href="javascript:void(0);" class="button redBtn CloseModal">Закрыть окно</a>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</form>
|
|
</div>
|
|
|
|
{literal}
|
|
<script type="text/javascript">
|
|
$(function(){
|
|
var a_id = '{/literal}{$alias_id}{literal}';
|
|
|
|
function closeAndReload() {
|
|
$('#ajax-dialog-aliases-' + a_id).dialog('destroy').remove();
|
|
if (window.parent) window.parent.location.reload();
|
|
else window.location.reload();
|
|
}
|
|
|
|
$(document).off('click', '.CloseModal').on('click', '.CloseModal', function(e){
|
|
e.preventDefault();
|
|
closeAndReload();
|
|
});
|
|
|
|
var $dialog = $('#ajax-dialog-aliases-' + a_id).closest('.ui-dialog');
|
|
$dialog.find('.ui-dialog-titlebar-close').on('click', function(){
|
|
if (window.parent) window.parent.location.reload();
|
|
});
|
|
|
|
$(document).off('click', '.SaveAlias').on('click', '.SaveAlias', function(e){
|
|
e.preventDefault();
|
|
var $btn = $(this);
|
|
|
|
$("#AliasForm").ajaxSubmit({
|
|
dataType: 'json',
|
|
beforeSubmit: function() {
|
|
$btn.attr("disabled", true).val("Сохранение...");
|
|
},
|
|
success: function(r){
|
|
if (r && r.status == 'success') {
|
|
$.jGrowl(r.message || "Изменения успешно сохранены", {
|
|
theme: "accept",
|
|
life: 3000
|
|
});
|
|
|
|
if (parseInt(a_id) === 0) {
|
|
setTimeout(function() {
|
|
if (window.parent) window.parent.location.reload();
|
|
}, 900);
|
|
} else {
|
|
$btn.attr("disabled", false).val("Сохранить изменения");
|
|
}
|
|
} else {
|
|
var msg = (r && r.message) ? r.message : "Ошибка при сохранении";
|
|
$.jGrowl(msg, {
|
|
theme: "error",
|
|
life: 5000
|
|
});
|
|
$btn.attr("disabled", false).val("Сохранить изменения");
|
|
}
|
|
},
|
|
error: function() {
|
|
$.jGrowl("Критическая ошибка сервера", { theme: "error" });
|
|
$btn.attr("disabled", false).val("Сохранить изменения");
|
|
}
|
|
});
|
|
});
|
|
});
|
|
</script>
|
|
{/literal} |