Update en.strings

This commit is contained in:
lalka2018 2023-10-14 14:25:46 +03:00
parent 6966ec0b89
commit 68e16cfbb0
22 changed files with 335 additions and 217 deletions

View file

@ -5,7 +5,7 @@ use Nette\Database\Table\ActiveRow;
use openvk\Web\Models\RowModel;
use openvk\Web\Models\Entities\Club;
use Chandler\Database\DatabaseConnection;
use openvk\Web\Models\Repositories\{Applications, Comments, Notes, Reports, Users, Posts, Photos, Videos, Clubs};
use openvk\Web\Models\Repositories\{Applications, Comments, Notes, Reports, Audios, Users, Posts, Photos, Videos, Clubs};
use Chandler\Database\DatabaseConnection as DB;
use Nette\InvalidStateException as ISE;
use Nette\Database\Table\Selection;
@ -74,6 +74,7 @@ class Report extends RowModel
else if ($this->getContentType() == "note") return (new Notes)->get($this->getContentId());
else if ($this->getContentType() == "app") return (new Applications)->get($this->getContentId());
else if ($this->getContentType() == "user") return (new Users)->get($this->getContentId());
else if ($this->getContentType() == "audio") return (new Audios)->get($this->getContentId());
else return null;
}

View file

@ -4,7 +4,7 @@ use morphos\Gender;
use openvk\Web\Themes\{Themepack, Themepacks};
use openvk\Web\Util\DateTime;
use openvk\Web\Models\RowModel;
use openvk\Web\Models\Entities\{Photo, Message, Correspondence, Gift};
use openvk\Web\Models\Entities\{Photo, Message, Correspondence, Gift, Audio};
use openvk\Web\Models\Repositories\{Applications, Bans, Comments, Notes, Posts, Users, Clubs, Albums, Gifts, Notifications, Videos, Photos};
use openvk\Web\Models\Exceptions\InvalidUserNameException;
use Nette\Database\Table\ActiveRow;
@ -463,7 +463,8 @@ class User extends RowModel
"news",
"links",
"poster",
"apps"
"apps",
"audios",
],
])->get($id);
}
@ -483,6 +484,7 @@ class User extends RowModel
"friends.add",
"wall.write",
"messages.write",
"audios.read",
],
])->get($id);
}
@ -1011,6 +1013,7 @@ class User extends RowModel
"friends.add",
"wall.write",
"messages.write",
"audios.read",
],
])->set($id, $status)->toInteger());
}
@ -1021,6 +1024,7 @@ class User extends RowModel
"length" => 1,
"mappings" => [
"photos",
"audios",
"videos",
"messages",
"notes",
@ -1028,7 +1032,7 @@ class User extends RowModel
"news",
"links",
"poster",
"apps"
"apps",
],
])->set($id, (int) $status)->toInteger();

View file

@ -58,6 +58,9 @@ final class AudioPresenter extends OpenVKPresenter
if (!$entity || $entity->isDeleted() || $entity->isBanned())
$this->redirect("/audios" . $this->user->id);
if(!$entity->getPrivacyPermission("audios.read", $this->user->identity))
$this->flashFail("err", tr("forbidden"), tr("forbidden_comment"));
$audios = $this->audios->getByUser($entity, $page, 10);
$audiosCount = $this->audios->getUserCollectionSize($entity);
}
@ -66,11 +69,38 @@ final class AudioPresenter extends OpenVKPresenter
$this->notFound();
$this->template->owner = $entity;
$this->template->ownerId = $owner;
$this->template->isMy = ($owner > 0 && ($entity->getId() === $this->user->id));
$this->template->isMyClub = ($owner < 0 && $entity->canBeModifiedBy($this->user->identity));
} else if ($mode === "new") {
$audios = $this->audios->getNew();
$audiosCount = $audios->size();
} else if ($mode === "playlists") {
if($owner < 0) {
$entity = (new Clubs)->get(abs($owner));
if (!$entity || $entity->isBanned())
$this->redirect("/playlists" . $this->user->id);
$playlists = $this->audios->getPlaylistsByClub($entity, $page, 10);
$playlistsCount = $this->audios->getClubPlaylistsCount($entity);
} else {
$entity = (new Users)->get($owner);
if (!$entity || $entity->isDeleted() || $entity->isBanned())
$this->redirect("/playlists" . $this->user->id);
if(!$entity->getPrivacyPermission("audios.read", $this->user->identity))
$this->flashFail("err", tr("forbidden"), tr("forbidden_comment"));
$playlists = $this->audios->getPlaylistsByUser($entity, $page, 10);
$playlistsCount = $this->audios->getUserPlaylistsCount($entity);
}
$this->template->playlists = iterator_to_array($playlists);
$this->template->playlistsCount = $playlistsCount;
$this->template->owner = $entity;
$this->template->ownerId = $owner;
$this->template->isMy = ($owner > 0 && ($entity->getId() === $this->user->id));
$this->template->isMyClub = ($owner < 0 && $entity->canBeModifiedBy($this->user->identity));
} else {
$audios = $this->audios->getPopular();
$audiosCount = $audios->size();
@ -223,24 +253,24 @@ final class AudioPresenter extends OpenVKPresenter
$owner = $this->user->id;
if ($this->requestParam("owner")) {
$club = (new Clubs)->get((int) $this->requestParam("owner") * -1);
$club = (new Clubs)->get((int) abs($this->requestParam("owner")));
if (!$club || $club->isBanned() || !$club->canBeModifiedBy($this->user->identity))
$this->redirect("/audios" . $this->user->id);
$owner = ($club->getId() * -1);
$this->template->club = $club;
}
$this->template->owner = $owner;
// exit(var_dump($owner));
if ($_SERVER["REQUEST_METHOD"] === "POST") {
$title = $this->postParam("title");
$description = $this->postParam("description");
$audios = !empty($this->postParam("audios")) ? explode(",", $this->postParam("audios")) : [];
if (!$title)
$this->returnJson(["success" => false, "error" => "Название не указано"]);
if(empty($title) || iconv_strlen($title) < 1)
$this->flash("err", tr("error"), "ну там короч нету имени ну хз");
$playlist = new Playlist;
$playlist->setOwner($owner);
@ -254,7 +284,7 @@ final class AudioPresenter extends OpenVKPresenter
DatabaseConnection::i()->getContext()->query("INSERT INTO `playlist_imports` (`entity`, `playlist`) VALUES (?, ?)", $owner, $playlist->getId());
$this->returnJson(["success" => true, "payload" => "/playlist" . $owner . "_" . $playlist->getId()]);
$this->redirect("/playlist" . $owner . "_" . $playlist->getId());
} else {
$this->template->audios = iterator_to_array($this->audios->getByUser($this->user->identity));
}
@ -295,7 +325,7 @@ final class AudioPresenter extends OpenVKPresenter
$this->template->audios = iterator_to_array($playlist->getAudios());
}
if ($_SERVER["REQUEST_METHOD"] === "POST") {
/*if ($_SERVER["REQUEST_METHOD"] === "POST") {
if (!$this->template->canEdit) {
$this->flashFail("err", tr("error"), tr("forbidden"));
}
@ -341,7 +371,7 @@ final class AudioPresenter extends OpenVKPresenter
$this->flash("succ", tr("changes_saved"));
$this->redirect("/playlist" . $playlist->getOwner()->getId() . "_" . $playlist->getId());
}
}*/
}
function renderAction(int $audio_id): void
@ -391,7 +421,7 @@ final class AudioPresenter extends OpenVKPresenter
$name = $this->postParam("name");
$lyrics = $this->postParam("lyrics");
$genre = empty($this->postParam("genre")) ? "undefined" : $this->postParam("genre");
$nsfw = ($this->postParam("nsfw") ?? "off") === "on";
$nsfw = (int)($this->postParam("explicit") ?? 0) === 1;
if(empty($performer) || empty($name) || iconv_strlen($performer . $name) > 128) # FQN of audio must not be more than 128 chars
$this->flashFail("err", tr("error"), tr("error_insufficient_info"), null, true);
@ -399,6 +429,7 @@ final class AudioPresenter extends OpenVKPresenter
$audio->setPerformer($performer);
$audio->setLyrics(empty($lyrics) ? NULL : $lyrics);
$audio->setGenre($genre);
$audio->setExplicit($nsfw);
$audio->save();
$this->returnJson(["success" => true, "new_info" => [
@ -420,6 +451,6 @@ final class AudioPresenter extends OpenVKPresenter
function renderPlaylists(int $owner)
{
$this->assertUserLoggedIn();
$this->renderList($owner, "playlists");
}
}

View file

@ -3,7 +3,7 @@ namespace openvk\Web\Presenters;
use openvk\Web\Models\Entities\{Club, Photo, Post};
use Nette\InvalidStateException;
use openvk\Web\Models\Entities\Notifications\ClubModeratorNotification;
use openvk\Web\Models\Repositories\{Clubs, Users, Albums, Managers, Topics};
use openvk\Web\Models\Repositories\{Clubs, Users, Albums, Managers, Topics, Audios};
use Chandler\Security\Authenticator;
final class GroupPresenter extends OpenVKPresenter
@ -31,6 +31,8 @@ final class GroupPresenter extends OpenVKPresenter
$this->template->albumsCount = (new Albums)->getClubAlbumsCount($club);
$this->template->topics = (new Topics)->getLastTopics($club, 3);
$this->template->topicsCount = (new Topics)->getClubTopicsCount($club);
$this->template->audios = (new Audios)->getByClub($club, 1, 3);
$this->template->audiosCount = (new Audios)->getClubCollectionSize($club);
}
$this->template->club = $club;

View file

@ -23,7 +23,7 @@ final class ReportPresenter extends OpenVKPresenter
if ($_SERVER["REQUEST_METHOD"] === "POST")
$this->assertNoCSRF();
$act = in_array($this->queryParam("act"), ["post", "photo", "video", "group", "comment", "note", "app", "user"]) ? $this->queryParam("act") : NULL;
$act = in_array($this->queryParam("act"), ["post", "photo", "video", "group", "comment", "note", "app", "user", "audio"]) ? $this->queryParam("act") : NULL;
if (!$this->queryParam("orig")) {
$this->template->reports = $this->reports->getReports(0, (int)($this->queryParam("p") ?? 1), $act, $_SERVER["REQUEST_METHOD"] !== "POST");
@ -88,7 +88,7 @@ final class ReportPresenter extends OpenVKPresenter
if(!$id)
exit(json_encode([ "error" => tr("error_segmentation") ]));
if(in_array($this->queryParam("type"), ["post", "photo", "video", "group", "comment", "note", "app", "user"])) {
if(in_array($this->queryParam("type"), ["post", "photo", "video", "group", "comment", "note", "app", "user", "audio"])) {
if (count(iterator_to_array($this->reports->getDuplicates($this->queryParam("type"), $id, NULL, $this->user->id))) <= 0) {
$report = new Report;
$report->setUser_id($this->user->id);

View file

@ -432,6 +432,7 @@ final class UserPresenter extends OpenVKPresenter
"friends.add",
"wall.write",
"messages.write",
"audios.read",
];
foreach($settings as $setting) {
$input = $this->postParam(str_replace(".", "_", $setting));

View file

@ -23,54 +23,20 @@
»
{_audio_popular}
</div>
<div n:if="$mode == 'playlists'">
{_audios}
»
{_audio_popular}
</div>
{/block}
{block content}
{* ref: https://archive.li/P32em *}
<div class="bigPlayer">
<div class="paddingLayer">
<div class="playButtons">
<div class="playButton musicIcon"></div>
<div class="arrowsButtons">
<div class="nextButton musicIcon"></div>
<div class="backButton musicIcon"></div>
</div>
</div>
<div class="trackPanel">
<div class="trackInfo">
<b>{_track_unknown}</b>
<span>{_track_noname}</span>
<span class="time">00:00</span>
</div>
<div class="selectableTrack">
<div>&nbsp;
<div class="slider"></div>
</div>
</div>
</div>
<div class="volumePanel">
<div class="selectableTrack">
<div>&nbsp;
<div class="slider"></div>
</div>
</div>
</div>
<div class="additionalButtons">
<div class="repeatButton musicIcon"></div>
<div class="shuffleButton musicIcon"></div>
<div class="deviceButton musicIcon"></div>
</div>
</div>
</div>
{include "bigplayer.xml"}
<div style="width: 100%;display: flex;margin-bottom: -10px;">
<div style="width: 74%;">
<div style="width: 74%;" n:if="$mode != 'playlists'">
<div style="padding: 8px;">
<div n:if="$audiosCount <= 0">
{include "../components/nothing.xml"}
@ -92,6 +58,38 @@
</div>
</div>
</div>
<div style="width: 74%;" n:if="$mode == 'playlists'">
<div style="padding: 8px;">
<div n:if="$playlistsCount <= 0">
{include "../components/error.xml", description => $ownerId > 0 ? ($ownerId == $thisUser->getId() ? tr("no_playlists_thisuser") : tr("no_playlists_user")) : tr("no_playlists_club")}
</div>
<div class="infContainer playlistContainer" style="display: flex;" n:if="$playlistsCount > 0">
<div class="infObj" n:foreach="$playlists as $playlist">
<a href="/playlist{$playlist->getPrettyId()}">
<div class="playlistCover">
<img src="{$playlist->getCoverURL()}">
</div>
<div class="playlistInfo">
<span>{$playlist->getName()}</span>
</div>
</a>
</div>
</div>
<div>
{include "../components/paginator.xml", conf => (object) [
"page" => $page,
"count" => $playlistsCount,
"amount" => sizeof($playlists),
"perPage" => $perPage ?? OPENVK_DEFAULT_PER_PAGE,
"atBottom" => true,
]}
</div>
</div>
</div>
{include "tabs.xml"}
</div>
{/block}

View file

@ -1,81 +1,46 @@
{extends "../@layout.xml"}
{block title}
Создать плейлист
{_new_playlist}
{/block}
{block header}
{include title}
{if !$_GET["owner"]}
<a href="{$thisUser->getURL()}">{$thisUser->getCanonicalName()}</a>
»
<a href="/audios{$thisUser->getId()}">{_audios}</a>
{else}
<a href="{$club->getURL()}">{$club->getCanonicalName()}</a>
»
<a href="/audios-{$club->getId()}">{_audios}</a>
{/if}
»
{_new_playlist}
{/block}
{block content}
{include "tabs.xml", mode => "list"}
<br />
<style>
textarea[name='description'] {
padding: 4px;
resize: vertical;
min-height: 150px;
max-height: 300px;
}
</style>
<form method="post" id="newPlaylistForm">
<input type="text" name="title" placeholder="Название" maxlength="128" />
<input type="text" name="title" placeholder="{_title}" maxlength="128" />
<br /><br />
<textarea placeholder="Описание" name="description" maxlength="2048" />
<textarea placeholder="{_description}" name="description" maxlength="2048" />
<br /><br />
<div n:if="count($audios) > 0">
<div n:if="sizeof($audios) > 0">
<div id="newPlaylistAudios" n:foreach="$audios as $audio">
{include "player.xml", audio => $audio, canAdd => true, addOnClick => "addToPlaylist({$audio->getId()})"}
<br/>
{include "player.xml", audio => $audio, addToPlaylistButton => true}
</div>
</div>
<input type="hidden" name="hash" value="{$csrfToken}" />
<button class="button" style="float: right;">{_create}</button>
</form>
<script n:if="count($audios) > 0">
function addToPlaylist(id) {
$(`#audioEmbed-${ id} .buttons`).html(`<div class="icon delete-icon" onClick="removeFromPlaylist(${ id})" />`);
}
function removeFromPlaylist(id) {
$(`#audioEmbed-${ id} .buttons`).html(`<div class="icon add-icon" onClick="addToPlaylist(${ id})" />`);
}
function create() {
let ids = [];
$("#newPlaylistAudios .delete-icon").each(function () {
ids.push($(this).parents("#miniplayer").first().parent().attr("id").replace("audioEmbed-", ""));
});
$.ajax(`/audios/newPlaylist`, {
type: "POST",
data: {
title: $("input[name='title']").val(),
description: $("textarea[name='description']").val(),
audios: ids.join(","),
owner: {$owner},
hash: {$csrfToken}
},
success: (response) => {
if (response.success) {
window.location.href = response.payload;
} else {
NewNotification("Ошибка", (response?.error ?? "Неизвестная ошибка"), "/assets/packages/static/openvk/img/error.png");
}
}
});
console.log(ids.join(","));
}
$("#newPlaylistForm").submit(function (event) {
event.preventDefault();
create();
});
</script>
{/block}

View file

@ -1,110 +1,46 @@
{extends "../@layout.xml"}
{block title}Плейлист{/block}
{block title}{_playlist}{/block}
{block header}
{include title}
<a href="/audios{$thisUser->getId()}">{_audios}</a>
»
{_playlist}
{/block}
{block content}
{include "tabs.xml"}
<style>
.playlist-descr > * { padding: 8px 0; }
.playlist-dates {
margin-top: -8px;
display: flex;
gap: 5px;
}
.playlist-dates > * { color: #818C99; }
.dvd { padding: .5px 2px }
textarea[name='description'] {
padding: 4px;
resize: vertical;
min-height: 150px;
}
</style>
<br />
<div style="display: flex; gap: 16px;">
{if $edit}<form id="editPlaylistForm" method="POST" style="display: flex; gap: 16px; width: 100%;" enctype="multipart/form-data">{/if}
<div style="width: 120px;">
<img src="{$playlist->getCoverURL()}" width="110" height="110" style="border-radius: 8px;" />
{if $edit}
<br /><br />
<label for="file-upload" class="button">
Обновить обложку
</label>
<input style="display: none;" type="file" name="cover" accept="image/*" id="file-upload" />
{/if}
{include "bigplayer.xml"}
{php $count = $playlist->size()}
<div class="playlistBlock">
<div class="playlistCover" style="float: left;">
<img src="{$playlist->getCoverURL()}">
<div class="profile_links">
<a id="profile_link">{_edit_playlist}</a>
</div>
</div>
<div style="width: -webkit-fill-available;">
<div class="playlist-descr">
{if !$edit}
<h4 style="display: flex; justify-content: space-between">
<div style="max-width: 90%;">{$playlist->getName()}</div>
<a n:if="$canEdit" class="icon edit-icon" href="/playlist{$playlist->getOwner()->getId()}_{$playlist->getId()}?act=edit" />
</h4>
<div n:if="$playlist->getDescription()">{$playlist->getDescription()}</div>
<div style="float: left;padding-left: 13px;width:75%">
<div class="playlistInfo">
<h4 style="border-bottom:unset;">{$playlist->getName()}</h4>
<div class="moreInfo">
<span>{tr("audios_count", $count)}</span><span>{_created_playlist}</span> {$playlist->getPublicationTime()}
<div style="margin-top: 11px;">
<span>{$playlist->getDescription()}</span>
</div>
<hr style="color: #f7f7f7;">
</div>
</div>
<div class="audios" style="margin-top: 14px;">
{if $count < 1}
{_empty_playlist}
{else}
<input type="text" name="title" placeholder="Название" value="{$playlist->getName()}" maxlength="128" />
<br /><br />
<textarea name="description" placeholder="Описание" maxlength="2048">{$playlist->getDescription()}</textarea>
й йбй бй дй д яюдюяд ю бяб бля лбябл бялб я бля бляб ля я не сделал....
{/if}
<div class="playlist-dates" n:attr="style => $playlist->getDescription() ? '' : 'margin-top: 0;'">
<span>создан {$playlist->getCreationTime()}</span>
{if $playlist->getEditTime()}
<span class="dvd">·</span>
<span>обновлен {$playlist->getEditTime()}</span>
{/if}
</div>
</div>
<h4 />
<div style="margin-top: 8px; margin-left: -8px;">
<div n:if="count($audios) <= 0">
{include "../components/nothing.xml"}
</div>
<div id="playlistAudios" n:if="count($audios) > 0" n:foreach="$audios as $audio">
{include "player.xml",
audio => $audio,
canAdd => $edit && !$playlist->hasAudio($audio),
canRemove => $edit && $playlist->hasAudio($audio),
addOnClick => "addToPlaylist({$audio->getId()})",
deleteOnClick => "removeFromPlaylist({$audio->getId()})"
}
</div>
<div n:if="count($audios) > 0">
{script "js/node_modules/umbrellajs/umbrella.min.js"}
{script "js/node_modules/dashjs/dist/dash.all.min.js"}
{include "player.js.xml", audios => $audios}
</div>
</div>
{if $edit}
<h4 />
<br />
<input type="hidden" name="hash" value="{$csrfToken}" />
<input type="hidden" name="audios" value="" />
<button class="button" style="float: right;">{_save}</button>
{/if}
</div>
</div>
{if $edit}</form>{/if}
<script n:if="count($audios) > 0 && $edit">
function addToPlaylist(id) {
$(`#audioEmbed-${ id} .buttons`).html(`<div class="icon delete-icon" onClick="removeFromPlaylist(${ id})" />`);
}
function removeFromPlaylist(id) {
$(`#audioEmbed-${ id} .buttons`).html(`<div class="icon add-icon" onClick="addToPlaylist(${ id})" />`);
}
$("#editPlaylistForm").submit(() => {
let ids = [];
$("#playlistAudios .delete-icon").each(function () {
ids.push($(this).parents("#miniplayer").first().parent().attr("id").replace("audioEmbed-", ""));
});
$("input[name='audios']").val(ids.join(","));
$("#editPlaylistForm").submit();
})
</script>
{/block}

View file

@ -145,7 +145,7 @@
perf_.value = document.querySelector("#lastStep input[name=performer]").value
genre_.value = document.querySelector("#lastStep select[name=genre]").value
lyrics_.value = document.querySelector("#lastStep textarea[name=lyrics]").value
explicit_.value = document.querySelector("#lastStep input[name=explicit]").value
explicit_.value = document.querySelector("#lastStep input[name=explicit]").checked ? "on" : "off"
document.querySelector("#audio_upload > form").submit();
})

View file

@ -0,0 +1,41 @@
<div class="bigPlayer">
<div class="paddingLayer">
<div class="playButtons">
<div class="playButton musicIcon"></div>
<div class="arrowsButtons">
<div class="nextButton musicIcon"></div>
<div class="backButton musicIcon"></div>
</div>
</div>
<div class="trackPanel">
<div class="trackInfo">
<b>{_track_unknown}</b>
<span>{_track_noname}</span>
<span class="time">00:00</span>
</div>
<div class="selectableTrack">
<div>&nbsp;
<div class="slider"></div>
</div>
</div>
</div>
<div class="volumePanel">
<div class="selectableTrack">
<div>&nbsp;
<div class="slider"></div>
</div>
</div>
</div>
<div class="additionalButtons">
<div class="repeatButton musicIcon"></div>
<div class="shuffleButton musicIcon"></div>
<div class="deviceButton musicIcon"></div>
</div>
</div>
</div>

View file

@ -3,6 +3,7 @@
{php $id = $audio->getId() . rand(0, 1000)}
{php $isWithdrawn = $audio->isWithdrawn()}
{php $editable = $audio->canBeModifiedBy($thisUser)}
<div id="audioEmbed-{$id}" data-realid="{$audio->getId()}" data-genre="{$audio->getGenre()}" class="audioEmbed {if !$audio->isAvailable()}lagged{/if} {if $isWithdrawn}withdrawn{/if}" onmouseenter="!this.classList.contains('inited') ? initPlayer({$id}, {$audio->getKeys()}, {$audio->getURL()}, {$audio->getLength()}) : console.log('Player already inited.')">
<audio class="audio" />
@ -44,9 +45,15 @@
</span>
<div class="buttons" style="margin-top: 8px;">
{php $hasAudio = $audio->isInLibraryOf($thisUser)}
<div class="remove-icon musicIcon" data-id="{$audio->getId()}" n:if="$hasAudio" ></div>
<div class="add-icon musicIcon" data-id="{$audio->getId()}" n:if="!$hasAudio" ></div>
<div class="edit-icon musicIcon" data-lyrics="{$audio->getLyrics()}" data-title="{$audio->getTitle()}" data-performer="{$audio->getPerformer()}" n:if="$audio->canBeModifiedBy($thisUser) && !$isWithdrawn" ></div>
{if !$addToPlaylistButton}
<div class="remove-icon musicIcon" data-id="{$audio->getId()}" n:if="$hasAudio" ></div>
<div class="add-icon musicIcon" data-id="{$audio->getId()}" n:if="!$hasAudio" ></div>
<div class="edit-icon musicIcon" data-lyrics="{$audio->getLyrics()}" data-title="{$audio->getTitle()}" data-performer="{$audio->getPerformer()}" data-explicit="{(int)$audio->isExplicit()}" n:if="$editable && !$isWithdrawn" ></div>
<div class="report-icon musicIcon" data-id="{$audio->getId()}" n:if="!$editable && !$isWithdrawn" ></div>
{else}
jrgnwighweif
{/if}
</div>
</div>
</div>

View file

@ -1,8 +1,15 @@
<div class="searchOptions newer">
<ul class="searchList">
<a n:attr="id => $mode === 'list' ? 'used' : 'ki'" href="/audios{$thisUser->getId()}">{_my_music}</a>
<a href="/player/upload">{_upload_audio}</a>
<a n:attr="id => $mode === 'list' && $isMy ? 'used' : 'ki'" href="/audios{$thisUser->getId()}">{_my_music}</a>
<a n:if="!$isMy" n:attr="id => $mode === 'list' ? 'used' : 'ki'" href="/audios{$ownerId}">{if $ownerId > 0}{_music_user}{else}{_music_club}{/if}</a>
<a href="/player/upload{if $isMyClub}?gid={abs($ownerId)}{/if}">{_upload_audio}</a>
<a n:attr="id => $mode === 'playlists' ? 'used' : 'ki'" href="/playlists{$thisUser->getId()}">{_my_playlists}</a>
<a n:if="$mode === 'playlists'" href="/audios/newPlaylist{if $isMyClub}?owner={abs($ownerId)}{/if}">{_new_playlist}</a>
<a n:attr="id => $mode === 'new' ? 'used' : 'ki'" href="/audios/new">{_audio_new}</a>
<a n:attr="id => $mode === 'popular' ? 'used' : 'ki'" href="/audios/popular">{_audio_popular}</a>
<a href="/search?type=audios">{_audio_search}</a>

View file

@ -90,6 +90,25 @@
</div>
</div>
</div>
<div>
<div class="content_title_expanded" onclick="hidePanel(this, {$audiosCount});">
{_audios}
</div>
<div>
<div class="content_subtitle">
{tr("audios_count", $audiosCount)}
<div style="float:right;">
<a href="/audios-{$club->getId()}">{_all_title}</a>
</div>
</div>
<div class="content_list long">
<div class="audio" n:foreach="$audios as $audio" style="width: 100%;">
{include "../Audio/player.xml", audio => $audio}
</div>
</div>
</div>
</div>
{presenter "openvk!Wall->wallEmbedded", -$club->getId()}
</div>

View file

@ -46,6 +46,9 @@
<div n:attr="id => ($mode === 'user' ? 'activetabs' : 'ki')" class="tab" mode="user">
<a n:attr="id => ($mode === 'user' ? 'act_tab_a' : 'ki')">Пользователи</a>
</div>
<div n:attr="id => ($mode === 'audio' ? 'activetabs' : 'ki')" class="tab" mode="audio">
<a n:attr="id => ($mode === 'audio' ? 'act_tab_a' : 'ki')">{_audios}</a>
</div>
</center>
<script>

View file

@ -23,6 +23,8 @@
{if $appsSoftDeleting}
{include "./content/app.xml", app => $object}
{/if}
{elseif $type == "audio"}
{include "../Audio/player.xml", audio => $object}
{else}
{include "../components/error.xml", description => tr("version_incompatibility")}
{/if}

View file

@ -384,6 +384,18 @@
</select>
</td>
</tr>
<tr>
<td width="120" valign="top">
<span class="nobold">{_privacy_setting_view_audio}</span>
</td>
<td>
<select name="audios.read", style="width: 164px;">
<option value="2" {if $user->getPrivacySetting('audios.read') == 2}selected{/if}>{_privacy_value_anybody}</option>
<option value="1" {if $user->getPrivacySetting('audios.read') == 1}selected{/if}>{_privacy_value_friends}</option>
<option value="0" {if $user->getPrivacySetting('audios.read') == 0}selected{/if}>{_privacy_value_nobody}</option>
</select>
</td>
</tr>
<tr>
<td>

View file

@ -277,6 +277,15 @@
margin-top: 3px;
}
.audioEntry .buttons .report-icon {
width: 12px;
height: 11px;
float: right;
background-position: -67px -51px;
margin-top: 3px;
margin-right: 3px;
}
.add-icon-noaction {
background-image: url('/assets/packages/static/openvk/img/audios_controls.png');
width: 11px;
@ -320,3 +329,29 @@
.audioEmbed.withdrawn {
filter: opacity(0.8);
}
.playlistCover img {
width: 135px;
height: 135px;
}
.playlistBlock {
margin-top: 14px;
}
.playlistContainer {
display: flex;
}
.playlistContainer .playlistCover img {
width:111px;
height:111px;
}
.playlistContainer .infObj {
margin-left: 15px;
}
.playlistContainer .infObj:first-of-type {
margin-left: 0px;
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 KiB

After

Width:  |  Height:  |  Size: 2.4 KiB

View file

@ -103,12 +103,17 @@ $(document).on("click", ".musicIcon.edit-icon", (e) => {
${tr("lyrics")}
<textarea name="lyrics" maxlength="500">${lyrics ?? ""}</textarea>
</div>
<div style="margin-top: 11px">
<label><input type="checkbox" name="explicit" ${e.currentTarget.dataset.explicit == 1 ? "checked" : ""} maxlength="500">${tr("audios_explicit")}</label>
</div>
`, [tr("ok"), tr("cancel")], [
function() {
let t_name = $(".ovk-diag-body input[name=name]").val();
let t_perf = $(".ovk-diag-body input[name=performer]").val();
let t_genre = $(".ovk-diag-body select[name=genre]").val();
let t_lyrics = $(".ovk-diag-body textarea[name=lyrics]").val();
let t_explicit = document.querySelector(".ovk-diag-body input[name=explicit]").checked;
$.ajax({
type: "POST",
@ -118,6 +123,7 @@ $(document).on("click", ".musicIcon.edit-icon", (e) => {
performer: t_perf,
genre: t_genre,
lyrics: t_lyrics,
explicit: Number(t_explicit),
hash: u("meta[name=csrf]").attr("value")
},
success: (response) => {
@ -144,8 +150,8 @@ $(document).on("click", ".musicIcon.edit-icon", (e) => {
}
e.currentTarget.setAttribute("data-lyrics", response.new_info.lyrics_unformatted)
e.currentTarget.setAttribute("data-explicit", Number(response.new_info.explicit))
player.setAttribute("data-genre", response.new_info.genre)
console.log(response)
} else {
MessageBox(tr("error"), response.flash.message, [tr("ok")], [Function.noop])
}
@ -248,3 +254,24 @@ $(document).on("click", ".audioEmbed.lagged", (e) => {
$(document).on("click", ".audioEmbed.withdrawn", (e) => {
MessageBox(tr("error"), tr("audio_embed_withdrawn"), [tr("ok")], [Function.noop])
})
$(document).on("click", ".musicIcon.report-icon", (e) => {
MessageBox(tr("report_question"), `
${tr("going_to_report_video")}
<br/>${tr("report_question_text")}
<br/><br/><b> ${tr("report_reason")}</b>: <input type='text' id='uReportMsgInput' placeholder='${tr("reason")}' />`, [tr("confirm_m"), tr("cancel")], [(function() {
res = document.querySelector("#uReportMsgInput").value;
xhr = new XMLHttpRequest();
xhr.open("GET", "/report/" + e.currentTarget.dataset.id + "?reason=" + res + "&type=audio", true);
xhr.onload = (function() {
if(xhr.responseText.indexOf("reason") === -1)
MessageBox(tr("error"), tr("error_sending_report"), ["OK"], [Function.noop]);
else
MessageBox(tr("action_successfully"), tr("will_be_watched"), ["OK"], [Function.noop]);
});
xhr.send(null)
}),
Function.noop])
})

View file

@ -347,7 +347,6 @@
"albums" = "Albums";
"album" = "Album";
"photos" = "photos";
"photo" = "Photo";
"create_album" = "Create album";
"edit_album" = "Edit album";
"edit_photo" = "Edit photo";
@ -569,6 +568,7 @@
"privacy_setting_add_to_friends" = "Who can add me to friends";
"privacy_setting_write_wall" = "Who can publish post on my wall";
"privacy_setting_write_messages" = "Who can write messages to me";
"privacy_setting_view_audio" = "Who can view my audios";
"privacy_value_anybody" = "Anybody";
"privacy_value_anybody_dative" = "Anybody";
"privacy_value_users" = "OpenVK users";
@ -725,6 +725,7 @@
"audios" = "Audios";
"audio" = "Audio";
"playlist" = "Playlist";
"upload_audio" = "Upload audio";
"performer" = "Performer";
@ -756,6 +757,8 @@
"track_noname" = "Without name";
"my_music" = "My music";
"music_user" = "User's music";
"music_club" = "Club's music";
"audio_new" = "New";
"audio_popular" = "Popular";
"audio_search" = "Search";
@ -769,6 +772,16 @@
"owner" = "Owner";
"select_audio" = "Select audios";
"no_playlists_thisuser" = "You haven't added any playlists yet.";
"no_playlists_user" = "This user has not added any playlists yet.";
"no_playlists_club" = "This group hasn't added playlists yet.";
"new_playlist" = "New playlist";
"created_playlist" = "created";
"bookmark" = "Add to collection";
"unbookmark" = "Remove from collection";
"empty_playlist" = "There are no audios in this playlist.";
"edit_playlist" = "Edit playlist";
/* Notifications */

View file

@ -541,6 +541,7 @@
"privacy_setting_add_to_friends" = "Кто может называть меня другом";
"privacy_setting_write_wall" = "Кто может писать у меня на стене";
"privacy_setting_write_messages" = "Кто может писать мне сообщения";
"privacy_setting_view_audio" = "Кто может видеть мои аудиозаписи";
"privacy_value_anybody" = "Все желающие";
"privacy_value_anybody_dative" = "Всем желающим";
"privacy_value_users" = "Пользователям OpenVK";
@ -680,6 +681,7 @@
"audios" = "Аудиозаписи";
"audio" = "Аудиозапись";
"playlist" = "Плейлист";
"upload_audio" = "Загрузить аудио";
"performer" = "Исполнитель";
@ -711,6 +713,8 @@
"track_noname" = "Без названия";
"my_music" = "Моя музыка";
"music_user" = "Музыка пользователя";
"music_club" = "Музыка группы";
"audio_new" = "Новое";
"audio_popular" = "Популярное";
"audio_search" = "Поиск";
@ -724,6 +728,16 @@
"owner" = "Владелец";
"select_audio" = "Выбрать аудиозаписи";
"no_playlists_thisuser" = "Вы ещё не добавляли плейлистов.";
"no_playlists_user" = "Этот пользователь ещё не добавлял плейлистов.";
"no_playlists_club" = "Эта группа ещё не добавляла плейлистов.";
"new_playlist" = "Новый плейлист";
"created_playlist" = "создан";
"bookmark" = "Добавить в коллекцию";
"unbookmark" = "Убрать из коллекции";
"empty_playlist" = "В этом плейлисте нет аудиозаписей.";
"edit_playlist" = "Редактировать плейлист";
/* Notifications */