unbroke classic and cologne blue skins

This commit is contained in:
Tim Starling 2005-06-28 14:18:08 +00:00
parent 738566a512
commit c22b8425c0
4 changed files with 60 additions and 37 deletions

View file

@ -1286,6 +1286,43 @@ END;
}
}
/**
* Build an array that represents the sidebar(s), the navigation bar among them
*
* @return array
* @access private
*/
function buildSidebar() {
$fname = 'SkinTemplate::buildSidebar';
wfProfileIn( $fname );
$bar = array();
$lines = explode( "\n", wfMsgForContent( 'sidebar' ) );
foreach ($lines as $line) {
if (strpos($line, '*') !== 0)
continue;
if (strpos($line, '**') !== 0) {
$line = trim($line, '* ');
$heading = $line;
} else {
if (strpos($line, '|') !== false) { // sanity check
$line = explode( '|' , trim($line, '* '), 2 );
$link = wfMsgForContent( $line[0] );
if( $link == '-' ) {
continue;
}
$bar[$heading][] = array(
'text' => wfMsg( $line[1] ),
'href' => $this->makeInternalOrExternalUrl( $link ),
'id' => 'n-' . $line[1],
);
} else { continue; }
}
}
wfProfileOut( $fname );
return $bar;
}
}
}

View file

@ -719,43 +719,7 @@ class SkinTemplate extends Skin {
return $content_actions;
}
/**
* Build an array that represents the sidebar(s), the navigation bar among them
*
* @return array
* @access private
*/
function buildSidebar() {
$fname = 'SkinTemplate::buildSidebar';
wfProfileIn( $fname );
$bar = array();
$lines = explode( "\n", wfMsgForContent( 'sidebar' ) );
foreach ($lines as $line) {
if (strpos($line, '*') !== 0)
continue;
if (strpos($line, '**') !== 0) {
$line = trim($line, '* ');
$heading = $line;
} else {
if (strpos($line, '|') !== false) { // sanity check
$line = explode( '|' , trim($line, '* '), 2 );
$link = wfMsgForContent( $line[0] );
if( $link == '-' ) {
continue;
}
$bar[$heading][] = array(
'text' => wfMsg( $line[1] ),
'href' => $this->makeInternalOrExternalUrl( $link ),
'id' => 'n-' . $line[1],
);
} else { continue; }
}
}
wfProfileOut( $fname );
return $bar;
}
/**
* build array of common navigation links

View file

@ -183,6 +183,17 @@ class SkinCologneBlue extends Skin {
$s .= $this->menuHead( "qbbrowse" );
# Use the first heading from the Monobook sidebar as the "browse" section
$bar = $this->buildSidebar();
$browseLinks = reset( $bar );
foreach ( $browseLinks as $link ) {
if ( $link['text'] != '-' ) {
$s .= "<a href=\"{$link['href']}\">" .
htmlspecialchars( $link['text'] ) . '</a>' . $sep;
}
}
if ( $wgOut->isArticle() ) {
$s .= $this->menuHead( "qbedit" );
$s .= "<strong>" . $this->editThisPage() . "</strong>";

View file

@ -145,6 +145,17 @@ class SkinStandard extends Skin {
$s .= "\n" . $this->logoText() . "\n<hr class='sep' />";
$sep = "\n<br />";
# Use the first heading from the Monobook sidebar as the "browse" section
$bar = $this->buildSidebar();
$browseLinks = reset( $bar );
foreach ( $browseLinks as $link ) {
if ( $link['text'] != '-' ) {
$s .= "<a href=\"{$link['href']}\">" .
htmlspecialchars( $link['text'] ) . '</a>' . $sep;
}
}
if( $wgUser->isLoggedIn() ) {
$s.= $this->specialLink( 'watchlist' ) ;