*
* @param Notice $notice The notice we'll display
*/
- function __construct($notice, $out=null)
+ function __construct(Notice $notice, Action $out=null)
{
parent::__construct($out);
if (!empty($notice->repeat_of)) {
$original = Notice::getKV('id', $notice->repeat_of);
- if (empty($original)) { // could have been deleted
+ if (!$original instanceof Notice) { // could have been deleted
$this->notice = $notice;
} else {
$this->notice = $original;
function showNotice()
{
- $this->out->elementStart('div', 'entry-title');
+ $this->showNoticeTitle();
$this->showAuthor();
+ $this->showAddressees();
$this->showContent();
- $this->out->elementEnd('div');
+ }
+
+ function showNoticeTitle()
+ {
+ if (Event::handle('StartShowNoticeTitle', array($this))) {
+ $this->element('a', array('href' => $this->notice->getUrl(),
+ 'class' => 'p-name metadata'),
+ $this->notice->getTitle());
+ Event::handle('EndShowNoticeTitle', array($this));
+ }
}
function showNoticeInfo()
{
- $this->out->elementStart('div', 'entry-content');
+ $this->out->elementStart('div', 'entry-metadata');
if (Event::handle('StartShowNoticeInfo', array($this))) {
$this->showNoticeLink();
$this->showNoticeSource();
if ($user) {
$this->out->elementStart('div', 'notice-options');
if (Event::handle('StartShowNoticeOptionItems', array($this))) {
- $this->showFaveForm();
$this->showReplyLink();
$this->showRepeatForm();
$this->showDeleteLink();
{
if (Event::handle('StartOpenNoticeListItemElement', array($this))) {
$id = (empty($this->repeat)) ? $this->notice->id : $this->repeat->id;
- $class = 'hentry notice';
+ $class = 'h-entry notice';
if ($this->notice->scope != 0 && $this->notice->scope != 1) {
$class .= ' limited-scope';
}
}
}
- /**
- * show the "favorite" form
- *
- * @return void
- */
- function showFaveForm()
- {
- if (Event::handle('StartShowFaveForm', array($this))) {
- $user = common_current_user();
- if ($user) {
- if ($user->hasFave($this->notice)) {
- $disfavor = new DisfavorForm($this->out, $this->notice);
- $disfavor->show();
- } else {
- $favor = new FavorForm($this->out, $this->notice);
- $favor->show();
- }
- }
- Event::handle('EndShowFaveForm', array($this));
- }
- }
-
/**
* show the author of a notice
*
function showAuthor()
{
- $this->out->elementStart('div', 'author');
-
- $this->out->elementStart('span', 'vcard author');
-
$attrs = array('href' => $this->profile->profileurl,
- 'class' => 'url',
- 'title' => $this->profile->nickname);
+ 'class' => 'h-card p-author',
+ 'title' => $this->profile->getNickname());
- $this->out->elementStart('a', $attrs);
- $this->showAvatar();
- $this->out->text(' ');
- $this->out->element('span',array('class' => 'fn'), $this->profile->getStreamName());
- $this->out->elementEnd('a');
-
- $this->out->elementEnd('span');
-
- $this->showAddressees();
-
- $this->out->elementEnd('div');
+ if (Event::handle('StartShowNoticeItemAuthor', array($this->profile, $this->out, &$attrs))) {
+ $this->out->elementStart('a', $attrs);
+ $this->showAvatar($this->profile);
+ $this->out->text($this->profile->getStreamName());
+ $this->out->elementEnd('a');
+ Event::handle('EndShowNoticeItemAuthor', array($this->profile, $this->out));
+ }
}
function showAddressees()
$pa = $this->getProfileAddressees();
if (!empty($pa)) {
- $this->out->elementStart('span', 'addressees');
+ $this->out->elementStart('ul', 'addressees');
$first = true;
foreach ($pa as $addr) {
- if (!$first) {
- // TRANS: Separator in profile addressees list.
- $this->out->text(_m('SEPARATOR',', '));
- } else {
- // Start of profile addressees list.
- $first = false;
- }
+ $this->out->elementStart('li', 'h-card');
$text = $addr['text'];
unset($addr['text']);
$this->out->element('a', $addr, $text);
+ $this->out->elementEnd('li');
}
- $this->out->elementEnd('span', 'addressees');
+ $this->out->elementEnd('ul', 'addressees');
}
}
foreach ($attentions as $attn) {
$class = $attn->isGroup() ? 'group' : 'account';
$pa[] = array('href' => $attn->profileurl,
- 'title' => $attn->nickname,
+ 'title' => $attn->getNickname(),
'class' => "addressee {$class}",
'text' => $attn->getStreamName());
}
return $this->notice->getReplyProfiles();
}
- /**
- * show the avatar of the notice's author
- *
- * This will use the default avatar if no avatar is assigned for the author.
- * It makes a link to the author's profile.
- *
- * @return void
- */
- function showAvatar()
- {
- $avatar_size = $this->avatarSize();
-
- $avatarUrl = $this->profile->avatarUrl($avatar_size);
-
- $this->out->element('img', array('src' => $avatarUrl,
- 'class' => 'avatar photo',
- 'width' => $avatar_size,
- 'height' => $avatar_size,
- 'alt' =>
- ($this->profile->fullname) ?
- $this->profile->fullname :
- $this->profile->nickname));
- }
-
- function avatarSize()
- {
- return AVATAR_STREAM_SIZE;
- }
-
/**
* show the nickname of the author
*
*/
function showNickname()
{
- $this->out->raw('<span class="nickname fn">' .
- htmlspecialchars($this->profile->nickname) .
+ $this->out->raw('<span class="p-name">' .
+ htmlspecialchars($this->profile->getNickname()) .
'</span>');
}
function showContent()
{
// FIXME: URL, image, video, audio
- $this->out->elementStart('p', array('class' => 'entry-content'));
- if ($this->notice->rendered) {
- $this->out->raw($this->notice->rendered);
- } else {
- // XXX: may be some uncooked notices in the DB,
- // we cook them right now. This should probably disappear in future
- // versions (>> 0.4.x)
- $this->out->raw(common_render_content($this->notice->content, $this->notice));
+ $this->out->elementStart('div', array('class' => 'e-content'));
+ if (Event::handle('StartShowNoticeContent', array($this->notice, $this->out, $this->out->getScoped()))) {
+ if ($this->notice->rendered) {
+ $this->out->raw($this->notice->rendered);
+ } else {
+ // XXX: may be some uncooked notices in the DB,
+ // we cook them right now. This should probably disappear in future
+ // versions (>> 0.4.x)
+ $this->out->raw(common_render_content($this->notice->content, $this->notice));
+ }
+ Event::handle('EndShowNoticeContent', array($this->notice, $this->out, $this->out->getScoped()));
}
- $this->out->elementEnd('p');
+ $this->out->elementEnd('div');
}
function showNoticeAttachments() {
function showNoticeLink()
{
$this->out->elementStart('a', array('rel' => 'bookmark',
- 'class' => 'timestamp',
+ 'class' => 'u-url timestamp',
'href' => $this->notice->getLocalUrl()));
$this->out->element('time', array('class' => 'dt-published',
'datetime' => common_date_iso8601($this->notice->created),
$repeater = Profile::getKV('id', $this->repeat->profile_id);
$attrs = array('href' => $repeater->profileurl,
- 'class' => 'url');
-
- if (!empty($repeater->fullname)) {
- $attrs['title'] = $repeater->fullname . ' (' . $repeater->nickname . ')';
- }
+ 'class' => 'h-card p-author',
+ 'title' => $repeater->getFancyName());
- $this->out->elementStart('span', 'repeat vcard');
+ $this->out->elementStart('span', 'repeat h-entry');
// TRANS: Addition in notice list item if notice was repeated. Followed by a span with a nickname.
- $this->out->raw(_('Repeated by'));
- $this->out->raw(' ');
+ $this->out->raw(_('Repeated by').' ');
- $this->out->elementStart('a', $attrs);
- $this->out->element('span', 'fn nickname', $repeater->nickname);
- $this->out->elementEnd('a');
+ $this->out->element('a', $attrs, $repeater->getNickname());
$this->out->elementEnd('span');
}
if (common_logged_in()) {
$this->out->text(' ');
$reply_url = common_local_url('newnotice',
- array('replyto' => $this->profile->nickname, 'inreplyto' => $this->notice->id));
+ array('replyto' => $this->profile->getNickname(), 'inreplyto' => $this->notice->id));
$this->out->elementStart('a', array('href' => $reply_url,
'class' => 'notice_reply',
// TRANS: Link title in notice list item to reply to a notice.