show where a notice came from

darcs-hash:20080730032651-84dde-0685ec5f899129bc75745ca8d1d083f56f3f1ff5.gz
This commit is contained in:
Evan Prodromou 2008-07-29 23:26:51 -04:00
parent e998cc3960
commit 2090e0aa78
2 changed files with 28 additions and 0 deletions

View File

@ -400,6 +400,10 @@ class ShowstreamAction extends StreamAction {
'href' => $noticeurl,
'title' => common_exact_date($notice->created)),
common_date_string($notice->created));
if ($notice->source) {
common_text(_(' from '));
$this->source_link($notice->source);
}
if ($notice->reply_to) {
$replyurl = common_local_url('shownotice', array('notice' => $notice->reply_to));
common_text(' (');

View File

@ -106,6 +106,10 @@ class StreamAction extends Action {
'href' => $noticeurl,
'title' => common_exact_date($notice->created)),
common_date_string($notice->created));
if ($notice->source) {
common_text(_(' from '));
$this->source_link($notice->source);
}
if ($notice->reply_to) {
$replyurl = common_local_url('shownotice', array('notice' => $notice->reply_to));
common_text(' (');
@ -131,4 +135,24 @@ class StreamAction extends Action {
}
common_element_end('li');
}
function source_link($source) {
$source_name = _($source);
switch ($source) {
case 'web':
case 'xmpp':
case 'mail':
case 'omb':
case 'api':
common_element('span', 'noticesource', $source_name);
break;
default:
$ns = new Notice_source($source);
if ($ns) {
common_element('a', array('href' => $ns->url),
$ns->name);
}
}
return;
}
}