]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - lib/messagelistitem.php
Caching fixes for Fave class
[quix0rs-gnu-social.git] / lib / messagelistitem.php
index 44e6976454c04339fd9ce61e151442b2d96ef298..c9f4c6042b92cb571d733ff661b8a3a4d3523a51 100644 (file)
@@ -4,7 +4,7 @@
  * Copyright (C) 2011, StatusNet, Inc.
  *
  * A single list item for showing in a message list
- * 
+ *
  * PHP version 5
  *
  * This program is free software: you can redistribute it and/or modify
@@ -65,37 +65,27 @@ abstract class MessageListItem extends Widget
      *
      * @return void
      */
-
     function show()
     {
-        $this->out->elementStart('li', array('class' => 'hentry notice',
+        $this->out->elementStart('li', array('class' => 'h-entry notice',
                                              'id' => 'message-' . $this->message->id));
 
         $profile = $this->getMessageProfile();
 
-        $this->out->elementStart('div', 'entry-title');
-        $this->out->elementStart('span', 'vcard author');
         $this->out->elementStart('a', array('href' => $profile->profileurl,
-                                            'class' => 'url'));
-        $avatar = $profile->getAvatar(AVATAR_STREAM_SIZE);
-        $this->out->element('img', array('src' => ($avatar) ?
-                                         $avatar->displayUrl() :
-                                         Avatar::defaultImage(AVATAR_STREAM_SIZE),
-                                         'class' => 'photo avatar',
+                                            'class' => 'p-author'));
+        $avatarUrl = $profile->avatarUrl(AVATAR_STREAM_SIZE);
+        $this->out->element('img', array('src' => $avatarUrl,
+                                         'class' => 'avatar u-photo',
                                          'width' => AVATAR_STREAM_SIZE,
                                          'height' => AVATAR_STREAM_SIZE,
-                                         'alt' =>
-                                         ($profile->fullname) ? $profile->fullname :
-                                         $profile->nickname));
-        $this->out->element('span', array('class' => 'nickname fn'),
-                            $profile->nickname);
+                                         'alt' => $profile->getBestName()));
+        $this->out->element('span', array('class' => 'nickname fn'), $profile->getNickname());
         $this->out->elementEnd('a');
-        $this->out->elementEnd('span');
 
         // FIXME: URL, image, video, audio
-        $this->out->elementStart('p', array('class' => 'entry-content'));
+        $this->out->elementStart('div', array('class' => 'e-content'));
         $this->out->raw($this->message->rendered);
-        $this->out->elementEnd('p');
         $this->out->elementEnd('div');
 
         $messageurl = common_local_url('showmessage',
@@ -107,19 +97,22 @@ abstract class MessageListItem extends Widget
             $messageurl = $this->message->uri;
         }
 
-        $this->out->elementStart('div', 'entry-content');
+        $this->out->elementStart('div', 'entry-metadata');
         $this->out->elementStart('a', array('rel' => 'bookmark',
                                             'class' => 'timestamp',
                                             'href' => $messageurl));
         $dt = common_date_iso8601($this->message->created);
-        $this->out->element('abbr', array('class' => 'published',
-                                          'title' => $dt),
+        $this->out->element('time', array('class' => 'dt-published',
+                                          'datetime' => common_date_iso8601($this->message->created),
+                                          // TRANS: Timestamp title (tooltip text) for NoticeListItem
+                                          'title' => common_exact_date($this->message->created)),
                             common_date_string($this->message->created));
         $this->out->elementEnd('a');
 
         if ($this->message->source) {
             $this->out->elementStart('span', 'source');
             // FIXME: bad i18n. Device should be a parameter (from %s).
+            // TRANS: Followed by notice source (usually the client used to send the notice).
             $this->out->text(_('from'));
             $this->showSource($this->message->source);
             $this->out->elementEnd('span');
@@ -129,6 +122,29 @@ abstract class MessageListItem extends Widget
         $this->out->elementEnd('li');
     }
 
+    /**
+     * Dummy method. Serves no other purpose than to make strings available used
+     * in self::showSource() through xgettext.
+     *
+     * @return void
+     */
+    function messageListItemDummyMessages()
+    {
+        // A dummy array with messages. These will get extracted by xgettext and
+        // are used in self::showSource().
+        $dummy_messages = array(
+            // TRANS: A possible notice source (web interface).
+            _m('SOURCE','web'),
+            // TRANS: A possible notice source (XMPP).
+            _m('SOURCE','xmpp'),
+            // TRANS: A possible notice source (e-mail).
+            _m('SOURCE','mail'),
+            // TRANS: A possible notice source (OpenMicroBlogging).
+            _m('SOURCE','omb'),
+            // TRANS: A possible notice source (Application Programming Interface).
+            _m('SOURCE','api'),
+        );
+    }
 
     /**
      * Show the source of the message
@@ -142,7 +158,7 @@ abstract class MessageListItem extends Widget
      */
     function showSource($source)
     {
-        $source_name = _($source);
+        $source_name = _m('SOURCE',$source);
         switch ($source) {
         case 'web':
         case 'xmpp':
@@ -152,7 +168,7 @@ abstract class MessageListItem extends Widget
             $this->out->element('span', 'device', $source_name);
             break;
         default:
-            $ns = Notice_source::staticGet($source);
+            $ns = Notice_source::getKV($source);
             if ($ns) {
                 $this->out->elementStart('span', 'device');
                 $this->out->element('a', array('href' => $ns->url,