]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Merge branch 'dev-0.7.x' into link-rel-paginate
authorMeitar Moscovitz <meitarm@gmail.com>
Wed, 11 Feb 2009 15:27:13 +0000 (02:27 +1100)
committerMeitar Moscovitz <meitarm@gmail.com>
Wed, 11 Feb 2009 15:27:13 +0000 (02:27 +1100)
13 files changed:
actions/all.php
actions/favorited.php
actions/groupmembers.php
actions/groups.php
actions/inbox.php
actions/outbox.php
actions/public.php
actions/replies.php
actions/showfavorites.php
actions/showgroup.php
actions/showstream.php
actions/tag.php
lib/action.php

index d75d1b94612b8f6adc42cd5f22c61490fed98a6f..4a625207a45f5623b8ca5c573883afa44225b58b 100644 (file)
@@ -78,6 +78,17 @@ class AllAction extends Action
                                      'title' => sprintf(_('Feed for friends of %s'), $this->user->nickname)));
     }
 
+    /**
+     * Output document relationship links
+     *
+     * @return void
+     */
+    function showRelationshipLinks()
+    {
+        $this->sequenceRelationships($this->page > 1, $this->count > NOTICES_PER_PAGE, // FIXME
+                                     $this->page, 'all', array('nickname' => $this->user->nickname));
+    }
+
     function showLocalNav()
     {
         $nav = new PersonalGroupNav($this);
index fd5ff413cbbfd9cc8f0ac478c7aa084a7c0d43ca..74920ca7e4073a7a4f68b0911ce971b55fa2d5b5 100644 (file)
@@ -195,4 +195,15 @@ class FavoritedAction extends Action
         $this->pagination($this->page > 1, $cnt > NOTICES_PER_PAGE,
                           $this->page, 'favorited');
     }
+
+    /**
+     * Output document relationship links
+     *
+     * @return void
+     */
+    function showRelationshipLinks()
+    {
+        $this->sequenceRelationships($this->page > 1, $this->count > NOTICES_PER_PAGE, // FIXME
+                                     $this->page, 'favorited');
+    }
 }
index 00f43a9f55e89c2e80d4a538e2fa3c62d45a6e8f..b80f3d90d10176f84f8c1446504fb3c763c461cb 100644 (file)
@@ -137,4 +137,15 @@ class GroupmembersAction extends Action
                           $this->page, 'groupmembers',
                           array('nickname' => $this->group->nickname));
     }
-}
\ No newline at end of file
+
+    /**
+     * Output document relationship links
+     *
+     * @return void
+     */
+    function showRelationshipLinks()
+    {
+        $this->sequenceRelationships($this->page > 1, $this->count > NOTICES_PER_PAGE, // FIXME
+                                     $this->page, 'groupmembers', array('nickname' => $this->group->nickname));
+    }
+}
index 39dc2232bc5d82574b658b22883d8e831f11c531..e158698de28216cbde3aa910cd32f6e0f8c46e56 100644 (file)
@@ -129,4 +129,15 @@ class GroupsAction extends Action
         $gbm = new GroupsByMembersSection($this);
         $gbm->show();
     }
+
+    /**
+     * Output document relationship links
+     *
+     * @return void
+     */
+    function showRelationshipLinks()
+    {
+        $this->sequenceRelationships($this->page > 1, $this->count > NOTICES_PER_PAGE, // FIXME
+                                     $this->page, 'groups', array('nickname' => $this->group->nickname));
+    }
 }
index b553ab26ca6d082a61addf9c17764b1d3b154548..7b5cf2d203d8f6abf1380ac74cc6e234f1d1d125 100644 (file)
@@ -63,6 +63,17 @@ class InboxAction extends MailboxAction
         }
     }
 
+    /**
+     * Output document relationship links
+     *
+     * @return void
+     */
+    function showRelationshipLinks()
+    {
+        $this->sequenceRelationships($this->page > 1, $this->count > NOTICES_PER_PAGE, // FIXME
+                                     $this->page, 'inbox', array('nickname' => $this->user->nickname));
+    }
+
     /**
      * Retrieve the messages for this user and this page
      *
index c8d7f28125e6bd539c6edd0fc1fb72379919847c..deef1cc870f5ef9a7ef6c2643be3f59a1f116958 100644 (file)
@@ -62,6 +62,17 @@ class OutboxAction extends MailboxAction
         }
     }
 
+    /**
+     * Output document relationship links
+     *
+     * @return void
+     */
+    function showRelationshipLinks()
+    {
+        $this->sequenceRelationships($this->page > 1, $this->count > NOTICES_PER_PAGE, // FIXME
+                                     $this->page, 'outbox', array('nickname' => $this->user->nickname));
+    }
+
     /**
      * retrieve the messages for this user and this page
      *
index cc6537f74f8afd4731f2bd15162fbaf176bd8bc7..eb2a4b1b004439ce7ba2a2d0cecc06e913ada860 100644 (file)
@@ -56,6 +56,18 @@ class PublicAction extends Action
 
     var $page = null;
 
+    /**
+     * Number of notices being shown on this page.
+     */
+    //    Does this need to be here? Should it be?
+    //    If it does, this property needs to be
+    //    added to other actions as well, like $page.
+    //    I'm trying to find a way to capture the
+    //    output of the $cnt variable from this
+    //    action's showContent() method but need
+    //    to do so earlier, I think...?
+    var $count = null;
+
     function isReadOnly()
     {
         return true;
@@ -127,6 +139,17 @@ class PublicAction extends Action
                                      'title' => _('Public Stream Feed')));
     }
 
+    /**
+     * Output document relationship links
+     *
+     * @return void
+     */
+    function showRelationshipLinks()
+    {
+        $this->sequenceRelationships($this->page > 1, $this->count > NOTICES_PER_PAGE, // FIXME
+                                     $this->page, 'public');
+    }
+
     /**
      * Extra head elements
      *
index 7eff74a6691e34505ceda2aa6dccbf9bc979bf33..7c24b554e0a0768ae81671b338103253570aac9c 100644 (file)
@@ -141,6 +141,17 @@ class RepliesAction extends Action
                                      '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));
+    }
+
     /**
      * show the personal group nav
      *
index 31479e1a7891d0933e63cb8bc5735ccc99d59345..585b3b75ab8809a6c6ff68c5693d30bee1cb0952 100644 (file)
@@ -153,6 +153,18 @@ class ShowfavoritesAction extends Action
                                      'title' => $feedtitle));
     }
 
+    /**
+     * Output document relationship links
+     *
+     * @return void
+     */
+    function showRelationshipLinks()
+    {
+        $this->sequenceRelationships($this->page > 1, $this->count > NOTICES_PER_PAGE, // FIXME
+                                     $this->page, 'showfavorites', array('nickname' => $this->user->nickname));
+    }
+
+
     /**
      * show the personal group nav
      *
index 7bc68fbc64a151ac377c414a4ace0e0d52997d26..a2b40f994811a2fc59f03cd2cbfd4128063e7c8c 100644 (file)
@@ -326,6 +326,17 @@ class ShowgroupAction extends Action
                                                         $this->group->nickname)));
     }
 
+    /**
+     * Output document relationship links
+     *
+     * @return void
+     */
+    function showRelationshipLinks()
+    {
+        $this->sequenceRelationships($this->page > 1, $this->count > NOTICES_PER_PAGE, // FIXME
+                                     $this->page, 'showgroup', array('nickname' => $this->group->nickname));
+    }
+
     /**
      * Fill in the sidebar.
      *
index 962f4b4524f499be25b7e1e403709e7b6ba543b9..1779c70f2c5e2069c4d35180d89c82604ce833b7 100644 (file)
@@ -195,6 +195,17 @@ class ShowstreamAction extends Action
                                                 $this->user->nickname)));
     }
 
+    /**
+     * Output document relationship links
+     *
+     * @return void
+     */
+    function showRelationshipLinks()
+    {
+        $this->sequenceRelationships($this->page > 1, $this->count > NOTICES_PER_PAGE, // FIXME
+                                     $this->page, 'showstream', array('nickname' => $this->user->nickname));
+    }
+
     function extraHead()
     {
         // FOAF
index 4401f892a94603df41e2b06748bba5cca35bcb05..2a564a25d49442d72f1306a21c5119f916016139 100644 (file)
@@ -69,6 +69,17 @@ class TagAction extends Action
                                      'title' => sprintf(_('Feed for tag %s'), $this->tag)));
     }
 
+    /**
+     * Output document relationship links
+     *
+     * @return void
+     */
+    function showRelationshipLinks()
+    {
+        $this->sequenceRelationships($this->page > 1, $this->count > NOTICES_PER_PAGE, // FIXME
+                                     $this->page, 'tag', array('tag' => $this->tag));
+    }
+
     function showPageNotice()
     {
         return sprintf(_('Messages tagged "%s", most recent first'), $this->tag);
index ce92addf5c1305424525604726b358b6ebb11b85..80a8969fa2bd3cdf89b71fdaacad8540cc85313e 100644 (file)
@@ -111,6 +111,7 @@ class Action extends HTMLOutputter // lawsuit
         $this->showTitle();
         $this->showStylesheets();
         $this->showScripts();
+        $this->showRelationshipLinks();
         $this->showOpenSearch();
         $this->showFeeds();
         $this->showDescription();
@@ -202,6 +203,19 @@ class Action extends HTMLOutputter // lawsuit
         }
     }
 
+    /**
+     * Show document relationship links
+     *
+     * SHOULD overload
+     *
+     * @return nothing
+     */
+    function showRelationshipLinks()
+    {
+        // output <link> elements with appropriate HTML4.01 link types:
+        // http://www.w3.org/TR/html401/types.html#type-links
+    }
+
     /**
      * Show OpenSearch headers
      *
@@ -924,4 +938,38 @@ class Action extends HTMLOutputter // lawsuit
             $this->elementEnd('div');
         }
     }
+
+    /**
+     * Generate document metadata for sequential navigation
+     *
+     * @param boolean $have_before is there something before?
+     * @param boolean $have_after  is there something after?
+     * @param integer $page        current page
+     * @param string  $action      current action
+     * @param array   $args        rest of query arguments
+     *
+     * @return nothing
+     */
+    function sequenceRelationships($have_next, $have_previous, $page, $action, $args=null)
+    {
+        // Outputs machine-readable pagination in <link> elements.
+        // Pattern taken from $this->pagination() method.
+
+        // "next" is equivalent to "after"
+        if ($have_next) {
+            $pargs   = array('page' => $page-1);
+            $newargs = $args ? array_merge($args, $pargs) : $pargs;
+            $this->element('link', array('rel' => 'next',
+                                         'href' => common_local_url($action, $newargs),
+                                         'title' => _('Next')));
+        }
+        // "previous" is equivalent to "before"
+        if ($have_previous=true) { // FIXME
+            $pargs   = array('page' => $page+1);
+            $newargs = $args ? array_merge($args, $pargs) : $pargs;
+            $this->element('link', array('rel' => 'prev',
+                                         'href' => common_local_url($action, $newargs),
+                                         'title' => _('Previous')));
+        }
+    }
 }