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-edit.phtml

127 lines
3.5 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->id]) ?>"
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-04 16:27:15 +02:00
<?php if (Access::check(new Privilege(
2014-04-27 15:59:29 +02:00
Privilege::EditPostSafety,
2014-05-04 16:27:15 +02:00
Access::getIdentity($this->context->transport->post->getUploader())))): ?>
2014-04-27 15:59:29 +02:00
2014-02-16 16:03:13 +01:00
<div class="form-row safety">
<label>Safety:</label>
<div class="input-wrapper">
<?php foreach (PostSafety::getAll() as $safety): ?>
<label>
2014-04-27 15:59:29 +02:00
<input type="radio"
name="safety"
2014-05-04 19:06:40 +02:00
<?php if ($this->context->transport->post->getSafety() == $safety): ?>
2014-04-27 15:59:29 +02:00
checked="checked"
<?php endif ?>
2014-05-04 19:06:40 +02:00
value="<?= $safety->toInteger() ?>"/>
&nbsp;<?= ucfirst($safety->toDisplayString()) ?>
2014-02-16 16:03:13 +01:00
</label>
<?php endforeach ?>
</div>
2013-10-22 00:38:10 +02:00
</div>
<?php endif ?>
2014-05-04 16:27:15 +02:00
<?php if (Access::check(new Privilege(
2014-04-27 15:59:29 +02:00
Privilege::EditPostTags,
2014-05-04 16:27:15 +02:00
Access::getIdentity($this->context->transport->post->getUploader())))): ?>
2014-04-27 15:59:29 +02:00
2014-02-16 16:03:13 +01:00
<div class="form-row tags">
<label for="tags">Tags:</label>
2014-04-27 15:59:29 +02:00
<div class="input-wrapper">
<input type="text"
name="tags"
id="tags"
placeholder="enter some tags&hellip;"
value="<?= join(',', array_map(function($tag) {
return htmlspecialchars($tag->name);
}, $this->context->transport->post->getTags())) ?>"/>
</div>
2013-10-22 00:38:10 +02:00
</div>
<?php endif ?>
2014-05-04 16:27:15 +02:00
<?php if (Access::check(new Privilege(
Privilege::EditPostSource,
Access::getIdentity($this->context->transport->post->getUploader())))): ?>
2014-04-27 15:59:29 +02:00
2014-02-16 16:03:13 +01:00
<div class="form-row source">
<label for="source">Source:</label>
2014-04-27 15:59:29 +02:00
<div class="input-wrapper">
<input type="text"
name="source"
id="source"
value="<?= htmlspecialchars($this->context->transport->post->source) ?>"/>
</div>
2013-10-22 00:38:10 +02:00
</div>
<?php endif ?>
2014-05-04 16:27:15 +02:00
<?php if (Access::check(new Privilege(
Privilege::EditPostRelations,
Access::getIdentity($this->context->transport->post->getUploader())))): ?>
2014-04-27 15:59:29 +02:00
2014-02-16 16:03:13 +01:00
<div class="form-row thumb">
<label for="relations">Relations:</label>
2014-04-27 15:59:29 +02:00
<div class="input-wrapper">
<input type="text"
name="relations"
id="relations"
placeholder="id1,id2,&hellip;"
value="<?= join(',', array_map(function($post) {
return $post->id;
}, $this->context->transport->post->getRelations())) ?>"/>
</div>
2013-10-30 20:20:01 +01:00
</div>
<?php endif ?>
2014-05-04 16:27:15 +02:00
<?php if (Access::check(new Privilege(
Privilege::EditPostFile,
Access::getIdentity($this->context->transport->post->getUploader())))): ?>
2014-04-27 15:59:29 +02:00
2014-02-16 16:03:13 +01:00
<div class="form-row url">
<label for="url">File:</label>
2014-04-27 15:59:29 +02:00
<div class="input-wrapper">
<input type="text" name="url" id="url" placeholder="Some url&hellip;"/>
</div>
</div>
2014-02-16 16:03:13 +01:00
<div class="form-row file">
<label for="file"></label>
2014-04-27 15:59:29 +02:00
<div class="input-wrapper">
<input type="file" name="file" id="file"/>
</div>
</div>
<?php endif ?>
2014-05-04 16:27:15 +02:00
<?php if (Access::check(new Privilege(
Privilege::EditPostThumb,
Access::getIdentity($this->context->transport->post->getUploader())))): ?>
2014-04-27 15:59:29 +02:00
2014-02-16 16:03:13 +01:00
<div class="form-row thumb">
<label for="thumb">Thumb:</label>
<div class="input-wrapper">
<input type="file" name="thumb" id="thumb"/>
<?php if ($this->context->transport->post->hasCustomThumb()): ?>
<small>(Currently using custom thumb)</small>
<?php endif ?>
</div>
2013-10-22 00:38:10 +02:00
</div>
<?php endif ?>
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>