Wctaiwan has uploaded a new change for review.
https://gerrit.wikimedia.org/r/131027
Change subject: Display page image on action=info
......................................................................
Display page image on action=info
Show the page image as one item under "Basic information" on action=info.
Bug: 64178
Change-Id: Id561c817fdda057c9dd8beae275c3b978b4dd20a
---
M PageImages.body.php
M PageImages.php
M i18n/en.json
M i18n/qqq.json
4 files changed, 44 insertions(+), 7 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/PageImages
refs/changes/27/131027/1
diff --git a/PageImages.body.php b/PageImages.body.php
index 16e93f5..d938a87 100644
--- a/PageImages.body.php
+++ b/PageImages.body.php
@@ -317,4 +317,38 @@
wfProfileOut( __METHOD__ );
return $list;
}
+
+ /**
+ * Add the page image to the info=action page.
+ * @param IContextSource $context
+ * @param array $pageInfo
+ * @return bool
+ */
+ public static function onInfoAction( IContextSource $context,
&$pageInfo ) {
+ global $wgDefaultUserOptions, $wgThumbLimits;
+
+ $imageFile = self::getPageImage( $context->getTitle() );
+ if ( $imageFile === null ) {
+ return true; // The page has no image.
+ }
+
+ $thumbSetting = $context->getUser()->getOption(
+ 'thumbsize',
+ $wgDefaultUserOptions['thumbsize']
+ );
+ $thumbSize = $wgThumbLimits[$thumbSetting];
+
+ $imageHtml = $imageFile->transform( array( 'width' =>
$thumbSize ) )->toHtml(
+ array(
+ 'alt' => $imageFile->getTitle()->getText(),
+ 'desc-link' => true,
+ )
+ );
+
+ $pageInfo['header-basic'][] = array(
+ $context->msg( 'pageimages-info-label' ),
+ $imageHtml
+ );
+ return true;
+ }
}
diff --git a/PageImages.php b/PageImages.php
index a988b33..13e2f14 100644
--- a/PageImages.php
+++ b/PageImages.php
@@ -23,6 +23,7 @@
$wgHooks['ParserMakeImageParams'][] = 'PageImages::onParserMakeImageParams';
$wgHooks['LinksUpdate'][] = 'PageImages::onLinksUpdate';
$wgHooks['OpenSearchXml'][] = 'PageImages::onOpenSearchXml';
+$wgHooks['InfoAction'][] = 'PageImages::onInfoAction';
$wgAPIPropModules['pageimages'] = 'ApiQueryPageImages';
diff --git a/i18n/en.json b/i18n/en.json
index 27208db..7106f31 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -1,7 +1,8 @@
{
- "@metadata": {
- "authors": []
- },
- "pageimages-desc": "Collects information about images used on page",
- "pageimages-blacklist": ""
-}
\ No newline at end of file
+ "@metadata": {
+ "authors": []
+ },
+ "pageimages-desc": "Collects information about images used on page",
+ "pageimages-blacklist": "",
+ "pageimages-info-label": "Page image"
+}
diff --git a/i18n/qqq.json b/i18n/qqq.json
index 077252f..782bf20 100644
--- a/i18n/qqq.json
+++ b/i18n/qqq.json
@@ -5,5 +5,6 @@
]
},
"pageimages-desc": "{{desc|name=Page
Images|url=http://www.mediawiki.org/wiki/Extension:PageImages}}",
- "pageimages-blacklist": "List of images. They will never be selected as
page images"
+ "pageimages-blacklist": "List of images. They will never be selected as
page images",
+ "pageimages-info-label": "Label for the page image field on the
info=action page"
}
--
To view, visit https://gerrit.wikimedia.org/r/131027
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Id561c817fdda057c9dd8beae275c3b978b4dd20a
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/PageImages
Gerrit-Branch: master
Gerrit-Owner: Wctaiwan <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits