From df3bc9f90daae9550d235c7959046c77ca643572 Mon Sep 17 00:00:00 2001 From: makar0nny <99399973+lalka2016@users.noreply.github.com> Date: Tue, 25 Apr 2023 09:23:38 +0300 Subject: [PATCH] some updates MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Теперь нету редиректа в настройки группы при смене аватарки --- Web/Presenters/GroupPresenter.php | 35 +++++++++++++++++++++++- Web/Presenters/templates/Group/View.xml | 4 +-- Web/routes.yml | 2 ++ Web/static/css/avataredit.css | 31 ++++++++++++++++++--- Web/static/img/upload.png | Bin 211 -> 257 bytes 5 files changed, 65 insertions(+), 7 deletions(-) diff --git a/Web/Presenters/GroupPresenter.php b/Web/Presenters/GroupPresenter.php index a0b83a59..2933ecda 100644 --- a/Web/Presenters/GroupPresenter.php +++ b/Web/Presenters/GroupPresenter.php @@ -250,7 +250,40 @@ final class GroupPresenter extends OpenVKPresenter $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 { $this->assertUserLoggedIn(); diff --git a/Web/Presenters/templates/Group/View.xml b/Web/Presenters/templates/Group/View.xml index bc10caba..219b751e 100644 --- a/Web/Presenters/templates/Group/View.xml +++ b/Web/Presenters/templates/Group/View.xml @@ -118,8 +118,8 @@ diff --git a/Web/routes.yml b/Web/routes.yml index 0dffb7bf..5a8c4f27 100644 --- a/Web/routes.yml +++ b/Web/routes.yml @@ -199,6 +199,8 @@ routes: handler: "Group->admin" - url: "/club{num}/setAdmin" handler: "Group->modifyAdmin" + - url: "/club{num}/al_avatars" + handler: "Group->editAvatar" - url: "/groups{num}" handler: "User->groups" - url: "/groups_pin" diff --git a/Web/static/css/avataredit.css b/Web/static/css/avataredit.css index 9f9c6a52..df10bebc 100644 --- a/Web/static/css/avataredit.css +++ b/Web/static/css/avataredit.css @@ -1,4 +1,4 @@ -/*avatar controls idk*/ +/*avatar controls*/ #avatarEdit { position: relative; @@ -17,6 +17,12 @@ { opacity:0; } +#avatarChange, #_avatarDelete, #groupAvatarChange { + -webkit-transition: all 200ms ease-in-out; + -moz-transition: all 200ms ease-in-out; + -o-transition: all 200ms ease-in-out; + transition: all 200ms ease-in-out; +} #avatarChange { position:absolute; @@ -28,6 +34,10 @@ padding-bottom:10px; opacity:0%; } +div#avatarAll:hover #avatarChange { + opacity: 1 !important; + visibility: visible; +} #uploadIcon { position:absolute; @@ -38,11 +48,20 @@ { color:#B2B2B2; } +#_newPicture:hover +{ + color: #D9D9D9; +} .newpict { position:absolute; - margin-left:0; - margin-right:0; + text-align:center; + left:20%; + top:75%; +} +.newpict:hover +{ + color:#5680a0; } #groupAvatarChange { @@ -60,4 +79,8 @@ position:absolute; left:0; margin-left:20px; -} \ No newline at end of file +} +#_newAvatarPicture:hover +{ + color:#D9D9D9; +} diff --git a/Web/static/img/upload.png b/Web/static/img/upload.png index e6280bc409ed82f60e09ba741372d77cfbe9ab7c..033009d2ae19ea404c6c1ecf3349f82919392f2c 100644 GIT binary patch delta 192 zcmV;x06+iJ0f7RLNq-Ok01FTSts}j40001%Nkl#@`6HJ5nZ~)f{G{qT6?F3?GumA-71!8xg zbM}HbV8uX%azN?~5Q~ENXy7#vn*cRDVgxGW0CEliu_;If2RS$m#C9MzPX=Oq3PAuQ uKN;E0|Dj9_0CWOa9eQZs1%pB{0|Nl}?jkA&l8|!%0000