]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
use a subclass for single notice items to show attachments
authorEvan Prodromou <evan@controlyourself.ca>
Tue, 23 Jun 2009 14:25:18 +0000 (07:25 -0700)
committerEvan Prodromou <evan@controlyourself.ca>
Tue, 23 Jun 2009 14:25:18 +0000 (07:25 -0700)
actions/shownotice.php
lib/noticelist.php

index b0d973a991cad8e61cfa2d8ce632013e89f3201b..0d89af5acc40b81849ee4d4fb2b7ca80fdbe53fd 100644 (file)
@@ -209,7 +209,7 @@ class ShownoticeAction extends Action
     function showContent()
     {
         $this->elementStart('ol', array('class' => 'notices xoxo'));
-        $nli = new NoticeListItem($this->notice, $this);
+        $nli = new SingleNoticeItem($this->notice, $this);
         $nli->show();
         $this->elementEnd('ol');
     }
@@ -264,3 +264,29 @@ class ShownoticeAction extends Action
         }
     }
 }
+
+class SingleNoticeItem extends NoticeListItem
+{
+    /**
+     * recipe function for displaying a single notice.
+     *
+     * We overload to show attachments.
+     *
+     * @return void
+     */
+
+    function show()
+    {
+        $this->showStart();
+        $this->showNotice();
+        $this->showNoticeAttachments();
+        $this->showNoticeInfo();
+        $this->showNoticeOptions();
+        $this->showEnd();
+    }
+
+    function showNoticeAttachments() {
+        $al = new AttachmentList($this->notice, $this->out);
+        $al->show();
+    }
+}
index ad792441a3794765df430698c0721a65b0737e37..bd4815cd6c05ffffda93bb1251333a942ad7e6b6 100644 (file)
@@ -179,7 +179,6 @@ class NoticeListItem extends Widget
     {
         $this->showStart();
         $this->showNotice();
-        $this->showNoticeAttachments();
         $this->showNoticeInfo();
         $this->showNoticeOptions();
         $this->showEnd();
@@ -193,18 +192,6 @@ class NoticeListItem extends Widget
         $this->out->elementEnd('div');
     }
 
-    function showNoticeAttachments() {
-        if ($this->isUsedInList()) {
-            return;
-        }
-        $al = new AttachmentList($this->notice, $this->out);
-        $al->show();
-    }
-
-    function isUsedInList() {
-        return 'shownotice' !== $this->out->args['action'];
-    }
-
     function showNoticeInfo()
     {
         $this->out->elementStart('div', 'entry-content');