jenkins-bot has submitted this change and it was merged. Change subject: Moved the display of links to previous, next and index page to PHP. ......................................................................
Moved the display of links to previous, next and index page to PHP. Change-Id: I58983f1bd4300d599e9e6787d50b2495af315e9d --- M ProofreadPage.body.php M ProofreadPage.php M includes/page/ProofreadPagePage.php M modules/ext.proofreadpage.page/ext.proofreadpage.page.js 4 files changed, 51 insertions(+), 10 deletions(-) Approvals: Tpt: Looks good to me, approved jenkins-bot: Verified diff --git a/ProofreadPage.body.php b/ProofreadPage.body.php index ddcea9d..01de00d 100644 --- a/ProofreadPage.body.php +++ b/ProofreadPage.body.php @@ -863,4 +863,54 @@ $list[self::getIndexNamespaceId() + 1] = 'Index_talk'; return true; } + + /** + * Add the links to previous, next, index page and scan image. + * @param $skin SkinTemplate object + * @param $links Structured navigation links + */ + public static function onSkinTemplateNavigation( &$skin, &$links ) { + global $wgOut, $wgExtensionAssetsPath; + $titleText = $wgOut->getPageTitle(); + $title = Title::newFromText( $titleText ); + if( $title->inNamespace( self::getPageNamespaceId() ) ) { + $page = ProofreadPagePage::newFromTitle( $title ); + $indexPage = $page->getIndex(); + if ( $indexPage !== null ) { + list( $prevTitle, $nextTitle ) = $indexPage->getPreviousAndNextPages( $page->getTitle() ); + if ( $prevTitle !== null ) { + if( !$prevTitle->exists() ) { + $prevLink = $prevTitle->getEditURL(); + } else { + $prevLink = $prevTitle->getLinkUrl(); + } + $links['namespaces']['proofreadPagePrevLink'] = array( 'class' => '', 'href' => $prevLink, + 'text' => wfMessage( 'proofreadpage_prevpage' )->plain() ); + } + if ( $nextTitle !== null ) { + if( !$nextTitle->exists() ) { + $nextLink = $nextTitle->getEditURL(); + } else { + $nextLink = $nextTitle->getLinkUrl(); + } + $links['namespaces']['proofreadPageNextLink'] = array( 'class' => '', 'href' => $nextLink, + 'text' => wfMessage( 'proofreadpage_nextpage' )->plain() ); + } + $indexLink = $indexPage->getTitle()->getLinkUrl(); + $links['namespaces']['proofreadPageIndexLink'] = array( 'class' => '', 'href' => $indexLink, + 'text' => wfMessage( 'proofreadpage_index' )->plain() ); + + $image = $page->getImage(); + $width = $image->getWidth(); + $filePage = $page->getPageNumber(); + $params = array( 'width' => $width, 'page' => $filePage ); + $image->getHandler()->normaliseParams( $image, $params ); + $thumbName = $image->thumbName( $params ); + $imageUrl = $image->getThumbUrl( $thumbName ); + $links['namespaces']['proofreadPageScanLink'] = array( 'class' => '', 'href' => $imageUrl, + 'text' => wfMessage( 'proofreadpage_image')->plain() ); + } + } + return true; + } } diff --git a/ProofreadPage.php b/ProofreadPage.php index 265fde1..57747d6 100644 --- a/ProofreadPage.php +++ b/ProofreadPage.php @@ -157,6 +157,7 @@ $wgHooks['LinksUpdateConstructed'][] = 'ProofreadPage::onLinksUpdateConstructed'; $wgHooks['CustomEditor'][] = 'ProofreadPage::onCustomEditor'; $wgHooks['CanonicalNamespaces'][] = 'ProofreadPage::addCanonicalNamespaces'; +$wgHooks['SkinTemplateNavigation'][] = 'ProofreadPage::onSkinTemplateNavigation'; /** diff --git a/includes/page/ProofreadPagePage.php b/includes/page/ProofreadPagePage.php index cfbcb6c..4adb0ae 100644 --- a/includes/page/ProofreadPagePage.php +++ b/includes/page/ProofreadPagePage.php @@ -282,7 +282,6 @@ if ( $out->isPrintable() ) { $parserOptions->setIsPrintable( true ); } - return $parserOptions; } } \ No newline at end of file diff --git a/modules/ext.proofreadpage.page/ext.proofreadpage.page.js b/modules/ext.proofreadpage.page/ext.proofreadpage.page.js index a25afd7..03011e2 100644 --- a/modules/ext.proofreadpage.page/ext.proofreadpage.page.js +++ b/modules/ext.proofreadpage.page/ext.proofreadpage.page.js @@ -1,11 +1,4 @@ // Author : ThomasV - License : GPL -/* -function prInitTabs() { - $( '#ca-talk' ).prev().before( '<li id="ca-prev"><span>' + self.proofreadPagePrevLink + '</span></li>' ); - $( '#ca-talk' ).prev().before( '<li id="ca-next"><span>' + self.proofreadPageNextLink + '</span></li>' ); - $( '#ca-talk' ).after( '<li id="ca-index"><span>' + self.proofreadPageIndexLink + '</span></li>' ); - $( '#ca-talk' ).after( '<li id="ca-image"><span>' + self.proofreadPageScanLink + '</span></li>' ); -}*/ function prSetSummary() { jQuery( "input[name='wpQuality']" ).click( function() { @@ -39,8 +32,6 @@ function prStartup() { jQuery( function() { -// prInit(); -// prInitZoom(); prSetSummary(); prHideHeaderFooter(); } ); -- To view, visit https://gerrit.wikimedia.org/r/84214 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I58983f1bd4300d599e9e6787d50b2495af315e9d Gerrit-PatchSet: 5 Gerrit-Project: mediawiki/extensions/ProofreadPage Gerrit-Branch: pagePagesRefactoring Gerrit-Owner: Rtdwivedi <ellydwivedi2...@gmail.com> Gerrit-Reviewer: Rtdwivedi <ellydwivedi2...@gmail.com> Gerrit-Reviewer: Tpt <thoma...@hotmail.fr> Gerrit-Reviewer: jenkins-bot _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits