mirror of
https://github.com/openvk/openvk
synced 2024-12-23 00:51:03 +03:00
Global: Cancel changed from past commits that was created by accident
This commit is contained in:
parent
85cd1c7554
commit
7fc19ff5e7
5 changed files with 33 additions and 152 deletions
|
@ -248,27 +248,24 @@ final class WallPresenter extends OpenVKPresenter
|
||||||
if($this->postParam("force_sign") === "on")
|
if($this->postParam("force_sign") === "on")
|
||||||
$flags |= 0b01000000;
|
$flags |= 0b01000000;
|
||||||
|
|
||||||
$photos = [];
|
try {
|
||||||
$_FILES["_pic_attachment"] = null;
|
$photo = NULL;
|
||||||
foreach($_FILES as $file) {
|
$video = NULL;
|
||||||
bdump($file);
|
if($_FILES["_pic_attachment"]["error"] === UPLOAD_ERR_OK) {
|
||||||
try {
|
$album = NULL;
|
||||||
if($file["error"] === UPLOAD_ERR_OK && preg_match('/^image\//', $file['type'])) {
|
if(!$anon && $wall > 0 && $wall === $this->user->id)
|
||||||
$album = NULL;
|
$album = (new Albums)->getUserWallAlbum($wallOwner);
|
||||||
if(!$anon && $wall > 0 && $wall === $this->user->id)
|
|
||||||
$album = (new Albums)->getUserWallAlbum($wallOwner);
|
$photo = Photo::fastMake($this->user->id, $this->postParam("text"), $_FILES["_pic_attachment"], $album, $anon);
|
||||||
|
}
|
||||||
$photos[] = Photo::fastMake($this->user->id, $this->postParam("text"), $file, $album, $anon);
|
|
||||||
}
|
|
||||||
} catch(\DomainException $ex) {
|
|
||||||
$this->flashFail("err", tr("failed_to_publish_post"), tr("media_file_corrupted"));
|
|
||||||
} catch(ISE $ex) {
|
|
||||||
$this->flashFail("err", tr("failed_to_publish_post"), tr("media_file_corrupted_or_too_large"));
|
|
||||||
}
|
|
||||||
|
|
||||||
if($_FILES["_vid_attachment"]["error"] === UPLOAD_ERR_OK) {
|
if($_FILES["_vid_attachment"]["error"] === UPLOAD_ERR_OK) {
|
||||||
$video = Video::fastMake($this->user->id, $this->postParam("text"), $_FILES["_vid_attachment"], $anon);
|
$video = Video::fastMake($this->user->id, $this->postParam("text"), $_FILES["_vid_attachment"], $anon);
|
||||||
}
|
}
|
||||||
|
} catch(\DomainException $ex) {
|
||||||
|
$this->flashFail("err", tr("failed_to_publish_post"), tr("media_file_corrupted"));
|
||||||
|
} catch(ISE $ex) {
|
||||||
|
$this->flashFail("err", tr("failed_to_publish_post"), tr("media_file_corrupted_or_too_large"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if(empty($this->postParam("text")) && !$photo && !$video)
|
if(empty($this->postParam("text")) && !$photo && !$video)
|
||||||
|
@ -288,9 +285,11 @@ final class WallPresenter extends OpenVKPresenter
|
||||||
$this->flashFail("err", tr("failed_to_publish_post"), tr("post_is_too_big"));
|
$this->flashFail("err", tr("failed_to_publish_post"), tr("post_is_too_big"));
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach($photos as $photo) {
|
if(!is_null($photo))
|
||||||
$post->attach($photo);
|
$post->attach($photo);
|
||||||
}
|
|
||||||
|
if(!is_null($video))
|
||||||
|
$post->attach($video);
|
||||||
|
|
||||||
if($wall > 0 && $wall !== $this->user->identity->getId())
|
if($wall > 0 && $wall !== $this->user->identity->getId())
|
||||||
(new WallPostNotification($wallOwner, $post, $this->user->identity))->emit();
|
(new WallPostNotification($wallOwner, $post, $this->user->identity))->emit();
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<table border="0" style="font-size: 11px;" n:class="post, !$compact ? post-divider, $post->isExplicit() ? post-nsfw">
|
<table border="0" style="font-size: 11px;" n:class="post, !$compact ? post-divider, $post->isExplicit() ? post-nsfw">
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr>
|
<tr>
|
||||||
<td width="{ifset $compact}27{else}54{/ifset}" style="{ifset $compact}display: block;{/ifset}" valign="top">
|
<td width="54" style="{ifset $compact}display: block;{/ifset}" valign="top">
|
||||||
<a href="{$author->getURL()}">
|
<a href="{$author->getURL()}">
|
||||||
<img src="{$author->getAvatarURL('miniscule')}" width="{ifset $compact}25{else}50{/ifset}" {ifset $compact}class="cCompactAvatars"{/ifset} />
|
<img src="{$author->getAvatarURL('miniscule')}" width="{ifset $compact}25{else}50{/ifset}" {ifset $compact}class="cCompactAvatars"{/ifset} />
|
||||||
<span n:if="!$post->isPostedOnBehalfOfGroup() && !$compact && $author->isOnline()" class="post-online">{_online}</span>
|
<span n:if="!$post->isPostedOnBehalfOfGroup() && !$compact && $author->isOnline()" class="post-online">{_online}</span>
|
||||||
|
|
|
@ -8,8 +8,8 @@
|
||||||
<!-- padding to fix <br/> bug -->
|
<!-- padding to fix <br/> bug -->
|
||||||
</div>
|
</div>
|
||||||
<div id="post-buttons{$textAreaId}" style="display: none;">
|
<div id="post-buttons{$textAreaId}" style="display: none;">
|
||||||
<div class="upload">
|
<div class="post-upload">
|
||||||
|
{_attachment}: <span>(unknown)</span>
|
||||||
</div>
|
</div>
|
||||||
<div n:if="$postOpts ?? true" class="post-opts">
|
<div n:if="$postOpts ?? true" class="post-opts">
|
||||||
{var $anonEnabled = OPENVK_ROOT_CONF['openvk']['preferences']['wall']['anonymousPosting']['enable']}
|
{var $anonEnabled = OPENVK_ROOT_CONF['openvk']['preferences']['wall']['anonymousPosting']['enable']}
|
||||||
|
@ -80,6 +80,10 @@
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
$(document).ready(() => {
|
$(document).ready(() => {
|
||||||
|
u("#post-buttons{$textAreaId} .postFileSel").on("change", function() {
|
||||||
|
handleUpload.bind(this, {$textAreaId})();
|
||||||
|
});
|
||||||
|
|
||||||
setupWallPostInputHandlers({$textAreaId});
|
setupWallPostInputHandlers({$textAreaId});
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -630,22 +630,6 @@ h4 {
|
||||||
|
|
||||||
.post-content .attachments_b {
|
.post-content .attachments_b {
|
||||||
margin-top: 8px;
|
margin-top: 8px;
|
||||||
display: grid;
|
|
||||||
grid-gap: 2px;
|
|
||||||
height: 100%;
|
|
||||||
max-height: 300px;
|
|
||||||
overflow: hidden;
|
|
||||||
}
|
|
||||||
|
|
||||||
.post-content .attachments_b > div {
|
|
||||||
min-width: 0;
|
|
||||||
min-height: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.post-content .attachments_b > div a img {
|
|
||||||
height: 100%;
|
|
||||||
object-fit: cover;
|
|
||||||
width: 100%;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.attachment .post {
|
.attachment .post {
|
||||||
|
@ -1922,67 +1906,6 @@ table td[width="120"] {
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
.progress {
|
|
||||||
border: 1px solid #eee;
|
|
||||||
height: 15px;
|
|
||||||
background: linear-gradient(to bottom, #fefefe, #fafafa);
|
|
||||||
}
|
|
||||||
|
|
||||||
.progress .progress-bar {
|
|
||||||
background: url('progress.png');
|
|
||||||
background-repeat: repeat-x;
|
|
||||||
height: 15px;
|
|
||||||
animation-name: progress;
|
|
||||||
animation-duration: 1s;
|
|
||||||
animation-iteration-count: infinite;
|
|
||||||
animation-timing-function: linear;
|
|
||||||
}
|
|
||||||
|
|
||||||
@keyframes progress {
|
|
||||||
from {
|
|
||||||
background-position: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
to {
|
|
||||||
background-position: 20px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.upload {
|
|
||||||
margin-top: 8px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.upload .upload-item {
|
|
||||||
width: 75px;
|
|
||||||
height: 60px;
|
|
||||||
overflow: hidden;
|
|
||||||
display: inline-block;
|
|
||||||
margin-right: 3px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.upload-item .upload-delete {
|
|
||||||
position: absolute;
|
|
||||||
background: rgba(0,0,0,0.5);
|
|
||||||
padding: 2px 5px;
|
|
||||||
text-decoration: none;
|
|
||||||
color: #fff;
|
|
||||||
font-size: 11px;
|
|
||||||
margin-left: 57px; /* мне лень переделывать :DDDD */
|
|
||||||
opacity: 0;
|
|
||||||
transition: 0.25s;
|
|
||||||
}
|
|
||||||
|
|
||||||
.upload-item:hover > .upload-delete {
|
|
||||||
opacity: 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
.upload-item img {
|
|
||||||
width: 100%;
|
|
||||||
max-height: 60px;
|
|
||||||
object-fit: cover;
|
|
||||||
border-radius: 3px;
|
|
||||||
}
|
|
||||||
|
|
||||||
#votesBalance {
|
#votesBalance {
|
||||||
margin-top: 50px;
|
margin-top: 50px;
|
||||||
padding: 7px;
|
padding: 7px;
|
||||||
|
|
|
@ -22,7 +22,7 @@ function trim(string) {
|
||||||
return newStr;
|
return newStr;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* function handleUpload(id) {
|
function handleUpload(id) {
|
||||||
console.warn("блять...");
|
console.warn("блять...");
|
||||||
|
|
||||||
u("#post-buttons" + id + " .postFileSel").not("#" + this.id).each(input => input.value = null);
|
u("#post-buttons" + id + " .postFileSel").not("#" + this.id).each(input => input.value = null);
|
||||||
|
@ -37,7 +37,7 @@ function trim(string) {
|
||||||
}
|
}
|
||||||
|
|
||||||
document.querySelector("#post-buttons" + id + " #wallAttachmentMenu").classList.add("hidden");
|
document.querySelector("#post-buttons" + id + " #wallAttachmentMenu").classList.add("hidden");
|
||||||
} */
|
}
|
||||||
|
|
||||||
function initGraffiti(id) {
|
function initGraffiti(id) {
|
||||||
let canvas = null;
|
let canvas = null;
|
||||||
|
@ -98,59 +98,14 @@ u(".post-like-button").on("click", function(e) {
|
||||||
let picCount = 0;
|
let picCount = 0;
|
||||||
|
|
||||||
function setupWallPostInputHandlers(id) {
|
function setupWallPostInputHandlers(id) {
|
||||||
u("#wall-post-input" + id).on("input", function(e) {
|
u("#wall-post-input" + id).on("paste", function(e) {
|
||||||
var boost = 5;
|
if(e.clipboardData.files.length === 1) {
|
||||||
var textArea = e.target;
|
var input = u("#post-buttons" + id + " input[name=_pic_attachment]").nodes[0];
|
||||||
textArea.style.height = "5px";
|
input.files = e.clipboardData.files;
|
||||||
var newHeight = textArea.scrollHeight;
|
|
||||||
textArea.style.height = newHeight + boost + "px";
|
|
||||||
return;
|
|
||||||
|
|
||||||
// revert to original size if it is larger (possibly changed by user)
|
|
||||||
// textArea.style.height = (newHeight > originalHeight ? (newHeight + boost) : originalHeight) + "px";
|
|
||||||
});
|
|
||||||
|
|
||||||
u(`#wall-post-input${id}`).on("paste", function(e) {
|
|
||||||
for (let i = 0; i < e.clipboardData.files.length; i++) {
|
|
||||||
console.log(e.clipboardData.files[i]);
|
|
||||||
if(e.clipboardData.files[i].type.match('^image/')) {
|
|
||||||
let blobURL = URL.createObjectURL(e.clipboardData.files[i]);
|
|
||||||
addPhotoMedia(e.clipboardData.files, blobURL);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
u(`#post-buttons${id} input[name=_pic_attachment]`).on("change", function(e) {
|
|
||||||
let blobURL = URL.createObjectURL(e.target.files[0]);
|
|
||||||
addPhotoMedia(e.target.files, blobURL);
|
|
||||||
});
|
|
||||||
|
|
||||||
function addPhotoMedia(files, preview) {
|
|
||||||
if(getMediaCount() >= 4) {
|
|
||||||
alert('Низя.');
|
|
||||||
} else {
|
|
||||||
picCount++;
|
|
||||||
u(`#post-buttons${id} .upload`).append(u(`
|
|
||||||
<div class="upload-item" id="aP${picCount}">
|
|
||||||
<a href="javascript:removePicture(${picCount})" class="upload-delete">×</a>
|
|
||||||
<img src="${preview}">
|
|
||||||
</div>
|
|
||||||
`));
|
|
||||||
u(`div#aP${picCount}`).nodes[0].append(u(`<input type="file" accept="image/*" name="attachPic${picCount}" id="attachPic${picCount}" style="display: none;">`).first());
|
|
||||||
let input = u(`#attachPic${picCount}`).nodes[0];
|
|
||||||
input.files = files; // нужен рефактор, но щас не
|
|
||||||
console.log(input);
|
|
||||||
u(input).trigger("change");
|
u(input).trigger("change");
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
|
|
||||||
function getMediaCount() {
|
|
||||||
return u(`#post-buttons${id} .upload`).nodes[0].children.length;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function removePicture(idA) {
|
|
||||||
u(`div#aP${idA}`).nodes[0].remove();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
u("#write > form").on("keydown", function(event) {
|
u("#write > form").on("keydown", function(event) {
|
||||||
|
|
Loading…
Reference in a new issue