Index: trunk/phase3/skins/common/shared.css |
— | — | @@ -136,3 +136,15 @@ |
137 | 137 | padding: 0.5em 0.2em 0.5em 0.2em; |
138 | 138 | border: 1px solid #ccc; |
139 | 139 | } |
| 140 | + |
| 141 | +/* Special:SpecialPages styling */ |
| 142 | +h3.mw-specialpagesgroup { |
| 143 | + background-color: #dcdcdc; |
| 144 | + padding: 2px; |
| 145 | + margin: .3em 0em 0em 0em; |
| 146 | +} |
| 147 | + |
| 148 | +table.mw-specialpages-table { |
| 149 | + background-color: #f9f9f9; |
| 150 | +} |
| 151 | + |
Index: trunk/phase3/includes/SpecialSpecialpages.php |
— | — | @@ -37,25 +37,53 @@ |
38 | 38 | } |
39 | 39 | |
40 | 40 | /** Put them into a sortable array */ |
41 | | - $sortedPages = array(); |
| 41 | + $groups = array(); |
42 | 42 | foreach ( $pages as $page ) { |
43 | 43 | if ( $page->isListed() ) { |
44 | | - $sortedPages[$page->getDescription()] = $page->getTitle(); |
| 44 | + $group = SpecialPage::getGroup( $page ); |
| 45 | + if( !isset($groups[$group]) ) { |
| 46 | + $groups[$group] = array(); |
| 47 | + } |
| 48 | + $groups[$group][$page->getDescription()] = $page->getTitle(); |
45 | 49 | } |
46 | 50 | } |
47 | 51 | |
48 | 52 | /** Sort */ |
49 | 53 | if ( $wgSortSpecialPages ) { |
50 | | - ksort( $sortedPages ); |
| 54 | + foreach( $groups as $group => $sortedPages ) { |
| 55 | + ksort( $groups[$group] ); |
| 56 | + } |
51 | 57 | } |
| 58 | + |
| 59 | + /** Always move "other" to end */ |
| 60 | + if( array_key_exists('other',$groups) ) { |
| 61 | + $other = $groups['other']; |
| 62 | + unset( $groups['other'] ); |
| 63 | + $groups['other'] = $other; |
| 64 | + } |
52 | 65 | |
53 | 66 | /** Now output the HTML */ |
54 | | - $wgOut->addHTML( '<h2>' . wfMsgHtml( $heading ) . "</h2>\n<ul>" ); |
55 | | - foreach ( $sortedPages as $desc => $title ) { |
56 | | - $link = $sk->makeKnownLinkObj( $title , htmlspecialchars( $desc ) ); |
57 | | - $wgOut->addHTML( "<li>{$link}</li>\n" ); |
| 67 | + $wgOut->addHTML( '<h2>' . wfMsgHtml( $heading ) . "</h2>\n" ); |
| 68 | + foreach ( $groups as $group => $sortedPages ) { |
| 69 | + $middle = ceil( count($sortedPages)/2 ); |
| 70 | + $max = count($sortedPages) - 1; |
| 71 | + $count = 0; |
| 72 | + |
| 73 | + $wgOut->addHTML( "<h3 class='mw-specialpagesgroup'>".wfMsgHtml("specialpages-group-$group")."</h3>\n" ); |
| 74 | + $wgOut->addHTML( "<table style='width: 100%;' class='mw-specialpages-table'><tr>" ); |
| 75 | + $wgOut->addHTML( "<td width='30%' valign='top'><ul>\n" ); |
| 76 | + foreach ( $sortedPages as $desc => $title ) { |
| 77 | + $link = $sk->makeKnownLinkObj( $title , htmlspecialchars( $desc ) ); |
| 78 | + $wgOut->addHTML( "<li>{$link}</li>\n" ); |
| 79 | + |
| 80 | + # Slit up the larger groups |
| 81 | + $count++; |
| 82 | + if( $max > 3 && $count == $middle && $count < $max ) { |
| 83 | + $wgOut->addHTML( "</ul></td><td width='10%'></td><td width='30%' valign='top'><ul>" ); |
| 84 | + } |
| 85 | + } |
| 86 | + $wgOut->addHTML( "</ul></td><td width='30%' valign='top'></td></tr></table>\n" ); |
58 | 87 | } |
59 | | - $wgOut->addHTML( "</ul>\n" ); |
60 | 88 | } |
61 | 89 | |
62 | 90 | |
Index: trunk/phase3/includes/DefaultSettings.php |
— | — | @@ -1336,7 +1336,7 @@ |
1337 | 1337 | * to ensure that client-side caches don't keep obsolete copies of global |
1338 | 1338 | * styles. |
1339 | 1339 | */ |
1340 | | -$wgStyleVersion = '133'; |
| 1340 | +$wgStyleVersion = '134'; |
1341 | 1341 | |
1342 | 1342 | |
1343 | 1343 | # Server-side caching: |
Index: trunk/phase3/includes/SpecialPage.php |
— | — | @@ -68,7 +68,15 @@ |
69 | 69 | * Query parameters that can be passed through redirects |
70 | 70 | */ |
71 | 71 | var $mAllowedRedirectParams = array(); |
72 | | - |
| 72 | + /** |
| 73 | + * List of special pages, followed by parameters. |
| 74 | + * If the only parameter is a string, that is the page name. |
| 75 | + * Otherwise, it is an array. The format is one of: |
| 76 | + ** array( 'SpecialPage', name, right ) |
| 77 | + ** array( 'IncludableSpecialPage', name, right, listed? ) |
| 78 | + ** array( 'UnlistedSpecialPage', name, right ) |
| 79 | + ** array( 'SpecialRedirectToSpecial', name, page to redirect to, special page param, ... ) |
| 80 | + */ |
73 | 81 | static public $mList = array( |
74 | 82 | 'DoubleRedirects' => array( 'SpecialPage', 'DoubleRedirects' ), |
75 | 83 | 'BrokenRedirects' => array( 'SpecialPage', 'BrokenRedirects' ), |
— | — | @@ -117,7 +125,7 @@ |
118 | 126 | 'Specialpages' => array( 'UnlistedSpecialPage', 'Specialpages' ), |
119 | 127 | 'Contributions' => array( 'SpecialPage', 'Contributions' ), |
120 | 128 | 'Emailuser' => array( 'UnlistedSpecialPage', 'Emailuser' ), |
121 | | - 'Whatlinkshere' => array( 'SpecialPage', 'Whatlinkshere' ), |
| 129 | + 'Whatlinkshere' => array( 'UnlistedSpecialPage', 'Whatlinkshere' ), |
122 | 130 | 'Recentchangeslinked' => array( 'UnlistedSpecialPage', 'Recentchangeslinked' ), |
123 | 131 | 'Movepage' => array( 'UnlistedSpecialPage', 'Movepage' ), |
124 | 132 | 'Blockme' => array( 'UnlistedSpecialPage', 'Blockme' ), |
— | — | @@ -154,7 +162,98 @@ |
155 | 163 | |
156 | 164 | static public $mAliases; |
157 | 165 | static public $mListInitialised = false; |
| 166 | + /** |
| 167 | + * List of special pages, followed by what subtitle they should go under |
| 168 | + * at Special:SpecialPages |
| 169 | + */ |
| 170 | + static public $mGroupsList = array( |
| 171 | + 'DoubleRedirects' => 'maintenance', |
| 172 | + 'BrokenRedirects' => 'maintenance', |
| 173 | + 'Lonelypages' => 'maintenance', |
| 174 | + 'Uncategorizedpages' => 'maintenance', |
| 175 | + 'Uncategorizedcategories' => 'maintenance', |
| 176 | + 'Uncategorizedimages' => 'maintenance', |
| 177 | + 'Uncategorizedtemplates' => 'maintenance', |
| 178 | + 'Unusedcategories' => 'maintenance', |
| 179 | + 'Unusedimages' => 'maintenance', |
| 180 | + 'Protectedpages' => 'maintenance', |
| 181 | + 'Protectedtitles' => 'maintenance', |
| 182 | + 'Unusedtemplates' => 'maintenance', |
| 183 | + 'Withoutinterwiki' => 'maintenance', |
| 184 | + 'Longpages' => 'maintenance', |
158 | 185 | |
| 186 | + 'Userlogin' => 'login', |
| 187 | + 'Userlogout' => 'login', |
| 188 | + 'CreateAccount' => 'login', |
| 189 | + |
| 190 | + 'Recentchanges' => 'changes', |
| 191 | + 'Recentchangeslinked' => 'changes', |
| 192 | + 'Watchlist' => 'changes', |
| 193 | + 'Newimages' => 'changes', |
| 194 | + 'Newpages' => 'changes', |
| 195 | + 'Log' => 'changes', |
| 196 | + |
| 197 | + 'Upload' => 'media', |
| 198 | + 'Imagelist' => 'media', |
| 199 | + 'MIMEsearch' => 'media', |
| 200 | + 'FileDuplicateSearch' => 'media', |
| 201 | + 'Filepath' => 'media', |
| 202 | + |
| 203 | + 'Listusers' => 'users', |
| 204 | + 'Listgrouprights' => 'users', |
| 205 | + 'Ipblocklist' => 'users', |
| 206 | + 'Contributions' => 'users', |
| 207 | + 'Emailuser' => 'users', |
| 208 | + 'Listadmins' => 'users', |
| 209 | + 'Listbots' => 'users', |
| 210 | + |
| 211 | + 'Wantedpages' => 'needy', |
| 212 | + 'Wantedcategories' => 'needy', |
| 213 | + 'Shortpages' => 'needy', |
| 214 | + 'Ancientpages' => 'needy', |
| 215 | + 'Deadendpages' => 'needy', |
| 216 | + |
| 217 | + 'Mostlinked' => 'highuse', |
| 218 | + 'Mostlinkedcategories' => 'highuse', |
| 219 | + 'Mostlinkedtemplates' => 'highuse', |
| 220 | + 'Mostcategories' => 'highuse', |
| 221 | + 'Mostimages' => 'highuse', |
| 222 | + 'Mostrevisions' => 'highuse', |
| 223 | + |
| 224 | + 'Userrights' => 'permissions', |
| 225 | + 'Blockip' => 'permissions', |
| 226 | + |
| 227 | + 'Statistics' => 'other', |
| 228 | + 'Fewestrevisions' => 'other', |
| 229 | + 'Randompage' => 'other', |
| 230 | + 'Disambiguations' => 'other', |
| 231 | + 'Specialpages' => 'other', |
| 232 | + 'Blockme' => 'other', |
| 233 | + 'Movepage' => 'other', |
| 234 | + 'MergeHistory' => 'other', |
| 235 | + 'Lockdb' => 'other', |
| 236 | + 'Unlockdb' => 'other', |
| 237 | + 'Version' => 'other', |
| 238 | + 'Whatlinkshere' => 'other', |
| 239 | + 'Booksources' => 'other', |
| 240 | + 'Revisiondelete' => 'other', |
| 241 | + 'Export' => 'other', |
| 242 | + 'Categories' => 'other', |
| 243 | + 'Undelete' => 'other', |
| 244 | + 'Import' => 'other', |
| 245 | + 'Unwatchedpages' => 'other', |
| 246 | + 'Randomredirect' => 'other', |
| 247 | + 'Allpages' => 'other', |
| 248 | + 'Allmessages' => 'other', |
| 249 | + 'Prefixindex' => 'other', |
| 250 | + 'Listredirects' => 'other', |
| 251 | + 'Preferences' => 'other', |
| 252 | + 'Resetpass' => 'other', |
| 253 | + 'Mypage' => 'other', |
| 254 | + 'Mytalk' => 'other', |
| 255 | + 'Mycontributions' => 'other', |
| 256 | + ); |
| 257 | + |
159 | 258 | /**#@-*/ |
160 | 259 | |
161 | 260 | /** |
— | — | @@ -265,6 +364,37 @@ |
266 | 365 | } |
267 | 366 | self::$mList[$page->mName] = $page; |
268 | 367 | } |
| 368 | + |
| 369 | + /** |
| 370 | + * Add a page to a certain display group for Special:SpecialPages |
| 371 | + * |
| 372 | + * @param mixed $page Must either be an array specifying a class name and |
| 373 | + * constructor parameters, or an object. |
| 374 | + * @param string $group |
| 375 | + * @static |
| 376 | + */ |
| 377 | + static function setGroup( &$page, $group ) { |
| 378 | + if ( !self::$mListInitialised ) { |
| 379 | + self::initList(); |
| 380 | + } |
| 381 | + self::$mGroupsList[$page->mName] = $group; |
| 382 | + } |
| 383 | + |
| 384 | + /** |
| 385 | + * Add a page to a certain display group for Special:SpecialPages |
| 386 | + * |
| 387 | + * @param mixed $page Must either be an array specifying a class name and |
| 388 | + * constructor parameters, or an object. |
| 389 | + * @static |
| 390 | + */ |
| 391 | + static function getGroup( &$page ) { |
| 392 | + if ( !self::$mListInitialised ) { |
| 393 | + self::initList(); |
| 394 | + } |
| 395 | + $group = isset(self::$mGroupsList[$page->mName]) ? |
| 396 | + self::$mGroupsList[$page->mName] : 'other'; |
| 397 | + return $group; |
| 398 | + } |
269 | 399 | |
270 | 400 | /** |
271 | 401 | * Remove a special page from the list |
Index: trunk/phase3/languages/messages/MessagesEn.php |
— | — | @@ -3254,6 +3254,17 @@ |
3255 | 3255 | 'version-software-product' => 'Product', |
3256 | 3256 | 'version-software-version' => 'Version', |
3257 | 3257 | |
| 3258 | +# Special:SpecialPages |
| 3259 | +'specialpages-group-maintenance' => 'Maintenance reports', |
| 3260 | +'specialpages-group-other' => 'Other special pages', |
| 3261 | +'specialpages-group-login' => 'Login/sign up', |
| 3262 | +'specialpages-group-changes' => 'Recent changes and logs', |
| 3263 | +'specialpages-group-media' => 'Media reports', |
| 3264 | +'specialpages-group-users' => 'Users and rights', |
| 3265 | +'specialpages-group-needy' => 'Pages in need of work', |
| 3266 | +'specialpages-group-highuse' => 'High use pages', |
| 3267 | +'specialpages-group-permissions' => 'Set user permissions', |
| 3268 | + |
3258 | 3269 | # Special:Filepath |
3259 | 3270 | 'filepath' => 'File path', |
3260 | 3271 | 'filepath-page' => 'File:', |