Skip to content
This repository has been archived by the owner on Jun 6, 2022. It is now read-only.

Commit

Permalink
Merge pull request #20 from JuliusTZM/master
Browse files Browse the repository at this point in the history
Updated version of Cavendish skin to MV 1.27
  • Loading branch information
DaSchTour authored Oct 21, 2016
2 parents af11cfa + d5b223a commit 38814fa
Show file tree
Hide file tree
Showing 51 changed files with 3,087 additions and 2,459 deletions.
339 changes: 339 additions & 0 deletions COPYING

Large diffs are not rendered by default.

48 changes: 11 additions & 37 deletions Cavendish.php
Original file line number Diff line number Diff line change
@@ -1,40 +1,14 @@
<?php
/**
* Mozilla cavendish theme
* Modified by DaSch for MW 1.19 and WeCoWi
*
* Loosely based on the cavendish style by Gabriel Wicke
*
* @todo document
* @package MediaWiki
* @subpackage Skins
*/


if ( !defined( 'MEDIAWIKI' ) ) {
die( 'This is an extension to the MediaWiki package and cannot be run standalone.' );
if ( function_exists( 'wfLoadSkin' ) ) {
wfLoadSkin( 'Cavendish' );
// Keep i18n globals so mergeMessageFileList.php doesn't break
$wgMessagesDirs['Modern'] = __DIR__ . '/i18n';
/* wfWarn(
'Deprecated PHP entry point used for Modern skin. Please use wfLoadSkin instead, ' .
'see https://www.mediawiki.org/wiki/Extension_registration for more details.'
); */
return true;
} else {
die( 'This version of the Modern skin requires MediaWiki 1.25+' );
}

$wgExtensionCredits['skin'][] = array(
'path' => __FILE__,
'name' => 'Cavendish', // name as shown under [[Special:Version]]
'namemsg' => 'cavendish', // used since MW 1.24, see the section on "Localisation messages" below
'version' => '2.3.4',
'url' => 'https://www.mediawiki.org/wiki/Skin:Cavendish',
'author' => '[https://mediawiki.org/wiki/User:DaSch DaSch]',
'descriptionmsg' => 'cavendish-desc', // see the section on "Localisation messages" below
'license' => 'GPL-2.0+',
);

$wgValidSkinNames['cavendish'] = 'Cavendish';
$wgAutoloadClasses['SkinCavendish'] = dirname(__FILE__).'/Cavendish.skin.php';
$wgExtensionMessagesFiles['Cavendish'] = dirname(__FILE__).'/Cavendish.i18n.php';

$wgResourceModules['skins.cavendish'] = array(
'styles' => array(
'Cavendish/cavendish/print.css' => array( 'media' => 'print' ),
'Cavendish/cavendish/cavendish.css' => array( 'media' => 'screen' ),
),
'remoteBasePath' => &$GLOBALS['wgStylePath'],
'localBasePath' => &$GLOBALS['wgStyleDirectory'],
);
20 changes: 20 additions & 0 deletions Gruntfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/*jshint node:true */
module.exports = function ( grunt ) {
grunt.loadNpmTasks( 'grunt-banana-checker' );
grunt.loadNpmTasks( 'grunt-jsonlint' );

grunt.initConfig( {
banana: {
all: 'i18n/'
},
jsonlint: {
all: [
'**/*.json',
'!node_modules/**'
]
}
} );

grunt.registerTask( 'test', [ 'jsonlint', 'banana' ] );
grunt.registerTask( 'default', 'test' );
};
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Cavendish
Cavendish MediaWiki Skin

This version of the skin is compatible with MW 1.27
228 changes: 228 additions & 0 deletions SkinCavendish.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,228 @@
<?php
class SkinCavendish extends SkinTemplate {
/** Using cavendish. */

var $skinname = 'cavendish', $stylename = 'cavendish',
$template = 'CavendishTemplate', $useHeadElement = true;

/**
* @param $out OutputPage object
*/
function setupSkinUserCss( OutputPage $out ) {
global $wgHandheldStyle, $wgStyleVersion, $wgJsMimeType, $wgStylePath, $wgVersion, $wgLogo;
parent::setupSkinUserCss( $out );
$out->addModuleStyles( "skins.cavendish" );
if( $wgHandheldStyle ) {
// Currently in testing... try 'chick/main.css'
$out->addStyle( $wgHandheldStyle, 'handheld' );
}
$out->addStyle( 'Cavendish/resources/IE60Fixes.css', 'screen', 'IE 6' );
$out->addStyle( 'Cavendish/resources/IE70Fixes.css', 'screen', 'IE 7' );

$out->addStyle( 'Cavendish/resources/rtl.css', 'screen', '', 'rtl' );

/* README for details */
include('resources/config.php');

$out->addStyle( 'Cavendish/resources/colors/'. $cavendishColor .'.css', 'screen' );

if ($cavendishExtensionCSS) {
$out->addStyle( 'Cavendish/resources/extensions.css', 'screen' );
}
$out->addStyle( 'Cavendish/resources/style.php', 'screen' );
}

}

class CavendishTemplate extends MonoBookTemplate {
var $skin;
/**
* Template filter callback for cavendish skin.
* Takes an associative array of data set from a SkinTemplate-based
* class, and a wrapper for MediaWiki's localization database, and
* outputs a formatted page.
*
* @access private
*/
function execute() {
global $wgRequest, $wgLang;
include('resources/config.php');
$QRURL = htmlentities( $this->getSkin()->getTitle()->getFullURL()).$cavendishQRurladd;
$styleversion = '2.3.5';
$this->skin = $skin = $this->data['skin'];
$action = $wgRequest->getText( 'action' );
if ( $action == "") {
$action = "view";
}
// Suppress warnings to prevent notices about missing indexes in $this->data
wfSuppressWarnings();
// HTML starts here
$this->html( 'headelement' );
?>
<div id="internal"></div>
<!-- Skin-Version: <?php echo $styleversion ?> //Please leave this for bugtracking purpose//-->
<div id="globalWrapper" class="<?php echo $action ?>">
<div id="p-personal" class="portlet">
<h5><?php $this->msg('personaltools') ?></h5>
<div class="pBody">
<ul <?php $this->html('userlangattributes') ?>>
<?php foreach($this->data['personal_urls'] as $key => $item) {?>

<li id="<?php echo Sanitizer::escapeId( "pt-$key" ) ?>" class="<?php
if ($item['active']) { ?>active <?php } ?>top-nav-element">
<span class="top-nav-left">&nbsp;</span>
<a class="top-nav-mid <?php echo htmlspecialchars($item['class']) ?>"
href="<?php echo htmlspecialchars($item['href']) ?>">
<?php echo htmlspecialchars($item['text']) ?></a>
<span class="top-nav-right">&nbsp;</span></li>
<?php
} ?>

</ul>
</div>
</div>
<div id="header">
<a name="top" id="contentTop"></a>
<h6>
<a
href="<?php echo htmlspecialchars($this->data['nav_urls']['mainpage']['href'])?>"
title="<?php $this->msg('mainpage') ?>"><?php $this->text('pagetitle') ?></a></h6>
<div id="p-cactions" class="portlet"><ul>
<?php foreach($this->data['content_actions'] as $key => $tab) {
echo '
<li id="' . Sanitizer::escapeId( "ca-$key" ) . '"';
if( $tab['class'] ) {
echo ' class="'.htmlspecialchars($tab['class']).'"';
}
echo '><a href="'.htmlspecialchars($tab['href']).'"';
# We don't want to give the watch tab an accesskey if the
# page is being edited, because that conflicts with the
# accesskey on the watch checkbox. We also don't want to
# give the edit tab an accesskey, because that's fairly su-
# perfluous and conflicts with an accesskey (Ctrl-E) often
# used for editing in Safari.
if( in_array( $action, array( 'edit', 'submit' ) ) && in_array( $key, array( 'edit', 'watch', 'unwatch' ) ) ) {
echo Linker::tooltip( 'ca-'.$key );
}
else {
echo Linker::tooltip( 'ca-'.$key );
}
echo '>'.htmlspecialchars($tab['text']).'</a></li>';
}
?>
</ul></div>
<?php
// TODO Searchbox Handling
$this->searchBox(); ?>
</div>
<div id="mBody">
<div id="side">
<div id="nav">
<?php //sidebar
$sidebar = $this->data['sidebar'];
if ( !isset( $sidebar['SEARCH'] ) ) $sidebar['SEARCH'] = true;
if ( !isset( $sidebar['TOOLBOX'] ) ) $sidebar['TOOLBOX'] = true;
if ( !isset( $sidebar['LANGUAGES'] ) ) $sidebar['LANGUAGES'] = true;
foreach ($sidebar as $boxName => $cont) {
// TODO Searchbox Handling
if ( $boxName == 'SEARCH' ) {
// $this->searchBox();
} elseif ( $boxName == 'TOOLBOX' ) {
$this->toolbox();
} elseif ( $boxName == 'LANGUAGES' ) {
$this->languageBox();
} else {
$this->customBox( $boxName, $cont );
}
}
?>
</div>
</div>
</div><!-- end of SIDE div -->
<div id="column-content">
<div id="content">
<a id="top"></a>
<?php if($this->data['sitenotice']) { ?><div id="siteNotice"><?php $this->html('sitenotice') ?></div><?php } ?>
<h1 id="firstHeading" class="firstHeading"><?php $this->html('title') ?></h1>
<div id="bodyContent">
<h3 id="siteSub"><?php $this->msg('tagline') ?></h3>
<div id="contentSub"><?php $this->html('subtitle') ?></div>
<?php if($this->data['undelete']) { ?><div id="contentSub2"><?php $this->html('undelete') ?></div><?php } ?>
<?php if($this->data['newtalk'] ) { ?><div class="usermessage"><?php $this->html('newtalk') ?></div><?php } ?>
<?php if($this->data['showjumplinks']) { ?><div id="jump-to-nav"><?php $this->msg('jumpto') ?> <a href="#column-one"><?php $this->msg('jumptonavigation') ?></a>, <a href="#searchInput"><?php $this->msg('jumptosearch') ?></a></div><?php } ?>
<!-- start content -->
<?php $this->html('bodytext') ?>
<?php if($this->data['catlinks']) { $this->html('catlinks'); } ?>
<!-- end content -->
<?php if($this->data['dataAfterContent']) { $this->html ('dataAfterContent'); } ?>
</div>
</div><!-- end of MAINCONTENT div -->
</div>
</div><!-- end of MBODY div -->
<div class="visualClear"></div>
<div id="footer">
<table>
<tr>
<td rowspan="2" class="f-iconsection">
<?php //copytight icon
if($this->data['copyrightico']) { ?><div id="f-copyrightico"><?php $this->html('copyrightico') ?></div><?php } ?>
</td>
<td align="center">
<?php // Generate additional footer links
$footerlinks = array(
'lastmod', 'viewcount', 'numberofwatchingusers', 'credits', 'copyright',
'privacy', 'about', 'disclaimer', 'tagline',
);
$validFooterLinks = array();
foreach( $footerlinks as $aLink ) {
if( isset( $this->data[$aLink] ) && $this->data[$aLink] ) {
$validFooterLinks[] = $aLink;
}
}
if ( count( $validFooterLinks ) > 0 ) {
?> <ul id="f-list">
<?php
foreach( $validFooterLinks as $aLink ) {
if( isset( $this->data[$aLink] ) && $this->data[$aLink] ) {
?> <li id="f-<?php echo$aLink?>"><?php $this->html($aLink) ?></li>
<?php }
}
}
?></ul></td>
<td rowspan="2" class="f-iconsection">
<?php
$validFooterIcons = $this->getFooterIcons( "nocopyright" );
foreach ( $validFooterIcons as $blockName => $footerIcons ) { ?>
<div id="f-<?php echo htmlspecialchars($blockName); ?>ico"><?php
foreach ( $footerIcons as $icon ) {
echo $this->skin->makeFooterIcon( $icon );
}
}
?></div>
<?php
// QR-Code added on option
if ($cavendishQRCode) { ?>
<div id="qrcode">
<a href="http://goqr.me/" style="border:0 none;cursor:default;text-decoration:none;"><img src="http://api.qrserver.com/v1/create-qr-code/?data=<?php echo $QRURL; ?>&#38;size=160x160" height=80 width=80 alt="QR Code generator" title="" /></a>
</div>
<?php } ?>
</td>
</tr>
<tr>
<td><div id="skin-info">
Mozilla Cavendish Theme based on Cavendish style by Gabriel Wicke modified by <a href="http://www.dasch-tour.de" title="DaSch-Tour Blog" target="_blank">DaSch</a> for the <a href="http://www.wecowi.de/" title="Web Community Wiki">Web Community Wiki</a><br/>
<a href="https:/DaSchTour/Cavendish" title="github projectpage">github Projectpage</a> &ndash; <a href="https:/DaSchTour/Cavendish/issues" title="Bug reporting at github">Report Bug</a> &ndash; Skin-Version: <?php echo $styleversion ?>
</div></td>
</tr>
</table>
</div><!-- end of the FOOTER div -->
</div><!-- end of the CONTAINER div -->
<!-- scripts and debugging information -->
<?php

$this->printTrail();
echo Html::closeElement( 'body' );
echo Html::closeElement( 'html' );
wfRestoreWarnings();
}
} // end of class
10 changes: 10 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"require-dev": {
"jakub-onderka/php-parallel-lint": "0.9"
},
"scripts": {
"test": [
"parallel-lint . --exclude node_modules --exclude vendor"
]
}
}
9 changes: 9 additions & 0 deletions i18n/en.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"@metadata": {
"authors": ["DaSch"]
},
"cavendish.css": "/* CSS placed here will affect users of the Modern skin */",
"cavendish.js": "/* Any JavaScript here will be loaded for users using the Cavendish skin */",
"skinname-cavendish": "Cavendish",
"cavendish-desc": "Mozilla cavendish theme. Modified by DaSch for MW 1.19 and WeCoWi. Loosely based on the cavendish style by Gabriel Wicke."
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit 38814fa

Please sign in to comment.