Reformat bookmark output

This commit is contained in:
Evan Prodromou 2010-12-22 15:24:13 -08:00
parent 1faaaed72b
commit ae64963d71
2 changed files with 79 additions and 36 deletions

View File

@ -175,48 +175,91 @@ class BookmarkPlugin extends Plugin
$nli->notice->id); $nli->notice->id);
if (!empty($nb)) { if (!empty($nb)) {
$att = $nli->notice->attachments();
$nli->out->elementStart('h3'); $out = $nli->out;
$nli->out->element('a', $notice = $nli->notice;
array('href' => $att[0]->url), $profile = $nli->profile;
$nb->title);
$nli->out->elementEnd('h3'); $atts = $notice->attachments();
$nli->out->element('p',
array('class' => 'bookmark_description'), if (count($atts) < 1) {
$nb->description); // Something wrong; let default code deal with it.
$nli->out->elementStart('p'); return true;
$nli->out->element('a', array('href' => $nli->profile->profileurl,
'class' => 'bookmark_author',
'title' => $nli->profile->getBestName()),
$nli->profile->getBestName());
$nli->out->elementEnd('p');
$tags = $nli->notice->getTags();
$nli->out->elementStart('ul', array('class' => 'bookmark_tags'));
foreach ($tags as $tag) {
$nli->out->elementStart('li');
$nli->out->element('a',
array('rel' => 'tag',
'href' => Notice_tag::url($tag)),
$tag);
$nli->out->elementEnd('li');
$nli->out->text(' ');
} }
$nli->out->elementEnd('ul');
$att = $atts[0];
$out->elementStart('h3');
$out->element('a',
array('href' => $att->url),
$nb->title);
$out->elementEnd('h3');
$out->elementStart('ul', array('class' => 'bookmark_tags'));
// Replies look like "for:" tags
$replies = $nli->notice->getReplies(); $replies = $nli->notice->getReplies();
if (!empty($replies)) { if (!empty($replies)) {
$nli->out->elementStart('ul', array('class' => 'bookmark_mentions'));
foreach ($replies as $reply) { foreach ($replies as $reply) {
$other = Profile::staticGet('id', $reply); $other = Profile::staticGet('id', $reply);
$nli->out->elementStart('li'); $out->elementStart('li');
$nli->out->element('a', array('rel' => 'tag', $out->element('a', array('rel' => 'tag',
'href' => $other->profileurl, 'href' => $other->profileurl,
'title' => $other->getBestName()), 'title' => $other->getBestName()),
sprintf('for:%s', $other->nickname)); sprintf('for:%s', $other->nickname));
$nli->out->elementEnd('li'); $out->elementEnd('li');
$nli->out->text(' '); $out->text(' ');
} }
$nli->out->elementEnd('ul');
} }
$tags = $nli->notice->getTags();
foreach ($tags as $tag) {
$out->elementStart('li');
$out->element('a',
array('rel' => 'tag',
'href' => Notice_tag::url($tag)),
$tag);
$out->elementEnd('li');
$out->text(' ');
}
$out->elementEnd('ul');
$out->element('p',
array('class' => 'bookmark_description'),
$nb->description);
$nli->showNoticeAttachments();
$out->elementStart('p', array('style' => 'float: left'));
$avatar = $profile->getAvatar(AVATAR_MINI_SIZE);
$out->element('img', array('src' => ($avatar) ?
$avatar->displayUrl() :
Avatar::defaultImage(AVATAR_MINI_SIZE),
'class' => 'avatar photo bookmark_avatar',
'width' => AVATAR_MINI_SIZE,
'height' => AVATAR_MINI_SIZE,
'alt' => $profile->getBestName()));
$out->raw('&nbsp;');
$out->element('a', array('href' => $profile->profileurl,
'title' => $profile->getBestName()),
$profile->nickname);
$nli->showNoticeLink();
$nli->showNoticeSource();
$nli->showNoticeLocation();
$nli->showContext();
$nli->showRepeat();
$out->elementEnd('p');
$nli->showNoticeOptions();
return false; return false;
} }
return true; return true;

View File

@ -1,3 +1,3 @@
.bookmark_tags li { display: inline; } .bookmark_tags li { display: inline; }
.bookmark_mentions li { display: inline; } .bookmark_mentions li { display: inline; }
.bookmark_avatar { float: left }