]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - lib/noticelist.php
Add a menuItem method to Action
[quix0rs-gnu-social.git] / lib / noticelist.php
index 0fe967da381388beb15e7e0c459f4e2c3586df58..be3128b4b67c52ff3d5a27c00f95102bc6fa1cda 100644 (file)
@@ -169,19 +169,39 @@ class NoticeListItem
     function show()
     {
         $this->showStart();
-        $this->showFaveForm();
+        $this->showNotice();
+        $this->showNoticeInfo();
+        $this->showNoticeOptions();
+        $this->showEnd();
+    }
+
+    function showNotice()
+    {
+        $this->elementStart('div', 'entry-title');
         $this->showAuthor();
         $this->showContent();
-        $this->startTimeSection();
+        $this->elementEnd('div');
+    }
+
+    function showNoticeInfo()
+    {
+        $this->elementStart('div', 'entry-content');
         $this->showNoticeLink();
         $this->showNoticeSource();
         $this->showReplyTo();
+        $this->elementEnd('div');
+    }
+
+    function showNoticeOptions()
+    {
+        $this->elementStart('div', 'notice-options');
+        $this->showFaveForm();
         $this->showReplyLink();
         $this->showDeleteLink();
-        $this->endTimeSection();
-        $this->showEnd();
+        $this->elementEnd('div');
     }
 
+
     /**
      * start a single notice.
      *
@@ -224,13 +244,13 @@ class NoticeListItem
 
     function showAuthor()
     {
-        common_element_start('span', 'vcard author');
-        common_element_start('a', array('href' => $this->profile->profileurl),
-                                        'class' => 'url');
+        $this->elementStart('span', 'vcard author');
+        $this->elementStart('a', array('href' => $this->profile->profileurl,
+                                        'class' => 'url'));
         $this->showAvatar();
         $this->showNickname();
-        common_element_end('a');
-        common_element_end('span');
+        $this->elementEnd('a');
+        $this->elementEnd('span');
     }
 
     /**
@@ -246,7 +266,7 @@ class NoticeListItem
     {
         $avatar = $this->profile->getAvatar(AVATAR_STREAM_SIZE);
 
-        common_element('img', array('src' => ($avatar) ?
+        $this->element('img', array('src' => ($avatar) ?
                                     common_avatar_display_url($avatar) :
                                     common_default_avatar(AVATAR_STREAM_SIZE),
                                     'class' => 'avatar photo',
@@ -268,7 +288,7 @@ class NoticeListItem
 
     function showNickname()
     {
-        common_element('span', array('class' => 'nickname fn'),
+        $this->element('span', array('class' => 'nickname fn'),
                        $this->profile->nickname);
     }
 
@@ -285,7 +305,7 @@ class NoticeListItem
     function showContent()
     {
         // FIXME: URL, image, video, audio
-        common_element_start('p', array('class' => 'content entry-title'));
+        common_element_start('p', array('class' => 'entry-content'));
         if ($this->notice->rendered) {
             common_raw($this->notice->rendered);
         } else {
@@ -297,21 +317,6 @@ class NoticeListItem
         common_element_end('p');
     }
 
-    /**
-     * show the "time" section of a notice
-     *
-     * This is the greyed-out section that appears beneath the content, including
-     * links to delete or reply to the notice. Probably should be called something
-     * else.
-     *
-     * @return void
-     */
-
-    function startTimeSection()
-    {
-        common_element_start('p', 'time');
-    }
-
     /**
      * show the link to the main page for the notice
      *
@@ -330,14 +335,18 @@ class NoticeListItem
             preg_match('/^http/', $this->notice->uri)) {
             $noticeurl = $this->notice->uri;
         }
-        common_element_start('a', array('class' => 'permalink',
-                                        'rel' => 'bookmark',
+        $this->elementStart('dl', 'timestamp');
+        $this->element('dt', _('Published')); 
+        $this->elementStart('dd', null);
+        $this->element('a', array('rel' => 'bookmark',
                                         'href' => $noticeurl));
         $dt = common_date_iso8601($this->notice->created);
-        common_element('abbr', array('class' => 'published',
+        $this->element('abbr', array('class' => 'published',
                                      'title' => $dt),
                        common_date_string($this->notice->created));
-        common_element_end('a');
+        $this->elementEnd('a');
+        $this->elementEnd('dd');
+        $this->elementEnd('dl');
     }
 
     /**
@@ -352,7 +361,8 @@ class NoticeListItem
     function showNoticeSource()
     {
         if ($this->notice->source) {
-            common_element('span', null, _(' from '));
+            $this->elementStart('dl', 'device');
+            $this->element('dt', null, _('From'));
             $source_name = _($this->notice->source);
             switch ($this->notice->source) {
             case 'web':
@@ -360,18 +370,22 @@ class NoticeListItem
             case 'mail':
             case 'omb':
             case 'api':
-                common_element('span', 'noticesource', $source_name);
+                $this->element('dd', 'noticesource', $source_name);
                 break;
             default:
                 $ns = Notice_source::staticGet($this->notice->source);
                 if ($ns) {
-                    common_element('a', array('href' => $ns->url),
+                    $this->elementStart('dd', null);
+                    $this->element('a', array('href' => $ns->url,
+                                              'rel' => 'external'),
                                    $ns->name);
+                    $this->elementEnd('dd');
                 } else {
-                    common_element('span', 'noticesource', $source_name);
+                    $this->element('dd', 'noticesource', $source_name);
                 }
                 break;
             }
+            $this->elementEnd('dl');
         }
     }
 
@@ -392,9 +406,8 @@ class NoticeListItem
             $this->elementStart('dl', 'response');
             $this->element('dt', null, _('To'));
             $this->elementStart('dd');
-            $this->element('a', array('class' => 'inreplyto',
-                                      'href' => $replyurl),
-                                      'rel' => 'in-reply-to',
+            $this->element('a', array('href' => $replyurl,
+                                      'rel' => 'in-reply-to'),
                            _('in reply to'));
             $this->elementEnd('dd');
             $this->elementEnd('dl');
@@ -447,17 +460,6 @@ class NoticeListItem
         }
     }
 
-    /**
-     * end the time section
-     *
-     * @return void
-     */
-
-    function endTimeSection()
-    {
-        common_element_end('p');
-    }
-
     /**
      * finish the notice
      *