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", "notes",
"groups", "groups",
"news", "news",
"links",
], ],
])->get($id); ])->get($id);
} }
@ -766,6 +767,7 @@ class User extends RowModel
"notes", "notes",
"groups", "groups",
"news", "news",
"links",
], ],
])->set($id, (int) $status)->toInteger(); ])->set($id, (int) $status)->toInteger();

View file

@ -375,6 +375,7 @@ final class UserPresenter extends OpenVKPresenter
"menu_notatoj" => "notes", "menu_notatoj" => "notes",
"menu_grupoj" => "groups", "menu_grupoj" => "groups",
"menu_novajoj" => "news", "menu_novajoj" => "news",
"menu_ligiloj" => "links",
]; ];
foreach($settings as $checkbox => $setting) foreach($settings as $checkbox => $setting)
$user->setLeftMenuItemStatus($setting, $this->checkbox($checkbox)); $user->setLeftMenuItemStatus($setting, $this->checkbox($checkbox));

View file

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

View file

@ -505,6 +505,16 @@
<td> <td>
<span class="nobold">{_my_feed}</span> <span class="nobold">{_my_feed}</span>
</td> </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>
<tr> <tr>
<td> <td>

View file

@ -406,6 +406,8 @@
"ui_settings_rating_show" = "Show"; "ui_settings_rating_show" = "Show";
"ui_settings_rating_hide" = "Hide"; "ui_settings_rating_hide" = "Hide";
"additional_links" = "Additional links";
/* Two-factor authentication */ /* Two-factor authentication */
"two_factor_authentication" = "Two-factor authentication"; "two_factor_authentication" = "Two-factor authentication";

View file

@ -426,6 +426,10 @@
"ui_settings_rating_show" = "Показывать"; "ui_settings_rating_show" = "Показывать";
"ui_settings_rating_hide" = "Скрывать"; "ui_settings_rating_hide" = "Скрывать";
"additional_links" = "Дополнительные ссылки";
/* Two-factor authentication */
"two_factor_authentication" = "Двухфакторная аутентификация"; "two_factor_authentication" = "Двухфакторная аутентификация";
"two_factor_authentication_disabled" = "Обеспечивает надежную защиту от взлома: для входа на страницу необходимо ввести код, полученный в приложении 2FA."; "two_factor_authentication_disabled" = "Обеспечивает надежную защиту от взлома: для входа на страницу необходимо ввести код, полученный в приложении 2FA.";
"two_factor_authentication_enabled" = "Двухфакторная аутентификация включена. Ваша страница защищена."; "two_factor_authentication_enabled" = "Двухфакторная аутентификация включена. Ваша страница защищена.";