}
}
+ /**
+ * Return categorised listable special pages which are available
+ * for the current user, and everyone.
+ * @static
+ */
+ static function getUsablePages() {
+ global $wgUser;
+ if ( !self::$mListInitialised ) {
+ self::initList();
+ }
+ $pages = array();
+
+ foreach ( self::$mList as $name => $rec ) {
+ $page = self::getPage( $name );
+ if ( $page->isListed()
+ && (
+ !$page->isRestricted()
+ || $page->userCanExecute( $wgUser )
+ )
+ ) {
+ $pages[$name] = $page;
+ }
+ }
+ return $pages;
+ }
+
/**
* Return categorised listable special pages for all users
* @static
$page = self::getPage( $name );
if (
$page->isListed()
- and $page->isRestricted()
- and $page->userCanExecute( $wgUser )
+ && $page->isRestricted()
+ && $page->userCanExecute( $wgUser )
) {
$pages[$name] = $page;
}
*
*/
function wfSpecialSpecialpages() {
- global $wgOut, $wgUser, $wgMessageCache;
+ global $wgOut, $wgUser, $wgMessageCache, $wgSortSpecialPages;
$wgMessageCache->loadAllMessages();
$wgOut->setRobotpolicy( 'noindex,nofollow' ); # Is this really needed?
$sk = $wgUser->getSkin();
- /** Pages available to all */
- wfSpecialSpecialpages_gen( SpecialPage::getRegularPages(), 'spheading', $sk );
-
- /** Restricted special pages */
- wfSpecialSpecialpages_gen( SpecialPage::getRestrictedPages(), 'restrictedpheading', $sk );
-}
-
-/**
- * sub function generating the list of pages
- * @param $pages the list of pages
- * @param $heading header to be used
- * @param $sk skin object ???
- */
-function wfSpecialSpecialpages_gen($pages,$heading,$sk) {
- global $wgOut, $wgSortSpecialPages;
-
+ $pages = SpecialPage::getUsablePages();
+
if( count( $pages ) == 0 ) {
# Yeah, that was pointless. Thanks for coming.
return;
}
-
+
/** Put them into a sortable array */
$groups = array();
foreach ( $pages as $page ) {
if( !isset($groups[$group]) ) {
$groups[$group] = array();
}
- $groups[$group][$page->getDescription()] = $page->getTitle();
+ $groups[$group][$page->getDescription()] = array( $page->getTitle(), $page->isRestricted() );
}
}
-
+
/** Sort */
if ( $wgSortSpecialPages ) {
foreach( $groups as $group => $sortedPages ) {
ksort( $groups[$group] );
}
}
-
+
/** Always move "other" to end */
if( array_key_exists('other',$groups) ) {
$other = $groups['other'];
unset( $groups['other'] );
$groups['other'] = $other;
}
-
+
/** Now output the HTML */
- $wgOut->addHTML( '<h2>' . wfMsgHtml( $heading ) . "</h2>\n" );
+ $restrictedPages = false;
foreach ( $groups as $group => $sortedPages ) {
- $middle = ceil( count($sortedPages)/2 );
- $total = count($sortedPages);
- $count = 0;
-
$wgOut->addHTML( "<h4 class='mw-specialpagesgroup'>".wfMsgHtml("specialpages-group-$group")."</h4>\n" );
- $wgOut->addHTML( "<table style='width: 100%;' class='mw-specialpages-table'><tr>" );
- $wgOut->addHTML( "<td width='30%' valign='top'><ul>\n" );
- foreach ( $sortedPages as $desc => $title ) {
+ $wgOut->addHTML( "<ul class='mw-specialpages-section'>" );
+ foreach ( $sortedPages as $desc => $specialpage ) {
+ list( $title, $restricted ) = $specialpage;
$link = $sk->makeKnownLinkObj( $title , htmlspecialchars( $desc ) );
- $wgOut->addHTML( "<li>{$link}</li>\n" );
-
- # Slit up the larger groups
- $count++;
- if( $total > 3 && $count == $middle ) {
- $wgOut->addHTML( "</ul></td><td width='10%'></td><td width='30%' valign='top'><ul>" );
+ if( $restricted ) {
+ $wgOut->addHTML( "<li class='mw-specialpages-page mw-specialpagerestricted'>{$link}</li>\n" );
+ $restrictedPages = true;
+ } else {
+ $wgOut->addHTML( "<li class='mw-specialpages-page'>{$link}</li>\n" );
}
}
- $wgOut->addHTML( "</ul></td><td width='30%' valign='top'></td></tr></table>\n" );
+ $wgOut->addHTML( "</ul>\n" );
}
-}
+ $wgOut->addHTML(
+ Xml::openElement('div', array( 'class' => 'mw-specialpages-notes' )).
+ wfMsgWikiHtml('specialpages-note').
+ Xml::closeElement('div')
+ );
+
+}
\ No newline at end of file
/* Special:SpecialPages styling */
h4.mw-specialpagesgroup {
- background-color: #dcdcdc;
padding: 2px;
- margin: .3em 0em 0em 0em;
+ background-color: #dcdcdc;
+ margin: .3em 0em 0em;
+ clear: both;
+}
+.mw-specialpages-section {
+ display: block;
+ width: 100%;
+ clear: both;
+}
+/*.mw-specialpages-column {
+ margin: 0em 0em .5em;
+ float: left;
+}*/
+.mw-specialpages-page {
+ float: left;
+ width: 275px;
+ margin: 0em .3em .3em;
}
+.mw-specialpagerestricted {
+ font-weight: bold;
+}
+
+/*.mw-restrictedicon {
+ position: relative;
+ top: -5px;
+ font-style: italic;
+ color: #777777;
+float: right;
+ font-size: .75em;
+}*/
+.mw-specialpages-notes {
+ clear: both;
+}
+/*.mw-specialpagenotes {
+ clear: both;
+}*/
+/*.mw-specialpagenote {
+ display: block;
+}
+.mw-specialpagenote-symbol {
+ float: left;
+}
+.mw-specialpagenote-text {
+ font-style: italic;
+}*/
+
#shared-image-dup, #shared-image-conflict {
font-style: italic;
}