Visman 7 lat temu
rodzic
commit
c5d8403883

+ 14 - 12
app/Controllers/Routing.php

@@ -103,18 +103,20 @@ class Routing
         }
         // только админ
         if ($user->isAdmin) {
-            $r->add('GET',           '/admin/statistics/info',              'AdminStatistics:info',   'AdminInfo'         );
-            $r->add(['GET', 'POST'], '/admin/options',                      'AdminOptions:edit',      'AdminOptions'      );
-            $r->add(['GET', 'POST'], '/admin/permissions',                  'AdminPermissions:edit',  'AdminPermissions'  );
-            $r->add(['GET', 'POST'], '/admin/categories',                   'AdminCategories:view',   'AdminCategories'   );
-            $r->add('GET',           '/admin/forums',                       'AdminForums:view',       'AdminForums'       );
-            $r->add('GET',           '/admin/groups',                       'AdminGroups:view',       'AdminGroups'       );
-            $r->add('POST',          '/admin/groups/default',               'AdminGroups:defaultSet', 'AdminGroupsDefault');
-            $r->add('POST',          '/admin/groups/new[/{base:[1-9]\d*}]', 'AdminGroups:edit',       'AdminGroupsNew'    );
-            $r->add(['GET', 'POST'], '/admin/groups/{id:[1-9]\d*}/edit',    'AdminGroups:edit',       'AdminGroupsEdit'   );
-            $r->add(['GET', 'POST'], '/admin/groups/{id:[1-9]\d*}/delete',  'AdminGroups:delete',     'AdminGroupsDelete' );
-            $r->add('GET',           '/admin/censoring',                    'AdminCensoring:view',    'AdminCensoring'    );
-            
+            $r->add('GET',           '/admin/statistics/info',                 'AdminStatistics:info',   'AdminInfo'         );
+            $r->add(['GET', 'POST'], '/admin/options',                         'AdminOptions:edit',      'AdminOptions'      );
+            $r->add(['GET', 'POST'], '/admin/permissions',                     'AdminPermissions:edit',  'AdminPermissions'  );
+            $r->add(['GET', 'POST'], '/admin/categories',                      'AdminCategories:view',   'AdminCategories'   );
+            $r->add(['GET', 'POST'], '/admin/categories/{id:[1-9]\d*}/delete', 'AdminCategories:delete', 'AdminCategoriesDelete');
+
+            $r->add('GET',           '/admin/forums',                          'AdminForums:view',       'AdminForums'       );
+            $r->add('GET',           '/admin/groups',                          'AdminGroups:view',       'AdminGroups'       );
+            $r->add('POST',          '/admin/groups/default',                  'AdminGroups:defaultSet', 'AdminGroupsDefault');
+            $r->add('POST',          '/admin/groups/new[/{base:[1-9]\d*}]',    'AdminGroups:edit',       'AdminGroupsNew'    );
+            $r->add(['GET', 'POST'], '/admin/groups/{id:[1-9]\d*}/edit',       'AdminGroups:edit',       'AdminGroupsEdit'   );
+            $r->add(['GET', 'POST'], '/admin/groups/{id:[1-9]\d*}/delete',     'AdminGroups:delete',     'AdminGroupsDelete' );
+            $r->add('GET',           '/admin/censoring',                       'AdminCensoring:view',    'AdminCensoring'    );
+
         }
 
         $uri = $_SERVER['REQUEST_URI'];

+ 32 - 7
app/Models/Categories/Manager.php

@@ -17,13 +17,13 @@ class Manager extends ManagerModel
 
     /**
      * Загрузка категорий из БД
-     * 
+     *
      * @return Manager
      */
     public function init()
     {
-        $sql = 'SELECT id, cat_name, disp_position 
-                FROM ::categories 
+        $sql = 'SELECT id, cat_name, disp_position
+                FROM ::categories
                 ORDER BY disp_position';
         $this->repository = $this->c->DB->query($sql)->fetchAll(\PDO::FETCH_UNIQUE);
         return $this;
@@ -62,8 +62,8 @@ class Manager extends ManagerModel
                 ':position' => $cat['disp_position'],
                 ':cid'      => $key,
             ];
-            $sql = 'UPDATE ::categories 
-                    SET cat_name=?s:name, disp_position=?i:position 
+            $sql = 'UPDATE ::categories
+                    SET cat_name=?s:name, disp_position=?i:position
                     WHERE id=?i:cid';
             $this->c->DB->query($sql, $vars); //????
         }
@@ -86,14 +86,39 @@ class Manager extends ManagerModel
             ':name'     => $name,
             ':position' => $pos,
         ];
-        $sql = 'INSERT INTO ::categories (cat_name, disp_position) 
+        $sql = 'INSERT INTO ::categories (cat_name, disp_position)
                 VALUES (?s:name, ?i:position)';
         $this->c->DB->query($sql, $vars);
-        
+
         $cid = $this->c->DB->lastInsertId();
 
         parent::set($cid, ['cat_name' => $name, 'disp_position' => $pos]);
 
         return $cid;
     }
+
+    public function delete($cid)
+    {
+        $root = $this->c->forums->get(0);
+        $del  = [];
+
+        foreach ($root->subforums as $forum) {
+            if ($forum->cat_id === $cid) {
+                $del = array_merge($del, [$forum], $forum->descendants);
+            }
+        }
+
+        if ($del) {
+            $this->c->forums->delete(...$del);
+        }
+
+        $vars = [
+            ':cid' => $cid,
+        ];
+        $sql = 'DELETE FROM ::categories
+                WHERE id=?i:cid';
+        $this->c->DB->exec($sql, $vars);
+
+        return $this;
+    }
 }

+ 111 - 10
app/Models/Pages/Admin/Categories.php

@@ -9,11 +9,11 @@ use ForkBB\Models\Pages\Admin;
 class Categories extends Admin
 {
     /**
-     * Подготавливает данные для шаблона
+     * Просмотр, редактирвоание и добавление категорий
      *
      * @param array $args
      * @param string $method
-     * 
+     *
      * @return Page
      */
     public function view(array $args, $method)
@@ -41,20 +41,17 @@ class Categories extends Admin
                 if (strlen($v->new) > 0) {
                     $this->c->categories->insert($v->new); //????
                 }
-                
+
                 $this->c->DB->commit();
 
                 $this->c->Cache->delete('forums_mark'); //????
 
-                return $this->c->Redirect->page('AdminCategories')->message(\ForkBB\__('Categories updated redirect'));
+                return $this->c->Redirect->page('AdminCategories')->message('Categories updated redirect');
             }
 
             $this->fIswev  = $v->getErrors();
         }
 
-        $this->nameTpl     = 'admin/categories';
-        $this->aIndex      = 'categories';
-
         $form = [
             'action' => $this->c->Router->link('AdminCategories'),
             'hidden' => [
@@ -72,7 +69,6 @@ class Categories extends Admin
 
         $fieldset = [];
         foreach ($this->c->categories->getList() as $key => $row) {
-
             $fieldset["form[{$key}][cat_name]"] = [
                 'dl'        => 'name',
                 'type'      => 'text',
@@ -89,7 +85,13 @@ class Categories extends Admin
                 'value' => $row['disp_position'],
                 'title' => \ForkBB\__('Category position label'),
             ];
-
+            $fieldset[] = [
+                'dl'    => 'delete',
+                'type'  => 'btn',
+                'value' => '❌',
+                'title' => \ForkBB\__('Delete'),
+                'link'  => $this->c->Router->link('AdminCategoriesDelete', ['id' => $key]),
+            ];
         }
         $fieldset['new'] = [
             'dl'        => 'new',
@@ -103,7 +105,106 @@ class Categories extends Admin
             'fields' => $fieldset,
         ];
 
-        $this->formUpdate = $form;
+        $this->nameTpl   = 'admin/form';
+        $this->aIndex    = 'categories';
+        $this->titles    = \ForkBB\__('Categories');
+        $this->form      = $form;
+        $this->classForm = 'editcategories';
+        $this->titleForm = \ForkBB\__('Categories');
+
+        return $this;
+    }
+
+    /**
+     * Удаление категорий
+     *
+     * @param array $args
+     * @param string $method
+     *
+     * @return Page
+     */
+    public function delete(array $args, $method)
+    {
+        $category = $this->c->categories->get((int) $args['id']);
+        if (! $category) {
+            return $this->c->Message->message('Bad request');
+        }
+
+        $this->c->Lang->load('admin_categories');
+
+        if ('POST' === $method) {
+            $v = $this->c->Validator->setRules([
+                'token'     => 'token:AdminCategoriesDelete',
+                'confirm'   => 'integer',
+                'delete'    => 'string',
+                'cancel'    => 'string',
+            ])->setArguments([
+                'token' => $args,
+            ]);
+
+            if (! $v->validation($_POST) || null === $v->delete) {
+                return $this->c->Redirect->page('AdminCategories')->message('Cancel redirect');
+            } elseif ($v->confirm !== 1) {
+                return $this->c->Redirect->page('AdminCategories')->message('No confirm redirect');
+            }
+
+            $this->c->DB->beginTransaction();
+
+            $this->c->categories->delete((int) $args['id']);
+
+            $this->c->DB->commit();
+
+            $this->c->Cache->delete('forums_mark'); //????
+
+            return $this->c->Redirect->page('AdminCategories')->message('Category deleted redirect');
+        }
+
+        $form = [
+            'action' => $this->c->Router->link('AdminCategoriesDelete', $args),
+            'hidden' => [
+                'token' => $this->c->Csrf->create('AdminCategoriesDelete', $args),
+            ],
+            'sets'   => [],
+            'btns'   => [
+                'delete'  => [
+                    'type'      => 'submit',
+                    'value'     => \ForkBB\__('Delete category'),
+                    'accesskey' => 'd',
+                ],
+                'cancel'  => [
+                    'type'      => 'submit',
+                    'value'     => \ForkBB\__('Cancel'),
+                ],
+            ],
+        ];
+
+        $form['sets'][] = [
+            'fields' => [
+                'confirm' => [
+                    'title'   => \ForkBB\__('Confirm delete'),
+                    'type'    => 'checkbox',
+                    'label'   => \ForkBB\__('I want to delete this category', $category['cat_name']),
+                    'value'   => '1',
+                    'checked' => false,
+                ],
+            ],
+        ];
+        $form['sets'][] = [
+            'info' => [
+                'info1' => [
+                    'type'  => '', //????
+                    'value' => \ForkBB\__('Delete category warn'),
+                    'html'  => true,
+                ],
+            ],
+        ];
+
+        $this->nameTpl   = 'admin/form';
+        $this->aIndex    = 'categories';
+        $this->titles    = \ForkBB\__('Delete category head');
+        $this->form      = $form;
+        $this->classForm = 'deletecategory';
+        $this->titleForm = \ForkBB\__('Delete category head');
 
         return $this;
     }

+ 9 - 6
app/Models/Pages/Admin/Groups.php

@@ -35,10 +35,11 @@ class Groups extends Admin
                 $groupsDefault[$key] = $group->g_title;
             }
         }
+
+        $this->aIndex        = 'groups';
         $this->groupsList    = $groupsList;
         $this->groupsNew     = $groupsNew;
         $this->groupsDefault = $groupsDefault;
-        $this->aIndex        = 'groups';
     }
 
     /**
@@ -49,6 +50,7 @@ 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' => [
@@ -122,7 +124,7 @@ class Groups extends Admin
         }
         $this->c->config->o_default_user_group = $v->defaultgroup;
         $this->c->config->save();
-        return $this->c->Redirect->page('AdminGroups')->message(\ForkBB\__('Default group redirect'));
+        return $this->c->Redirect->page('AdminGroups')->message('Default group redirect');
     }
 
     /**
@@ -613,9 +615,9 @@ class Groups extends Admin
             ]);
 
             if (! $v->validation($_POST) || null === $v->delete) {
-                return $this->c->Redirect->page('AdminGroups')->message(\ForkBB\__('Cancel redirect'));
+                return $this->c->Redirect->page('AdminGroups')->message('Cancel redirect');
             } elseif ($v->confirm !== 1) {
-                return $this->c->Redirect->page('AdminGroups')->message(\ForkBB\__('No confirm redirect'));
+                return $this->c->Redirect->page('AdminGroups')->message('No confirm redirect');
             }
 
             $this->c->DB->beginTransaction();
@@ -628,7 +630,7 @@ class Groups extends Admin
 
             $this->c->DB->commit();
 
-            return $this->c->Redirect->page('AdminGroups')->message(\ForkBB\__('Group removed redirect'));
+            return $this->c->Redirect->page('AdminGroups')->message('Group removed redirect');
         }
 
         $form = [
@@ -680,15 +682,16 @@ class Groups extends Admin
                 'info1' => [
                     'type'  => '', //????
                     'value' => \ForkBB\__('Confirm delete warn'),
+                    'html'  => true,
                 ],
             ],
         ];
 
         $this->nameTpl   = 'admin/form';
         $this->titles    = \ForkBB\__('Group delete');
+        $this->form      = $form;
         $this->titleForm = \ForkBB\__('Group delete');
         $this->classForm = 'deletegroup';
-        $this->form      = $form;
 
         return $this;
     }

+ 2 - 1
app/Models/Pages/Admin/Options.php

@@ -108,7 +108,7 @@ class Options extends Admin
             if ($valid) {
                 $config->save();
                 
-                return $this->c->Redirect->page('AdminOptions')->message(\ForkBB\__('Options updated redirect'));
+                return $this->c->Redirect->page('AdminOptions')->message('Options updated redirect');
             }
     
             $this->fIswev  = $v->getErrors();
@@ -116,6 +116,7 @@ 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';

+ 2 - 1
app/Models/Pages/Admin/Permissions.php

@@ -52,7 +52,7 @@ class Permissions extends Admin
             if ($valid) {
                 $config->save();
                 
-                return $this->c->Redirect->page('AdminPermissions')->message(\ForkBB\__('Perms updated redirect'));
+                return $this->c->Redirect->page('AdminPermissions')->message('Perms updated redirect');
             }
     
             $this->fIswev  = $v->getErrors();
@@ -60,6 +60,7 @@ 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';

+ 3 - 3
app/Models/Pages/Auth.php

@@ -25,7 +25,7 @@ class Auth extends Page
     public function logout($args)
     {
         if (empty($args['token']) || ! $this->c->Csrf->verify($args['token'], 'Logout', $args)) {
-            return $this->c->Redirect->page('Index')->message(\ForkBB\__('Bad token'));
+            return $this->c->Redirect->page('Index')->message('Bad token');
         }
 
         $this->c->Cookie->deleteUser();
@@ -33,7 +33,7 @@ class Auth extends Page
         $this->c->users->updateLastVisit($this->c->user);
 
         $this->c->Lang->load('auth');
-        return $this->c->Redirect->page('Index')->message(\ForkBB\__('Logout redirect'));
+        return $this->c->Redirect->page('Index')->message('Logout redirect');
     }
 
     /**
@@ -93,7 +93,7 @@ class Auth extends Page
         ]);
 
         if ($v->validation($_POST)) {
-            return $this->c->Redirect->url($v->redirect)->message(\ForkBB\__('Login redirect'));
+            return $this->c->Redirect->url($v->redirect)->message('Login redirect');
         } else {
             $this->fIswev = $v->getErrors();
             return $this->login([

+ 4 - 4
app/Models/Pages/Delete.php

@@ -40,18 +40,18 @@ class Delete extends Page
             ]);
     
             if (! $v->validation($_POST) || null === $v->delete) {
-                return $this->c->Redirect->page('ViewPost', $args)->message(\ForkBB\__('Cancel redirect'));
+                return $this->c->Redirect->page('ViewPost', $args)->message('Cancel redirect');
             } elseif ($v->confirm !== 1) {
-                return $this->c->Redirect->page('ViewPost', $args)->message(\ForkBB\__('No confirm redirect'));
+                return $this->c->Redirect->page('ViewPost', $args)->message('No confirm redirect');
             }
     
             $this->c->DB->beginTransaction();
     
             if ($deleteTopic) {
-                $redirect = $this->c->Redirect->page('Forum', ['id' => $topic->forum_id])->message(\ForkBB\__('Topic del redirect'));
+                $redirect = $this->c->Redirect->page('Forum', ['id' => $topic->forum_id])->message('Topic del redirect');
                 $this->c->topics->delete($topic);
             } else {
-                $redirect = $this->c->Redirect->page('ViewPost', ['id' => $this->c->posts->previousPost($post)])->message(\ForkBB\__('Post del redirect'));
+                $redirect = $this->c->Redirect->page('ViewPost', ['id' => $this->c->posts->previousPost($post)])->message('Post del redirect');
                 $this->c->posts->delete($post);
             }
     

+ 1 - 1
app/Models/Pages/Edit.php

@@ -148,6 +148,6 @@ class Edit extends Page
         
         return $this->c->Redirect
             ->page('ViewPost', ['id' => $post->id])
-            ->message(\ForkBB\__('Edit redirect'));
+            ->message('Edit redirect');
     }
 }

+ 1 - 1
app/Models/Pages/Post.php

@@ -227,6 +227,6 @@ class Post extends Page
         
         return $this->c->Redirect
             ->page('ViewPost', ['id' => $merge ? $lastPost->id : $post->id])
-            ->message(\ForkBB\__('Post redirect'));
+            ->message('Post redirect');
     }
 }

+ 1 - 1
app/Models/Pages/Redirect.php

@@ -60,7 +60,7 @@ class Redirect extends Page
         $this->nameTpl = 'layouts/redirect';
         $this->titles  = \ForkBB\__('Redirecting');
         $this->robots  = 'noindex';
-        $this->message = $message;
+        $this->message = \ForkBB\__($message);
         $this->timeout = (int) $this->c->config->o_redirect_delay;  //???? перенести в заголовки?
 
         return $this;

+ 1 - 1
app/Models/Pages/Register.php

@@ -44,7 +44,7 @@ class Register extends Page
 
         // нет согласия с правилами
         if (isset($this->fIswev['cancel'])) {
-            return $this->c->Redirect->page('Index')->message(\ForkBB\__('Reg cancel redirect'));
+            return $this->c->Redirect->page('Index')->message('Reg cancel redirect');
         }
 
         $this->fIndex     = 'register';

+ 9 - 9
app/lang/English/admin_categories.po

@@ -24,14 +24,14 @@ msgstr "Category deleted. Redirecting …"
 msgid "Delete category head"
 msgstr "Delete category (together with all forums and posts it contains)"
 
-msgid "Confirm delete subhead"
-msgstr "Confirm delete category"
+msgid "Confirm delete"
+msgstr "Delete category?"
 
-msgid "Confirm delete info"
-msgstr "Are you sure that you want to delete the category <b>%s</b>?"
+msgid "I want to delete this category"
+msgstr "Yes, I want to delete the category <b>%s</b>"
 
 msgid "Delete category warn"
-msgstr "<b>WARNING!</b> Deleting a category will delete all forums and posts (if any) in this category!"
+msgstr "<b>WARNING!</b> Deleting a category will delete all forums, topics and posts (if any) in this category!"
 
 msgid "Must enter integer message"
 msgstr "Position must be a positive integer value."
@@ -54,14 +54,14 @@ msgstr "Add new"
 msgid "Add category help"
 msgstr "The name of the new category you want to add. You can edit the name of the category later. Go to <a href="%1$s">%2$s</a> to add forums to your new category."
 
-msgid "Delete categories head"
-msgstr "Delete categories"
+msgid "Delete category head"
+msgstr "Delete category"
 
 msgid "Delete categories subhead"
 msgstr "Delete categories"
 
-msgid "Delete category label"
-msgstr "Delete a category"
+msgid "Delete category"
+msgstr "Delete category"
 
 msgid "Delete category help"
 msgstr "Select the name of the category you want to delete. You will be asked to confirm your choice of category for deletion before it is deleted."

+ 1 - 1
app/lang/English/admin_groups.po

@@ -79,7 +79,7 @@ msgid "Confirm delete"
 msgstr "Delete group?"
 
 msgid "Confirm delete warn"
-msgstr "WARNING! After you deleted a group you cannot restore it."
+msgstr "<b>WARNING!</b> After you deleted a group you cannot restore it."
 
 msgid "Delete group head"
 msgstr "Delete group"

+ 7 - 7
app/lang/Russian/admin_categories.po

@@ -24,11 +24,11 @@ msgstr "Категория удалена. Переадресация …"
 msgid "Delete category head"
 msgstr "Удаление категории (вместе со всеми разделами и темами в ней)"
 
-msgid "Confirm delete subhead"
-msgstr "Подтверждение удаления категории"
+msgid "Confirm delete"
+msgstr "Удалить категорию?"
 
-msgid "Confirm delete info"
-msgstr "Вы уверены, что хотите удалить категорию <b>%s</b>?"
+msgid "I want to delete this category"
+msgstr "Да, я хочу удалить категорию <b>%s</b>"
 
 msgid "Delete category warn"
 msgstr "<b>ВНИМАНИЕ!</b> Удаляя категорию вы удалите все разделы, темы и сообщения относящиеся к ней (если таковые имеются)!"
@@ -54,13 +54,13 @@ msgstr "Добавить"
 msgid "Add category help"
 msgstr "Имя для новой категории. Вы сможете изменить имя категории позже. Перейдите в <a href="%1$s">%2$s</a>, чтобы добавить разделы в новую категорию."
 
-msgid "Delete categories head"
-msgstr "Удаление категорий"
+msgid "Delete category head"
+msgstr "Удаление категории"
 
 msgid "Delete categories subhead"
 msgstr "Удаление категорий"
 
-msgid "Delete category label"
+msgid "Delete category"
 msgstr "Удалить категорию"
 
 msgid "Delete category help"

+ 1 - 1
app/lang/Russian/admin_groups.po

@@ -79,7 +79,7 @@ msgid "Confirm delete"
 msgstr "Удалить группу?"
 
 msgid "Confirm delete warn"
-msgstr "ВНИМАНИЕ! Удалённую группу невозможно восстановить."
+msgstr "<b>ВНИМАНИЕ!</b> Удалённую группу невозможно восстановить."
 
 msgid "Delete group head"
 msgstr "Удалить группу"

+ 0 - 12
app/templates/admin/categories.tpl

@@ -1,12 +0,0 @@
-@section ('updown')
-<a href="">UP</a> <a href="">DOWN</a>
-@endsection
-@extends ('layouts/admin')
-      <section class="f-admin f-updatecategories-form">
-        <h2>{!! __('Edit categories head') !!}</h2>
-        <div class="f-fdiv">
-@if ($form = $p->formUpdate)
-  @include ('layouts/form')
-@endif
-        </div>
-      </section>

+ 17 - 17
app/templates/admin/groups.tpl

@@ -1,22 +1,6 @@
 @extends ('layouts/admin')
-      <section class="f-admin">
-        <h2>{!! __('Add group subhead') !!}</h2>
-        <div class="f-fdiv">
-@if ($form = $p->formNew)
-  @include ('layouts/form')
-@endif
-        </div>
-      </section>
-      <section class="f-admin">
-        <h2>{!! __('Default group subhead') !!}</h2>
-        <div class="f-fdiv">
-@if ($form = $p->formDefault)
-  @include ('layouts/form')
-@endif
-        </div>
-      </section>
       <section class="f-admin f-grlist">
-        <h2>{!! __('Edit groups subhead') !!}</h2>
+        <h2>{!! __('User groups') !!}</h2>
         <div>
           <fieldset>
             <p>{!! __('Edit groups info') !!}</p>
@@ -33,3 +17,19 @@
           </fieldset>
         </div>
       </section>
+      <section class="f-admin">
+        <h2>{!! __('Default group subhead') !!}</h2>
+        <div class="f-fdiv">
+@if ($form = $p->formDefault)
+  @include ('layouts/form')
+@endif
+        </div>
+      </section>
+      <section class="f-admin">
+        <h2>{!! __('Add group subhead') !!}</h2>
+        <div class="f-fdiv">
+@if ($form = $p->formNew)
+  @include ('layouts/form')
+@endif
+        </div>
+      </section>

+ 8 - 6
app/templates/layouts/form.tpl

@@ -20,9 +20,11 @@
     @endif
     @foreach ($set['fields'] as $key => $cur)
             <dl @if (isset($cur['dl'])) class="f-field-{{ $cur['dl'] }}" @endif>
-              <dt> @if (isset($cur['title']))<label class="f-child1 @if (isset($cur['required'])) f-req @endif" for="id-{{ $key }}">{!! $cur['title'] !!}</label> @endif</dt>
+              <dt> @if (isset($cur['title']))<label class="f-child1 @if (isset($cur['required'])) f-req @endif" @if (is_string($key)) for="id-{{ $key }}" @endif>{!! $cur['title'] !!}</label> @endif</dt>
               <dd>
-      @if ('textarea' === $cur['type'])
+      @if ('text' === $cur['type'])
+                <input @if (isset($cur['required'])) required @endif @if (isset($cur['autofocus'])) autofocus @endif class="f-ctrl" id="id-{{ $key }}" name="{{ $key }}" type="text" @if (! empty($cur['maxlength'])) maxlength="{{ $cur['maxlength'] }}" @endif @if (isset($cur['pattern'])) pattern="{{ $cur['pattern'] }}" @endif @if (isset($cur['value'])) value="{{ $cur['value'] }}" @endif>
+      @elseif ('textarea' === $cur['type'])
                 <textarea @if (isset($cur['required'])) required @endif @if (isset($cur['autofocus'])) autofocus @endif class="f-ctrl" id="id-{{ $key }}" name="{{ $key }}">{{ $cur['value'] or '' }}</textarea>
         @if (isset($cur['bb']))
                 <ul class="f-child5">
@@ -37,10 +39,6 @@
                   <option value="{{ $v }}" @if ($v == $cur['value']) selected @endif>{{ $n }}</option>
         @endforeach
                 </select>
-      @elseif ('text' === $cur['type'])
-                <input @if (isset($cur['required'])) required @endif @if (isset($cur['autofocus'])) autofocus @endif class="f-ctrl" id="id-{{ $key }}" name="{{ $key }}" type="text" @if (! empty($cur['maxlength'])) maxlength="{{ $cur['maxlength'] }}" @endif @if (isset($cur['pattern'])) pattern="{{ $cur['pattern'] }}" @endif @if (isset($cur['value'])) value="{{ $cur['value'] }}" @endif>
-      @elseif ('password' === $cur['type'])
-                <input @if (isset($cur['required'])) required @endif @if (isset($cur['autofocus'])) autofocus @endif class="f-ctrl" id="id-{{ $key }}" name="{{ $key }}" type="password" @if (! empty($cur['maxlength'])) maxlength="{{ $cur['maxlength'] }}" @endif @if (isset($cur['pattern'])) pattern="{{ $cur['pattern'] }}" @endif @if (isset($cur['value'])) value="{{ $cur['value'] }}" @endif>
       @elseif ('number' === $cur['type'])
                 <input @if (isset($cur['required'])) required @endif @if (isset($cur['autofocus'])) autofocus @endif class="f-ctrl" id="id-{{ $key }}" name="{{ $key }}" type="number" min="{{ $cur['min'] }}" max="{{ $cur['max'] }}" @if (isset($cur['value'])) value="{{ $cur['value'] }}" @endif>
       @elseif ('checkbox' === $cur['type'])
@@ -49,6 +47,10 @@
         @foreach ($cur['values'] as $v => $n)
                 <label class="f-label"><input @if (isset($cur['autofocus'])) autofocus @endif type="radio" id="id-{{ $key }}-{{ $v }}" name="{{ $key }}" value="{{ $v }}" @if ($v == $cur['value']) checked @endif>{{ $n }}</label>
         @endforeach
+      @elseif ('password' === $cur['type'])
+                <input @if (isset($cur['required'])) required @endif @if (isset($cur['autofocus'])) autofocus @endif class="f-ctrl" id="id-{{ $key }}" name="{{ $key }}" type="password" @if (! empty($cur['maxlength'])) maxlength="{{ $cur['maxlength'] }}" @endif @if (isset($cur['pattern'])) pattern="{{ $cur['pattern'] }}" @endif @if (isset($cur['value'])) value="{{ $cur['value'] }}" @endif>
+      @elseif ('btn' === $cur['type'])
+                <a class="f-btn" href="{!! $cur['link'] !!}">{{ $cur['value'] }}</a>
       @endif
       @if (isset($cur['info']))
                 <p class="f-child4">{!! $cur['info'] !!}</p>

+ 32 - 16
public/style/ForkBB/style.css

@@ -105,8 +105,8 @@ h3 {
   font-size: 1rem;
 }
 
-.f-header h1, 
-.f-category h2, 
+.f-header h1,
+.f-category h2,
 .f-category h3 {
   font-family: "Segoe Print", "Flow Ext";
 }
@@ -431,6 +431,7 @@ select {
 
 .f-fdiv .f-ctrl,
 .f-fdiv .f-btn {
+  line-height: 1.125rem;
   padding: 0.5rem;
   font-size: 1rem;
   display: block;
@@ -532,7 +533,7 @@ select {
 }
 
 .f-ctrl:focus {
-  box-shadow: inset 0 0 0.5rem 0 rgba(170,121,57,0.75), 0 0 0.5rem 0 rgba(170,121,57,0.75); 
+  box-shadow: inset 0 0 0.5rem 0 rgba(170,121,57,0.75), 0 0 0.5rem 0 rgba(170,121,57,0.75);
 }
 
 .f-ctrl + .f-fhint {
@@ -548,7 +549,7 @@ select {
 .f-ctrl:active + .f-fhint {
 /*  margin-top: 0.3125rem; */
 /*  margin-bottom: -0.625rem; */
-  
+
   max-height: 10rem;
 }
 
@@ -1533,7 +1534,8 @@ li + li .f-btn {
 }
 
 .f-post-form .f-btn,
-.f-deletegroup-form .f-btn {
+.f-deletegroup-form .f-btn,
+.f-deletecategory-form .f-btn {
   width: auto;
   display: inline;
 }
@@ -1558,39 +1560,53 @@ li + li .f-btn {
     float: left;
     padding-left: 0.3125rem;
   }
-}  
+}
 
 /*********************/
 /* Админка/Категории */
 /*********************/
 
-.f-updatecategories-form dt {
+.f-editcategories-form dt {
   display: none;
 }
 
-.f-updatecategories-form dd {
+.f-editcategories-form dd {
   padding-left: 0;
 }
 
-.f-updatecategories-form .f-field-name {
+.f-editcategories-form .f-field-name {
+  float: left;
+  width: calc(100% - 8rem);
+}
+
+.f-editcategories-form .f-field-position {
+  padding-left: 0.625rem;
   float: left;
-  width: 70%;
+  width: 5rem;
 }
 
-.f-updatecategories-form .f-field-position {
+.f-editcategories-form .f-field-delete {
   padding-left: 0.625rem;
   float: left;
-  width: 30%;
+  width: 3rem;
+  overflow: hidden;
 }
 
-.f-updatecategories-form dl:first-child dt,
-.f-updatecategories-form dl:nth-child(2) dt,
-.f-updatecategories-form dl:last-child dt {
+.f-editcategories-form .f-field-delete .f-btn {
+  margin: 0;
+  text-align: center;
+}
+
+.f-editcategories-form dl:first-child dt,
+.f-editcategories-form dl:nth-child(2) dt,
+.f-editcategories-form dl:nth-child(3) dt,
+.f-editcategories-form dl:last-child dt {
   display: block;
   width: 100%;
   overflow: hidden;
+  float: none;
 }
 
-.f-updatecategories-form .f-child1 {
+.f-editcategories-form .f-child1 {
   font-weight: normal;
 }