Add group creator display options

This commit allows you to display the list of administrators instead of the group author (maximum 7 administrators, the rest will be hidden) and hide the group author
This commit is contained in:
Maxim Leshchenko 2021-11-05 11:44:50 +02:00
parent 1bb097fea7
commit b15b9643a0
6 changed files with 54 additions and 12 deletions

View file

@ -110,6 +110,11 @@ class Club extends RowModel
return $this->getRecord()->closed;
}
function getAdministratorsListDisplay(): int
{
return $this->getRecord()->administrators_list_display;
}
function getType(): int
{
return $this->getRecord()->type;

View file

@ -150,6 +150,7 @@ final class GroupPresenter extends OpenVKPresenter
$club->setAbout(empty($this->postParam("about")) ? NULL : $this->postParam("about"));
$club->setShortcode(empty($this->postParam("shortcode")) ? NULL : $this->postParam("shortcode"));
$club->setWall(empty($this->postParam("wall")) ? 0 : 1);
$club->setAdministrators_List_Display(empty($this->postParam("administrators_list_display")) ? 0 : $this->postParam("administrators_list_display"));
if($_FILES["ava"]["error"] === UPLOAD_ERR_OK) {
$photo = new Photo;

View file

@ -69,6 +69,16 @@
<input type="checkbox" name="wall" value="1" {if $club->canPost()}checked{/if}/> {_group_allow_post_for_everyone}
</td>
</tr>
<tr>
<td width="120" valign="top">
<span class="nobold">{_group_administrators_list}: </span>
</td>
<td>
<input type="radio" name="administrators_list_display" value="0" {if $club->getAdministratorsListDisplay() == 0}checked{/if}/> {_group_display_only_creator}<br>
<input type="radio" name="administrators_list_display" value="1" {if $club->getAdministratorsListDisplay() == 1}checked{/if}/> {_group_display_all_administrators}<br>
<input type="radio" name="administrators_list_display" value="2" {if $club->getAdministratorsListDisplay() == 2}checked{/if}/> {_group_dont_display_administrators_list}<br>
</td>
</tr>
<tr>
<td>

View file

@ -105,6 +105,7 @@
{_"group_type_open"}
</div>
</div>
{if $club->getAdministratorsListDisplay() == 0}
<div>
<div class="content_title_expanded" onclick="hidePanel(this);">
{_"creator"}
@ -118,6 +119,30 @@
</ul>
</div>
</div>
{elseif $club->getAdministratorsListDisplay() == 1}
<div>
<div class="content_title_expanded" onclick="hidePanel(this);">
{_"administrators"}
</div>
<div style="padding:4px">
{var author = $club->getOwner()}
<ul>
<li>
<a href="{$author->getURL()}"><b>{$author->getCanonicalName()}</b></a>
</li>
<li n:foreach="$club->getManagers(1) as $manager">
<a href="{$manager->getURL()}"><b>{$manager->getCanonicalName()}</b></a>
</li>
{var managersCount = $club->getManagersCount()}
{if $managersCount > 7}
<li>
<b>{tr("and_more", $managersCount - 7)}</b>
</li>
{/if}
</ul>
</div>
</div>
{/if}
<div n:if="$albumsCount > 0">
<div class="content_title_expanded" onclick="hidePanel(this, {$albumsCount});">
{_"albums"}

View file

@ -0,0 +1 @@
ALTER TABLE groups ADD COLUMN administrators_list_display TINYINT(3) UNSIGNED NOT NULL DEFAULT 0;

@ -1 +1 @@
Subproject commit 12998df6df2a28489ba2e65a9f255af115eb83de
Subproject commit c3127e1af00fa19e88acdf1c8ce0ebe74a61d6d4