openvk/Web/Presenters/templates/Apps/Play.xml

64 lines
2.2 KiB
XML

{extends "../@layout.xml"}
{var $canReport = $owner->getId() !== $thisUser->getId()}
{block title}
{$name}
{/block}
{block header}
{$name}
<a style="float: right;" onClick="reportApp()" n:if="$canReport ?? false">{_report}</a>
{/block}
{block content}
<center>
<iframe id="appFrame" referrerpolicy="unsafe-url" frameBorder="0" src="{$url}" height="600" width="600"
sandbox="allow-scripts allow-same-origin allow-pointer-lock allow-forms allow-downloads-without-user-activation"></iframe>
</center>
<div n:if="!is_null($news)" id="news">
<h4>{$news->getName()}</h4>
<div id="app_news_container">
{$news->getText()|noescape}
</div>
</div>
<center>
<p>
{_app_dev}: <a href="{$owner->getURL()}">{$owner->getFullName()}</a>
</p>
</center>
<script>
window.appId = {$id};
window.appTitle = {$name};
window.appPerms = {$perms};
window.appOrigin = {$origin};
</script>
<script n:if="$canReport ?? false">
function reportApp() {
uReportMsgTxt = {_going_to_report_app};
uReportMsgTxt += "<br/>"+tr("report_question_text");
uReportMsgTxt += "<br/><br/><b>"+tr("report_reason")+"</b>: <input type='text' id='uReportMsgInput' placeholder='" + tr("reason") + "' />"
MessageBox(tr("report_question"), uReportMsgTxt, [tr("confirm_m"), tr("cancel")], [
(function() {
res = document.querySelector("#uReportMsgInput").value;
xhr = new XMLHttpRequest();
xhr.open("GET", "/report/" + {$id} + "?reason=" + res + "&type=app", 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
]);
}
</script>
{script "js/al_games.js"}
{/block}