Lewis Cawte has uploaded a new change for review. https://gerrit.wikimedia.org/r/155905
Change subject: Some cleanup to Daddio skin. ...................................................................... Some cleanup to Daddio skin. Basic resourceloader support, fix Modern include to work with recent pathing. Also rename class file to meet the precedent set by other third-party skins of having the templates at Skinname.skin.php. Change-Id: I68e6bdbb249bb5b7b572d344099b03e1419f941e --- M Daddio.php R Daddio.skin.php 2 files changed, 20 insertions(+), 21 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/skins/Daddio refs/changes/05/155905/1 diff --git a/Daddio.php b/Daddio.php index adcce67..d9446b8 100644 --- a/Daddio.php +++ b/Daddio.php @@ -22,5 +22,14 @@ ); $wgValidSkinNames['daddio'] = 'Daddio'; -$wgAutoloadClasses['SkinDaddio'] = dirname( __FILE__ ) . "/Daddio.class.php"; -$wgMessagesDirs['SkinDaddio'] = __DIR__ . '/i18n'; \ No newline at end of file +$wgAutoloadClasses['SkinDaddio'] = __DIR__ . "/Daddio.skin.php"; +$wgMessagesDirs['SkinDaddio'] = __DIR__ . '/i18n'; + +$wgResourceModules['skins.daddio'] = array( + 'styles' => array( + 'daddio/main.css' => array( 'media' => 'screen' ), + 'daddio/print.css' => array( 'media' => 'print' ) +// 'daddio/rtl.css', 'screen', '', 'rtl' ); + ), + 'localBasePath' => __DIR__, +); diff --git a/Daddio.class.php b/Daddio.skin.php similarity index 86% rename from Daddio.class.php rename to Daddio.skin.php index 35757e0..a930ae2 100644 --- a/Daddio.class.php +++ b/Daddio.skin.php @@ -10,7 +10,7 @@ global $IP; // @todo Fixme: autoload ModernTemplate -require_once( "$IP/skins/Modern.php" ); +require_once( "$IP/skins/Modern/Modern.php" ); /** * Inherit main code from SkinTemplate, set the CSS and template filter. @@ -18,19 +18,11 @@ * @ingroup Skins */ class SkinDaddio extends SkinTemplate { - var $skinname = 'daddio', $stylename = 'daddio', + public $skinname = 'daddio', $stylename = 'daddio', $template = 'DaddioTemplate', $useHeadElement = true; function setupSkinUserCss( OutputPage $out ){ - global $wgScriptPath; - - $path = "{$wgScriptPath}/skins/Daddio"; - - // Do not call parent::setupSkinUserCss(), we have our own print style - $out->addStyle( 'common/shared.css', 'screen' ); - $out->addStyle( "$path/daddio/main.css", 'screen' ); - $out->addStyle( "$path/daddio/print.css", 'print' ); - $out->addStyle( "$path/daddio/rtl.css", 'screen', '', 'rtl' ); + $out->addModules( 'skin.daddio' ); } } @@ -40,6 +32,8 @@ * @ingroup Skins */ class DaddioTemplate extends ModernTemplate { + public $skin; + /** * Template filter callback for Daddio skin. * Takes an associative array of data set from a SkinTemplate-based @@ -50,9 +44,6 @@ */ function execute() { $this->skin = $skin = $this->data['skin']; - - // Suppress warnings to prevent notices about missing indexes in $this->data - wfSuppressWarnings(); $this->html( 'headelement' ); @@ -63,13 +54,13 @@ <div id="mw_contentwrapper"> <!-- navigation portlet --> <div class="portlet" id="p-cactions"> - <h5><?php $this->msg('views') ?></h5> + <h5><?php $this->msg('views') ?></h5> <div class="pBody"> <ul> <?php foreach($this->data['content_actions'] as $key => $tab) { ?> <li id="ca-<?php echo Sanitizer::escapeId($key) ?>"<?php if($tab['class']) { ?> class="<?php echo htmlspecialchars($tab['class']) ?>"<?php } - ?>><a href="<?php echo htmlspecialchars($tab['href']) ?>"<?php echo $skin->tooltipAndAccesskey('ca-'.$key) ?>><?php + ?>><a href="<?php echo htmlspecialchars($tab['href']) ?>"<?php echo $skin->tooltipAndAccesskeyAttribs('ca-'.$key) ?>><?php echo htmlspecialchars($tab['text']) ?></a></li> <?php } ?> </ul> @@ -109,7 +100,7 @@ <div id="mw_portlets"> <?php - $sidebar = $this->data['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; @@ -142,7 +133,7 @@ <?php foreach($this->data['personal_urls'] as $key => $item) { ?> <li id="pt-<?php echo Sanitizer::escapeId($key) ?>"<?php if ($item['active']) { ?> class="active"<?php } ?>><a href="<?php - echo htmlspecialchars($item['href']) ?>"<?php echo $skin->tooltipAndAccesskey('pt-'.$key) ?><?php + echo htmlspecialchars($item['href']) ?>"<?php echo $skin->tooltipAndAccesskeyAttribs('pt-'.$key) ?><?php if(!empty($item['class'])) { ?> class="<?php echo htmlspecialchars($item['class']) ?>"<?php } ?>><?php echo htmlspecialchars($item['text']) ?></a></li> @@ -181,7 +172,6 @@ </div> <!-- bottom of page --> </body></html> <?php - wfRestoreWarnings(); } // end of execute() method } // end of class -- To view, visit https://gerrit.wikimedia.org/r/155905 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I68e6bdbb249bb5b7b572d344099b03e1419f941e Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/skins/Daddio Gerrit-Branch: master Gerrit-Owner: Lewis Cawte <le...@lewiscawte.me> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits