* Moved all styles to SpecialInterwiki.css, with mw-interwikitable (largely inspired by wikitable) for tables, so that it also work for sites that don't have wikitable definitions

* Parse messages in the introduction table  instead of outputing them raw
* Whitespaces fixes
This commit is contained in:
Alexandre Emsenhuber 2009-02-10 10:32:13 +00:00
parent 6342678669
commit c8e409c165
Notes: Raimond Spekking 2009-03-28 22:26:10 +00:00
2 changed files with 64 additions and 21 deletions

41
SpecialInterwiki.css Normal file
View file

@ -0,0 +1,41 @@
/**
* CSS for Special:Interwiki
*/
table.mw-interwikitable {
margin: 1em 1em 1em 0;
background: #fdfdfd;
border: 1px #aaa solid;
border-collapse: collapse;
}
table.mw-interwikitable th,
table.mw-interwikitable td {
border: 1px #aaa solid;
padding: 0.2em;
}
table.mw-interwikitable th {
background: #f2f2f2;
text-align: center;
}
table.mw-interwikitable.intro th {
padding-right: 1.4ex;
vertical-align: top;
}
table.mw-interwikitable.intro th.mw-align-left {
text-align: left;
}
table.mw-interwikitable.intro th.mw-align-right {
text-align: right;
}
table.mw-interwikitable.body td.mw-interwikitable-local,
table.mw-interwikitable.body td.mw-interwikitable-trans {
text-align: center;
}

View file

@ -206,15 +206,19 @@ class SpecialInterwiki extends SpecialPage {
}
}
function trans_local($tl, $msg0, $msg1)
{
if($tl==='0') return ($msg0);
if($tl==='1') return ($msg1);
return ( htmlspecialchars( $tl ));
function trans_local( $tl, $msg0, $msg1 ) {
if( $tl==='0' )
return $msg0;
if( $tl==='1' )
return $msg1;
return htmlspecialchars( $tl );
}
function showList( $admin ) {
global $wgUser, $wgOut;
global $wgUser, $wgOut, $wgScriptPath;
$wgOut->addExtensionStyle( "{$wgScriptPath}/extensions/Interwiki/SpecialInterwiki.css" );
$prefixmessage = wfMsgHtml( 'interwiki_prefix' );
$urlmessage = wfMsgHtml( 'interwiki_url' );
$localmessage = wfMsgHtml( 'interwiki_local' );
@ -222,17 +226,16 @@ class SpecialInterwiki extends SpecialPage {
$message_0 = wfMsgHtml( 'interwiki_0' );
$message_1 = wfMsgHtml( 'interwiki_1' );
$sty='padding-right:1.4ex; vertical-align:top; text-align:';
$out = '
<table width="100%" cellspacing="0" cellpadding="0" border="0" style="border:0" class="wikitable">
<tr><th style="'.$sty.'left">'.$prefixmessage.'</th><td>'.wfMsg( 'interwiki_prefix_intro' ).'</td></tr>
<tr><th style="'.$sty.'left">'.$urlmessage.'</th><td>'.wfMsg( 'interwiki_url_intro' ).'</td></tr>
<tr><th style="'.$sty.'left">'.$localmessage.'</th><td>'.wfMsg( 'interwiki_local_intro' ).'</td></tr>
<tr><th style="'.$sty.'right">'.$message_0.'</th><td>'.wfMsg( 'interwiki_local_0_intro' ).'</td></tr>
<tr><th style="'.$sty.'right">'.$message_1.'</th><td>'.wfMsg( 'interwiki_local_1_intro' ).'</td></tr>
<tr><th style="'.$sty.'left">'.$transmessage.'</th><td>'.wfMsg( 'interwiki_trans_intro' ).'</td></tr>
<tr><th style="'.$sty.'right">'.$message_1.'</th><td>'.wfMsg( 'interwiki_trans_1_intro' ).'</td></tr>
<tr><th style="'.$sty.'right">'.$message_0.'</th><td>'.wfMsg( 'interwiki_trans_0_intro' ).'</td></tr>
<table width="100%" cellspacing="0" cellpadding="0" border="0" style="border:0" class="mw-interwikitable intro">
<tr><th class="mw-align-left">' . $prefixmessage . '</th><td>' . wfMsgExt( 'interwiki_prefix_intro', 'parseinline' ) . '</td></tr>
<tr><th class="mw-align-left">' . $urlmessage . '</th><td>' . wfMsgExt( 'interwiki_url_intro', 'parseinline' ) . '</td></tr>
<tr><th class="mw-align-left">' . $localmessage . '</th><td>' . wfMsgExt( 'interwiki_local_intro', 'parseinline' ) . '</td></tr>
<tr><th class="mw-align-right">' . $message_0 . '</th><td>' . wfMsgExt( 'interwiki_local_0_intro', 'parseinline' ) . '</td></tr>
<tr><th class="mw-align-right">' . $message_1 . '</th><td>' . wfMsgExt( 'interwiki_local_1_intro', 'parseinline' ) . '</td></tr>
<tr><th class="mw-align-left">' . $transmessage . '</th><td>' . wfMsgExt( 'interwiki_trans_intro', 'parseinline' ) . '</td></tr>
<tr><th class="mw-align-right">' . $message_1 . '</th><td>' . wfMsgExt( 'interwiki_trans_1_intro', 'parseinline' ) . '</td></tr>
<tr><th class="mw-align-right">' . $message_0 . '</th><td>' . wfMsgExt( 'interwiki_trans_0_intro', 'parseinline' ) . '</td></tr>
</table>
';
$wgOut->addWikiMsg( 'interwiki_intro' );
@ -244,7 +247,7 @@ class SpecialInterwiki extends SpecialPage {
$skin = $wgUser->getSkin();
$addtext = wfMsgHtml( 'interwiki_addtext' );
$addlink = $skin->link( $selfTitle, $addtext, array(), array( 'action' => 'add' ) );
$wgOut->addHTML( '<ul>' . '<li>' . $addlink . '</li>' . '</ul>' );
$wgOut->addHTML( '<p>' . $addlink . '</p>' );
}
$dbr = wfGetDB( DB_SLAVE );
@ -256,8 +259,7 @@ class SpecialInterwiki extends SpecialPage {
}
$out = "
<br />
<table width='100%' style='border:1px solid #aaa;' class='wikitable'>
<table width='100%' class='mw-interwikitable body'>
<tr id='interwikitable-header'><th>$prefixmessage</th> <th>$urlmessage</th> <th>$localmessage</th> <th>$transmessage</th>";
if( $admin ) {
$deletemessage = wfMsgHtml( 'delete' );
@ -274,8 +276,8 @@ class SpecialInterwiki extends SpecialPage {
$out .= "<tr class='mw-interwikitable-row'>
<td class='mw-interwikitable-prefix'>$prefix</td>
<td class='mw-interwikitable-url'>$url</td>
<td class='center mw-interwikitable-local'>$local</td>
<td class='center mw-interwikitable-trans'>$trans</td>";
<td class='mw-interwikitable-local'>$local</td>
<td class='mw-interwikitable-trans'>$trans</td>";
if( $admin ) {
$out .= '<td class="mw-interwikitable-modify">';
$out .= $skin->link( $selfTitle, $editmessage, array(),