From 2231d888c935d9d6b56b9109301544aec0e81133 Mon Sep 17 00:00:00 2001 From: Visman Date: Mon, 23 Apr 2018 16:55:27 +0700 Subject: [PATCH] 2018-04-23 --- app/Models/Pages/Admin.php | 47 +++++++++++++-------- app/Models/Pages/Admin/Categories.php | 4 +- app/Models/Pages/Admin/Censoring.php | 2 +- app/Models/Pages/Admin/Forums.php | 9 ++-- app/Models/Pages/Admin/Groups.php | 11 +++-- app/Models/Pages/Admin/Index.php | 3 +- app/Models/Pages/Admin/Maintenance.php | 3 +- app/Models/Pages/Admin/Options.php | 1 - app/Models/Pages/Admin/Permissions.php | 1 - app/Models/Pages/Admin/Statistics.php | 14 +++--- app/Models/Pages/Admin/Users.php | 6 ++- app/lang/English/admin.po | 3 ++ app/lang/English/admin_users.po | 2 +- app/lang/Russian/admin.po | 3 ++ app/lang/Russian/admin_users.po | 2 +- app/templates/admin/phpinfo.forkbb.php | 14 +++--- app/templates/admin/users_result.forkbb.php | 2 +- app/templates/layouts/admin.forkbb.php | 23 +++++++--- public/style/ForkBB/style.css | 40 ++++++------------ 19 files changed, 107 insertions(+), 83 deletions(-) diff --git a/app/Models/Pages/Admin.php b/app/Models/Pages/Admin.php index 0e0599ee..020e290a 100644 --- a/app/Models/Pages/Admin.php +++ b/app/Models/Pages/Admin.php @@ -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); } } diff --git a/app/Models/Pages/Admin/Categories.php b/app/Models/Pages/Admin/Categories.php index 0322c817..05cd4a7a 100644 --- a/app/Models/Pages/Admin/Categories.php +++ b/app/Models/Pages/Admin/Categories.php @@ -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'); diff --git a/app/Models/Pages/Admin/Censoring.php b/app/Models/Pages/Admin/Censoring.php index cd3195de..17e6f8b1 100644 --- a/app/Models/Pages/Admin/Censoring.php +++ b/app/Models/Pages/Admin/Censoring.php @@ -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'); diff --git a/app/Models/Pages/Admin/Forums.php b/app/Models/Pages/Admin/Forums.php index 12f518e4..bbadba02 100644 --- a/app/Models/Pages/Admin/Forums.php +++ b/app/Models/Pages/Admin/Forums.php @@ -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'; } diff --git a/app/Models/Pages/Admin/Groups.php b/app/Models/Pages/Admin/Groups.php index 2dc6c04c..03f30b06 100644 --- a/app/Models/Pages/Admin/Groups.php +++ b/app/Models/Pages/Admin/Groups.php @@ -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']; diff --git a/app/Models/Pages/Admin/Index.php b/app/Models/Pages/Admin/Index.php index da7e41e7..6702b6be 100644 --- a/app/Models/Pages/Admin/Index.php +++ b/app/Models/Pages/Admin/Index.php @@ -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'); diff --git a/app/Models/Pages/Admin/Maintenance.php b/app/Models/Pages/Admin/Maintenance.php index 900f5057..adcd1803 100644 --- a/app/Models/Pages/Admin/Maintenance.php +++ b/app/Models/Pages/Admin/Maintenance.php @@ -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; } diff --git a/app/Models/Pages/Admin/Options.php b/app/Models/Pages/Admin/Options.php index 76e0ac3a..19d3f7f6 100644 --- a/app/Models/Pages/Admin/Options.php +++ b/app/Models/Pages/Admin/Options.php @@ -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'; diff --git a/app/Models/Pages/Admin/Permissions.php b/app/Models/Pages/Admin/Permissions.php index b0684979..33a5325c 100644 --- a/app/Models/Pages/Admin/Permissions.php +++ b/app/Models/Pages/Admin/Permissions.php @@ -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'; diff --git a/app/Models/Pages/Admin/Statistics.php b/app/Models/Pages/Admin/Statistics.php index ee154624..b6287bfb 100644 --- a/app/Models/Pages/Admin/Statistics.php +++ b/app/Models/Pages/Admin/Statistics.php @@ -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')) { diff --git a/app/Models/Pages/Admin/Users.php b/app/Models/Pages/Admin/Users.php index 17faed63..a9e0f609 100644 --- a/app/Models/Pages/Admin/Users.php +++ b/app/Models/Pages/Admin/Users.php @@ -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, ]; diff --git a/app/lang/English/admin.po b/app/lang/English/admin.po index 15a0acfd..d3954dff 100644 --- a/app/lang/English/admin.po +++ b/app/lang/English/admin.po @@ -98,3 +98,6 @@ msgstr "Loading of the plugin - %s - failed." msgid "Data updated redirect" msgstr "Data updated. Redirecting …" + +msgid "\"%s\"" +msgstr "\"%s\"" diff --git a/app/lang/English/admin_users.po b/app/lang/English/admin_users.po index c5662cdd..3cce9d0d 100644 --- a/app/lang/English/admin_users.po +++ b/app/lang/English/admin_users.po @@ -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" diff --git a/app/lang/Russian/admin.po b/app/lang/Russian/admin.po index 9277d47f..574d114c 100644 --- a/app/lang/Russian/admin.po +++ b/app/lang/Russian/admin.po @@ -98,3 +98,6 @@ msgstr "Загрузить плагин %s не удалось. msgid "Data updated redirect" msgstr "Данные изменены. Переадресация …" + +msgid "\"%s\"" +msgstr "\"%s\"" diff --git a/app/lang/Russian/admin_users.po b/app/lang/Russian/admin_users.po index 9896ac0f..fee75def 100644 --- a/app/lang/Russian/admin_users.po +++ b/app/lang/Russian/admin_users.po @@ -241,7 +241,7 @@ msgid "IP search head" msgstr "Поиск по IP" msgid "IP search subhead" -msgstr "Введите IP для поиска" +msgstr "IP для поиска" msgid "IP address label" msgstr "IP адрес" diff --git a/app/templates/admin/phpinfo.forkbb.php b/app/templates/admin/phpinfo.forkbb.php index 53e3acdd..c3487c33 100644 --- a/app/templates/admin/phpinfo.forkbb.php +++ b/app/templates/admin/phpinfo.forkbb.php @@ -1,7 +1,7 @@ -@extends ('layouts/main') -
-

phpinfo()

-
- {!! $p->phpinfo !!} -
-
+@extends ('layouts/admin') +
+

phpinfo()

+
+ {!! $p->phpinfo !!} +
+
diff --git a/app/templates/admin/users_result.forkbb.php b/app/templates/admin/users_result.forkbb.php index 72165476..27e30d97 100644 --- a/app/templates/admin/users_result.forkbb.php +++ b/app/templates/admin/users_result.forkbb.php @@ -1,6 +1,6 @@ @extends ('layouts/admin')
-

{!! __('User search head') !!}

+

{!! __('Results head') !!}

@if ($form = $p->formResult) @include ('layouts/form') diff --git a/app/templates/layouts/admin.forkbb.php b/app/templates/layouts/admin.forkbb.php index 5d3905a4..4d094a39 100644 --- a/app/templates/layouts/admin.forkbb.php +++ b/app/templates/layouts/admin.forkbb.php @@ -1,18 +1,31 @@ +@section ('crumbs') +
    + @foreach ($p->crumbs as $cur) +
  • + @if ($cur[0]) + {{ $cur[1] }} + @else + {{ $cur[1] }} + @endif +
  • + @endforeach +
+@endsection @extends ('layouts/main') -
+ +
diff --git a/public/style/ForkBB/style.css b/public/style/ForkBB/style.css index 94b9f8da..c3c266e9 100644 --- a/public/style/ForkBB/style.css +++ b/public/style/ForkBB/style.css @@ -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;