Groups: Add group creator display options (#270 from maksalees)

This commit is contained in:
Vladimir Barinov 2021-11-05 13:49:33 +03:00 committed by GitHub
commit a4f3970ad0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 39 additions and 2 deletions

View file

@ -110,6 +110,11 @@ class Club extends RowModel
return $this->getRecord()->closed; return $this->getRecord()->closed;
} }
function getAdministratorsListDisplay(): int
{
return $this->getRecord()->administrators_list_display;
}
function getType(): int function getType(): int
{ {
return $this->getRecord()->type; 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->setAbout(empty($this->postParam("about")) ? NULL : $this->postParam("about"));
$club->setShortcode(empty($this->postParam("shortcode")) ? NULL : $this->postParam("shortcode")); $club->setShortcode(empty($this->postParam("shortcode")) ? NULL : $this->postParam("shortcode"));
$club->setWall(empty($this->postParam("wall")) ? 0 : 1); $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) { if($_FILES["ava"]["error"] === UPLOAD_ERR_OK) {
$photo = new Photo; $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} <input type="checkbox" name="wall" value="1" {if $club->canPost()}checked{/if}/> {_group_allow_post_for_everyone}
</td> </td>
</tr> </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> <tr>
<td> <td>

View file

@ -105,7 +105,7 @@
{_"group_type_open"} {_"group_type_open"}
</div> </div>
</div> </div>
<div> <div n:if="$club->getAdministratorsListDisplay() == 0">
<div class="content_title_expanded" onclick="hidePanel(this);"> <div class="content_title_expanded" onclick="hidePanel(this);">
{_"creator"} {_"creator"}
</div> </div>
@ -118,6 +118,26 @@
</ul> </ul>
</div> </div>
</div> </div>
<div n:if="$club->getAdministratorsListDisplay() == 1">
<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()}
<li n:if="$managersCount > 7">
<b>{tr("and_more", $managersCount - 7)}</b>
</li>
</ul>
</div>
</div>
<div n:if="$albumsCount > 0"> <div n:if="$albumsCount > 0">
<div class="content_title_expanded" onclick="hidePanel(this, {$albumsCount});"> <div class="content_title_expanded" onclick="hidePanel(this, {$albumsCount});">
{_"albums"} {_"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