Wall: Hotfix - added a embedded version of wall

This commit is contained in:
veselcraft 2021-09-15 21:00:34 +03:00
parent 4ecef2d687
commit 316a369a5e
4 changed files with 73 additions and 24 deletions

View file

@ -39,7 +39,7 @@ final class WallPresenter extends OpenVKPresenter
$this->logPostView($post, $wall);
}
function renderWall(int $user): void
function renderWall(int $user, bool $embedded = false): void
{
if(false)
exit("Ошибка доступа: " . (string) random_int(0, 255));
@ -57,6 +57,7 @@ final class WallPresenter extends OpenVKPresenter
else
$canPost = false;
if ($embedded == true) $this->template->_template = "components/wall.xml";
$this->template->oObj = $owner;
$this->template->owner = $user;
$this->template->canPost = $canPost;
@ -69,9 +70,15 @@ final class WallPresenter extends OpenVKPresenter
"perPage" => OPENVK_DEFAULT_PER_PAGE,
];
$this->logPostsViewed($this->template->posts, $user);
}
function renderWallEmbedded(int $user): void
{
$this->renderWall($user, true);
}
function renderFeed(): void
{
$this->assertUserLoggedIn();

View file

@ -462,7 +462,7 @@
</p>
</div>
{presenter "openvk!Wall->wall", $user->getId()}
{presenter "openvk!Wall->wallEmbedded", $user->getId()}
<script n:if="isset($thisUser) && $thisUser->getChandlerUser()->can('access')->model('admin')->whichBelongsTo(NULL)">
function banUser() {

View file

@ -1,30 +1,70 @@
<div class="content_divider">
<div class="content_title_expanded" onclick="hidePanel(this, {$count});">
<div class="content_title_expanded" onclick="hidePanel(this);">
{_"wall"}
<nobold>
{tr("wall", $count)}
<a href="/wall{$owner}" class="float-right lowercase">{_all_title}</a>
</nobold>
</div>
<div>
<div class="content_subtitle">
{tr("wall", $count)}
<div style="float: right;">
<a onclick="show_write_textarea()">{_'write'}</a>
<div n:if="$canPost" class="content_subtitle">
<div id="write" style="padding: 5px 0;" onfocusin="expand_wall_textarea();">
<form action="/wall{$owner}/makePost" method="post" enctype="multipart/form-data" style="margin:0;">
<textarea id="wall-post-input" placeholder="{_write}" name="text" style="width: 100%;resize: none;" class="small-textarea"></textarea>
<div>
<!-- padding to fix <br/> bug -->
</div>
<div id="post-buttons" style="display: none;">
<div class="post-upload">
Вложение: <span>(unknown)</span>
</div>
<div class="post-opts">
{if !is_null($thisUser) && $owner < 0 && $club->canBeModifiedBy($thisUser)}
<script>
function onWallAsGroupClick(el) {
_display = el.checked ? "block" : "none";
document.querySelector("#forceSignOpt").style.display = _display;
}
</script>
<label>
<input type="checkbox" name="as_group" onchange="onWallAsGroupClick(this)" /> От имени сообщества
</label>
<label id="forceSignOpt" style="display: none;">
<input type="checkbox" name="force_sign" /> Подпись автора
</label>
{/if}
<label>
<input type="checkbox" name="nsfw" /> Содержит NSFW-контент
</label>
</div>
<input type="file" name="_pic_attachment" accept="image/*" style="display:none;" />
<input type="hidden" name="type" value="1" />
<input type="hidden" name="hash" value="{$csrfToken}" />
<br/>
<input type="submit" value="{_'write'}" class="button" />
<div style="float: right;">
<a href="javascript:void(document.querySelector(`input[name=_pic_attachment]`).click());">
{_attach_photo}
</a>
</div>
</div>
</form>
</div>
</div>
<div id="write" style="padding: 8px; display: none;">
<form action="/actions/add_post" method="post">
<textarea name="text" style="width: 100%;"></textarea>
<input type="hidden" name="id" value="{$owner}" />
<input type="hidden" name="type" value="1" />
<div style="float: right;">
<input type="submit" value="{_'write'}" class="button" />
</div>
</form>
</div>
<div class="content">
{foreach $posts->page($__page, 10) as $post}
{include "post.xml", post => $post}
{/foreach}
{include "paginator.xml", page => $__page, bag => $posts}
<div class="content">
{if sizeof($posts) > 0}
{foreach $posts as $post}
<a name="postGarter={$post->getId()}"></a>
{include "../components/post.xml", post => $post}
{/foreach}
{include "../components/paginator.xml", conf => $paginatorConf}
{else}
{_no_posts_abstract}
{/if}
</div>
</div>
</div>

View file

@ -217,6 +217,8 @@ routes:
handler: "VKAPI->tokenLogin"
- url: "/sandbox_cocksex"
handler: "About->sandbox"
- url: "/internal/wall{num}"
handler: "Wall->wallEmbedded"
- url: "/{?shortCode}"
handler: "UnknownTextRouteStrategy->delegate"
placeholders: