]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - actions/replies.php
change controlyourself.ca to status.net
[quix0rs-gnu-social.git] / actions / replies.php
index 7c24b554e0a0768ae81671b338103253570aac9c..37c1f33e6f9bcde0d9c511b8f36622654095126e 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /**
- * Laconica, the distributed open-source microblogging tool
+ * StatusNet, the distributed open-source microblogging tool
  *
  * List of replies
  *
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  *
  * @category  Personal
- * @package   Laconica
- * @author    Evan Prodromou <evan@controlyourself.ca>
- * @copyright 2008-2009 Control Yourself, Inc.
+ * @package   StatusNet
+ * @author    Evan Prodromou <evan@status.net>
+ * @copyright 2008-2009 StatusNet, Inc.
  * @license   http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
- * @link      http://laconi.ca/
+ * @link      http://status.net/
  */
 
 if (!defined('LACONICA')) {
@@ -39,16 +39,16 @@ require_once INSTALLDIR.'/lib/feedlist.php';
  * List of replies
  *
  * @category Personal
- * @package  Laconica
- * @author   Evan Prodromou <evan@controlyourself.ca>
+ * @package  StatusNet
+ * @author   Evan Prodromou <evan@status.net>
  * @license  http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
- * @link     http://laconi.ca/
+ * @link     http://status.net/
  */
 
-class RepliesAction extends Action
+class RepliesAction extends OwnerDesignAction
 {
-    var $user = null;
     var $page = null;
+    var $notice;
 
     /**
      * Prepare the object
@@ -84,7 +84,14 @@ class RepliesAction extends Action
         $this->page = ($this->arg('page')) ? ($this->arg('page')+0) : 1;
 
         common_set_returnto($this->selfUrl());
-        
+
+        $this->notice = $this->user->getReplies(($this->page-1) * NOTICES_PER_PAGE,
+             NOTICES_PER_PAGE + 1);
+
+        if($this->page > 1 && $this->notice->N == 0){
+            $this->serverError(_('No such page'),$code=404);
+        }
+
         return true;
     }
 
@@ -129,27 +136,13 @@ class RepliesAction extends Action
      * @return void
      */
 
-    function showFeeds()
+    function getFeeds()
     {
         $rssurl   = common_local_url('repliesrss',
                                      array('nickname' => $this->user->nickname));
         $rsstitle = sprintf(_('Feed for replies to %s'), $this->user->nickname);
 
-        $this->element('link', array('rel' => 'alternate',
-                                     'href' => $rssurl,
-                                     'type' => 'application/rss+xml',
-                                     'title' => $rsstitle));
-    }
-
-    /**
-     * Output document relationship links
-     *
-     * @return void
-     */
-    function showRelationshipLinks()
-    {
-        $this->sequenceRelationships($this->page > 1, $this->count > NOTICES_PER_PAGE, // FIXME
-                                     $this->page, 'replies', array('nickname' => $this->user->nickname));
+        return array(new Feed(Feed::RSS1, $rssurl, $rsstitle));
     }
 
     /**
@@ -164,25 +157,6 @@ class RepliesAction extends Action
         $nav->show();
     }
 
-    /**
-     * Show the replies feed links
-     *
-     * @return void
-     */
-
-    function showExportData()
-    {
-        $fl = new FeedList($this);
-
-        $rssurl = common_local_url('repliesrss',
-                                   array('nickname' => $this->user->nickname));
-
-        $fl->show(array(0=>array('href'=> $rssurl,
-                                 'type' => 'rss',
-                                 'version' => 'RSS 1.0',
-                                 'item' => 'repliesrss')));
-    }
-
     /**
      * Show the content
      *
@@ -193,19 +167,42 @@ class RepliesAction extends Action
 
     function showContent()
     {
-        $notice = $this->user->getReplies(($this->page-1) * NOTICES_PER_PAGE,
-                                          NOTICES_PER_PAGE + 1);
-
-        $nl = new NoticeList($notice, $this);
+        $nl = new NoticeList($this->notice, $this);
 
         $cnt = $nl->show();
+        if (0 === $cnt) {
+            $this->showEmptyListMessage();
+        }
 
         $this->pagination($this->page > 1, $cnt > NOTICES_PER_PAGE,
                           $this->page, 'replies',
                           array('nickname' => $this->user->nickname));
     }
 
-    function isReadOnly()
+    function showEmptyListMessage()
+    {
+        $message = sprintf(_('This is the timeline showing replies to %s but %s hasn\'t received a notice to his attention yet.'), $this->user->nickname, $this->user->nickname) . ' ';
+
+        if (common_logged_in()) {
+            $current_user = common_current_user();
+            if ($this->user->id === $current_user->id) {
+                $message .= _('You can engage other users in a conversation, subscribe to more people or [join groups](%%action.groups%%).');
+            } else {
+                $message .= sprintf(_('You can try to [nudge %s](../%s) or [post something to his or her attention](%%%%action.newnotice%%%%?status_textarea=%s).'), $this->user->nickname, $this->user->nickname, '@' . $this->user->nickname);
+            }
+        }
+        else {
+            $message .= sprintf(_('Why not [register an account](%%%%action.%s%%%%) and then nudge %s or post a notice to his or her attention.'),
+                                (!common_config('site','openidonly')) ? 'register' : 'openidlogin',
+                                $this->user->nickname);
+        }
+
+        $this->elementStart('div', 'guide');
+        $this->raw(common_markup_to_html($message));
+        $this->elementEnd('div');
+    }
+
+    function isReadOnly($args)
     {
         return true;
     }