diff --git a/Media.php b/Media.php index 265108e..cc7003a 100644 --- a/Media.php +++ b/Media.php @@ -16,6 +16,18 @@ function getTitle() function getDescription() { + $body = $this->body; + if (!empty($this->inreplyto)) { + if (is_array($this->inreplyto)) { + foreach ($this->inreplyto as $inreplyto) { + $body = '
-draw('entity/edit/footer');?> \ No newline at end of file + +draw('entity/edit/footer');?> ' . $body; + } + } else { + $body = ' ' . $body; + } + } + return $body; + return $this->body; } @@ -25,7 +37,11 @@ function getDescription() */ function getActivityStreamsObjectType() { - return 'media'; + $meta = array('type' => 'media'); + if ($this->inreplyto) { + $meta['in-reply-to'] = $this->inreplyto; + } + return $meta; } /** @@ -47,6 +63,19 @@ function saveDataFromInput() } } + $this->inreplyto = \Idno\Core\Idno::site()->currentPage()->getInput('inreplyto'); + + // TODO fetch syndicated reply targets asynchronously (or maybe on-demand, when syndicating?) + if (!empty($inreplyto)) { + if (is_array($inreplyto)) { + foreach ($inreplyto as $inreplytourl) { + $this->syndicatedto = \Idno\Core\Webmention::addSyndicatedReplyTargets($inreplytourl, $this->syndicatedto); + } + } else { + $this->syndicatedto = \Idno\Core\Webmention::addSyndicatedReplyTargets($inreplyto); + } + } + $this->title = \Idno\Core\Idno::site()->currentPage()->getInput('title'); $this->body = \Idno\Core\Idno::site()->currentPage()->getInput('body'); $this->tags = \Idno\Core\Idno::site()->currentPage()->getInput('tags'); diff --git a/templates/default/entity/Media/edit.tpl.php b/templates/default/entity/Media/edit.tpl.php index 1a243a8..c3e9748 100644 --- a/templates/default/entity/Media/edit.tpl.php +++ b/templates/default/entity/Media/edit.tpl.php @@ -1,4 +1,18 @@ draw('entity/edit/header');?> +inreplyto)) { + if (!is_array($vars['object']->inreplyto)) { + $vars['object']->inreplyto = array($vars['object']->inreplyto); + } +} else { + $vars['object']->inreplyto = array(); +} +if (!empty($vars['url'])) { + $vars['object']->inreplyto = array($vars['url']); +} + +?>