From 8edebcb0d5267109f92d09c346a8f705e9c5bf02 Mon Sep 17 00:00:00 2001 From: Maxim Leshchenko Date: Fri, 17 Dec 2021 18:58:31 +0200 Subject: [PATCH] Users: Add ability to hide custom links by users through settings --- Web/Models/Entities/User.php | 2 ++ Web/Presenters/UserPresenter.php | 1 + Web/Presenters/templates/@layout.xml | 3 ++- Web/Presenters/templates/User/Settings.xml | 10 ++++++++++ locales/en.strings | 2 ++ locales/ru.strings | 4 ++++ 6 files changed, 21 insertions(+), 1 deletion(-) diff --git a/Web/Models/Entities/User.php b/Web/Models/Entities/User.php index dfeabf5d..e0212578 100644 --- a/Web/Models/Entities/User.php +++ b/Web/Models/Entities/User.php @@ -353,6 +353,7 @@ class User extends RowModel "notes", "groups", "news", + "links", ], ])->get($id); } @@ -766,6 +767,7 @@ class User extends RowModel "notes", "groups", "news", + "links", ], ])->set($id, (int) $status)->toInteger(); diff --git a/Web/Presenters/UserPresenter.php b/Web/Presenters/UserPresenter.php index 551976fc..f2d1921a 100644 --- a/Web/Presenters/UserPresenter.php +++ b/Web/Presenters/UserPresenter.php @@ -375,6 +375,7 @@ final class UserPresenter extends OpenVKPresenter "menu_notatoj" => "notes", "menu_grupoj" => "groups", "menu_novajoj" => "news", + "menu_ligiloj" => "links", ]; foreach($settings as $checkbox => $setting) $user->setLeftMenuItemStatus($setting, $this->checkbox($checkbox)); diff --git a/Web/Presenters/templates/@layout.xml b/Web/Presenters/templates/@layout.xml index e868b1f0..a540facb 100644 --- a/Web/Presenters/templates/@layout.xml +++ b/Web/Presenters/templates/@layout.xml @@ -168,7 +168,7 @@ {_"my_settings"} {var canAccessAdminPanel = $thisUser->getChandlerUser()->can("access")->model("admin")->whichBelongsTo(NULL)} {var canAccessHelpdesk = $thisUser->getChandlerUser()->can("write")->model('openvk\Web\Models\Entities\TicketReply')->whichBelongsTo(0)} - {var menuLinksAvaiable = sizeof(OPENVK_ROOT_CONF['openvk']['preferences']['menu']['links']) > 0} + {var menuLinksAvaiable = sizeof(OPENVK_ROOT_CONF['openvk']['preferences']['menu']['links']) > 0 && $thisUser->getLeftMenuItemStatus('links')} {if $canAccessAdminPanel} Админ-панель @@ -181,6 +181,7 @@ {/if} {_my_feed} + + + + + + {_additional_links} + diff --git a/locales/en.strings b/locales/en.strings index 8474074d..06c8da0d 100644 --- a/locales/en.strings +++ b/locales/en.strings @@ -406,6 +406,8 @@ "ui_settings_rating_show" = "Show"; "ui_settings_rating_hide" = "Hide"; +"additional_links" = "Additional links"; + /* Two-factor authentication */ "two_factor_authentication" = "Two-factor authentication"; diff --git a/locales/ru.strings b/locales/ru.strings index cf2c0c4d..7a37653a 100644 --- a/locales/ru.strings +++ b/locales/ru.strings @@ -426,6 +426,10 @@ "ui_settings_rating_show" = "Показывать"; "ui_settings_rating_hide" = "Скрывать"; +"additional_links" = "Дополнительные ссылки"; + +/* Two-factor authentication */ + "two_factor_authentication" = "Двухфакторная аутентификация"; "two_factor_authentication_disabled" = "Обеспечивает надежную защиту от взлома: для входа на страницу необходимо ввести код, полученный в приложении 2FA."; "two_factor_authentication_enabled" = "Двухфакторная аутентификация включена. Ваша страница защищена.";