This repository has been archived on 2025-02-26. You can view files and clone it, but cannot push or open issues or pull requests.
szurubooru/src/Views/post/post-edit.phtml

109 lines
3.3 KiB
PHTML
Raw Normal View History

2014-04-27 15:59:29 +02:00
<form method="post"
2014-04-30 00:11:13 +02:00
action="<?= \Chibi\Router::linkTo(
['PostController', 'editAction'],
['id' => $this->context->transport->post->getId()]) ?>"
2014-04-27 15:59:29 +02:00
enctype="multipart/form-data"
class="edit-post">
2013-10-22 00:38:10 +02:00
<h1>edit post</h1>
2014-04-27 15:59:29 +02:00
<input type="hidden"
name="edit-token"
id="edit-token"
value="<?= htmlspecialchars($this->context->transport->post->getEditToken()) ?>"/>
2014-05-20 17:03:47 +02:00
<?php
if (Access::check(new Privilege(
Privilege::EditPostSafety,
Access::getIdentity($this->context->transport->post->getUploader()))))
{
$safety = PostSafety::getAll();
$context = new StdClass;
$context->label = 'Safety';
$context->name = 'safety';
$context->optionValues = array_map(function($s) { return $s->toInteger(); }, $safety);
$context->optionLabels = array_map(function($s) { return ucfirst($s->toDisplayString()); }, $safety);
$context->activeOptionValue = $this->context->transport->post->getSafety()->toInteger();
$this->renderExternal('input-radioboxes', $context);
}
if (Access::check(new Privilege(
Privilege::EditPostTags,
Access::getIdentity($this->context->transport->post->getUploader()))))
{
$context = new StdClass;
$context->label = 'Tags';
$context->name = 'tags';
$context->placeholder = 'Enter some tags&hellip;';
$context->value = join(',', array_map(
function($tag)
{
return htmlspecialchars($tag->getName());
},
$this->context->transport->post->getTags()));
$this->renderExternal('input-text', $context);
}
if (Access::check(new Privilege(
Privilege::EditPostSource,
Access::getIdentity($this->context->transport->post->getUploader()))))
{
$context = new StdClass;
$context->label = 'Source';
$context->name = 'source';
$context->value = htmlspecialchars($this->context->transport->post->getSource());
$this->renderExternal('input-text', $context);
}
if (Access::check(new Privilege(
Privilege::EditPostRelations,
Access::getIdentity($this->context->transport->post->getUploader()))))
{
$context = new StdClass;
$context->label = 'Relations';
$context->name = 'relations';
$context->placeholder = 'id1,id2,&hellip;';
$context->value = join(',', array_map(
function($post)
{
return $post->getId();
},
$this->context->transport->post->getRelations()));
$this->renderExternal('input-text', $context);
}
if (Access::check(new Privilege(
Privilege::EditPostContent,
Access::getIdentity($this->context->transport->post->getUploader()))))
{
$context = new StdClass;
$context->label = 'File';
$context->name = 'url';
$context->placeholder = 'Some URL&hellip;';
$this->renderExternal('input-text', $context);
$context = new StdClass;
$context->name = 'file';
$this->renderExternal('input-file', $context);
}
if (Access::check(new Privilege(
Privilege::EditPostThumb,
Access::getIdentity($this->context->transport->post->getUploader()))))
{
$context = new StdClass;
$context->name = 'thumb';
$context->label = 'Thumb';
if ($this->context->transport->post->hasCustomThumb())
$context->additionalInfo = '(Currently using custom thumb)';
$this->renderExternal('input-file', $context);
}
?>
2013-10-22 00:38:10 +02:00
2014-02-16 16:03:13 +01:00
<div class="form-row">
<label></label>
<button class="submit" type="submit">Submit</button>
2013-10-22 00:38:10 +02:00
</div>
</form>