Yaron Koren has uploaded a new change for review.
https://gerrit.wikimedia.org/r/76098
Change subject: Added optional header message for pages with no approved
revision
......................................................................
Added optional header message for pages with no approved revision
Change-Id: I0693d1f78e6b5e7031961772430cdfd17362ca15
---
M ApprovedRevs.hooks.php
M ApprovedRevs.i18n.php
M ApprovedRevs.php
3 files changed, 27 insertions(+), 0 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ApprovedRevs
refs/changes/98/76098/1
diff --git a/ApprovedRevs.hooks.php b/ApprovedRevs.hooks.php
index 11601c6..78161b9 100644
--- a/ApprovedRevs.hooks.php
+++ b/ApprovedRevs.hooks.php
@@ -688,4 +688,28 @@
return true;
}
+ /**
+ * If this page has no approved revision, display a header message
+ * stating that, if the setting to display this message is activated.
+ */
+ public static function displayNotApprovedHeader( Article &$article,
&$outputDone, &$useParserCache ) {
+ global $egApprovedRevsShowNotApprovedMessage;
+ if ( !$egApprovedRevsShowNotApprovedMessage) {
+ return true;
+ }
+
+ $title = $article->getTitle();
+ if ( ! ApprovedRevs::hasApprovedRevision( $title ) ) {
+ $text = wfMessage( 'approvedrevs-noapprovedrevision'
)->text();
+ global $wgOut;
+ if ( $wgOut->getSubtitle() != '' ) {
+ $wgOut->appendSubtitle( '<br />' . $text );
+ } else {
+ $wgOut->setSubtitle( $text );
+ }
+ }
+
+ return true;
+ }
+
}
diff --git a/ApprovedRevs.i18n.php b/ApprovedRevs.i18n.php
index b302af4..cae493d 100644
--- a/ApprovedRevs.i18n.php
+++ b/ApprovedRevs.i18n.php
@@ -28,6 +28,7 @@
'approvedrevs-notlatest' => 'This is the approved revision of this
page; it is not the most recent.',
'approvedrevs-approvedandlatest' => 'This is the approved revision of
this page, as well as being the most recent.',
'approvedrevs-blankpageshown' => 'No revision has been approved for
this page.',
+ 'approvedrevs-noapprovedrevision' => 'This is the latest revision of
this page; it has no approved revision.',
'approvedrevs-editwarning' => 'Please note that you are now editing the
latest revision of this page, which is not the approved one shown by default.',
'approvedrevs' => 'Approved revisions',
'approvedrevs-approvedpages' => 'All pages with an approved revision',
diff --git a/ApprovedRevs.php b/ApprovedRevs.php
index d5f5e9e..f06e4f8 100644
--- a/ApprovedRevs.php
+++ b/ApprovedRevs.php
@@ -29,6 +29,7 @@
$egApprovedRevsBlankIfUnapproved = false;
$egApprovedRevsAutomaticApprovals = true;
$egApprovedRevsShowApproveLatest = false;
+$egApprovedRevsShowNotApprovedMessage = false;
// internationalization
$wgExtensionMessagesFiles['ApprovedRevs'] = $egApprovedRevsIP .
'ApprovedRevs.i18n.php';
@@ -70,6 +71,7 @@
$wgHooks['EditPage::showEditForm:initial'][] =
'ApprovedRevsHooks::addWarningToEditPage';
$wgHooks['sfHTMLBeforeForm'][] = 'ApprovedRevsHooks::addWarningToSFForm';
$wgHooks['ArticleViewHeader'][] = 'ApprovedRevsHooks::setArticleHeader';
+$wgHooks['ArticleViewHeader'][] =
'ApprovedRevsHooks::displayNotApprovedHeader';
// logging
$wgLogTypes['approval'] = 'approval';
--
To view, visit https://gerrit.wikimedia.org/r/76098
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I0693d1f78e6b5e7031961772430cdfd17362ca15
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ApprovedRevs
Gerrit-Branch: master
Gerrit-Owner: Yaron Koren <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits