mirror of
https://github.com/openvk/openvk
synced 2024-12-23 00:51:03 +03:00
* Что я должен здесь сказать? * playerock * Copypaste
This commit is contained in:
parent
97a176c261
commit
06f324f98c
9 changed files with 43 additions and 15 deletions
|
@ -254,6 +254,9 @@ class Post extends Postable
|
||||||
if($this->isDeactivationMessage() || $this->isUpdateAvatarMessage())
|
if($this->isDeactivationMessage() || $this->isUpdateAvatarMessage())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
if($this->getTargetWall() > 0)
|
||||||
|
return $this->getPublicationTime()->timestamp() + WEEK > time();
|
||||||
|
|
||||||
return $user->getId() == $this->getOwner(false)->getId();
|
return $user->getId() == $this->getOwner(false)->getId();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -167,9 +167,9 @@ abstract class Postable extends Attachable
|
||||||
$this->stateChanges("created", time());
|
$this->stateChanges("created", time());
|
||||||
|
|
||||||
$this->stateChanges("virtual_id", $pCount + 1);
|
$this->stateChanges("virtual_id", $pCount + 1);
|
||||||
} else {
|
} /*else {
|
||||||
$this->stateChanges("edited", time());
|
$this->stateChanges("edited", time());
|
||||||
}
|
}*/
|
||||||
|
|
||||||
parent::save();
|
parent::save();
|
||||||
}
|
}
|
||||||
|
|
|
@ -552,6 +552,7 @@ final class WallPresenter extends OpenVKPresenter
|
||||||
"nsfw" => $this->postParam("type") === "post" ? (int)$post->isExplicit() : 0,
|
"nsfw" => $this->postParam("type") === "post" ? (int)$post->isExplicit() : 0,
|
||||||
"from_group" => $this->postParam("type") === "post" && $post->getTargetWall() < 0 ?
|
"from_group" => $this->postParam("type") === "post" && $post->getTargetWall() < 0 ?
|
||||||
((int)$post->isPostedOnBehalfOfGroup()) : "false",
|
((int)$post->isPostedOnBehalfOfGroup()) : "false",
|
||||||
|
"new_text" => $post->getText(false),
|
||||||
"author" => [
|
"author" => [
|
||||||
"name" => $post->getOwner()->getCanonicalName(),
|
"name" => $post->getOwner()->getCanonicalName(),
|
||||||
"avatar" => $post->getOwner()->getAvatarUrl()
|
"avatar" => $post->getOwner()->getAvatarUrl()
|
||||||
|
|
|
@ -2,9 +2,13 @@
|
||||||
{block title}{_upload_photo}{/block}
|
{block title}{_upload_photo}{/block}
|
||||||
|
|
||||||
{block header}
|
{block header}
|
||||||
<a href="{$thisUser->getURL()}">{$thisUser->getCanonicalName()}</a>
|
<a href="{$album->getOwner()->getURL()}">{$album->getOwner()->getCanonicalName()}</a>
|
||||||
»
|
»
|
||||||
<a href="/albums{$thisUser->getId()}">{_albums}</a>
|
{if $album->getOwner() instanceof openvk\Web\Models\Entities\Club}
|
||||||
|
<a href="/albums{$album->getOwner()->getId() * -1}">{_albums}</a>
|
||||||
|
{else}
|
||||||
|
<a href="/albums{$album->getOwner()->getId()}">{_albums}</a>
|
||||||
|
{/if}
|
||||||
»
|
»
|
||||||
<a href="/album{$album->getPrettyId()}">{$album->getName()}</a>
|
<a href="/album{$album->getPrettyId()}">{$album->getName()}</a>
|
||||||
»
|
»
|
||||||
|
@ -23,7 +27,7 @@
|
||||||
|
|
||||||
<input type="file" accept=".jpg,.png,.gif" name="files[]" multiple class="button" id="uploadButton" style="display:none">
|
<input type="file" accept=".jpg,.png,.gif" name="files[]" multiple class="button" id="uploadButton" style="display:none">
|
||||||
|
|
||||||
<div class="container_gray" style="height: 344px;">
|
<div class="container_gray" style="min-height: 344px;">
|
||||||
<div class="insertThere"></div>
|
<div class="insertThere"></div>
|
||||||
<div class="whiteBox" style="display: block;">
|
<div class="whiteBox" style="display: block;">
|
||||||
<div class="boxContent">
|
<div class="boxContent">
|
||||||
|
|
|
@ -8,19 +8,19 @@
|
||||||
<tr>
|
<tr>
|
||||||
<td width="30" valign="top">
|
<td width="30" valign="top">
|
||||||
<a href="{$author->getURL()}">
|
<a href="{$author->getURL()}">
|
||||||
<img src="{$author->getAvatarURL('miniscule')}" width="30" class="cCompactAvatars" />
|
<img src="{$author->getAvatarURL('miniscule')}" width="30" class="cCompactAvatars post-avatar" />
|
||||||
</a>
|
</a>
|
||||||
</td>
|
</td>
|
||||||
<td width="100%" valign="top">
|
<td width="100%" valign="top">
|
||||||
<div class="post-author">
|
<div class="post-author">
|
||||||
<a href="{$author->getURL()}"><b>
|
<a href="{$author->getURL()}"><b class="post-author-name">
|
||||||
{$author->getCanonicalName()}
|
{$author->getCanonicalName()}
|
||||||
</b></a>
|
</b></a>
|
||||||
<img n:if="$author->isVerified()" class="name-checkmark" src="/assets/packages/static/openvk/img/checkmark.png"><br/>
|
<img n:if="$author->isVerified()" class="name-checkmark" src="/assets/packages/static/openvk/img/checkmark.png"><br/>
|
||||||
</div>
|
</div>
|
||||||
<div class="post-content" id="{$comment->getId()}">
|
<div class="post-content" id="{$comment->getId()}">
|
||||||
<div class="text" id="text{$comment->getId()}">
|
<div class="text" id="text{$comment->getId()}">
|
||||||
<span class="really_text">{$comment->getText()|noescape}</span>
|
<span data-text="{$comment->getText(false)}" class="really_text">{$comment->getText()|noescape}</span>
|
||||||
|
|
||||||
<div n:ifcontent class="attachments_b">
|
<div n:ifcontent class="attachments_b">
|
||||||
<div class="attachment" n:foreach="$comment->getChildren() as $attachment" data-localized-nsfw-text="{_nsfw_warning}">
|
<div class="attachment" n:foreach="$comment->getChildren() as $attachment" data-localized-nsfw-text="{_nsfw_warning}">
|
||||||
|
|
|
@ -72,7 +72,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="post-content" id="{$post->getPrettyId()}">
|
<div class="post-content" id="{$post->getPrettyId()}">
|
||||||
<div class="text">
|
<div class="text">
|
||||||
<span class="really_text">{$post->getText()|noescape}</span>
|
<span data-text="{$post->getText(false)}" class="really_text">{$post->getText()|noescape}</span>
|
||||||
|
|
||||||
<div n:ifcontent class="attachments_b">
|
<div n:ifcontent class="attachments_b">
|
||||||
<div class="attachment" n:foreach="$post->getChildren() as $attachment" data-localized-nsfw-text="{_nsfw_warning}">
|
<div class="attachment" n:foreach="$post->getChildren() as $attachment" data-localized-nsfw-text="{_nsfw_warning}">
|
||||||
|
|
|
@ -63,7 +63,7 @@
|
||||||
<div class="text">
|
<div class="text">
|
||||||
{var $owner = $author->getId()}
|
{var $owner = $author->getId()}
|
||||||
|
|
||||||
<span class="really_text">{$post->getText()|noescape}</span>
|
<span data-text="{$post->getText(false)}" class="really_text">{$post->getText()|noescape}</span>
|
||||||
|
|
||||||
<div n:ifcontent class="attachments_b">
|
<div n:ifcontent class="attachments_b">
|
||||||
<div class="attachment" n:foreach="$post->getChildren() as $attachment" data-localized-nsfw-text="{_nsfw_warning}">
|
<div class="attachment" n:foreach="$post->getChildren() as $attachment" data-localized-nsfw-text="{_nsfw_warning}">
|
||||||
|
|
|
@ -6,6 +6,18 @@ $(document).on("change", "#uploadButton", (e) => {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for(const file of e.currentTarget.files) {
|
||||||
|
if(!file.type.startsWith('image/')) {
|
||||||
|
MessageBox(tr("error"), tr("only_images_accepted", escapeHtml(file.name)), [tr("ok")], [() => {Function.noop}])
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(file.size > 5 * 1024 * 1024) {
|
||||||
|
MessageBox(tr("error"), tr("max_filesize", 5), [tr("ok")], [() => {Function.noop}])
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if(document.querySelector(".whiteBox").style.display == "block") {
|
if(document.querySelector(".whiteBox").style.display == "block") {
|
||||||
document.querySelector(".whiteBox").style.display = "none"
|
document.querySelector(".whiteBox").style.display = "none"
|
||||||
document.querySelector(".insertThere").append(document.getElementById("fakeButton"));
|
document.querySelector(".insertThere").append(document.getElementById("fakeButton"));
|
||||||
|
@ -142,23 +154,23 @@ $(document).on("dragover drop", (e) => {
|
||||||
return false;
|
return false;
|
||||||
})
|
})
|
||||||
|
|
||||||
$(document).on("dragover", (e) => {
|
$(".container_gray").on("dragover", (e) => {
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
document.querySelector("#fakeButton").classList.add("dragged")
|
document.querySelector("#fakeButton").classList.add("dragged")
|
||||||
document.querySelector("#fakeButton").value = tr("drag_files_here")
|
document.querySelector("#fakeButton").value = tr("drag_files_here")
|
||||||
})
|
})
|
||||||
|
|
||||||
$(document).on("dragleave", (e) => {
|
$(".container_gray").on("dragleave", (e) => {
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
document.querySelector("#fakeButton").classList.remove("dragged")
|
document.querySelector("#fakeButton").classList.remove("dragged")
|
||||||
document.querySelector("#fakeButton").value = tr("upload_picts")
|
document.querySelector("#fakeButton").value = tr("upload_picts")
|
||||||
})
|
})
|
||||||
|
|
||||||
$("#fakeButton").on("drop", (e) => {
|
$(".container_gray").on("drop", (e) => {
|
||||||
e.originalEvent.dataTransfer.dropEffect = 'move';
|
e.originalEvent.dataTransfer.dropEffect = 'move';
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
|
|
||||||
$(document).trigger("dragleave")
|
$(".container_gray").trigger("dragleave")
|
||||||
|
|
||||||
let files = e.originalEvent.dataTransfer.files
|
let files = e.originalEvent.dataTransfer.files
|
||||||
|
|
||||||
|
@ -177,3 +189,10 @@ $("#fakeButton").on("drop", (e) => {
|
||||||
document.getElementById("uploadButton").files = files
|
document.getElementById("uploadButton").files = files
|
||||||
u("#uploadButton").trigger("change")
|
u("#uploadButton").trigger("change")
|
||||||
})
|
})
|
||||||
|
|
||||||
|
u(".container_gray").on("paste", (e) => {
|
||||||
|
if(e.clipboardData.files.length > 0 && e.clipboardData.files.length < 10) {
|
||||||
|
document.getElementById("uploadButton").files = e.clipboardData.files;
|
||||||
|
u("#uploadButton").trigger("change")
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
|
@ -273,7 +273,7 @@ $(document).on("click", "#editPost", (e) => {
|
||||||
content.insertAdjacentHTML("afterbegin", `
|
content.insertAdjacentHTML("afterbegin", `
|
||||||
<div class="editMenu">
|
<div class="editMenu">
|
||||||
<div id="wall-post-input999">
|
<div id="wall-post-input999">
|
||||||
<textarea id="new_content">${text.innerHTML.replace(/(<([^>]+)>)/gi, '')}</textarea>
|
<textarea id="new_content">${text.dataset.text}</textarea>
|
||||||
<input type="button" class="button" value="${tr("save")}" id="endEditing">
|
<input type="button" class="button" value="${tr("save")}" id="endEditing">
|
||||||
<input type="button" class="button" value="${tr("cancel")}" id="cancelEditing">
|
<input type="button" class="button" value="${tr("cancel")}" id="cancelEditing">
|
||||||
</div>
|
</div>
|
||||||
|
@ -343,6 +343,7 @@ $(document).on("click", "#editPost", (e) => {
|
||||||
|
|
||||||
post.querySelector(".post-avatar").setAttribute("src", result.author.avatar)
|
post.querySelector(".post-avatar").setAttribute("src", result.author.avatar)
|
||||||
post.querySelector(".post-author-name").innerHTML = result.author.name
|
post.querySelector(".post-author-name").innerHTML = result.author.name
|
||||||
|
post.querySelector(".really_text").setAttribute("data-text", result.new_text)
|
||||||
} else {
|
} else {
|
||||||
MessageBox(tr("error"), result.error, [tr("ok")], [Function.noop])
|
MessageBox(tr("error"), result.error, [tr("ok")], [Function.noop])
|
||||||
post.querySelector("#editPost").click()
|
post.querySelector("#editPost").click()
|
||||||
|
|
Loading…
Reference in a new issue