Jdlrobson has uploaded a new change for review. https://gerrit.wikimedia.org/r/200943
Change subject: Add pagination to Special:GatherList ...................................................................... Add pagination to Special:GatherList Infinite scroll and pagination for other things will come in a later patch. Bug: T94515 Change-Id: I87ff376afc20f5779a6fe5205bf66d8b4f60d9ad --- M includes/specials/SpecialGatherLists.php 1 file changed, 27 insertions(+), 7 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Gather refs/changes/43/200943/1 diff --git a/includes/specials/SpecialGatherLists.php b/includes/specials/SpecialGatherLists.php index bb7769e..8220221 100644 --- a/includes/specials/SpecialGatherLists.php +++ b/includes/specials/SpecialGatherLists.php @@ -13,6 +13,7 @@ use Linker; use Gather\views\helpers\CSS; use MWTimestamp; +use Exception; /** * Render a collection of articles. @@ -57,21 +58,40 @@ } elseif ( $this->canHideLists() ) { $out->addSubtitle( $this->getSubTitle( true ) ); } + $req = $this->getRequest(); + $limit = 100; + $offset = $req->getVal( 'offset', '' ); + // FIXME: Make method on CollectionsList $api = new ApiMain( new FauxRequest( array( 'action' => 'query', 'list' => 'lists', 'lstmode' => $subPage === 'hidden' ? 'allhidden' : 'allpublic', + 'lstlimit' => $limit, // FIXME: Need owner to link to collection 'lstprop' => 'label|description|image|count|updated|owner', - // TODO: Pagination - 'continue' => '', + 'continue' => $req->getVal( 'continue', '' ), + 'lstcontinue' => $req->getVal( 'lstcontinue', '' ), ) ) ); - $api->execute(); - $data = $api->getResultData(); - if ( isset( $data['query']['lists'] ) ) { - $lists = $data['query']['lists']; - $this->render( $lists, $subPage === 'hidden' ? 'show' : 'hide' ); + try { + $api->execute(); + $data = $api->getResultData(); + $continue = isset( $data['continue'] ) ? $data['continue'] : false; + if ( isset( $data['query']['lists'] ) ) { + $lists = $data['query']['lists']; + $this->render( $lists, $subPage === 'hidden' ? 'show' : 'hide' ); + } + } catch ( Exception $e ) { + $continue = false; + } + + if ( $continue ) { + $nextPageUrl = $this->getTitle()->getLocalUrl( $continue ); + $out->addHTML( + Html::element( 'a', array( + 'href' => $nextPageUrl, + ), 'older' ) + ); } } -- To view, visit https://gerrit.wikimedia.org/r/200943 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I87ff376afc20f5779a6fe5205bf66d8b4f60d9ad Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Gather Gerrit-Branch: master Gerrit-Owner: Jdlrobson <jrob...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits