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-database 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 pt-2">
21 <form action=
"<?= Wrong\Models\Actions::find(14)->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 <select name=
"template_id" class=
"custom-select">
52 foreach (Wrong\Models\Templates::all_available(
'select',
'type') as $row) {
53 echo
'<option value="' . $row->id .
'">' . $row->name .
'</option>';
58 <div
class=
"input-group input-group-sm mt-2">
59 <div
class=
"input-group-prepend w-50">
60 <span
class=
"input-group-text w-100">Запрос</span>
62 <input type=
"text" name=
"request" class=
"form-control" value=
"/api/select/request" placeholder=
"/api/select/request" autocomplete=
"off" required>
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=
"Доступные каталоги: <?= implode(', ', $user->writeble_paths) ?>" type=
"text" name=
"file" class=
"form-control" value=
"/api/select/<?= Wrong\Rights\Group::row($user->main_group_id)->path ?>/request.php" placeholder=
"/api/select/<?= Wrong\Rights\Group::row($user->main_group_id)->path ?>/request.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]"));
104 $(
"#<?= $basename ?> form [name=request]").keyup(
function() {
105 let filename = ($(
this).val().trim().match(/[^\/]+$/)?.[0] ||
'') +
'.php';
106 let replace = $(
"#<?= $basename ?> form [name=file]").val().trim().replace(/[^\/]+$/, filename);
107 $(
"#<?= $basename ?> form [name=file]").val(replace);
112 let path = $(
'#<?= $basename ?> [name="owner_group"] option:selected').data(
'path');
113 let file = $(
"#<?= $basename ?> form [name=file]").val();
114 file = file.replace(/^(\/api\/[^/]+\/)[^/]+/,
'$1' + path);
115 $(
"#<?= $basename ?> form [name=file]").val(file);
117 $(
'#<?= $basename ?> [name="owner_group"]').on(
'change', setPath);
118 $(
'#<?= $basename ?> [name="owner_group"]').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']