http://www.mediawiki.org/wiki/Special:Code/MediaWiki/73450

Revision: 73450
Author:   nad
Date:     2010-09-21 05:26:51 +0000 (Tue, 21 Sep 2010)

Log Message:
-----------
make action tab work for vector based skins too

Modified Paths:
--------------
    trunk/extensions/EmailPage/EmailPage.php

Modified: trunk/extensions/EmailPage/EmailPage.php
===================================================================
--- trunk/extensions/EmailPage/EmailPage.php    2010-09-21 05:20:46 UTC (rev 
73449)
+++ trunk/extensions/EmailPage/EmailPage.php    2010-09-21 05:26:51 UTC (rev 
73450)
@@ -10,36 +10,35 @@
  * @copyright © 2007 Aran Dunkley
  * @licence GNU General Public Licence 2.0 or later
  */
+if( !defined( 'MEDIAWIKI' ) ) die( "Not an entry point." );
 
-if ( !defined( 'MEDIAWIKI' ) ) die( 'Not an entry point.' );
+define( 'EMAILPAGE_VERSION', "1.3.6, 2010-09-21" );
 
-define( 'EMAILPAGE_VERSION', '1.3.5, 2010-09-17' );
-
-$wgEmailPageGroup           = 'sysop';              # Users must belong to 
this group to send emails (empty string means anyone can send)
-$wgEmailPageContactsCat     = '';                   # This specifies the name 
of a category containing categories of contact pages
-$wgEmailPageCss             = 'EmailPage.css';      # A minimal CSS page to 
embed in the email (eg. monobook/main.css without portlets, actions etc)
-$wgEmailPageAllowRemoteAddr = array( '127.0.0.1' ); # Allow anonymous sending 
from these addresses
+$wgEmailPageGroup           = "sysop";              # Users must belong to 
this group to send emails (empty string means anyone can send)
+$wgEmailPageContactsCat     = "";                   # This specifies the name 
of a category containing categories of contact pages
+$wgEmailPageCss             = "EmailPage.css";      # A minimal CSS page to 
embed in the email (eg. monobook/main.css without portlets, actions etc)
+$wgEmailPageAllowRemoteAddr = array( "127.0.0.1" ); # Allow anonymous sending 
from these addresses
 $wgEmailPageAllowAllUsers   = false;                # Whether to allow sending 
to all users (the "user" group)
 $wgEmailPageToolboxLink     = true;                 # Add a link to the 
sidebar toolbox?
 $wgEmailPageActionLink      = true;                 # Add a link to the 
actions links?
-$wgPhpMailerClass           = dirname( __FILE__ ) . 
'/phpMailer_v2.1.0beta2/class.phpmailer.php'; # From 
http://phpmailer.sourceforge.net/
+$wgPhpMailerClass           = dirname( __FILE__ ) . 
"/phpMailer_v2.1.0beta2/class.phpmailer.php"; # From 
http://phpmailer.sourceforge.net/
 
-if ( $wgEmailPageGroup ) $wgGroupPermissions['sysop'][$wgEmailPageGroup] = 
true;
+if( $wgEmailPageGroup ) $wgGroupPermissions['sysop'][$wgEmailPageGroup] = true;
 
-if ( isset( $_SERVER['SERVER_ADDR'] ) ) $wgEmailPageAllowRemoteAddr[] = 
$_SERVER['SERVER_ADDR'];
+if( isset( $_SERVER['SERVER_ADDR'] ) ) $wgEmailPageAllowRemoteAddr[] = 
$_SERVER['SERVER_ADDR'];
 
 $dir = dirname( __FILE__ ) . '/';
-$wgAutoloadClasses['SpecialEmailPage'] = $dir . 'EmailPage_body.php';
-$wgExtensionMessagesFiles['EmailPage'] = $dir . 'EmailPage.i18n.php';
-$wgExtensionAliasesFiles['EmailPage']  = $dir . 'EmailPage.alias.php';
-$wgSpecialPages['EmailPage']           = 'SpecialEmailPage';
+$wgAutoloadClasses['SpecialEmailPage'] = $dir . "EmailPage_body.php";
+$wgExtensionMessagesFiles['EmailPage'] = $dir . "EmailPage.i18n.php";
+$wgExtensionAliasesFiles['EmailPage']  = $dir . "EmailPage.alias.php";
+$wgSpecialPages['EmailPage']           = "SpecialEmailPage";
 
 $wgExtensionCredits['specialpage'][] = array(
        'path'           => __FILE__,
-       'name'           => 'EmailPage',
-       'author'         => '[http://www.organicdesign.co.nz/nad User:Nad]',
-       'descriptionmsg' => 'ea-desc',
-       'url'            => 'http://www.mediawiki.org/wiki/Extension:EmailPage',
+       'name'           => "EmailPage",
+       'author'         => "[http://www.organicdesign.co.nz/nad User:Nad]",
+       'descriptionmsg' => "ea-desc",
+       'url'            => "http://www.mediawiki.org/wiki/Extension:EmailPage";,
        'version'        => EMAILPAGE_VERSION
 );
 
@@ -48,7 +47,10 @@
 
 # Add toolbox and action links
 if ( $wgEmailPageToolboxLink ) $wgHooks['SkinTemplateToolboxEnd'][] = 
'wfEmailPageToolboxLink';
-if ( $wgEmailPageActionLink )  $wgHooks['SkinTemplateTabs'][] = 
'wfEmailPageActionLink';
+if ( $wgEmailPageActionLink )  {
+       $wgHooks['SkinTemplateTabs'][] = 'wfEmailPageActionLink';
+       $wgHooks['SkinTemplateNavigation'][] = 'wfEmailPageActionLinkVector';
+}
 
 function wfEmailPageToolboxLink() {
        global $wgTitle, $wgUser, $wgEmailPageGroup;
@@ -67,3 +69,12 @@
        }
        return true;
 }
+
+function wfEmailPageActionLinkVector( $skin, &$actions ) {
+       global $wgTitle, $wgUser, $wgEmailPageGroup;
+       if ( is_object( $wgTitle ) && ( empty( $wgEmailPageGroup ) || in_array( 
$wgEmailPageGroup, $wgUser->getEffectiveGroups() ) ) ) {
+               $url = SpecialPage::getTitleFor( 'EmailPage' )->getLocalURL( 
array( 'ea-title' => $wgTitle->getPrefixedText() ) );
+               $actions['views']['email'] = array( 'text' => wfMsg( 'email' ), 
'class' => false, 'href' => $url );
+       }
+       return true;
+}



_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to