summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEvan Prodromou <evan@status.net>2009-10-29 16:16:02 -0400
committerEvan Prodromou <evan@status.net>2009-10-29 16:16:02 -0400
commit49dd54315ffd98b84e64d0377d4c26c07ec4084e (patch)
treec0571a3ee6a9e3c12fca25b3ae5f000d7cb53710
parent5b0809f4a3619e8123b486f7e910913dc4e10086 (diff)
show notice location in notice list
-rw-r--r--lib/noticelist.php39
1 files changed, 39 insertions, 0 deletions
diff --git a/lib/noticelist.php b/lib/noticelist.php
index 6c296f82a..8b3015cc3 100644
--- a/lib/noticelist.php
+++ b/lib/noticelist.php
@@ -199,6 +199,7 @@ class NoticeListItem extends Widget
{
$this->out->elementStart('div', 'entry-content');
$this->showNoticeLink();
+ $this->showNoticeLocation();
$this->showNoticeSource();
$this->showContext();
$this->out->elementEnd('div');
@@ -370,6 +371,44 @@ class NoticeListItem extends Widget
}
/**
+ * show the notice location
+ *
+ * shows the notice location in the correct language.
+ *
+ * If an URL is available, makes a link. Otherwise, just a span.
+ *
+ * @return void
+ */
+
+ function showNoticeLocation()
+ {
+ $id = $this->notice->id;
+
+ $location = $this->notice->getLocation();
+
+ if (empty($location)) {
+ return;
+ }
+
+ $name = $location->getName();
+
+ if (empty($name)) {
+ // XXX: Could be a translation issue. Fall back to... something?
+ return;
+ }
+
+ $url = $location->getUrl();
+
+ if (empty($url)) {
+ $this->out->element('span', array('class' => 'location'), $name);
+ } else {
+ $this->out->element('a', array('class' => 'location',
+ 'href' => $url),
+ $name);
+ }
+ }
+
+ /**
* Show the source of the notice
*
* Either the name (and link) of the API client that posted the notice,