http://www.mediawiki.org/wiki/Special:Code/MediaWiki/84512

Revision: 84512
Author:   reedy
Date:     2011-03-22 01:14:15 +0000 (Tue, 22 Mar 2011)
Log Message:
-----------
Properly wikitabulate the "other projects"

Somewhat related to (bug 14949) Improve organization of "other projects" in 
SiteMatrix list

Modified Paths:
--------------
    trunk/extensions/SiteMatrix/SiteMatrix.i18n.php
    trunk/extensions/SiteMatrix/SiteMatrix_body.php

Modified: trunk/extensions/SiteMatrix/SiteMatrix.i18n.php
===================================================================
--- trunk/extensions/SiteMatrix/SiteMatrix.i18n.php     2011-03-22 01:13:01 UTC 
(rev 84511)
+++ trunk/extensions/SiteMatrix/SiteMatrix.i18n.php     2011-03-22 01:14:15 UTC 
(rev 84512)
@@ -15,6 +15,7 @@
        'sitematrix-language'  => 'Language',
        'sitematrix-project'   => 'Name of project, interproject link and 
interwiki link',
        'sitematrix-others'    => 'Other projects of Wikimedia',
+       'sitematrix-other-projects' => 'Other projects',
        'sitematrix-total'     => "'''Total count: $1'''",
        'sitematrix-sitetotal' => 'Total',
        'sitematrix-private'   => 'private',

Modified: trunk/extensions/SiteMatrix/SiteMatrix_body.php
===================================================================
--- trunk/extensions/SiteMatrix/SiteMatrix_body.php     2011-03-22 01:13:01 UTC 
(rev 84511)
+++ trunk/extensions/SiteMatrix/SiteMatrix_body.php     2011-03-22 01:14:15 UTC 
(rev 84512)
@@ -346,10 +346,10 @@
                                Xml::element( 'th', array( 'colspan' => count( 
$matrix->getSites() ) ), wfMsg( 'sitematrix-project' ) ) .
                        "</tr>
                        <tr>";
-                               foreach ( $matrix->getNames() as $id => $name ) 
{
-                                       $url = $matrix->getSiteUrl( $id );
-                                       $s .= Xml::tags( 'th', null, "<a 
href=\"{$url}\">{$name}</a>" );
-                               }
+               foreach ( $matrix->getNames() as $id => $name ) {
+                       $url = $matrix->getSiteUrl( $id );
+                       $s .= Xml::tags( 'th', null, "<a 
href=\"{$url}\">{$name}</a>" );
+               }
                $s .= "</tr>\n";
 
                # Bulk of table
@@ -361,7 +361,7 @@
                                $attribs['title'] = $localLanguageNames[$lang];
                        }
                        $s .= '<td>' . $anchor . Xml::element( 'strong', 
$attribs, $wgLanguageNames[$lang] ) . '</td>';
-                       $langhost = str_replace( '_', '-', $lang );
+
                        foreach ( $matrix->getNames() as $site => $name ) {
                                $url = $matrix->getUrl( $lang, $site );
                                if ( $matrix->exist( $lang, $site ) ) {
@@ -388,7 +388,12 @@
 
                # Specials
                $s .= '<h2 id="mw-sitematrix-others">' . wfMsg( 
'sitematrix-others' ) . '</h2>';
-               $s .= '<ul>';
+
+               $s .= Xml::openElement( 'table', array( 'class' => 'wikitable', 
'id' => 'mw-sitematrix-other-table' ) ) .
+                       "<tr>" .
+                               Xml::element( 'th', null, wfMsg( 
'sitematrix-other-projects' ) ) .
+                       "</tr>";
+
                foreach ( $matrix->getSpecials() as $special ) {
                        list( $lang, $site ) = $special;
                        $langhost = str_replace( '_', '-', $lang );
@@ -396,18 +401,24 @@
 
                        # Handle options
                        $flags = array();
-                       if( $matrix->isPrivate( $lang . $site ) )
+                       if( $matrix->isPrivate( $lang . $site ) ) {
                                $flags[] = wfMsgHtml( 'sitematrix-private' );
-                       if( $matrix->isFishbowl( $lang . $site ) )
+                       }
+                       if( $matrix->isFishbowl( $lang . $site ) ) {
                                $flags[] = wfMsgHtml( 'sitematrix-fishbowl' );
+                       }
                        $flagsStr = implode( ', ', $flags );
-                       if( $site != 'wiki' ) $langhost .= $site;
+                       if( $site != 'wiki' ) {
+                               $langhost .= $site;
+                       }
                        $closed = $matrix->isClosed( $lang, $site );
-                       $s .= '<li>' . ( $closed ? '<del>' : '' ) .
+                       $s .= '<tr><td>' . ( $closed ? '<del>' : '' ) .
                                wfSpecialList( '<a href="' . $url . '/">' . 
$langhost . "</a>", $flagsStr ) .
-                               ( $closed ? '</del>' : '' ) . "</li>\n";
+                               ( $closed ? '</del>' : '' ) . "</td></tr>\n";
                }
-               $s .= '</ul>';
+
+               $s .= Xml::closeElement( 'table' ) . "\n";
+
                $wgOut->addHTML( $s );
                $wgOut->addWikiMsg( 'sitematrix-total', $matrix->getCount() );
        }


_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to