Merge branch 'lalka2016:avatarxd2' into avatarxd2

This commit is contained in:
Dmitry Tretyakov 2023-04-25 13:44:37 +07:00 committed by GitHub
commit 40d30a918f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 38 additions and 3 deletions

View file

@ -250,7 +250,40 @@ final class GroupPresenter extends OpenVKPresenter
$this->flash("succ", "Изменения сохранены", "Новые данные появятся в вашей группе."); $this->flash("succ", "Изменения сохранены", "Новые данные появятся в вашей группе.");
} }
} }
function renderEditAvatar(int $id)
{
$this->assertUserLoggedIn();
$this->willExecuteWriteAction();
$club = $this->clubs->get($id);
if(!$club ||!$club->canBeModifiedBy($this->user->identity))
{
$this->flashFail("err", "Неизвестная ошибка", "Не удалось сохранить фотографию.");
}
if($_FILES["ava"]["error"] === UPLOAD_ERR_OK) {
$photo = new Photo;
try {
$anon = OPENVK_ROOT_CONF["openvk"]["preferences"]["wall"]["anonymousPosting"]["enable"];
if($anon && $this->user->id === $club->getOwner()->getId())
$anon = $club->isOwnerHidden();
else if($anon)
$anon = $club->getManager($this->user->identity)->isHidden();
$photo->setOwner($this->user->id);
$photo->setDescription("Group image");
$photo->setFile($_FILES["ava"]);
$photo->setCreated(time());
$photo->setAnonymous($anon);
$photo->save();
(new Albums)->getClubAvatarAlbum($club)->addPhoto($photo);
} catch(ISE $ex) {
$name = $album->getName();
$this->flashFail("err", "Неизвестная ошибка", "Не удалось сохранить фотографию.");
}
}
$this->flash("succ", "Фотография сохранена", "Новые данные появятся в вашей группе.");
$this->redirect("/club$id");
}
function renderEditBackdrop(int $id): void function renderEditBackdrop(int $id): void
{ {
$this->assertUserLoggedIn(); $this->assertUserLoggedIn();

View file

@ -118,8 +118,8 @@
<a id="_avatarDelete" href="/photo{$club->getAvatarPhoto()->getPrettyId()}/delete"> <a id="_avatarDelete" href="/photo{$club->getAvatarPhoto()->getPrettyId()}/delete">
<img id="deleteButton" src="/assets/packages/static/openvk/img/delete.png" style="opacity:0;"></a> <img id="deleteButton" src="/assets/packages/static/openvk/img/delete.png" style="opacity:0;"></a>
<ul id="groupAvatarChange"> <ul id="groupAvatarChange">
<li id="ff"> <li>
<img src="/assets/packages/static/openvk/img/upload.png" id="_newAvatarPicture2"><a href="/club{$club->getId()}/edit" id="_newAvatarPicture" style="color:#B2B2B2;" onmouseover="_newAvatarPicture.style.color = '#D9D9D9';" onmouseleave="_newAvatarPicture.style.color = '#B2B2B2';"> {tr("new_photo")}</a> <img src="/assets/packages/static/openvk/img/upload.png" id="_newAvatarPicture2"><a href="/club{$club->getId()}/al_avatars" id="_newAvatarPicture" style="color:#B2B2B2;" onmouseover="_newAvatarPicture.style.color = '#D9D9D9';" onmouseleave="_newAvatarPicture.style.color = '#B2B2B2';"> {tr("new_photo")}</a>
</li> </li>
<!--<li><img src="/assets/packages/static/openvk/img/miniature.png"><a href="javascript:alert('')" id="_changeMiniature" style="color:#B2B2B2;" onmouseover="_changeMiniature.style.color = '#D9D9D9';" onmouseleave="_changeMiniature.style.color = '#B2B2B2';">{tr("change_miniature")}</a></li>--> <!--<li><img src="/assets/packages/static/openvk/img/miniature.png"><a href="javascript:alert('')" id="_changeMiniature" style="color:#B2B2B2;" onmouseover="_changeMiniature.style.color = '#D9D9D9';" onmouseleave="_changeMiniature.style.color = '#B2B2B2';">{tr("change_miniature")}</a></li>-->
</ul> </ul>

View file

@ -199,6 +199,8 @@ routes:
handler: "Group->admin" handler: "Group->admin"
- url: "/club{num}/setAdmin" - url: "/club{num}/setAdmin"
handler: "Group->modifyAdmin" handler: "Group->modifyAdmin"
- url: "/club{num}/al_avatars"
handler: "Group->editAvatar"
- url: "/groups{num}" - url: "/groups{num}"
handler: "User->groups" handler: "User->groups"
- url: "/groups_pin" - url: "/groups_pin"

Binary file not shown.

Before

Width:  |  Height:  |  Size: 211 B

After

Width:  |  Height:  |  Size: 257 B