2018-04-23

This commit is contained in:
Visman 2018-04-23 16:55:27 +07:00
parent bc04fc1640
commit 2231d888c9
19 changed files with 107 additions and 83 deletions

View file

@ -7,6 +7,11 @@ use ForkBB\Models\Page;
class Admin extends Page class Admin extends Page
{ {
/**
* @var array
*/
protected $aCrumbs = [];
/** /**
* Конструктор * Конструктор
* *
@ -30,6 +35,8 @@ class Admin extends Page
public function prepare() public function prepare()
{ {
$this->aNavigation = $this->aNavigation(); $this->aNavigation = $this->aNavigation();
$this->crumbs = $this->crumbs(...$this->aCrumbs);
parent::prepare(); parent::prepare();
} }
@ -40,23 +47,21 @@ class Admin extends Page
*/ */
protected function aNavigation() protected function aNavigation()
{ {
$r = $this->c->Router; $r = $this->c->Router;
$nav = [ $nav = [
'Moderator menu' => [ 'index' => [$r->link('Admin'), \ForkBB\__('Admin index')],
'index' => [$r->link('Admin'), \ForkBB\__('Admin index')], 'users' => [$r->link('AdminUsers'), \ForkBB\__('Users')],
'users' => [$r->link('AdminUsers'), \ForkBB\__('Users')],
],
]; ];
if ($this->user->isAdmin || $this->user->g_mod_ban_users == '1') { if ($this->user->isAdmin || $this->user->g_mod_ban_users == '1') {
$nav['Moderator menu']['bans'] = ['admin_bans.php', \ForkBB\__('Bans')]; $nav['bans'] = ['admin_bans.php', \ForkBB\__('Bans')];
} }
if ($this->user->isAdmin || $this->c->config->o_report_method == '0' || $this->c->config->o_report_method == '2') { if ($this->user->isAdmin || $this->c->config->o_report_method == '0' || $this->c->config->o_report_method == '2') {
$nav['Moderator menu']['reports'] = ['admin_reports.php', \ForkBB\__('Reports')]; $nav['reports'] = ['admin_reports.php', \ForkBB\__('Reports')];
} }
if ($this->user->isAdmin) { if ($this->user->isAdmin) {
$nav['Admin menu'] = [ $nav += [
'options' => [$r->link('AdminOptions'), \ForkBB\__('Admin options')], 'options' => [$r->link('AdminOptions'), \ForkBB\__('Admin options')],
'permissions' => [$r->link('AdminPermissions'), \ForkBB\__('Permissions')], 'permissions' => [$r->link('AdminPermissions'), \ForkBB\__('Permissions')],
'categories' => [$r->link('AdminCategories'), \ForkBB\__('Categories')], 'categories' => [$r->link('AdminCategories'), \ForkBB\__('Categories')],
@ -71,19 +76,25 @@ class Admin extends Page
} }
/** /**
* Возвращает title страницы * Возвращает массив хлебных крошек
* $this->pageTitle * Заполняет массив титула страницы
* *
* @param array $titles * @param mixed $crumbs
* *
* @return string * @return array
*/ */
protected function getPageTitle(array $titles = []) protected function crumbs(...$crumbs)
{ {
if (empty($titles)) { if ('index' !== $this->aIndex) {
$titles = $this->titles; if (isset($this->aNavigation[$this->aIndex])) {
$crumbs[] = $this->aNavigation[$this->aIndex];
} else {
$crumbs[] = 'unknown';
}
} }
$titles[] = \ForkBB\__('Admin title');
return parent::getPageTitle($titles); $crumbs[] = [$this->c->Router->link('Admin'), \ForkBB\__('Admin title')];
return parent::crumbs(...$crumbs);
} }
} }

View file

@ -113,7 +113,6 @@ class Categories extends Admin
$this->nameTpl = 'admin/form'; $this->nameTpl = 'admin/form';
$this->aIndex = 'categories'; $this->aIndex = 'categories';
$this->titles = \ForkBB\__('Categories');
$this->form = $form; $this->form = $form;
$this->classForm = 'editcategories'; $this->classForm = 'editcategories';
$this->titleForm = \ForkBB\__('Categories'); $this->titleForm = \ForkBB\__('Categories');
@ -209,7 +208,8 @@ class Categories extends Admin
$this->nameTpl = 'admin/form'; $this->nameTpl = 'admin/form';
$this->aIndex = 'categories'; $this->aIndex = 'categories';
$this->titles = \ForkBB\__('Delete category head'); $this->aCrumbs[] = [$this->c->Router->link('AdminCategoriesDelete', ['id' => $args['id']]), \ForkBB\__('Delete category head')];
$this->aCrumbs[] = \ForkBB\__('"%s"', $category['cat_name']);
$this->form = $form; $this->form = $form;
$this->classForm = ['deletecategory', 'btnsrow']; $this->classForm = ['deletecategory', 'btnsrow'];
$this->titleForm = \ForkBB\__('Delete category head'); $this->titleForm = \ForkBB\__('Delete category head');

View file

@ -123,7 +123,7 @@ class Censoring extends Admin
$this->nameTpl = 'admin/form'; $this->nameTpl = 'admin/form';
$this->aIndex = 'censoring'; $this->aIndex = 'censoring';
$this->titles = \ForkBB\__('Censoring'); # $this->titles = \ForkBB\__('Censoring');
$this->form = $form; $this->form = $form;
$this->classForm = 'editcensorship'; $this->classForm = 'editcensorship';
$this->titleForm = \ForkBB\__('Censoring'); $this->titleForm = \ForkBB\__('Censoring');

View file

@ -201,7 +201,6 @@ class Forums extends Admin
$this->nameTpl = 'admin/form'; $this->nameTpl = 'admin/form';
$this->aIndex = 'forums'; $this->aIndex = 'forums';
$this->titles = \ForkBB\__('Forums');
$this->form = $form; $this->form = $form;
$this->classForm = ['editforums', 'inline']; $this->classForm = ['editforums', 'inline'];
$this->titleForm = \ForkBB\__('Forums'); $this->titleForm = \ForkBB\__('Forums');
@ -297,7 +296,8 @@ class Forums extends Admin
$this->nameTpl = 'admin/form'; $this->nameTpl = 'admin/form';
$this->aIndex = 'forums'; $this->aIndex = 'forums';
$this->titles = \ForkBB\__('Delete forum head'); $this->aCrumbs[] = [$this->c->Router->link('AdminForumsDelete', ['id' => $forum->id]), \ForkBB\__('Delete forum head')];
$this->aCrumbs[] = \ForkBB\__('"%s"', $forum->forum_name);
$this->form = $form; $this->form = $form;
$this->classForm = ['deleteforum', 'btnsrow']; $this->classForm = ['deleteforum', 'btnsrow'];
$this->titleForm = \ForkBB\__('Delete forum head'); $this->titleForm = \ForkBB\__('Delete forum head');
@ -321,13 +321,14 @@ class Forums extends Admin
if (empty($args['id'])) { if (empty($args['id'])) {
$forum = $this->c->forums->create(); $forum = $this->c->forums->create();
$marker = 'AdminForumsNew'; $marker = 'AdminForumsNew';
$this->titles = \ForkBB\__('Add forum head'); $this->aCrumbs[] = [$this->c->Router->link($marker), \ForkBB\__('Add forum head')];
$this->titleForm = \ForkBB\__('Add forum head'); $this->titleForm = \ForkBB\__('Add forum head');
$this->classForm = 'createforum'; $this->classForm = 'createforum';
} else { } else {
$forum = $this->c->forums->loadTree((int) $args['id']); //????? $forum = $this->c->forums->loadTree((int) $args['id']); //?????
$marker = 'AdminForumsEdit'; $marker = 'AdminForumsEdit';
$this->titles = \ForkBB\__('Edit forum head'); $this->aCrumbs[] = [$this->c->Router->link($marker, $args), \ForkBB\__('Edit forum head')];
$this->aCrumbs[] = \ForkBB\__('"%s"', $forum->forum_name);
$this->titleForm = \ForkBB\__('Edit forum head'); $this->titleForm = \ForkBB\__('Edit forum head');
$this->classForm = 'editforum'; $this->classForm = 'editforum';
} }

View file

@ -50,7 +50,6 @@ class Groups extends Admin
public function view() public function view()
{ {
$this->nameTpl = 'admin/groups'; $this->nameTpl = 'admin/groups';
$this->titles = \ForkBB\__('User groups');
$this->formNew = [ $this->formNew = [
'action' => $this->c->Router->link('AdminGroupsNew'), 'action' => $this->c->Router->link('AdminGroupsNew'),
'hidden' => [ 'hidden' => [
@ -58,6 +57,7 @@ class Groups extends Admin
], ],
'sets' => [ 'sets' => [
'base' => [ 'base' => [
'legend' => \ForkBB\__('Add group subhead'),
'fields' => [ 'fields' => [
'basegroup' => [ 'basegroup' => [
'type' => 'select', 'type' => 'select',
@ -85,6 +85,7 @@ class Groups extends Admin
], ],
'sets' => [ 'sets' => [
'del' => [ 'del' => [
'legend' => \ForkBB\__('Default group subhead'),
'fields' => [ 'fields' => [
'defaultgroup' => [ 'defaultgroup' => [
'type' => 'select', 'type' => 'select',
@ -181,7 +182,8 @@ class Groups extends Admin
$marker = 'AdminGroupsEdit'; $marker = 'AdminGroupsEdit';
$vars = ['id' => $group->g_id]; $vars = ['id' => $group->g_id];
$notNext .= ',' . $group->g_id; $notNext .= ',' . $group->g_id;
$this->titles = \ForkBB\__('Edit group'); $this->aCrumbs[] = [$this->c->Router->link($marker, $vars), \ForkBB\__('Edit group')];
$this->aCrumbs[] = \ForkBB\__('"%s"', $group->g_title);
$this->titleForm = \ForkBB\__('Edit group'); $this->titleForm = \ForkBB\__('Edit group');
$this->classForm = 'editgroup'; $this->classForm = 'editgroup';
} else { } else {
@ -189,7 +191,7 @@ class Groups extends Admin
$vars = ['base' => $group->g_id]; $vars = ['base' => $group->g_id];
$group->g_title = ''; $group->g_title = '';
$group->g_id = null; $group->g_id = null;
$this->titles = \ForkBB\__('Create new group'); $this->aCrumbs[] = \ForkBB\__('Create new group');
$this->titleForm = \ForkBB\__('Create new group'); $this->titleForm = \ForkBB\__('Create new group');
$this->classForm = 'creategroup'; $this->classForm = 'creategroup';
} }
@ -721,7 +723,8 @@ class Groups extends Admin
]; ];
$this->nameTpl = 'admin/form'; $this->nameTpl = 'admin/form';
$this->titles = \ForkBB\__('Group delete'); $this->aCrumbs[] = [$this->c->Router->link('AdminGroupsDelete', $args), \ForkBB\__('Group delete')];
$this->aCrumbs[] = \ForkBB\__('"%s"', $group->g_title);
$this->form = $form; $this->form = $form;
$this->titleForm = \ForkBB\__('Group delete'); $this->titleForm = \ForkBB\__('Group delete');
$this->classForm = ['deletegroup', 'btnsrow']; $this->classForm = ['deletegroup', 'btnsrow'];

View file

@ -8,7 +8,7 @@ class Index extends Admin
{ {
/** /**
* Подготавливает данные для шаблона * Подготавливает данные для шаблона
* *
* @return Page * @return Page
*/ */
public function index() public function index()
@ -16,7 +16,6 @@ class Index extends Admin
$this->c->Lang->load('admin_index'); $this->c->Lang->load('admin_index');
$this->nameTpl = 'admin/index'; $this->nameTpl = 'admin/index';
$this->titles = \ForkBB\__('Admin index');
$this->revision = $this->c->config->i_fork_revision; $this->revision = $this->c->config->i_fork_revision;
$this->linkStat = $this->c->Router->link('AdminStatistics'); $this->linkStat = $this->c->Router->link('AdminStatistics');

View file

@ -99,6 +99,7 @@ class Maintenance extends Admin
], ],
], ],
'indx' => [ 'indx' => [
'legend' => \ForkBB\__('Rebuild index head'),
'fields' => [ 'fields' => [
'limit' => [ 'limit' => [
'type' => 'number', 'type' => 'number',
@ -146,7 +147,7 @@ class Maintenance extends Admin
$this->nameTpl = 'admin/maintenance'; $this->nameTpl = 'admin/maintenance';
$this->aIndex = 'maintenance'; $this->aIndex = 'maintenance';
$this->titles = \ForkBB\__('Maintenance'); # $this->titles = \ForkBB\__('Maintenance');
return $this; return $this;
} }

View file

@ -122,7 +122,6 @@ class Options extends Admin
$this->aIndex = 'options'; $this->aIndex = 'options';
$this->nameTpl = 'admin/form'; $this->nameTpl = 'admin/form';
$this->titles = \ForkBB\__('Admin options');
$this->form = $this->viewForm($config); $this->form = $this->viewForm($config);
$this->titleForm = \ForkBB\__('Options head'); $this->titleForm = \ForkBB\__('Options head');
$this->classForm = 'editoptions'; $this->classForm = 'editoptions';

View file

@ -62,7 +62,6 @@ class Permissions extends Admin
$this->aIndex = 'permissions'; $this->aIndex = 'permissions';
$this->nameTpl = 'admin/form'; $this->nameTpl = 'admin/form';
$this->titles = \ForkBB\__('Permissions');
$this->form = $this->viewForm($config); $this->form = $this->viewForm($config);
$this->titleForm = \ForkBB\__('Permissions head'); $this->titleForm = \ForkBB\__('Permissions head');
$this->classForm = 'editpermissions'; $this->classForm = 'editpermissions';

View file

@ -45,9 +45,11 @@ class Statistics extends Admin
$phpinfo = '- - -'; $phpinfo = '- - -';
} }
$this->nameTpl = 'admin/phpinfo'; $this->nameTpl = 'admin/phpinfo';
$this->titles = 'phpinfo()'; $this->mainSuffix = '-one-column';
$this->phpinfo = $phpinfo; $this->aCrumbs[] = [$this->c->Router->link('AdminInfo'), 'phpinfo()'];
$this->aCrumbs[] = [$this->c->Router->link('AdminStatistics'), \ForkBB\__('Server statistics')];
$this->phpinfo = $phpinfo;
return $this; return $this;
} }
@ -61,9 +63,9 @@ class Statistics extends Admin
{ {
$this->c->Lang->load('admin_index'); $this->c->Lang->load('admin_index');
$this->nameTpl = 'admin/statistics'; $this->nameTpl = 'admin/statistics';
$this->titles = \ForkBB\__('Server statistics'); $this->aCrumbs[] = [$this->c->Router->link('AdminStatistics'), \ForkBB\__('Server statistics')];
$this->linkInfo = $this->c->Router->link('AdminInfo'); $this->linkInfo = $this->c->Router->link('AdminInfo');
// Get the server load averages (if possible) // Get the server load averages (if possible)
if (@\file_exists('/proc/loadavg') && \is_readable('/proc/loadavg')) { if (@\file_exists('/proc/loadavg') && \is_readable('/proc/loadavg')) {

View file

@ -104,7 +104,8 @@ class Users extends Admin
$this->nameTpl = 'admin/users_result'; $this->nameTpl = 'admin/users_result';
$this->aIndex = 'users'; $this->aIndex = 'users';
$this->titles = \ForkBB\__('Users'); $this->mainSuffix = '-one-column';
$this->aCrumbs[] = [$this->c->Router->link('AdminShowUsersWithFilter', ['filters' => $args['filters'], 'hash' => $args['hash']]), \ForkBB\__('Results head')];
$this->formResult = $this->formUsers($userList, $startNum); $this->formResult = $this->formUsers($userList, $startNum);
return $this; return $this;
@ -204,7 +205,7 @@ class Users extends Admin
$this->nameTpl = 'admin/users'; $this->nameTpl = 'admin/users';
$this->aIndex = 'users'; $this->aIndex = 'users';
$this->titles = \ForkBB\__('Users'); # $this->titles = \ForkBB\__('Users');
$this->formSearch = $this->formSearch($data); $this->formSearch = $this->formSearch($data);
if ($this->user->isAdmin) { if ($this->user->isAdmin) {
@ -472,6 +473,7 @@ class Users extends Admin
'required' => true, 'required' => true,
]; ];
$form['sets']['ip'] = [ $form['sets']['ip'] = [
'legend' => \ForkBB\__('IP search subhead'),
'fields' => $fields, 'fields' => $fields,
]; ];

View file

@ -98,3 +98,6 @@ msgstr "Loading of the plugin - <strong>%s</strong> - failed."
msgid "Data updated redirect" msgid "Data updated redirect"
msgstr "Data updated. Redirecting …" msgstr "Data updated. Redirecting …"
msgid "\"%s\""
msgstr "\"%s\""

View file

@ -241,7 +241,7 @@ msgid "IP search head"
msgstr "IP search" msgstr "IP search"
msgid "IP search subhead" msgid "IP search subhead"
msgstr "Enter IP to search for" msgstr "IP for search"
msgid "IP address label" msgid "IP address label"
msgstr "IP address" msgstr "IP address"

View file

@ -98,3 +98,6 @@ msgstr "Загрузить плагин <strong>%s</strong> не удалось.
msgid "Data updated redirect" msgid "Data updated redirect"
msgstr "Данные изменены. Переадресация …" msgstr "Данные изменены. Переадресация …"
msgid "\"%s\""
msgstr "\"%s\""

View file

@ -241,7 +241,7 @@ msgid "IP search head"
msgstr "Поиск по IP" msgstr "Поиск по IP"
msgid "IP search subhead" msgid "IP search subhead"
msgstr "Введите IP для поиска" msgstr "IP для поиска"
msgid "IP address label" msgid "IP address label"
msgstr "IP адрес" msgstr "IP адрес"

View file

@ -1,7 +1,7 @@
@extends ('layouts/main') @extends ('layouts/admin')
<section class="f-main f-phpinfo"> <section class="f-admin f-phpinfo">
<h2>phpinfo()</h2> <h2>phpinfo()</h2>
<div class="f-phpinfo-div"> <div class="f-phpinfo-div">
{!! $p->phpinfo !!} {!! $p->phpinfo !!}
</div> </div>
</section> </section>

View file

@ -1,6 +1,6 @@
@extends ('layouts/admin') @extends ('layouts/admin')
<section class="f-admin f-search-user-form"> <section class="f-admin f-search-user-form">
<h2>{!! __('User search head') !!}</h2> <h2>{!! __('Results head') !!}</h2>
<div class="f-fdiv"> <div class="f-fdiv">
@if ($form = $p->formResult) @if ($form = $p->formResult)
@include ('layouts/form') @include ('layouts/form')

View file

@ -1,18 +1,31 @@
@section ('crumbs')
<ul class="f-crumbs">
@foreach ($p->crumbs as $cur)
<li class="f-crumb"><!-- inline -->
@if ($cur[0])
<a href="{!! $cur[0] !!}" @if ($cur[2]) class="active" @endif>{{ $cur[1] }}</a>
@else
<span @if ($cur[2]) class="active" @endif>{{ $cur[1] }}</span>
@endif
</li><!-- endinline -->
@endforeach
</ul>
@endsection
@extends ('layouts/main') @extends ('layouts/main')
<div class="f-main f-main-admin"> <div class="f-nav-links">
@yield ('crumbs')
</div>
<div class="f-main f-main-admin{!! $p->mainSuffix or '' !!}">
<aside class="f-admin-menu"> <aside class="f-admin-menu">
@if ($p->aNavigation) @if ($p->aNavigation)
<nav class="f-admin-nav f-menu"> <nav class="f-admin-nav f-menu">
<input id="id-an-checkbox" class="f-menu-checkbox" style="display: none;" type="checkbox"> <input id="id-an-checkbox" class="f-menu-checkbox" style="display: none;" type="checkbox">
<label class="f-menu-toggle" for="id-an-checkbox"></label> <label class="f-menu-toggle" for="id-an-checkbox"></label>
@foreach ($p->aNavigation as $aNameSub => $aNavigationSub)
<h2 class="f-menu-items">{!! __($aNameSub) !!}</h2>
<ul class="f-menu-items"> <ul class="f-menu-items">
@foreach ($aNavigationSub as $key => $val) @foreach ($p->aNavigation as $key => $val)
<li id="id-anav-{{ $key }}" class="f-menu-item"><a class="f-menu-a @if ($key == $p->aIndex) active @endif" href="{!! $val[0] !!}">{!! $val[1] !!}</a></li> <li id="id-anav-{{ $key }}" class="f-menu-item"><a class="f-menu-a @if ($key == $p->aIndex) active @endif" href="{!! $val[0] !!}">{!! $val[1] !!}</a></li>
@endforeach @endforeach
</ul> </ul>
@endforeach
</nav> </nav>
@endif @endif
</aside> </aside>

View file

@ -847,49 +847,30 @@ select {
color: #F8F4E3; color: #F8F4E3;
} }
.f-admin-menu h2 {
text-align: center;
border: 0;
white-space: nowrap;
/* font-size: 1.125rem; */
text-transform: uppercase;
}
.f-admin-menu input:checked ~ h2 {
padding: 0.625rem;
}
@media screen and (min-width: 50rem) { @media screen and (min-width: 50rem) {
.f-main-admin { .f-main-admin {
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;
} }
.f-admin-menu { .f-main-admin .f-admin-menu {
width: 13rem; width: 13rem;
margin-right: 1rem; margin-right: 1rem;
} }
.f-admin-wrap { .f-main-admin .f-admin-wrap {
width: calc(100% - 14rem); width: calc(100% - 14rem);
} }
.f-admin-menu .f-menu-toggle { .f-main-admin .f-admin-menu .f-menu-toggle {
display: none; display: none;
} }
.f-admin-menu .f-menu-items { .f-main-admin .f-admin-menu .f-menu-items {
max-height: 100rem; max-height: 100rem;
} }
.f-admin-menu .f-menu-a { .f-main-admin .f-admin-menu .f-menu-a {
text-align: left;
text-transform: none;
border-bottom: 0.0625rem dotted;
}
.f-admin-menu h2 {
padding: 0.625rem;
text-align: left; text-align: left;
text-transform: none; text-transform: none;
border-bottom: 0.0625rem dotted; border-bottom: 0.0625rem dotted;
@ -899,12 +880,15 @@ select {
/***********/ /***********/
/* Админка */ /* Админка */
/***********/ /***********/
.f-admin:not(:last-child) {
margin-bottom: 1rem;
}
.f-admin > h2 { .f-admin > h2 {
padding: 0.625rem 0.625rem 0 0.625rem; display: none;
} }
.f-admin > div { .f-admin > div {
margin-top: 0.625rem;
background-color: #F8F4E3; background-color: #F8F4E3;
border: 0.0625rem solid #AA7939; border: 0.0625rem solid #AA7939;
} }
@ -957,6 +941,10 @@ select {
word-break: break-all; word-break: break-all;
} }
.f-phpinfo-div {
overflow-x: auto;
}
.f-admin .f-wrap-between { .f-admin .f-wrap-between {
display: flex; display: flex;
align-items: flex-end; align-items: flex-end;