[NEW FEATURE] Microblog

Can be enabled in settings
This commit is contained in:
veselcraft 2021-01-04 12:33:25 -05:00
parent b88012b17b
commit 057e6c5c63
10 changed files with 409 additions and 106 deletions

View file

@ -74,6 +74,11 @@ class User extends RowModel
return (bool) $this->getRecord()->milkshake;
}
function hasMicroblogEnabled(): bool
{
return (bool) $this->getRecord()->microblog;
}
function getChandlerGUID(): string
{
return $this->getRecord()->user;

View file

@ -263,6 +263,9 @@ final class UserPresenter extends OpenVKPresenter
if (in_array($this->postParam("rating"), [0, 1]))
$user->setShow_Rating((int) $this->postParam("rating"));
if (in_array($this->postParam("microblog"), [0, 1]))
$user->setMicroblog((int) $this->postParam("microblog"));
}elseif($_GET['act'] === "lMenu") {
$settings = [
"menu_bildoj" => "photos",

View file

@ -40,6 +40,11 @@
{if $thisUser->getStyleAvatar() == 2}
{css "css/avatar.2.css"}
{/if}
{if $thisUser->hasMicroblogEnabled() == 1}
{css "css/microblog.css"}
{/if}
{else}
{css "css/style.css"}
{css "css/dialog.css"}

View file

@ -314,6 +314,17 @@
</select>
</td>
</tr>
<tr>
<td width="120" valign="top">
<span class="nobold">Вид постов</span>
</td>
<td>
<select name="microblog">
<option value="0" {if !$user->hasMicroblogEnabled()}selected{/if}>Старый</option>
<option value="1" {if $user->hasMicroblogEnabled()}selected{/if}>Микроблог</option>
</select>
</td>
</tr>
<tr>
<td>

View file

@ -1,106 +1,7 @@
{var author = $post->getOwner()}
<table border="0" style="font-size: 11px;" n:class="post, $post->isExplicit() ? post-nsfw">
<tbody>
<tr>
<td width="54" valign="top">
<img
src="{$author->getAvatarURL()}"
width="50" />
</td>
<td width="100%" valign="top">
<div class="post-author">
<a href="{$author->getURL()}">
<b>
{$author->getCanonicalName()}
</b>
</a>
{if $author->isVerified()}<img class="name-checkmark" src="/assets/packages/static/openvk/img/checkmark.png">{/if}
{$post->isPostedOnBehalfOfGroup() ? "опубликовали" : ($author->isFemale() ? tr("post_writes_f") : tr("post_writes_m"))}
{if ($onWallOf ?? false) &&!$post->isPostedOnBehalfOfGroup() && $post->getOwnerPost() !== $post->getTargetWall()}
{var wallId = $post->getTargetWall()}
{var wallURL = $wallId > -1 ? "/id$wallId" : "/club" . abs($wallId)}
на
<a href="{$wallURL}">
<b>
{if isset($thisUser) && $thisUser->getId() === $wallId}
вашей
{/if}
стене
{if $wallId < 0}
группы
{/if}
</b>
</a>
{/if}
<br/>
<a href="/wall{$post->getPrettyId()}" class="date">{$post->getPublicationTime()}</a>
</div>
<div class="post-content" id="{$post->getPrettyId()}">
<div class="text" id="text{$post->getPrettyId()}">
{$post->getText()|noescape}
<div n:ifcontent class="attachments_b">
<div class="attachment" n:foreach="$post->getChildren() as $attachment" data-localized-nsfw-text="{_nsfw_warning}">
{include "attachment.xml", attachment => $attachment}
</div>
</div>
</div>
<div n:if="$post->isAd()" style="color:grey;">
<br/>
&nbsp;! Этот пост был размещён за взятку.
</div>
<div n:if="$post->isSigned()" class="post-signature">
{var acutalAuthor = $post->getOwner(false)}
<span>
Автор:
<a href="{$acutalAuthor->getURL()}">
{$acutalAuthor->getCanonicalName()}
</a>
</span>
</div>
</div>
<div n:if="isset($thisUser) &&! ($compact ?? false)" class="post-menu">
{if $post->canBeDeletedBy($thisUser) && !($forceNoDeleteLink ?? false)}
<a href="/wall{$post->getPrettyId()}/delete">{_"delete"}</a>&nbsp;|&nbsp;
{/if}
{if !($forceNoCommentsLink ?? false)}
<a href="/wall{$post->getPrettyId()}#comments">
{if $post->getCommentsCount() > 0}
{_"comments"} (<b>{$post->getCommentsCount()}</b>)
{else}
{_"comments"}
{/if}
</a>
&nbsp;|&nbsp;
{/if}
<a class="post-share-button" href="/wall{$post->getPrettyId()}/repost?hash={rawurlencode($csrfToken)}">
{if $post->getRepostCount() > 0}
{_"share"}
(<b>{$post->getRepostCount()}</b>)
{else}
{_"share"}
{/if}
</a>
<div class="like_wrap">
{var liked = $post->hasLikeFrom($thisUser)}
<a href="/wall{$post->getPrettyId()}/like?hash={rawurlencode($csrfToken)}"
class="post-like-button"
data-liked="{(int) $liked}"
data-likes="{$post->getLikesCount()}">
<div class="heart" style="{if $liked}opacity: 1;{else}opacity: 0.4;{/if}"></div>
<span class="likeCnt">{$post->getLikesCount()}</span>
</a>
</div>
</div>
<div n:if="isset($thisUser) &&! ($compact ?? false)" class="post-menu-s">
<!-- kosfurler -->
</div>
</td>
</tr>
</tbody>
</table>
{ifset $thisUser}
{if $thisUser->hasMicroblogEnabled()}
{include "post/microblogpost.xml", post => $post}
{else}
{include "post/oldpost.xml", post => $post}
{/if}
{/ifset}

View file

@ -0,0 +1,94 @@
{var author = $post->getOwner()}
<table border="0" style="font-size: 11px;" n:class="post, !$compact ? post-divider, $post->isExplicit() ? post-nsfw">
<tbody>
<tr>
<td width="54" valign="top">
<img
src="{$author->getAvatarURL()}"
width="{ifset $compact}25{else}50{/ifset}" />
</td>
<td width="100%" valign="top">
<div class="post-author">
<a href="{$author->getURL()}">
<b>
{$author->getCanonicalName()}
</b>
</a>
{if $author->isVerified()}<img class="name-checkmark" src="/assets/packages/static/openvk/img/checkmark.png">{/if}
{ifset $compact}<br>
<a href="/wall{$post->getPrettyId()}" class="date">{$post->getPublicationTime()}</a>
{/ifset}
{if $post->canBeDeletedBy($thisUser) && !($forceNoDeleteLink ?? false) && !isset($compact)}
<a class="delete" href="/wall{$post->getPrettyId()}/delete"></a>
{/if}
</div>
<div class="post-content" id="{$post->getPrettyId()}">
<div class="text" id="text{$post->getPrettyId()}">
{$post->getText()|noescape}
<div n:ifcontent class="attachments_b">
<div class="attachment" n:foreach="$post->getChildren() as $attachment" data-localized-nsfw-text="{_nsfw_warning}">
{include "../attachment.xml", attachment => $attachment}
</div>
</div>
</div>
<div n:if="$post->isAd()" style="color:grey;">
<br/>
&nbsp;! Этот пост был размещён за взятку.
</div>
<div n:if="$post->isSigned()" class="post-signature">
{var acutalAuthor = $post->getOwner(false)}
<span>
Автор:
<a href="{$acutalAuthor->getURL()}">
{$acutalAuthor->getCanonicalName()}
</a>
</span>
</div>
</div>
<div class="post-menu" n:if="!isset($compact)">
<a href="/wall{$post->getPrettyId()}" class="date">{$post->getPublicationTime()}</a>
{if isset($thisUser)}
&nbsp;
{if !($forceNoCommentsLink ?? false)}
<a href="/wall{$post->getPrettyId()}#comments">
{if $post->getCommentsCount() > 0}
{_"comments"} (<b>{$post->getCommentsCount()}</b>)
{else}
{_"comments"}
{/if}
</a>
&nbsp;|&nbsp;
{/if}
<div class="like_wrap">
<a class="post-share-button" href="/wall{$post->getPrettyId()}/repost?hash={rawurlencode($csrfToken)}"
class="post-like-button">
<div class="repost-icon" style="opacity: 0.4;"></div>
<span class="likeCnt">{$post->getRepostCount()}</span>
</a>
{var liked = $post->hasLikeFrom($thisUser)}
<a href="/wall{$post->getPrettyId()}/like?hash={rawurlencode($csrfToken)}"
class="post-like-button"
data-liked="{(int) $liked}"
data-likes="{$post->getLikesCount()}">
<div class="heart" style="{if $liked}opacity: 1;{else}opacity: 0.4;{/if}"></div>
<span class="likeCnt">{$post->getLikesCount()}</span>
</a>
</div>
{/if}
</div>
<div n:if="isset($thisUser) &&! ($compact ?? false)" class="post-menu-s">
<!-- kosfurler -->
</div>
</td>
</tr>
</tbody>
</table>

View file

@ -0,0 +1,106 @@
{var author = $post->getOwner()}
<table border="0" style="font-size: 11px;" n:class="post, $post->isExplicit() ? post-nsfw">
<tbody>
<tr>
<td width="54" valign="top">
<img
src="{$author->getAvatarURL()}"
width="50" />
</td>
<td width="100%" valign="top">
<div class="post-author">
<a href="{$author->getURL()}">
<b>
{$author->getCanonicalName()}
</b>
</a>
{if $author->isVerified()}<img class="name-checkmark" src="/assets/packages/static/openvk/img/checkmark.png">{/if}
{$post->isPostedOnBehalfOfGroup() ? "опубликовали" : ($author->isFemale() ? tr("post_writes_f") : tr("post_writes_m"))}
{if ($onWallOf ?? false) &&!$post->isPostedOnBehalfOfGroup() && $post->getOwnerPost() !== $post->getTargetWall()}
{var wallId = $post->getTargetWall()}
{var wallURL = $wallId > -1 ? "/id$wallId" : "/club" . abs($wallId)}
на
<a href="{$wallURL}">
<b>
{if isset($thisUser) && $thisUser->getId() === $wallId}
вашей
{/if}
стене
{if $wallId < 0}
группы
{/if}
</b>
</a>
{/if}
<br/>
<a href="/wall{$post->getPrettyId()}" class="date">{$post->getPublicationTime()}</a>
</div>
<div class="post-content" id="{$post->getPrettyId()}">
<div class="text" id="text{$post->getPrettyId()}">
{$post->getText()|noescape}
<div n:ifcontent class="attachments_b">
<div class="attachment" n:foreach="$post->getChildren() as $attachment" data-localized-nsfw-text="{_nsfw_warning}">
{include "../attachment.xml", attachment => $attachment}
</div>
</div>
</div>
<div n:if="$post->isAd()" style="color:grey;">
<br/>
&nbsp;! Этот пост был размещён за взятку.
</div>
<div n:if="$post->isSigned()" class="post-signature">
{var acutalAuthor = $post->getOwner(false)}
<span>
Автор:
<a href="{$acutalAuthor->getURL()}">
{$acutalAuthor->getCanonicalName()}
</a>
</span>
</div>
</div>
<div n:if="isset($thisUser) &&! ($compact ?? false)" class="post-menu">
{if $post->canBeDeletedBy($thisUser) && !($forceNoDeleteLink ?? false)}
<a href="/wall{$post->getPrettyId()}/delete">{_"delete"}</a>&nbsp;|&nbsp;
{/if}
{if !($forceNoCommentsLink ?? false)}
<a href="/wall{$post->getPrettyId()}#comments">
{if $post->getCommentsCount() > 0}
{_"comments"} (<b>{$post->getCommentsCount()}</b>)
{else}
{_"comments"}
{/if}
</a>
&nbsp;|&nbsp;
{/if}
<a class="post-share-button" href="/wall{$post->getPrettyId()}/repost?hash={rawurlencode($csrfToken)}">
{if $post->getRepostCount() > 0}
{_"share"}
(<b>{$post->getRepostCount()}</b>)
{else}
{_"share"}
{/if}
</a>
<div class="like_wrap">
{var liked = $post->hasLikeFrom($thisUser)}
<a href="/wall{$post->getPrettyId()}/like?hash={rawurlencode($csrfToken)}"
class="post-like-button"
data-liked="{(int) $liked}"
data-likes="{$post->getLikesCount()}">
<div class="heart" style="{if $liked}opacity: 1;{else}opacity: 0.4;{/if}"></div>
<span class="likeCnt">{$post->getLikesCount()}</span>
</a>
</div>
</div>
<div n:if="isset($thisUser) &&! ($compact ?? false)" class="post-menu-s">
<!-- kosfurler -->
</div>
</td>
</tr>
</tbody>
</table>

View file

@ -0,0 +1,60 @@
/* VK's Microblog CSS */
/* Design belongs to Pavel Durov & mail.ru */
.post {
padding: 5px 0 5px 0;
}
.post-divider {
border-bottom: 1px #ddd solid;
}
.post-author {
background-color: transparent;
border: none;
padding: 0 3px 3px 3px;
}
.post-author .date {
font-size: 11px;
color: grey;
}
.post-content {
border: none;
}
.post-menu {
font-size: 10px;
}
.post-menu .date {
color: grey;
}
.repost-icon {
background: url('/assets/packages/static/openvk/img/like.gif') no-repeat 1px -20px;
height: 12px;
margin: 2px 3px 0px;
width: 11px;
float: left;
}
.repost-icon:hover {
opacity: 1 !important;
}
.post-author .delete {
float: right;
display: inline-block;
height: 16px;
width: 16px;
overflow: auto;
background: url("/assets/packages/static/openvk/img/delete.svg") no-repeat -4px -4px;
opacity: 0.1;
transition-duration: 0.3s;
}
.post-author .delete:hover {
opacity: 0.4;
}

57
Web/static/img/delete.svg Normal file
View file

@ -0,0 +1,57 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
version="1.1"
id="mdi-abjad-arabic"
width="24"
height="24"
viewBox="0 0 24 24"
sodipodi:docname="delete.svg"
inkscape:version="1.0 (4035a4fb49, 2020-05-01)">
<metadata
id="metadata9">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<defs
id="defs7" />
<sodipodi:namedview
inkscape:document-rotation="0"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1920"
inkscape:window-height="1017"
id="namedview5"
showgrid="false"
inkscape:zoom="11.313708"
inkscape:cx="32.713384"
inkscape:cy="33.606387"
inkscape:window-x="-8"
inkscape:window-y="-8"
inkscape:window-maximized="1"
inkscape:current-layer="mdi-abjad-arabic" />
<path
sodipodi:nodetypes="ccccccccccccc"
id="path7"
d="M 5.2732075,7.875 7.8825825,5.265625 12.054457,9.4375 16.351333,5.265625 18.835708,7.875 l -4.140625,4.078125 4.09375,4.09375 -2.71875,2.6875 -4.046876,-4.078125 -4.0776645,4.046415 -2.78125,-2.78125 4.140165,-3.983915 z"
style="fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
</svg>

After

Width:  |  Height:  |  Size: 1.9 KiB

61
Web/static/img/repost.svg Normal file
View file

@ -0,0 +1,61 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
sodipodi:docname="report.svg"
inkscape:version="1.0 (4035a4fb49, 2020-05-01)"
id="svg8"
version="1.1"
viewBox="0 0 4.23328 4.2332798"
height="16"
width="16">
<defs
id="defs2" />
<sodipodi:namedview
inkscape:window-maximized="1"
inkscape:window-y="-7"
inkscape:window-x="-7"
inkscape:window-height="996"
inkscape:window-width="1920"
units="px"
showgrid="false"
inkscape:document-rotation="0"
inkscape:current-layer="layer1"
inkscape:document-units="px"
inkscape:cy="12.045415"
inkscape:cx="-8.0399623"
inkscape:zoom="22.627417"
inkscape:pageshadow="2"
inkscape:pageopacity="0.0"
borderopacity="1.0"
bordercolor="#666666"
pagecolor="#ffffff"
id="base" />
<metadata
id="metadata5">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
id="layer1"
inkscape:groupmode="layer"
inkscape:label="Layer 1">
<path
sodipodi:nodetypes="cccccccccccccccc"
id="path833"
d="M 2.7927677,1.6482826 V 2.0049158 L 3.4738786,1.3238048 2.7956908,0.64561689 V 1.1104094 H 1.3854359 C 1.0520637,1.1560645 0.82238205,1.369634 0.75401958,1.7125935 v 1.099132 C 0.76314758,3.1837826 0.9448503,3.4265626 1.3591269,3.4402187 H 3.1435545 V 2.9403473 L 1.7420691,2.9345009 C 1.4916174,2.9454878 1.2348484,2.7744961 1.2480444,2.4287831 L 1.2421984,2.0926125 C 1.2360285,1.8711259 1.4209937,1.6535064 1.7084521,1.6497441 Z"
style="fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.2 KiB