Users: Add ability to hide custom links by users through settings

This commit is contained in:
Maxim Leshchenko 2021-12-17 18:58:31 +02:00
parent 4dcb62a1d3
commit 8edebcb0d5
No known key found for this signature in database
GPG key ID: BB9C44A8733FBEEE
6 changed files with 21 additions and 1 deletions

View file

@ -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();

View file

@ -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));

View file

@ -168,7 +168,7 @@
<a href="/settings" class="link">{_"my_settings"}</a>
{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')}
<div n:if="$canAccessAdminPanel || $canAccessHelpdesk || $menuLinksAvaiable" class="menu_divider"></div>
{if $canAccessAdminPanel}
<a href="/admin" class="link">Админ-панель</a>
@ -181,6 +181,7 @@
</a>
{/if}
<a
n:if="$thisUser->getLeftMenuItemStatus('links')"
n:foreach="OPENVK_ROOT_CONF['openvk']['preferences']['menu']['links'] as $menuItem"
href="{$menuItem['url']}"
target="_blank"

View file

@ -505,6 +505,16 @@
<td>
<span class="nobold">{_my_feed}</span>
</td>
</tr><tr n:if="sizeof(OPENVK_ROOT_CONF['openvk']['preferences']['menu']['links']) > 0">
<td width="120" valign="top" align="right" align="right">
<input
n:attr="checked => $user->getLeftMenuItemStatus('links')"
type="checkbox"
name="menu_ligiloj" />
</td>
<td>
<span class="nobold">{_additional_links}</span>
</td>
</tr>
<tr>
<td>

View file

@ -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";

View file

@ -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" = "Двухфакторная аутентификация включена. Ваша страница защищена.";