Pārlūkot izejas kodu

Adding a navbar icon, option to change displayed name in navbar from $wgSitename, and cleaning up formatting of code.

Tom Hutchison 11 gadi atpakaļ
vecāks
revīzija
39d38c46ec
1 mainītis faili ar 70 papildinājumiem un 60 dzēšanām
  1. 70 60
      Foreground.skin.php

+ 70 - 60
Foreground.skin.php

@@ -19,6 +19,7 @@ class Skinforeground extends SkinTemplate {
 			'NavWrapperType' => 'divonly',
 			'showHelpUnderTools' => true,
 			'showRecentChangesUnderTools' => true,
+			'wikiName' => &$GLOBALS['wgSitename'],
 			'IeEdgeCode' => 1
 		);
 		foreach ($wgForegroundFeaturesDefaults as $fgOption => $fgOptionValue) {
@@ -68,72 +69,81 @@ class foregroundTemplate extends BaseTemplate {
 ?>
 <!-- START FOREGROUNDTEMPLATE -->
 		<nav class="top-bar">
-						<ul class="title-area">
-							<li class="name"><h1><a href="<?php echo $this->data['nav_urls']['mainpage']['href']; ?>"><?php echo $this->text('sitename'); ?></a></h1></li>
-						   <li class="toggle-topbar menu-icon"><a href="#"><span><?php echo wfMessage( 'foreground-menutitle' )->text(); ?></span></a></li>
-						</ul>
-
-						<section class="top-bar-section">
-
-		    		<ul id="top-bar-left" class="left">
-		 						<li class="divider"></li>
-									<?php foreach ( $this->getSidebar() as $boxName => $box ) { if ( ($box['header'] != wfMessage( 'toolbox' )->text())  ) { ?>
-									<li class="has-dropdown active"  id='<?php echo Sanitizer::escapeId( $box['id'] ) ?>'<?php echo Linker::tooltip( $box['id'] ) ?>>
-											<a href="#"><?php echo htmlspecialchars( $box['header'] ); ?></a>
-											<?php if ( is_array( $box['content'] ) ) { ?>
-												<ul class="dropdown">
-													<?php foreach ( $box['content'] as $key => $item ) { echo $this->makeListItem( $key, $item ); } ?>
-        								</ul>
-											<?php } } ?>
-									<?php } ?>
-		    		</ul>
-
-		        <ul id="top-bar-right" class="right">
-			      <li class="has-form">
-		        	<form action="<?php $this->text( 'wgScript' ); ?>" id="searchform" class="mw-search">
-		        		<div class="row collapse">
-		            	<div class="small-8 columns">
-		        				<?php echo $this->makeSearchInput(array('placeholder' => wfMessage('searchsuggest-search')->text(), 'id' => 'searchInput') ); ?>
-		        			</div>
-		        			 <div class="small-4 columns">
-		        				<button type="submit" class="button search"><?php echo wfMessage( 'search' )->text() ?></button>
-		        			</div>
-		        		</div>
-		        	</form>
-		        </li>
-		         <li class="divider show-for-small"></li>
-		         <li class="has-form">
-
-								<li class="has-dropdown active"><a href="#"><i class="fa fa-cogs"></i></a>
-									<ul id="toolbox-dropdown" class="dropdown">
-										<?php foreach ( $this->getToolbox() as $key => $item ) { echo $this->makeListItem($key, $item); } ?>
-										<?php if ($wgForegroundFeatures['showRecentChangesUnderTools']): ?><li id="n-recentchanges"><?php echo Linker::specialLink('Recentchanges') ?></li><?php endif; ?>
-										<?php if ($wgForegroundFeatures['showHelpUnderTools']): ?><li id="n-help" <?php echo Linker::tooltip('help') ?>><a href="/wiki/Help:Contents"><?php echo wfMessage( 'help' )->text() ?></a></li><?php endif; ?>
-									</ul>
-								</li>
-
-							<?php if ($wgUser->isLoggedIn()): ?>
-								<li id="personal-tools-dropdown" class="has-dropdown active"><a href="#"><i class="fa fa-user"></i></a>
-									<ul class="dropdown">
-									<?php foreach ( $this->getPersonalTools() as $key => $item ) { echo $this->makeListItem($key, $item); } ?>
-									</ul>
-								</li>
-
-							<?php else: ?>
+			<ul class="title-area">
+				<li class="name">
+					<h1 class="title-name">
+					<a href="<?php echo $this->data['nav_urls']['mainpage']['href']; ?>">
+					<img alt="<?php echo $this->text('sitename'); ?>" src="<?php echo $this->text('logopath') ?>" style="max-width: 64px;height:auto; max-height:36px; display: inline-block; vertical-align:middle;">
+					<div class="title-name" style="display: inline-block;"><?php echo $wgForegroundFeatures['wikiName']; ?></div>
+					</a>
+					</h1>
+				</li>
+				<li class="toggle-topbar menu-icon">
+					<a href="#"><span><?php echo wfMessage( 'foreground-menutitle' )->text(); ?></span></a>
+				</li>
+			</ul>
+
+		<section class="top-bar-section">
+
+			<ul id="top-bar-left" class="left">
+				<li class="divider"></li>
+					<?php foreach ( $this->getSidebar() as $boxName => $box ) { if ( ($box['header'] != wfMessage( 'toolbox' )->text())  ) { ?>
+				<li class="has-dropdown active"  id='<?php echo Sanitizer::escapeId( $box['id'] ) ?>'<?php echo Linker::tooltip( $box['id'] ) ?>>
+					<a href="#"><?php echo htmlspecialchars( $box['header'] ); ?></a>
+						<?php if ( is_array( $box['content'] ) ) { ?>
+							<ul class="dropdown">
+								<?php foreach ( $box['content'] as $key => $item ) { echo $this->makeListItem( $key, $item ); } ?>
+							</ul>
+								<?php } } ?>
+						<?php } ?>
+			</ul>
+
+			<ul id="top-bar-right" class="right">
+				<li class="has-form">
+					<form action="<?php $this->text( 'wgScript' ); ?>" id="searchform" class="mw-search">
+						<div class="row collapse">
+						<div class="small-8 columns">
+							<?php echo $this->makeSearchInput(array('placeholder' => wfMessage('searchsuggest-search')->text(), 'id' => 'searchInput') ); ?>
+						</div>
+						<div class="small-4 columns">
+							<button type="submit" class="button search"><?php echo wfMessage( 'search' )->text() ?></button>
+						</div>
+						</div>
+						</form>
+				</li>
+				<li class="divider show-for-small"></li>
+				<li class="has-form">
+
+				<li class="has-dropdown active"><a href="#"><i class="fa fa-cogs"></i></a>
+					<ul id="toolbox-dropdown" class="dropdown">
+						<?php foreach ( $this->getToolbox() as $key => $item ) { echo $this->makeListItem($key, $item); } ?>
+						<?php if ($wgForegroundFeatures['showRecentChangesUnderTools']): ?><li id="n-recentchanges"><?php echo Linker::specialLink('Recentchanges') ?></li><?php endif; ?>
+						<?php if ($wgForegroundFeatures['showHelpUnderTools']): ?><li id="n-help" <?php echo Linker::tooltip('help') ?>><a href="/wiki/Help:Contents"><?php echo wfMessage( 'help' )->text() ?></a></li><?php endif; ?>
+					</ul>
+				</li>
+
+				<?php if ($wgUser->isLoggedIn()): ?>
+				<li id="personal-tools-dropdown" class="has-dropdown active"><a href="#"><i class="fa fa-user"></i></a>
+					<ul class="dropdown">
+						<?php foreach ( $this->getPersonalTools() as $key => $item ) { echo $this->makeListItem($key, $item); } ?>
+					</ul>
+				</li>
+
+						<?php else: ?>
 							<li>
 								<?php if (isset($this->data['personal_urls']['anonlogin'])): ?>
-									<a href="<?php echo $this->data['personal_urls']['anonlogin']['href']; ?>"><?php echo wfMessage( 'login' )->text() ?></a>
+								<a href="<?php echo $this->data['personal_urls']['anonlogin']['href']; ?>"><?php echo wfMessage( 'login' )->text() ?></a>
 								<?php elseif (isset($this->data['personal_urls']['login'])): ?>
 									<a href="<?php echo htmlspecialchars($this->data['personal_urls']['login']['href']); ?>"><?php echo wfMessage( 'login' )->text() ?></a>
-								<?php else: ?>
-									<?php echo Linker::link(Title::newFromText('Special:UserLogin'), wfMessage( 'login' )->text()); ?>
-								<?php endif; ?>
+									<?php else: ?>
+										<?php echo Linker::link(Title::newFromText('Special:UserLogin'), wfMessage( 'login' )->text()); ?>
+									<?php endif; ?>
 							</li>
 
-							<?php endif; ?>
+				<?php endif; ?>
 
-		       </ul>
-		     </section>
+			</ul>
+		</section>
 		</nav>
 		<?php if ($wgForegroundFeatures['NavWrapperType'] != '0') echo "</div>"; ?>
 		
@@ -210,4 +220,4 @@ class foregroundTemplate extends BaseTemplate {
 		wfRestoreWarnings();
 	}
 }
-?>
+?>