X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=actions%2Fshownotice.php;h=b8927372bb10d1c72e83da54ab66ec052d4944b3;hb=27ef3b1d905cdf8f47b47293a757624dda88fdc7;hp=005335e3b4b281831bb2a01dada39c9733392d37;hpb=120a117f41e272644eea6c6f0600a720e86fcd14;p=quix0rs-gnu-social.git diff --git a/actions/shownotice.php b/actions/shownotice.php index 005335e3b4..b8927372bb 100644 --- a/actions/shownotice.php +++ b/actions/shownotice.php @@ -78,6 +78,9 @@ class ShownoticeAction extends OwnerDesignAction function prepare($args) { parent::prepare($args); + if ($this->boolean('ajax')) { + StatusNet::setApi(true); + } $id = $this->arg('notice'); @@ -167,11 +170,7 @@ class ShownoticeAction extends OwnerDesignAction function title() { - if (!empty($this->profile->fullname)) { - $base = $this->profile->fullname . ' (' . $this->profile->nickname . ')'; - } else { - $base = $this->profile->nickname; - } + $base = $this->profile->getFancyName(); return sprintf(_('%1$s\'s status on %2$s'), $base, @@ -192,22 +191,26 @@ class ShownoticeAction extends OwnerDesignAction { parent::handle($args); - if ($this->notice->is_local == Notice::REMOTE_OMB) { - if (!empty($this->notice->url)) { - $target = $this->notice->url; - } else if (!empty($this->notice->uri) && preg_match('/^https?:/', $this->notice->uri)) { - // Old OMB posts saved the remote URL only into the URI field. - $target = $this->notice->uri; - } else { - // Shouldn't happen. - $target = false; - } - if ($target && $target != $this->selfUrl()) { - common_redirect($target, 301); - return false; + if ($this->boolean('ajax')) { + $this->showAjax(); + } else { + if ($this->notice->is_local == Notice::REMOTE_OMB) { + if (!empty($this->notice->url)) { + $target = $this->notice->url; + } else if (!empty($this->notice->uri) && preg_match('/^https?:/', $this->notice->uri)) { + // Old OMB posts saved the remote URL only into the URI field. + $target = $this->notice->uri; + } else { + // Shouldn't happen. + $target = false; + } + if ($target && $target != $this->selfUrl()) { + common_redirect($target, 301); + return false; + } } + $this->showPage(); } - $this->showPage(); } /** @@ -236,6 +239,21 @@ class ShownoticeAction extends OwnerDesignAction $this->elementEnd('ol'); } + function showAjax() + { + header('Content-Type: text/xml;charset=utf-8'); + $this->xw->startDocument('1.0', 'UTF-8'); + $this->elementStart('html'); + $this->elementStart('head'); + $this->element('title', null, _('Notice')); + $this->elementEnd('head'); + $this->elementStart('body'); + $nli = new NoticeListItem($this->notice, $this); + $nli->show(); + $this->elementEnd('body'); + $this->elementEnd('html'); + } + /** * Don't show page notice * @@ -278,12 +296,6 @@ class ShownoticeAction extends OwnerDesignAction 'content' => $id->toString())); } - if ($user->jabbermicroid && $user->jabber && $this->notice->uri) { - $id = new Microid('xmpp:', $user->jabber, - $this->notice->uri); - $this->element('meta', array('name' => 'microid', - 'content' => $id->toString())); - } $this->element('link',array('rel'=>'alternate', 'type'=>'application/json+oembed', 'href'=>common_local_url( @@ -303,7 +315,7 @@ class ShownoticeAction extends OwnerDesignAction $avatar = $this->profile->getAvatar(AVATAR_PROFILE_SIZE); $avatarUrl = ($avatar) ? $avatar->displayUrl() : - Avatar::defaultImage($avatar_size); + Avatar::defaultImage(AVATAR_PROFILE_SIZE); $this->element('meta', array('property' => 'og:image', 'content' => $avatarUrl)); $this->element('meta', array('property' => 'og:description', @@ -311,7 +323,7 @@ class ShownoticeAction extends OwnerDesignAction } } -class SingleNoticeItem extends NoticeListItem +class SingleNoticeItem extends DoFollowListItem { /** * recipe function for displaying a single notice. @@ -335,8 +347,38 @@ class SingleNoticeItem extends NoticeListItem $this->showEnd(); } + /** + * For our zoomed-in special case we'll use a fuller list + * for the attachment info. + */ function showNoticeAttachments() { $al = new AttachmentList($this->notice, $this->out); $al->show(); } + + /** + * show the avatar of the notice's author + * + * We use the larger size for single notice page. + * + * @return void + */ + + function showAvatar() + { + $avatar_size = AVATAR_PROFILE_SIZE; + + $avatar = $this->profile->getAvatar($avatar_size); + + $this->out->element('img', array('src' => ($avatar) ? + $avatar->displayUrl() : + Avatar::defaultImage($avatar_size), + 'class' => 'avatar photo', + 'width' => $avatar_size, + 'height' => $avatar_size, + 'alt' => + ($this->profile->fullname) ? + $this->profile->fullname : + $this->profile->nickname)); + } }