* Normalize titles in Special:Randomincategory
authorVictor Vasiliev <vasilievvv@users.mediawiki.org>
Sun, 11 Nov 2007 14:17:59 +0000 (14:17 +0000)
committerVictor Vasiliev <vasilievvv@users.mediawiki.org>
Sun, 11 Nov 2007 14:17:59 +0000 (14:17 +0000)
* Add link on Special:Randomincategory to sidebar

RELEASE-NOTES
includes/SkinTemplate.php
includes/SpecialRandomincategory.php
languages/messages/MessagesEn.php
languages/messages/MessagesRu.php
skins/MonoBook.php

index 1891782..089e798 100644 (file)
@@ -58,6 +58,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
 * (bug 11848) Allow URL parameters 'editintro' and 'preload' in Special:Mypage 
   and Special:Mytalk
 * Add special page for getting random page from category
+* Add link on Special:Randomincategory to sidebar
 
 === Bug fixes in 1.12 ===
 
index eb651b5..6145e9d 100644 (file)
@@ -893,6 +893,13 @@ class SkinTemplate extends Skin {
                                );
                }
 
+               if( $this->mTitle->getNamespace() == NS_CATEGORY || $this->mTitle->getNamespace() == NS_CATEGORY_TALK ) {
+                       $nav_urls['randomincategory'] = array(
+                               'text' => wfMsg( 'randomincategory-toolbox' ),
+                               'href' => self::makeSpecialUrlSubpage( 'Randomincategory', $this->mTitle->getText() ),
+                       );
+               }
+
                if( $this->mTitle->getNamespace() == NS_USER || $this->mTitle->getNamespace() == NS_USER_TALK ) {
                        $id = User::idFromName($this->mTitle->getText());
                        $ip = User::isIP($this->mTitle->getText());
@@ -1196,3 +1203,4 @@ class QuickTemplate {
        }
 }
 
+
index 5372fa1..ba5ebe3 100644 (file)
@@ -53,7 +53,8 @@ class RandomPageInCategory {
                return $this->namespace;
        }
        public function setCategory ( $cat ) {
-               $this->category = $cat;
+               $category = Title::makeTitleSafe( NS_CATEGORY, $cat );
+               $this->category = $category->getDBKey();
        }
 
        /**
@@ -122,3 +123,4 @@ class RandomPageInCategory {
 }
 
 
+
index 49093b7..0976766 100644 (file)
@@ -1555,6 +1555,7 @@ PICT # misc.
 'randompage-nopages'              => 'There are no pages in this namespace.',
 'randompage-url'                  => 'Special:Random', # don't translate or duplicate this message to other languages
 'randomincategory'                => 'Random page in category',
+'randomincategory-toolbox'        => 'Random page',
 'randomincategory-nocategory'     => 'Category $1 doesn\'t exist or is empty',
 'randomincategory-label'          => 'Category:',
 'randomincategory-submit'         => 'Go',
index 250cbf3..45b43de 100644 (file)
@@ -1216,6 +1216,7 @@ $3 указал следующую причину: ''$2''",
 'randompage'                      => 'Случайная страница',
 'randompage-nopages'              => 'В данном пространстве имён отсутствуют страницы.',
 'randomincategory'                => 'Случайная страница в категории',
+'randomincategory-toolbox'        => 'Случайная страница',
 'randomincategory-nocategory'     => 'Категория "$1" пуста или не существует',
 'randomincategory-label'          => 'Категория:',
 'randomincategory-submit'         => 'Перейти',
index d0148a7..fcf7d4b 100644 (file)
@@ -221,6 +221,11 @@ class MonoBookTemplate extends QuickTemplate {
                } elseif ($this->data['nav_urls']['permalink']['href'] === '') { ?>
                                <li id="t-ispermalink"<?php echo $skin->tooltip('t-ispermalink') ?>><?php $this->msg('permalink') ?></li><?php
                }
+               
+               if(!empty($this->data['nav_urls']['randomincategory']['href'])) { ?>
+                               <li id="t-random"><a href="<?php echo htmlspecialchars($this->data['nav_urls']['randomincategory']['href'])
+                               ?>"<?php echo $skin->tooltipAndAccesskey('t-print') ?>><?php $this->msg('randomincategory-toolbox') ?></a></li><?php
+               }
 
                wfRunHooks( 'MonoBookTemplateToolboxEnd', array( &$this ) );
 ?>