jenkins-bot has submitted this change and it was merged. Change subject: Some cleanup of Daddio skin. ......................................................................
Some cleanup of Daddio skin. Various improvements, or at least I hope this is an improvement over the status quo. Untested, but mostly based on MonoBook, so it should work(TM). Change-Id: I12baef6296779fe1c1d222d173cc0095948a2e4d --- M Daddio.php M Daddio.skin.php 2 files changed, 99 insertions(+), 76 deletions(-) Approvals: Isarra: Looks good to me, approved jenkins-bot: Verified diff --git a/Daddio.php b/Daddio.php index d9446b8..914ba92 100644 --- a/Daddio.php +++ b/Daddio.php @@ -16,20 +16,28 @@ $wgExtensionCredits['skin'][] = array( 'path' => __FILE__, 'name' => 'Daddio', + // @todo FIXME: add a meaningful version number 'author' => array( 'Rufus Post', 'Aaron Schulz' ), 'description-msg' => 'daddio-desc', 'url' => 'https://www.mediawiki.org/wiki/Skin:Daddio', ); $wgValidSkinNames['daddio'] = 'Daddio'; -$wgAutoloadClasses['SkinDaddio'] = __DIR__ . "/Daddio.skin.php"; +// *cough cough* assumptions... +if ( !isset( $wgAutoloadClasses['ModernTemplate'] ) ) { + $wgAutoloadClasses['ModernTemplate'] = __DIR__ . '/../Modern/SkinModern.php'; +} +$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' ); + // @Lcawte: this probably isn't the most kosher way to do this, but it's + // how most/all ShoutWiki skins do it and it works for our setup at + // least. Feel free to improve it :D + 'skins/Daddio/daddio/main.css' => array( 'media' => 'screen' ), + 'skins/Daddio/daddio/print.css' => array( 'media' => 'print' ) ), - 'localBasePath' => __DIR__, + 'position' => 'top', + //'localBasePath' => __DIR__, ); diff --git a/Daddio.skin.php b/Daddio.skin.php index a930ae2..e9921dd 100644 --- a/Daddio.skin.php +++ b/Daddio.skin.php @@ -3,28 +3,25 @@ * Daddio skin. Skin for getting work done. * Based on Modern, modified by Rufus Post, Aaron Schulz * + * @file */ -if( !defined( 'MEDIAWIKI' ) ) +if ( !defined( 'MEDIAWIKI' ) ) { die( -1 ); - -global $IP; -// @todo Fixme: autoload ModernTemplate -require_once( "$IP/skins/Modern/Modern.php" ); +} /** * Inherit main code from SkinTemplate, set the CSS and template filter. - * @todo document + * * @ingroup Skins */ class SkinDaddio extends SkinTemplate { public $skinname = 'daddio', $stylename = 'daddio', $template = 'DaddioTemplate', $useHeadElement = true; - function setupSkinUserCss( OutputPage $out ){ - $out->addModules( 'skin.daddio' ); + function setupSkinUserCss( OutputPage $out ) { + $out->addModuleStyles( 'skin.daddio' ); } - } /** @@ -39,14 +36,13 @@ * 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() { - $this->skin = $skin = $this->data['skin']; + public function execute() { + $this->skin = $this->data['skin']; + + $this->data['pageLanguage'] = $this->skin->getTitle()->getPageViewLanguage()->getHtmlCode(); $this->html( 'headelement' ); - ?> <!-- heading --> @@ -54,15 +50,14 @@ <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->tooltipAndAccesskeyAttribs('ca-'.$key) ?>><?php - echo htmlspecialchars($tab['text']) ?></a></li> - <?php } ?> + <?php + foreach ( $this->data['content_actions'] as $key => $tab ) { + echo $this->makeListItem( $key, $tab ); + } + ?> </ul> </div> </div> @@ -73,39 +68,45 @@ the content area without affecting the meaning of 'em' in #mw_content, which is used for the margins --> <div id="mw_contentholder"> - <div class='mw-topboxes'> + <div class="mw-topboxes"> <div id="mw-js-message" style="display:none;"></div> - <div class="mw-topbox" id="siteSub"><?php $this->msg('tagline') ?></div> - <?php if($this->data['newtalk'] ) { - ?><div class="usermessage mw-topbox"><?php $this->html('newtalk') ?></div> + <div class="mw-topbox" id="siteSub"><?php $this->msg( 'tagline' ) ?></div> + <?php if ( $this->data['newtalk'] ) { + ?><div class="usermessage mw-topbox"><?php $this->html( 'newtalk' ) ?></div> <?php } ?> - <?php if($this->data['sitenotice']) { - ?><div class="mw-topbox" id="siteNotice"><?php $this->html('sitenotice') ?></div> + <?php if ( $this->data['sitenotice'] ) { + ?><div class="mw-topbox" id="siteNotice"><?php $this->html( 'sitenotice' ) ?></div> <?php } ?> </div> - <div id="mw_header"><h1 id="firstHeading"><?php $this->data['displaytitle']!=""?$this->html('title'):$this->text('title') ?></h1></div> - <div id="contentSub"><?php $this->html('subtitle') ?></div> + <div id="mw_header"><h1 id="firstHeading" class="firstHeading" lang="<?php $this->text( 'pageLanguage' ); ?>"><span dir="auto"><?php $this->html( 'title' ) ?></span></h1></div> + <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['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 } ?> + <?php if ( $this->data['undelete'] ) { ?><div id="contentSub2"><?php $this->html( 'undelete' ) ?></div><?php } ?> + <div id="jump-to-nav" class="mw-jump"><?php $this->msg( 'jumpto' ) ?> <a href="#column-one"><?php $this->msg( 'jumptonavigation' ) ?></a>, <a href="#searchInput"><?php $this->msg( 'jumptosearch' ) ?></a></div> - <?php $this->html('bodytext') ?> - <div class='mw_clear'></div> - <?php if($this->data['catlinks']) { $this->html('catlinks'); } ?> - <?php $this->html('dataAfterContent') ?> + <?php $this->html( 'bodytext' ) ?> + <div class="mw_clear"></div> + <?php if ( $this->data['catlinks'] ) { $this->html( 'catlinks' ); } ?> + <?php $this->html( 'dataAfterContent' ) ?> </div><!-- mw_contentholder --> </div><!-- mw_content --> </div><!-- mw_contentwrapper --> <div id="mw_portlets"> - <?php + <?php $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; + 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) { + foreach ( $sidebar as $boxName => $cont ) { if ( $boxName == 'SEARCH' ) { $this->searchBox(); } elseif ( $boxName == 'TOOLBOX' ) { @@ -127,49 +128,63 @@ <!-- personal portlet --> <div class="portlet_top" id="p-personal"> - <h5><?php $this->msg('personaltools') ?></h5> + <h5><?php $this->msg( 'personaltools' ) ?></h5> <div class="pBody"> - <ul> -<?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->tooltipAndAccesskeyAttribs('pt-'.$key) ?><?php - if(!empty($item['class'])) { ?> class="<?php - echo htmlspecialchars($item['class']) ?>"<?php } ?>><?php - echo htmlspecialchars($item['text']) ?></a></li> -<?php } ?> + <ul<?php $this->html( 'userlangattributes' ) ?>> + <?php + foreach ( $this->getPersonalTools() as $key => $item ) { + echo $this->makeListItem( $key, $item ); + } + ?> </ul> </div> </div> - <!-- bottom of page --> + <!-- bottom of page --> <div id="mw_bottom"> - <!-- footer --> - <div id="footer"> - <ul id="f-list"> + <?php + // Mostly stol--I mean nationalized from MonoBook + $validFooterIcons = $this->getFooterIcons( 'icononly' ); + $validFooterLinks = $this->getFooterLinks( 'flat' ); // Additional footer links + + if ( count( $validFooterIcons ) + count( $validFooterLinks ) > 0 ) { ?> +<!-- footer --> +<div id="footer" role="contentinfo"<?php $this->html( 'userlangattributes' ) ?>> <?php - $footerlinks = array( - 'lastmod', 'viewcount', 'numberofwatchingusers', 'credits', 'copyright', - 'privacy', 'about', 'disclaimer', 'tagline', - ); - foreach( $footerlinks as $aLink ) { - if( isset( $this->data[$aLink] ) && $this->data[$aLink] ) { -?> <li id="<?php echo$aLink?>"><?php $this->html($aLink) ?></li> -<?php } + $footerEnd = '</div>'; + } else { + $footerEnd = ''; + } + // @todo FIXME/CHECKME: do these belong here or not? + // I don't think the original version had these, so if they break stuff, feel + // free to remove 'em + foreach ( $validFooterIcons as $blockName => $footerIcons ) { ?> + <div id="f-<?php echo htmlspecialchars( $blockName ); ?>ico"> +<?php + foreach ( $footerIcons as $icon ) { + echo $this->skin->makeFooterIcon( $icon ); } ?> - </ul> </div> +<?php } - <?php $this->html('bottomscripts'); /* JS call to runBodyOnloadHook */ ?> -<?php $this->html('reporttime') ?> -<?php if ( $this->data['debug'] ): ?> -<!-- Debug output: -<?php $this->text( 'debug' ); ?> ---> -<?php endif; ?> -</div> <!-- bottom of page --> + if ( count( $validFooterLinks ) > 0 ) { +?> <ul id="f-list"> +<?php + foreach ( $validFooterLinks as $aLink ) { ?> + <li id="<?php echo $aLink ?>"><?php $this->html( $aLink ) ?></li> +<?php + } +?> + </ul> +<?php } +echo $footerEnd; + + // Call ResourceLoader to output bottom scripts (mostly JS) and whatnot + $this->printTrail(); +?> +</div> <!-- bottom of page --> </body></html> <?php } // end of execute() method -- To view, visit https://gerrit.wikimedia.org/r/155906 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I12baef6296779fe1c1d222d173cc0095948a2e4d Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/skins/Daddio Gerrit-Branch: master Gerrit-Owner: Lewis Cawte <le...@lewiscawte.me> Gerrit-Reviewer: Isarra <zhoris...@gmail.com> Gerrit-Reviewer: Jack Phoenix <j...@countervandalism.net> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits