浏览代码

Make skin configurable (show page actions for anonymous; make menu fixed - if you want).

ardiman 11 年之前
父节点
当前提交
6f1f39adf2
共有 2 个文件被更改,包括 28 次插入2 次删除
  1. 14 2
      Foreground.skin.php
  2. 14 0
      README.md

+ 14 - 2
Foreground.skin.php

@@ -6,6 +6,7 @@
  * @file
  * @ingroup Skins
  */
+ 
 
 class Skinforeground extends SkinTemplate {
 	public $skinname = 'foreground', $stylename = 'foreground', $template = 'foregroundTemplate', $useHeadElement = true;
@@ -30,8 +31,19 @@ class Skinforeground extends SkinTemplate {
 class foregroundTemplate extends BaseTemplate {
 	public function execute() {
 		global $wgUser;
+		global $wgForegroundFeatures;
 		wfSuppressWarnings();
 		$this->html('headelement');
+		$wgForegroundFeaturesDefaults = array(
+			'showActionsForAnon' => true,
+			'makeNavFixed' => false,
+		);
+		foreach ($wgForegroundFeaturesDefaults as $fgOption => $fgOptionValue) {
+			if ( !isset($wgForegroundFeatures[$fgOption]) ) {
+				$wgForegroundFeatures[$fgOption] = $fgOptionValue;
+			}
+		}
+		if ($wgForegroundFeatures['makeNavFixed']) echo "<div class='fixed'>";
 ?>
 <!-- START FOREGROUNDTEMPLATE -->
 		<nav class="top-bar">
@@ -103,7 +115,7 @@ class foregroundTemplate extends BaseTemplate {
 		       </ul>
 		     </section>
 		</nav>
-
+		<?php if ($wgForegroundFeatures['makeNavFixed']) echo "</div>"; ?>
 		<div class="row">
 				<div class="large-12 columns">
 				<!--[if lt IE 9]>
@@ -119,7 +131,7 @@ class foregroundTemplate extends BaseTemplate {
 
 		<div class="row">
 				<div id="p-cactions" class="large-12 columns">
-					<?php if ($wgUser->isLoggedIn()): ?>
+					<?php if ($wgUser->isLoggedIn() || $wgForegroundFeatures['showActionsForAnon']): ?>
 						<a href="#" data-dropdown="drop1" class="button dropdown small secondary radius"><i class="icon-cog"><span class="show-for-medium-up">&nbsp;<?php echo wfMessage( 'actions' )->text() ?></span></i></a>
 						<ul id="drop1" class="views large-12 columns f-dropdown">
 							<?php foreach( $this->data['content_actions'] as $key => $item ) { echo $this->makeListItem($key, $item); } ?>

+ 14 - 0
README.md

@@ -28,6 +28,20 @@ To activate Foreground for all users and anonymous visitors, you need to set the
 
     $wgDefaultSkin = "foreground";
 
+## Configuration
+
+Use following features in `LocalSettings.php` to change the behavior. 
+
+- `showActionsForAnon => true` displays page actions for non-logged-in visitors.
+- `makeNavFixed => true` menu will be fixed on top. 
+
+These are the default values:
+
+    $wgForegroundFeatures = array(
+      'showActionsForAnon' => true,
+      'makeNavFixed' => false,
+    );
+
 ### Notes on other skins
 
 As you build a wiki out with Foreground you will likely use the responsive grid from Foundation. This is key to making a responsive wiki, and is one of the largest _migration_ requirements when you want to move a wiki that ppreviously used Vector (and likely a lot of tables for layout) to Foreground. Once you do this, the ability of a user to select whatever skin will be removed. If you take full advantage of Foreground in your templates the lack of the Foundation grid will make viewing the wiki using [Vector](http://wikiapiary.com/wiki/Skin:Vector) or [MonoBook](http://wikiapiary.com/wiki/Skin:MonoBook) very difficult.