openvk/Web/Presenters/templates/components/textArea.xml

97 lines
5 KiB
XML
Raw Permalink Normal View History

2022-01-02 21:52:53 +03:00
{php if(!isset($GLOBALS["textAreaCtr"])) $GLOBALS["textAreaCtr"] = 10;}
{var textAreaId = ($post ?? NULL) === null ? (++$GLOBALS["textAreaCtr"]) : $post->getId()}
2021-11-28 14:39:42 +03:00
<div id="write" style="padding: 5px 0;" onfocusin="expand_wall_textarea({$textAreaId});">
<form action="{$route}" method="post" enctype="multipart/form-data" style="margin:0;">
2021-11-28 14:39:42 +03:00
<textarea id="wall-post-input{$textAreaId}" placeholder="{_write}" name="text" style="width: 100%;resize: none;" class="small-textarea"></textarea>
<div>
<!-- padding to fix <br/> bug -->
</div>
2021-11-28 14:39:42 +03:00
<div id="post-buttons{$textAreaId}" style="display: none;">
<div class="post-upload">
{_attachment}: <span>(unknown)</span>
</div>
<div n:if="$postOpts ?? true" class="post-opts">
2021-11-15 22:45:48 +03:00
{var anonEnabled = OPENVK_ROOT_CONF['openvk']['preferences']['wall']['anonymousPosting']['enable']}
{if !is_null($thisUser) && !is_null($club ?? NULL) && $owner < 0}
{if $club->canBeModifiedBy($thisUser)}
<script>
function onWallAsGroupClick(el) {
2021-11-15 22:45:48 +03:00
document.querySelector("#forceSignOpt").style.display = el.checked ? "block" : "none";
{if $anonEnabled}
document.querySelector("#octoberAnonOpt").style.display = el.checked ? "none" : "block";
{/if}
}
</script>
<label>
<input type="checkbox" name="as_group" onchange="onWallAsGroupClick(this)" /> {_"post_as_group"}
</label>
<label id="forceSignOpt" style="display: none;">
<input type="checkbox" name="force_sign" /> {_"add_signature"}
</label>
{/if}
{/if}
2021-11-15 22:45:48 +03:00
<label n:if="$anonEnabled" id="octoberAnonOpt">
<input type="checkbox" name="anon" /> {_"as_anonymous"}
2021-11-15 22:45:48 +03:00
</label>
<label>
<input type="checkbox" name="nsfw" /> {_"contains_nsfw"}
</label>
</div>
<div n:if="!($postOpts ?? true) && !is_null($thisUser) && !is_null($club ?? NULL) && $club->canBeModifiedBy($thisUser)" class="post-opts">
<label>
<input type="checkbox" name="as_group" /> {_"comment_as_group"}
</label>
</div>
<input type="file" class="postFileSel" id="postFilePic" name="_pic_attachment" accept="image/*" style="display:none;" />
<input type="file" class="postFileSel" id="postFileVid" name="_vid_attachment" accept="video/*" 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" />
2021-10-13 20:48:36 +03:00
<div style="float: right; display: flex; flex-direction: column;">
<a href="javascript:void(u('#post-buttons{$textAreaId} #wallAttachmentMenu').toggleClass('hidden'));">
{_attach}
</a>
2021-10-13 20:48:36 +03:00
<div id="wallAttachmentMenu" class="hidden">
<a href="javascript:void(document.querySelector('#post-buttons{$textAreaId} input[name=_pic_attachment]').click());">
2021-10-13 20:48:36 +03:00
<img src="/assets/packages/static/openvk/img/oxygen-icons/16x16/mimetypes/application-x-egon.png" />
{_attach_photo}
</a>
<a href="javascript:void(document.querySelector('#post-buttons{$textAreaId} input[name=_vid_attachment]').click());">
<img src="/assets/packages/static/openvk/img/oxygen-icons/16x16/mimetypes/application-vnd.rn-realmedia.png" />
{_attach_video}
</a>
<a n:if="$graffiti ?? false" href="javascript:initGraffiti({$textAreaId});">
<img src="/assets/packages/static/openvk/img/oxygen-icons/16x16/actions/draw-brush.png" />
{_draw_graffiti}
</a>
2021-10-13 20:48:36 +03:00
</div>
</div>
</div>
</form>
</div>
<script>
$(document).ready(() => {
u("#post-buttons{$textAreaId} .postFileSel").on("change", function() {
handleUpload.bind(this, {$textAreaId})();
});
setupWallPostInputHandlers({$textAreaId});
});
</script>
2021-11-28 17:28:17 +03:00
{if $graffiti}
{script "js/node_modules/react/dist/react-with-addons.min.js"}
{script "js/node_modules/react-dom/dist/react-dom.min.js"}
{script "js/vnd_literallycanvas.js"}
{css "js/node_modules/literallycanvas/lib/css/literallycanvas.css"}
{/if}