mirror of
https://github.com/openvk/openvk
synced 2025-07-07 08:19:49 +03:00
"Browse" button redesign
"Browse" button redesign
This commit is contained in:
commit
bd404f76df
6 changed files with 53 additions and 4 deletions
|
@ -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();
|
||||
|
|
|
@ -119,7 +119,7 @@
|
|||
<img id="deleteButton" src="/assets/packages/static/openvk/img/delete.png" style="opacity:0;"></a>
|
||||
<ul id="groupAvatarChange">
|
||||
<li>
|
||||
<img src="/assets/packages/static/openvk/img/upload.png" id="_newAvatarPicture2"><a href="/club{$club->getId()}/edit" id="_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><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>
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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;
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 211 B After Width: | Height: | Size: 257 B |
|
@ -108,9 +108,13 @@ document.addEventListener("DOMContentLoaded", function() { //BEGIN
|
|||
return e.preventDefault();
|
||||
});
|
||||
u("#_newPicture").on("click", function(e) {
|
||||
MessageBox(tr('new_photo'),
|
||||
MessageBox(tr('new_photo'),
|
||||
"<form id='tmpPhDelF' action='" + u(this).attr("href") + "' method='POST' enctype='multipart/form-data'>"+
|
||||
"<div id='tmpdd' style='text-align:center'>"+tr('real_photo')+"<br><br>"+tr('formats')+"<br><br>"+"<input type='file' accept='image/*' name='blob' value='"+tr('select_file')+"'><br><br>"+tr('upload_problems')+"<br></div>"+
|
||||
"<div id='tmpdd' style='text-align:center'>"+tr('formats')+"<br><br>"+
|
||||
"<label class=\"button\" style=\"\">"+tr('browse')+
|
||||
"<input type=\"file\" id=\"blob\" name=\"blob\" style=\"display: none;\" onchange=\"filename.innerHTML=blob.files[0].name\" /></label>"+
|
||||
"<div id=\"filename\" style=\"margin-top: 10px;\"></div>"+
|
||||
"<br><br>"+tr('upload_problems')+"<br></div>"+
|
||||
//"<p><input type='checkbox' name='makeAvatarPost'>"+tr('leave_photo')+"</p>"+
|
||||
"<input type='hidden' name='hash' value='" + u("meta[name=csrf]").attr("value") + "' />"+
|
||||
"</form>", [
|
||||
|
|
Loading…
Reference in a new issue