* (bug 21912) Watchlist token implementation has been refactored and
Special:ResetTokens was added to allow users to reset their tokens
instead of presenting them in Preferences.
+* Special:PrefixIndex now lets you strip the searched prefix from the displayed
+ titles. Given a list of articles named Bug1, Bug2, you can now transclude the
+ list of bug numbers using: {{Special:PrefixIndex/Bug|stripprefix=1}}.
+ The special page form received a new checkbox matching that option.
=== Bug fixes in 1.22 ===
* Disable Special:PasswordReset when $wgEnableEmail is false. Previously one
* @ingroup SpecialPage
*/
class SpecialPrefixindex extends SpecialAllpages {
+
+ /**
+ * Whether to remove the searched prefix from the displayed link. Useful
+ * for inclusion of a set of sub pages in a root page.
+ */
+ protected $stripPrefix = false;
+
// Inherit $maxPerPage
function __construct() {
$ns = $request->getIntOrNull( 'namespace' );
$namespace = (int)$ns; // if no namespace given, use 0 (NS_MAIN).
$hideredirects = $request->getBool( 'hideredirects', false );
+ $this->stripPrefix = $request->getBool( 'stripprefix', $this->stripPrefix );
$namespaces = $wgContLang->getNamespaces();
$out->setPageTitle(
'hideredirects',
$hideredirects
) . ' ' .
+ Xml::checkLabel(
+ $this->msg( 'prefixindex-strip' )->text(),
+ 'stripprefix',
+ 'stripprefix',
+ $this->stripPrefix
+ ) . ' ' .
Xml::submitButton( $this->msg( 'allpagessubmit' )->text() ) .
"</td>
</tr>";
if ( $res->numRows() > 0 ) {
$out = Xml::openElement( 'table', array( 'id' => 'mw-prefixindex-list-table' ) );
+ $prefixLength = strlen( $prefix );
while ( ( $n < $this->maxPerPage ) && ( $s = $res->fetchObject() ) ) {
$t = Title::makeTitle( $s->page_namespace, $s->page_title );
if ( $t ) {
+ $displayed = $t->getText();
+ if ( $this->stripPrefix ) {
+ $displayed = substr( $displayed, $prefixLength );
+ }
$link = ( $s->page_is_redirect ? '<div class="allpagesredirect">' : '' ) .
Linker::linkKnown(
$t,
- htmlspecialchars( $t->getText() ),
+ htmlspecialchars( $displayed ),
$s->page_is_redirect ? array( 'class' => 'mw-redirect' ) : array()
) .
( $s->page_is_redirect ? '</div>' : '' );
'mostrevisions-summary' => '', # do not translate or duplicate this message to other languages
'prefixindex' => 'All pages with prefix',
'prefixindex-namespace' => 'All pages with prefix ($1 namespace)',
+'prefixindex-strip' => 'Strip prefix in list',
'prefixindex-summary' => '', # do not translate or duplicate this message to other languages
'shortpages' => 'Short pages',
'shortpages-summary' => '', # do not translate or duplicate this message to other languages
'prefixindex' => '{{doc-special|PrefixIndex}}
When the user limits the list to a certain namespace, {{msg-mw|allinnamespace}} is used instead.',
'prefixindex-namespace' => 'The page title of [[Special:PrefixIndex]] limited to a specific namespace. Similar to {{msg-mw|allinnamespace}}. $1 is the name of the namespace',
+'prefixindex-strip' => 'Label for a checkbox. If the checkbox is checked, the prefix searched will be removed from the title displayed in the list. Used in [[Special:PrefixIndex]].',
'shortpages' => '{{doc-special|ShortPages}}',
'longpages' => '{{doc-special|LongPages}}',
'deadendpages' => '{{doc-special|DeadendPages}}',
'prefixindex',
'prefixindex-namespace',
'prefixindex-summary',
+ 'prefixindex-strip',
'shortpages',
'shortpages-summary',
'longpages',