diff --git a/actions/all.php b/actions/all.php index f5bbfe2e39..cb68691ba0 100644 --- a/actions/all.php +++ b/actions/all.php @@ -69,6 +69,17 @@ class AllAction extends ProfileAction sprintf(_('Feed for friends of %s (Atom)'), $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); diff --git a/actions/favorited.php b/actions/favorited.php index 09ab1216a6..8cf1528b2a 100644 --- a/actions/favorited.php +++ b/actions/favorited.php @@ -221,4 +221,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'); + } } diff --git a/actions/groupmembers.php b/actions/groupmembers.php index 00f43a9f55..b80f3d90d1 100644 --- a/actions/groupmembers.php +++ b/actions/groupmembers.php @@ -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)); + } +} diff --git a/actions/groups.php b/actions/groups.php index 39dc2232bc..e158698de2 100644 --- a/actions/groups.php +++ b/actions/groups.php @@ -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)); + } } diff --git a/actions/inbox.php b/actions/inbox.php index b553ab26ca..7b5cf2d203 100644 --- a/actions/inbox.php +++ b/actions/inbox.php @@ -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 * diff --git a/actions/outbox.php b/actions/outbox.php index c8d7f28125..deef1cc870 100644 --- a/actions/outbox.php +++ b/actions/outbox.php @@ -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 * diff --git a/actions/public.php b/actions/public.php index 5a380de9a8..961606908d 100644 --- a/actions/public.php +++ b/actions/public.php @@ -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; @@ -135,6 +147,17 @@ class PublicAction extends Action _('Public Stream Feed (Atom)'))); } + /** + * 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 * diff --git a/actions/replies.php b/actions/replies.php index 2769cb4227..1b593776e3 100644 --- a/actions/replies.php +++ b/actions/replies.php @@ -138,6 +138,17 @@ class RepliesAction extends Action return array(new Feed(Feed::RSS1, $rssurl, $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 * diff --git a/actions/showfavorites.php b/actions/showfavorites.php index 4d43495054..5ebbfef776 100644 --- a/actions/showfavorites.php +++ b/actions/showfavorites.php @@ -150,6 +150,18 @@ class ShowfavoritesAction extends Action return array(new Feed(Feed::RSS1, $feedurl, $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 * diff --git a/actions/showgroup.php b/actions/showgroup.php index 79445851f9..d5e5a4e11a 100644 --- a/actions/showgroup.php +++ b/actions/showgroup.php @@ -311,6 +311,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. * diff --git a/actions/showstream.php b/actions/showstream.php index ce237dae22..3fe604f24b 100644 --- a/actions/showstream.php +++ b/actions/showstream.php @@ -135,6 +135,17 @@ class ShowstreamAction extends ProfileAction sprintf(_('FOAF for %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, 'showstream', array('nickname' => $this->user->nickname)); + } + function extraHead() { // for remote subscriptions etc. diff --git a/actions/tag.php b/actions/tag.php index 583879f9cc..06411085b7 100644 --- a/actions/tag.php +++ b/actions/tag.php @@ -77,6 +77,17 @@ class TagAction extends Action 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); diff --git a/lib/action.php b/lib/action.php index cc98d4445a..dddba9eb02 100644 --- a/lib/action.php +++ b/lib/action.php @@ -124,6 +124,7 @@ class Action extends HTMLOutputter // lawsuit $this->showShortcutIcon(); $this->showStylesheets(); $this->showScripts(); + $this->showRelationshipLinks(); $this->showOpenSearch(); $this->showFeeds(); $this->showDescription(); @@ -264,6 +265,19 @@ class Action extends HTMLOutputter // lawsuit } } + /** + * Show document relationship links + * + * SHOULD overload + * + * @return nothing + */ + function showRelationshipLinks() + { + // output elements with appropriate HTML4.01 link types: + // http://www.w3.org/TR/html401/types.html#type-links + } + /** * Show OpenSearch headers * @@ -1039,4 +1053,36 @@ class Action extends HTMLOutputter // lawsuit { return null; } + + /** + * 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 elements. + // Pattern taken from $this->pagination() method. + + // "next" is equivalent to "after" + if ($have_next) { + $pargs = array('page' => $page-1); + $this->element('link', array('rel' => 'next', + 'href' => common_local_url($action, $args, $pargs), + 'title' => _('Next'))); + } + // "previous" is equivalent to "before" + if ($have_previous=true) { // FIXME + $pargs = array('page' => $page+1); + $this->element('link', array('rel' => 'prev', + 'href' => common_local_url($action, $args, $pargs), + 'title' => _('Previous'))); + } + } }