8 isset(
$user) or require
$_SERVER[
'DOCUMENT_ROOT'] .
'/page/404.php';
11 <div
class=
"modal fade" id=
"<?= $basename ?>" tabindex=
"-1" data-backdrop=
"static" data-keyboard=
"false">
12 <div
class=
"modal-dialog modal-lg modal-dialog-centered" role=
"document">
13 <div
class=
"modal-content">
14 <div
class=
"modal-header">
15 <h5
class=
"modal-title"><i
class=
"fa fa-columns mr-2"></i>Добавить шаблон</h5>
16 <button type=
"button" class=
"close" data-dismiss=
"modal" aria-label=
"Close">
17 <span aria-hidden=
"true">×</span>
20 <div
class=
"modal-body">
21 <form action=
"<?= Wrong\Models\Actions::find(18)->request ?>">
22 <div
class=
"border px-2 py-1 rounded bg-light-info">
23 <small>Группы доступа <a onclick=
"if(~~this.dataset.checked){$(this).html('отметить все');this.dataset.checked=0;$(this).parents('form').find('[name^=groups]').prop('checked', false);}else{$(this).html('снять все');this.dataset.checked=1;$(this).parents('form').find('[name^=groups]').prop('checked', true);}return false;" href=
"#">отметить все</a></small>
25 foreach (Wrong\Rights\Group::$groups_not_system as $row) {
26 echo
'<div class="custom-control custom-checkbox small">
27 <input type="checkbox" name="groups[' . $row->id .
']" class="custom-control-input" id="check-group-' . $row->id .
'">
28 <label class="custom-control-label" for="check-group-' . $row->id .
'">' .
Wrong\Rights\Group::text($row->id) .
'</label>
33 <div
class=
"input-group input-group-sm mt-2">
34 <div
class=
"input-group-prepend w-50">
35 <span
class=
"input-group-text w-100">Группа владелец</span>
37 <select name=
"owner_group" class=
"custom-select">
39 foreach (
$user->subordinate_groups as $id) {
41 echo
'<option data-path="' . $row->path .
'" value="' . $row->id .
'" ' . ($row->id ==
$user->main_group_id ?
' selected' :
'') .
'>' . Wrong\Rights\Group::text($row->id) .
'</option>';
46 <div
class=
"input-group input-group-sm mt-2">
47 <div
class=
"input-group-prepend w-50">
48 <span
class=
"input-group-text w-100">Название</span>
50 <input type=
"text" name=
"name" class=
"form-control" value=
"" autocomplete=
"off" placeholder=
"Название">
52 <div
class=
"input-group input-group-sm mt-2">
53 <div
class=
"input-group-prepend w-50">
54 <span
class=
"input-group-text w-100">Тип шаблона</span>
56 <select name=
"type" class=
"custom-select">
57 <option value=
"page">page</option>
58 <option value=
"incode">incode</option>
59 <option value=
"modal">modal</option>
60 <option value=
"select">select</option>
61 <option value=
"action">action</option>
64 <div
class=
"input-group input-group-sm mt-2">
65 <div
class=
"input-group-prepend w-50">
66 <span
class=
"input-group-text w-100">Файл шаблона</span>
68 <input title=
"Доступные каталоги: modal, page, incode, select, action" type=
"text" name=
"file" class=
"form-control" value=
"/../templates/page/<?= Wrong\Rights\Group::row($user->main_group_id)->path ?>/template.php" placeholder=
"/../templates/page/<?= Wrong\Rights\Group::row($user->main_group_id)->path ?>/template.php" autocomplete=
"off" required>
70 <button type=
"submit" class=
"btn btn-sm btn-block btn-success mt-3">Сохранить</button>
76 $(
"#<?= $basename ?> form").submit(
function(e) {
77 lockSubmit($(
"#<?= $basename ?> form [type=submit]"));
81 url: $(
this).attr(
"action"),
82 data: $(
this).serialize(),
91 errorToast(response.error);
94 $(
'.dataTable').DataTable().ajax.reload(
null,
false);
95 $(
'.toast').toast(
'hide');
96 successToast(response.message);
97 $(
"#<?= $basename ?>").modal(
"hide");
100 unlockSubmit($(
"#<?= $basename ?> form [type=submit]"));
106 let path = $(
'#<?= $basename ?> [name="type"]').val();
107 let path2 = $(
'#<?= $basename ?> [name="owner_group"] option:selected').data(
'path');
108 let file = $(
"#<?= $basename ?> form [name=file]").val();
109 file = file.replace(/^(\/\.\.\/templates\/)[^/]+\/[^/]+/,
'$1' + path +
'/' + path2);
110 $(
"#<?= $basename ?> form [name=file]").val(file);
112 $(
'#<?= $basename ?> [name="type"], #<?= $basename ?> [name="owner_group"]').on(
'change', setPath);
113 $(
'#<?= $basename ?> [name="type"]').trigger(
'change');
setcookie('FROM_UID', $uid, [ 'expires'=> time()+31536000, 'path'=> '/', 'domain'=> $_SERVER['HTTP_HOST'], 'secure'=> Wrong\Start\Env::$e->IS_SECURE, 'httponly'=> false, 'samesite'=> Wrong\Start\Env::$e->IS_SECURE ? 'None' :'Lax']) or setcookie('FROM_UID' $_SERVER['HTTP_HOST']