AddBasePage

Aus Free Software
Zur Navigation springen Zur Suche springen

Deprecated Extension!

This extension is deprecated and no longer maintained by the developer. It may no longer work for current versions of MediaWiki and Bugs are no longer fixed. Please see the Deprecated section for more information.

Manual on MediaWiki Extensions
List of MediaWiki Extensions
Crystal Clear action run.png
AddBasePage

Release status: stable

Implementation Skin
Description This extension adds a few javascript-variables needed for Common.js. This extension is part of the PerPageResources project.
Author(s) Mathias Ertl (Mati talk)
Version 1.0.1 (2008-02-06)
MediaWiki 1.11.0
License GPL v3 or any later version.
Download See Download
Documentation
Changelog
Parameters none
Example view the source-code of this page and search for 'wgMainArticlePage'.
Hooks used

BeforePageDisplay


AddBasePage is a simple extension adding a few javascript variables to each page:

  • The basepage of the current page, i.e. 'Foo' from the page 'Foo/Bar'. Please see the #BasePage-section if you are interested in imitating what this extension does.
  • The name of the Resources-page in this wiki
  • The name of the tab of the Resources-page in this wiki in its current configuration

Common.js relies on these variables to build the correct links to the resource-page. The name of the basepage is used on subpages so that the resource-tab links to the resource-page of the actual article and not to the resource-page of the resource. The other variables are used to have the correct translated names of the resource-special page if the user sets the language to something different then the standard in his UserPreferences.



Deprecated

This extension is no longer maintained because Common.js, which used the variables provided by this extension, is no longer needed (the tabs added by it are added by the Resources and AddResource extensions themselves without the need for JavaScript) and is therefor deprecated too.

Download

The source code of this extension was hosted on git.fsinf.at, a project no longer maintained. Since this extension was so old, the git repository was not transfered to any other repository and the source code is no longer available.

Installation & Configuration

Simply download the file, put it in your extensions-directory and add this line in LocalSettings.php:

require_once( "$IP/AddBasePage/AddBasePage.php" );

BasePage

Getting the name of the *true* base-page is actually not that trivial in MediaWiki. Title.php offers a function 'getBaseText' but that simply returns the title up to the first slash. Which is not always the base-page since a page-name may contain slashes and the returned text might not be the name of a page at all.

I solved this problem by simply adding a simple check if the return-value of getBaseText represents an existing page or not. If not, the page adds the full text instead. Note that this actually introduces a subtle bug: if the extension is used on a subpage where the title contains a slash it would add the subpage instead of the true base-page. Note that a simple call to getBaseText would add a non-existing page instead.

Changelog

1.0.1 (rev. 186)
  • fixed a bug that caused wgMainArticlePage to point to the discussion page if viewing a discussion page that doesn't exist
1.0

first version documented here

Licence

GPL v3 or any later version.

See also poker spiele