openvk/Web/Presenters/templates/Wall/Post.xml
lalka2018 97a176c261
Редактирование постов только покруче (#979)
* Add editing posts

* Add checkboxes

* Add ctrl+enter + fix empty posts

* Fix funny bug
2023-09-14 20:54:22 +03:00

70 lines
3 KiB
XML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{extends "../@layout.xml"}
{block title}{_post}{/block}
{block header}
<a href="{$wallOwner->getURL()}">
{$wallOwner->getCanonicalName()}
</a>
»
<a href="/wall{$wallOwner->getId() * ($isWallOfGroup ? -1 : 1)}">
{_wall}
</a>
»
{_post}
{/block}
{block content}
{include "../components/post.xml", post => $post, forceNoCommentsLink => TRUE, forceNoDeleteLink => TRUE}
<hr/>
<div style="float: left; min-height: 100px; width: 68%;">
{include "../components/comments.xml",
comments => $comments,
count => $cCount,
page => $cPage,
model => "posts",
parent => $post }
</div>
<div style="float: left; min-height: 100px; width: 32%;">
<h4>{_actions}</h4>
{if isset($thisUser)}
{var $canDelete = $post->canBeDeletedBy($thisUser)}
{if $thisUser->getId() != $post->getOwner()->getId()}
{var $canReport = true}
{/if}
{/if}
<a n:if="$canDelete ?? false" class="profile_link" style="display:block;width:96%;" href="/wall{$post->getPrettyId()}/delete">{_delete}</a>
<a
n:if="$thisUser->getChandlerUser()->can('access')->model('admin')->whichBelongsTo(NULL) AND $post->getEditTime()"
style="display:block;width:96%;"
class="profile_link"
href="/admin/logs?type=1&obj_type=Post&obj_id={$post->getId()}"
>
{_changes_history}
</a>
<a n:if="$canReport ?? false" class="profile_link" style="display:block;width:96%;" href="javascript:reportPost()">{_report}</a>
</div>
<script n:if="$canReport ?? false">
function reportPost() {
uReportMsgTxt = "Вы собираетесь пожаловаться на данную запись.";
uReportMsgTxt += "<br/>Что именно вам кажется недопустимым в этом материале?";
uReportMsgTxt += "<br/><br/><b>Причина жалобы</b>: <input type='text' id='uReportMsgInput' placeholder='Причина' />"
MessageBox("Пожаловаться?", uReportMsgTxt, ["Подтвердить", "Отмена"], [
(function() {
res = document.querySelector("#uReportMsgInput").value;
xhr = new XMLHttpRequest();
xhr.open("GET", "/report/" + {$post->getId()} + "?reason=" + res + "&type=post", true);
xhr.onload = (function() {
if(xhr.responseText.indexOf("reason") === -1)
MessageBox("Ошибка", "Не удалось подать жалобу...", ["OK"], [Function.noop]);
else
MessageBox("Операция успешна", "Скоро её рассмотрят модераторы", ["OK"], [Function.noop]);
});
xhr.send(null);
}),
Function.noop
]);
}
</script>
{/block}