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-04-29 23:52:17 +02:00
|
|
|
<?php if (Access::check(
|
2014-04-27 15:59:29 +02:00
|
|
|
Privilege::EditPostSafety,
|
2014-04-29 23:52:17 +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"
|
|
|
|
<?php if ($this->context->transport->post->safety == $safety): ?>
|
|
|
|
checked="checked"
|
|
|
|
<?php endif ?>
|
|
|
|
value="<?= $safety ?>"/>
|
2014-04-27 14:44:06 +02:00
|
|
|
<?= ucfirst(PostSafety::toDisplayString($safety)) ?>
|
2014-02-16 16:03:13 +01:00
|
|
|
</label>
|
|
|
|
<?php endforeach ?>
|
|
|
|
</div>
|
2013-10-22 00:38:10 +02:00
|
|
|
</div>
|
|
|
|
<?php endif ?>
|
|
|
|
|
2014-04-29 23:52:17 +02:00
|
|
|
<?php if (Access::check(
|
2014-04-27 15:59:29 +02:00
|
|
|
Privilege::EditPostTags,
|
2014-04-29 23:52:17 +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…"
|
|
|
|
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-04-27 15:59:29 +02:00
|
|
|
<?php if (
|
2014-04-29 23:52:17 +02:00
|
|
|
Access::check(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-04-27 15:59:29 +02:00
|
|
|
<?php if (
|
2014-04-29 23:52:17 +02:00
|
|
|
Access::check(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,…"
|
|
|
|
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-04-27 15:59:29 +02:00
|
|
|
<?php if (
|
2014-04-29 23:52:17 +02:00
|
|
|
Access::check(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…"/>
|
|
|
|
</div>
|
2013-11-23 17:27:56 +01:00
|
|
|
</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>
|
2013-11-23 17:27:56 +01:00
|
|
|
</div>
|
|
|
|
<?php endif ?>
|
|
|
|
|
2014-04-27 15:59:29 +02:00
|
|
|
<?php if (
|
2014-04-29 23:52:17 +02:00
|
|
|
Access::check(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>
|
2013-11-23 17:28:48 +01:00
|
|
|
<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 ?>
|
|
|
|
|
|
|
|
<input type="hidden" name="submit" value="1"/>
|
|
|
|
|
2014-02-16 16:03:13 +01:00
|
|
|
<div class="form-row">
|
|
|
|
<label></label>
|
2013-11-30 14:22:49 +01:00
|
|
|
<button class="submit" type="submit">Submit</button>
|
2013-10-22 00:38:10 +02:00
|
|
|
</div>
|
|
|
|
</form>
|