Legoktm has uploaded a new change for review.
https://gerrit.wikimedia.org/r/89609
Change subject: Add a tab with a link to edit on mediawiki.org
......................................................................
Add a tab with a link to edit on mediawiki.org
Also modifies the namespace tabs to not be red links
Change-Id: I3f2e950ade531b178c406924e1107b321ddfb1a8
---
M HelpPages.hooks.php
M HelpPages.i18n.php
M HelpPages.php
3 files changed, 37 insertions(+), 0 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/HelpPages
refs/changes/09/89609/1
diff --git a/HelpPages.hooks.php b/HelpPages.hooks.php
index 9386a5c..9565853 100644
--- a/HelpPages.hooks.php
+++ b/HelpPages.hooks.php
@@ -23,6 +23,40 @@
}
/**
+ * @param SkinTemplate $sktemplate
+ * @param array $links
+ * @return bool
+ */
+ public static function onSkinTemplateNavigationUniversal( &$sktemplate,
&$links ) {
+ //var_dump($links);
+ $context = $sktemplate->getContext();
+ $title = $sktemplate->getTitle();
+ //var_dump($links);
+ if ( $title->getNamespace() == NS_HELP ) {
+ list ( $text, $oldid ) =
HelpPages::getPagePlusFallbacks( 'Help:' . $title->getText() );
+ if ( $text ) {
+ $links['namespaces']['help']['class'] =
'selected';
+ $links['namespaces']['help_talk']['class'] = '';
+ $links['namespaces']['help_talk']['href'] =
'//www.mediawiki.org/wiki/Help talk:' . $title->getText();
+ $links['views'] = array(); // Kill the 'Create'
button @todo make this suck less
+ $links['views'][] = array(
+ 'class' => false,
+ 'text' => $context->msg(
'helppages-edit-tab' ),
+ 'href' => wfAppendQuery(
+
'//www.mediawiki.org/w/index.php',
+ array(
+ 'action' => 'edit',
+ 'title' =>
$title->getPrefixedText()
+ )
+ )
+ );
+ }
+ }
+ return true;
+ }
+
+
+ /**
* Use action=purge to clear cache
* @param $article Article
* @return bool
diff --git a/HelpPages.i18n.php b/HelpPages.i18n.php
index 6fb7d93..b8c162a 100644
--- a/HelpPages.i18n.php
+++ b/HelpPages.i18n.php
@@ -15,6 +15,7 @@
$messages['en'] = array(
'helppages-desc' => 'Automatically fetches help pages from
[//www.mediawiki.org mediawiki.org]',
'helppages-notice' => 'This page was downloaded from
[//www.mediawiki.org/?oldid=$1 mediawiki.org] and can be edited there.',
+ 'helppages-edit-tab' => 'Edit on MediaWiki.org',
);
/** Message documentation (Message documentation)
@@ -23,4 +24,5 @@
$messages['qqq'] = array(
'helppages-desc' => '{{desc|name=Help
Pages|url=http://www.mediawiki.org/wiki/Extension:HelpPages}}',
'helppages-notice' => 'Message shown above help pages from
mediawiki.org, $1 is the revision id of the page that was fetched',
+ 'helppages-edit-tab' => 'Text on tab that replaces "create", and links
to the edit interface on MediaWiki.org',
);
diff --git a/HelpPages.php b/HelpPages.php
index 9e983be..443014c 100644
--- a/HelpPages.php
+++ b/HelpPages.php
@@ -40,6 +40,7 @@
$wgExtensionMessagesFiles['HelpPages'] = "$dir/HelpPages.i18n.php";
$wgHooks['ShowMissingArticle'][] = 'HelpPagesHooks::onShowMissingArticle';
+$wgHooks['SkinTemplateNavigation::Universal'][] =
'HelpPagesHooks::onSkinTemplateNavigationUniversal';
$wgResourceModules['ext.HelpPages'] = array(
'styles' => 'ext.HelpPages.css',
--
To view, visit https://gerrit.wikimedia.org/r/89609
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I3f2e950ade531b178c406924e1107b321ddfb1a8
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/HelpPages
Gerrit-Branch: master
Gerrit-Owner: Legoktm <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits