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
{
/**
* @var array
*/
protected $aCrumbs = [];
/**
* Конструктор
*
@ -30,6 +35,8 @@ class Admin extends Page
public function prepare()
{
$this->aNavigation = $this->aNavigation();
$this->crumbs = $this->crumbs(...$this->aCrumbs);
parent::prepare();
}
@ -40,23 +47,21 @@ class Admin extends Page
*/
protected function aNavigation()
{
$r = $this->c->Router;
$r = $this->c->Router;
$nav = [
'Moderator menu' => [
'index' => [$r->link('Admin'), \ForkBB\__('Admin index')],
'users' => [$r->link('AdminUsers'), \ForkBB\__('Users')],
],
'index' => [$r->link('Admin'), \ForkBB\__('Admin index')],
'users' => [$r->link('AdminUsers'), \ForkBB\__('Users')],
];
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') {
$nav['Moderator menu']['reports'] = ['admin_reports.php', \ForkBB\__('Reports')];
$nav['reports'] = ['admin_reports.php', \ForkBB\__('Reports')];
}
if ($this->user->isAdmin) {
$nav['Admin menu'] = [
$nav += [
'options' => [$r->link('AdminOptions'), \ForkBB\__('Admin options')],
'permissions' => [$r->link('AdminPermissions'), \ForkBB\__('Permissions')],
'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)) {
$titles = $this->titles;
if ('index' !== $this->aIndex) {
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->aIndex = 'categories';
$this->titles = \ForkBB\__('Categories');
$this->form = $form;
$this->classForm = 'editcategories';
$this->titleForm = \ForkBB\__('Categories');
@ -209,7 +208,8 @@ class Categories extends Admin
$this->nameTpl = 'admin/form';
$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->classForm = ['deletecategory', 'btnsrow'];
$this->titleForm = \ForkBB\__('Delete category head');

View file

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

View file

@ -201,7 +201,6 @@ class Forums extends Admin
$this->nameTpl = 'admin/form';
$this->aIndex = 'forums';
$this->titles = \ForkBB\__('Forums');
$this->form = $form;
$this->classForm = ['editforums', 'inline'];
$this->titleForm = \ForkBB\__('Forums');
@ -297,7 +296,8 @@ class Forums extends Admin
$this->nameTpl = 'admin/form';
$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->classForm = ['deleteforum', 'btnsrow'];
$this->titleForm = \ForkBB\__('Delete forum head');
@ -321,13 +321,14 @@ class Forums extends Admin
if (empty($args['id'])) {
$forum = $this->c->forums->create();
$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->classForm = 'createforum';
} else {
$forum = $this->c->forums->loadTree((int) $args['id']); //?????
$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->classForm = 'editforum';
}

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -45,9 +45,11 @@ class Statistics extends Admin
$phpinfo = '- - -';
}
$this->nameTpl = 'admin/phpinfo';
$this->titles = 'phpinfo()';
$this->phpinfo = $phpinfo;
$this->nameTpl = 'admin/phpinfo';
$this->mainSuffix = '-one-column';
$this->aCrumbs[] = [$this->c->Router->link('AdminInfo'), 'phpinfo()'];
$this->aCrumbs[] = [$this->c->Router->link('AdminStatistics'), \ForkBB\__('Server statistics')];
$this->phpinfo = $phpinfo;
return $this;
}
@ -61,9 +63,9 @@ class Statistics extends Admin
{
$this->c->Lang->load('admin_index');
$this->nameTpl = 'admin/statistics';
$this->titles = \ForkBB\__('Server statistics');
$this->linkInfo = $this->c->Router->link('AdminInfo');
$this->nameTpl = 'admin/statistics';
$this->aCrumbs[] = [$this->c->Router->link('AdminStatistics'), \ForkBB\__('Server statistics')];
$this->linkInfo = $this->c->Router->link('AdminInfo');
// Get the server load averages (if possible)
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->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);
return $this;
@ -204,7 +205,7 @@ class Users extends Admin
$this->nameTpl = 'admin/users';
$this->aIndex = 'users';
$this->titles = \ForkBB\__('Users');
# $this->titles = \ForkBB\__('Users');
$this->formSearch = $this->formSearch($data);
if ($this->user->isAdmin) {
@ -472,6 +473,7 @@ class Users extends Admin
'required' => true,
];
$form['sets']['ip'] = [
'legend' => \ForkBB\__('IP search subhead'),
'fields' => $fields,
];

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1,6 +1,6 @@
@extends ('layouts/admin')
<section class="f-admin f-search-user-form">
<h2>{!! __('User search head') !!}</h2>
<h2>{!! __('Results head') !!}</h2>
<div class="f-fdiv">
@if ($form = $p->formResult)
@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')
<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">
@if ($p->aNavigation)
<nav class="f-admin-nav f-menu">
<input id="id-an-checkbox" class="f-menu-checkbox" style="display: none;" type="checkbox">
<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">
@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>
@endforeach
</ul>
@endforeach
</nav>
@endif
</aside>

View file

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