X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=lib%2Fnoticelist.php;h=4182d8808f7046520a9453e8ab1c90b6562083dd;hb=590cc0c9a41206ba58c9333b4e9ef8931285f7e4;hp=1283e43e4a0ace99c9659e77598b6025bf28a0b0;hpb=607e65be81d6b42990706884f96fa024301c7893;p=quix0rs-gnu-social.git diff --git a/lib/noticelist.php b/lib/noticelist.php index 1283e43e4a..4182d8808f 100644 --- a/lib/noticelist.php +++ b/lib/noticelist.php @@ -22,6 +22,7 @@ * @category UI * @package Laconica * @author Evan Prodromou + * @author Sarven Capadisli * @copyright 2008 Control Yourself, Inc. * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 * @link http://laconi.ca/ @@ -67,7 +68,7 @@ class NoticeList extends Widget function __construct($notice, $out=null) { - parent::__construct($out); + parent::__construct($out); $this->notice = $notice; } @@ -160,7 +161,7 @@ class NoticeListItem extends Widget function __construct($notice, $out=null) { - parent::__construct($out); + parent::__construct($out); $this->notice = $notice; $this->profile = $notice->getProfile(); } @@ -202,14 +203,16 @@ class NoticeListItem extends Widget function showNoticeOptions() { - $this->out->elementStart('div', 'notice-options'); - $this->showFaveForm(); - $this->showReplyLink(); - $this->showDeleteLink(); - $this->out->elementEnd('div'); + $user = common_current_user(); + if ($user) { + $this->out->elementStart('div', 'notice-options'); + $this->showFaveForm(); + $this->showReplyLink(); + $this->showDeleteLink(); + $this->out->elementEnd('div'); + } } - /** * start a single notice. * @@ -221,7 +224,7 @@ class NoticeListItem extends Widget // XXX: RDFa // TODO: add notice_type class e.g., notice_video, notice_image $this->out->elementStart('li', array('class' => 'hentry notice', - 'id' => 'notice-' . $this->notice->id)); + 'id' => 'notice-' . $this->notice->id)); } /** @@ -235,11 +238,11 @@ class NoticeListItem extends Widget $user = common_current_user(); if ($user) { if ($user->hasFave($this->notice)) { - $disfavor = new DisfavorForm($this->out, $this->notice); - $disfavor->show(); + $disfavor = new DisfavorForm($this->out, $this->notice); + $disfavor->show(); } else { - $favor = new FavorForm($this->out, $this->notice); - $favor->show(); + $favor = new FavorForm($this->out, $this->notice); + $favor->show(); } } } @@ -255,8 +258,12 @@ class NoticeListItem extends Widget function showAuthor() { $this->out->elementStart('span', 'vcard author'); - $this->out->elementStart('a', array('href' => $this->profile->profileurl, - 'class' => 'url')); + $attrs = array('href' => $this->profile->profileurl, + 'class' => 'url'); + if (!empty($this->profile->fullname)) { + $attrs['title'] = $this->profile->fullname . ' (' . $this->profile->nickname . ') '; + } + $this->out->elementStart('a', $attrs); $this->showAvatar(); $this->showNickname(); $this->out->elementEnd('a'); @@ -274,18 +281,23 @@ class NoticeListItem extends Widget function showAvatar() { - $avatar = $this->profile->getAvatar(AVATAR_STREAM_SIZE); + if ('shownotice' === $this->out->trimmed('action')) { + $avatar_size = AVATAR_PROFILE_SIZE; + } else { + $avatar_size = AVATAR_STREAM_SIZE; + } + $avatar = $this->profile->getAvatar($avatar_size); $this->out->element('img', array('src' => ($avatar) ? - common_avatar_display_url($avatar) : - common_default_avatar(AVATAR_STREAM_SIZE), - 'class' => 'avatar photo', - 'width' => AVATAR_STREAM_SIZE, - 'height' => AVATAR_STREAM_SIZE, - 'alt' => - ($this->profile->fullname) ? - $this->profile->fullname : - $this->profile->nickname)); + $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)); } /** @@ -299,7 +311,7 @@ class NoticeListItem extends Widget function showNickname() { $this->out->element('span', array('class' => 'nickname fn'), - $this->profile->nickname); + $this->profile->nickname); } /** @@ -346,14 +358,14 @@ class NoticeListItem extends Widget $noticeurl = $this->notice->uri; } $this->out->elementStart('dl', 'timestamp'); - $this->out->element('dt', null, _('Published')); + $this->out->element('dt', null, _('Published')); $this->out->elementStart('dd', null); $this->out->elementStart('a', array('rel' => 'bookmark', - 'href' => $noticeurl)); + 'href' => $noticeurl)); $dt = common_date_iso8601($this->notice->created); $this->out->element('abbr', array('class' => 'published', - 'title' => $dt), - common_date_string($this->notice->created)); + 'title' => $dt), + common_date_string($this->notice->created)); $this->out->elementEnd('a'); $this->out->elementEnd('dd'); $this->out->elementEnd('dl'); @@ -375,23 +387,24 @@ class NoticeListItem extends Widget $this->out->element('dt', null, _('From')); $source_name = _($this->notice->source); switch ($this->notice->source) { - case 'web': - case 'xmpp': - case 'mail': - case 'omb': - case 'api': - $this->out->element('dd', 'noticesource', $source_name); + case 'web': + case 'xmpp': + case 'mail': + case 'omb': + case 'system': + case 'api': + $this->out->element('dd', null, $source_name); break; - default: + default: $ns = Notice_source::staticGet($this->notice->source); if ($ns) { $this->out->elementStart('dd', null); $this->out->element('a', array('href' => $ns->url, - 'rel' => 'external'), - $ns->name); + 'rel' => 'external'), + $ns->name); $this->out->elementEnd('dd'); } else { - $this->out->element('dd', 'noticesource', $source_name); + $this->out->element('dd', null, $source_name); } break; } @@ -417,8 +430,8 @@ class NoticeListItem extends Widget $this->out->element('dt', null, _('To')); $this->out->elementStart('dd'); $this->out->element('a', array('href' => $replyurl, - 'rel' => 'in-reply-to'), - _('in reply to')); + 'rel' => 'in-reply-to'), + _('in reply to')); $this->out->elementEnd('dd'); $this->out->elementEnd('dl'); } @@ -435,16 +448,21 @@ class NoticeListItem extends Widget function showReplyLink() { - $reply_url = common_local_url('newnotice', - array('replyto' => $this->profile->nickname)); - - $this->out->elementStart('dl', 'notice_reply'); - $this->out->element('dt', null, _('Reply to this notice')); - $this->out->elementStart('dd'); - $this->out->element('a', array('href' => $reply_url, - 'title' => _('reply')), _('Reply')); - $this->out->elementEnd('dd'); - $this->out->elementEnd('dl'); + if (common_logged_in()) { + $reply_url = common_local_url('newnotice', + array('replyto' => $this->profile->nickname)); + + $this->out->elementStart('dl', 'notice_reply'); + $this->out->element('dt', null, _('Reply to this notice')); + $this->out->elementStart('dd'); + $this->out->elementStart('a', array('href' => $reply_url, + 'title' => _('Reply to this notice'))); + $this->out->text(_('Reply')); + $this->out->element('span', 'notice_id', $this->notice->id); + $this->out->elementEnd('a'); + $this->out->elementEnd('dd'); + $this->out->elementEnd('dl'); + } } /** @@ -463,7 +481,7 @@ class NoticeListItem extends Widget $this->out->element('dt', null, _('Delete this notice')); $this->out->elementStart('dd'); $this->out->element('a', array('href' => $deleteurl, - 'title' => _('delete')), _('Delete')); + 'title' => _('Delete this notice')), _('Delete')); $this->out->elementEnd('dd'); $this->out->elementEnd('dl'); }