Index: trunk/phase3/skins/common/shared.css |
— | — | @@ -236,11 +236,54 @@ |
237 | 237 | |
238 | 238 | /* Special:SpecialPages styling */ |
239 | 239 | h4.mw-specialpagesgroup { |
| 240 | + padding: 2px; |
240 | 241 | background-color: #dcdcdc; |
241 | | - padding: 2px; |
242 | | - margin: .3em 0em 0em 0em; |
| 242 | + margin: .3em 0em 0em; |
| 243 | + clear: both; |
243 | 244 | } |
| 245 | +.mw-specialpages-section { |
| 246 | + display: block; |
| 247 | + width: 100%; |
| 248 | + clear: both; |
| 249 | +} |
| 250 | +/*.mw-specialpages-column { |
| 251 | + margin: 0em 0em .5em; |
| 252 | + float: left; |
| 253 | +}*/ |
| 254 | +.mw-specialpages-page { |
| 255 | + float: left; |
| 256 | + width: 275px; |
| 257 | + margin: 0em .3em .3em; |
| 258 | +} |
244 | 259 | |
| 260 | +.mw-specialpagerestricted { |
| 261 | + font-weight: bold; |
| 262 | +} |
| 263 | + |
| 264 | +/*.mw-restrictedicon { |
| 265 | + position: relative; |
| 266 | + top: -5px; |
| 267 | + font-style: italic; |
| 268 | + color: #777777; |
| 269 | +float: right; |
| 270 | + font-size: .75em; |
| 271 | +}*/ |
| 272 | +.mw-specialpages-notes { |
| 273 | + clear: both; |
| 274 | +} |
| 275 | +/*.mw-specialpagenotes { |
| 276 | + clear: both; |
| 277 | +}*/ |
| 278 | +/*.mw-specialpagenote { |
| 279 | + display: block; |
| 280 | +} |
| 281 | +.mw-specialpagenote-symbol { |
| 282 | + float: left; |
| 283 | +} |
| 284 | +.mw-specialpagenote-text { |
| 285 | + font-style: italic; |
| 286 | +}*/ |
| 287 | + |
245 | 288 | #shared-image-dup, #shared-image-conflict { |
246 | 289 | font-style: italic; |
247 | 290 | } |
Index: trunk/phase3/includes/SpecialSpecialpages.php |
— | — | @@ -8,34 +8,20 @@ |
9 | 9 | * |
10 | 10 | */ |
11 | 11 | function wfSpecialSpecialpages() { |
12 | | - global $wgOut, $wgUser, $wgMessageCache; |
| 12 | + global $wgOut, $wgUser, $wgMessageCache, $wgSortSpecialPages; |
13 | 13 | |
14 | 14 | $wgMessageCache->loadAllMessages(); |
15 | 15 | |
16 | 16 | $wgOut->setRobotpolicy( 'noindex,nofollow' ); # Is this really needed? |
17 | 17 | $sk = $wgUser->getSkin(); |
18 | 18 | |
19 | | - /** Pages available to all */ |
20 | | - wfSpecialSpecialpages_gen( SpecialPage::getRegularPages(), 'spheading', $sk ); |
21 | | - |
22 | | - /** Restricted special pages */ |
23 | | - wfSpecialSpecialpages_gen( SpecialPage::getRestrictedPages(), 'restrictedpheading', $sk ); |
24 | | -} |
25 | | - |
26 | | -/** |
27 | | - * sub function generating the list of pages |
28 | | - * @param $pages the list of pages |
29 | | - * @param $heading header to be used |
30 | | - * @param $sk skin object ??? |
31 | | - */ |
32 | | -function wfSpecialSpecialpages_gen($pages,$heading,$sk) { |
33 | | - global $wgOut, $wgSortSpecialPages; |
34 | | - |
| 19 | + $pages = SpecialPage::getUsablePages(); |
| 20 | + |
35 | 21 | if( count( $pages ) == 0 ) { |
36 | 22 | # Yeah, that was pointless. Thanks for coming. |
37 | 23 | return; |
38 | 24 | } |
39 | | - |
| 25 | + |
40 | 26 | /** Put them into a sortable array */ |
41 | 27 | $groups = array(); |
42 | 28 | foreach ( $pages as $page ) { |
— | — | @@ -44,44 +30,45 @@ |
45 | 31 | if( !isset($groups[$group]) ) { |
46 | 32 | $groups[$group] = array(); |
47 | 33 | } |
48 | | - $groups[$group][$page->getDescription()] = $page->getTitle(); |
| 34 | + $groups[$group][$page->getDescription()] = array( $page->getTitle(), $page->isRestricted() ); |
49 | 35 | } |
50 | 36 | } |
51 | | - |
| 37 | + |
52 | 38 | /** Sort */ |
53 | 39 | if ( $wgSortSpecialPages ) { |
54 | 40 | foreach( $groups as $group => $sortedPages ) { |
55 | 41 | ksort( $groups[$group] ); |
56 | 42 | } |
57 | 43 | } |
58 | | - |
| 44 | + |
59 | 45 | /** Always move "other" to end */ |
60 | 46 | if( array_key_exists('other',$groups) ) { |
61 | 47 | $other = $groups['other']; |
62 | 48 | unset( $groups['other'] ); |
63 | 49 | $groups['other'] = $other; |
64 | 50 | } |
65 | | - |
| 51 | + |
66 | 52 | /** Now output the HTML */ |
67 | | - $wgOut->addHTML( '<h2>' . wfMsgHtml( $heading ) . "</h2>\n" ); |
| 53 | + $restrictedPages = false; |
68 | 54 | foreach ( $groups as $group => $sortedPages ) { |
69 | | - $middle = ceil( count($sortedPages)/2 ); |
70 | | - $total = count($sortedPages); |
71 | | - $count = 0; |
72 | | - |
73 | 55 | $wgOut->addHTML( "<h4 class='mw-specialpagesgroup'>".wfMsgHtml("specialpages-group-$group")."</h4>\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 ) { |
| 56 | + $wgOut->addHTML( "<ul class='mw-specialpages-section'>" ); |
| 57 | + foreach ( $sortedPages as $desc => $specialpage ) { |
| 58 | + list( $title, $restricted ) = $specialpage; |
77 | 59 | $link = $sk->makeKnownLinkObj( $title , htmlspecialchars( $desc ) ); |
78 | | - $wgOut->addHTML( "<li>{$link}</li>\n" ); |
79 | | - |
80 | | - # Slit up the larger groups |
81 | | - $count++; |
82 | | - if( $total > 3 && $count == $middle ) { |
83 | | - $wgOut->addHTML( "</ul></td><td width='10%'></td><td width='30%' valign='top'><ul>" ); |
| 60 | + if( $restricted ) { |
| 61 | + $wgOut->addHTML( "<li class='mw-specialpages-page mw-specialpagerestricted'>{$link}</li>\n" ); |
| 62 | + $restrictedPages = true; |
| 63 | + } else { |
| 64 | + $wgOut->addHTML( "<li class='mw-specialpages-page'>{$link}</li>\n" ); |
84 | 65 | } |
85 | 66 | } |
86 | | - $wgOut->addHTML( "</ul></td><td width='30%' valign='top'></td></tr></table>\n" ); |
| 67 | + $wgOut->addHTML( "</ul>\n" ); |
87 | 68 | } |
88 | | -} |
| 69 | + $wgOut->addHTML( |
| 70 | + Xml::openElement('div', array( 'class' => 'mw-specialpages-notes' )). |
| 71 | + wfMsgWikiHtml('specialpages-note'). |
| 72 | + Xml::closeElement('div') |
| 73 | + ); |
| 74 | + |
| 75 | +} |
\ No newline at end of file |
Index: trunk/phase3/includes/SpecialPage.php |
— | — | @@ -375,6 +375,32 @@ |
376 | 376 | } |
377 | 377 | |
378 | 378 | /** |
| 379 | + * Return categorised listable special pages which are available |
| 380 | + * for the current user, and everyone. |
| 381 | + * @static |
| 382 | + */ |
| 383 | + static function getUsablePages() { |
| 384 | + global $wgUser; |
| 385 | + if ( !self::$mListInitialised ) { |
| 386 | + self::initList(); |
| 387 | + } |
| 388 | + $pages = array(); |
| 389 | + |
| 390 | + foreach ( self::$mList as $name => $rec ) { |
| 391 | + $page = self::getPage( $name ); |
| 392 | + if ( $page->isListed() |
| 393 | + && ( |
| 394 | + !$page->isRestricted() |
| 395 | + || $page->userCanExecute( $wgUser ) |
| 396 | + ) |
| 397 | + ) { |
| 398 | + $pages[$name] = $page; |
| 399 | + } |
| 400 | + } |
| 401 | + return $pages; |
| 402 | + } |
| 403 | + |
| 404 | + /** |
379 | 405 | * Return categorised listable special pages for all users |
380 | 406 | * @static |
381 | 407 | */ |
— | — | @@ -409,8 +435,8 @@ |
410 | 436 | $page = self::getPage( $name ); |
411 | 437 | if ( |
412 | 438 | $page->isListed() |
413 | | - and $page->isRestricted() |
414 | | - and $page->userCanExecute( $wgUser ) |
| 439 | + && $page->isRestricted() |
| 440 | + && $page->userCanExecute( $wgUser ) |
415 | 441 | ) { |
416 | 442 | $pages[$name] = $page; |
417 | 443 | } |
Index: trunk/phase3/languages/messages/MessagesEn.php |
— | — | @@ -3392,6 +3392,7 @@ |
3393 | 3393 | 'fileduplicatesearch-result-n' => 'The file "$1" has {{PLURAL:$2|1 identical duplication|$2 identical duplications}}.', |
3394 | 3394 | |
3395 | 3395 | # Special:SpecialPages |
| 3396 | +'specialpages-note' => "<hr>\n* <span class=\"mw-specialpagerestricted\">Highlighted</span> special pages are restricted.", |
3396 | 3397 | 'specialpages-group-maintenance' => 'Maintenance reports', |
3397 | 3398 | 'specialpages-group-other' => 'Other special pages', |
3398 | 3399 | 'specialpages-group-login' => 'Login / sign up', |
Index: trunk/phase3/RELEASE-NOTES |
— | — | @@ -128,6 +128,9 @@ |
129 | 129 | 'import-upload' instead of 'upload' |
130 | 130 | * Add information about user group membership to Special:Preferences |
131 | 131 | * (bug 14146) Wrap usage section on imagepages into <div>s. |
| 132 | +* New layout for Special:Specialpages. Restricted pages are marked but not separated |
| 133 | + from other pages in their group. And the page uses css rather than tables to create |
| 134 | + a column layout which grades well in all sizes of browsers. |
132 | 135 | |
133 | 136 | === Bug fixes in 1.13 === |
134 | 137 | |