[MediaWiki-commits] [Gerrit] Some cleanup of Daddio skin. - change (mediawiki...Daddio)

2014-08-23 Thread Lewis Cawte (Code Review)
Lewis Cawte has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/155906

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(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/skins/Daddio 
refs/changes/06/155906/1

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

[MediaWiki-commits] [Gerrit] Some cleanup to Daddio skin. - change (mediawiki...Daddio)

2014-08-23 Thread Lewis Cawte (Code Review)
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 

[MediaWiki-commits] [Gerrit] Some cleanup of Daddio skin. - change (mediawiki...Daddio)

2014-08-23 Thread jenkins-bot (Code Review)
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 

[MediaWiki-commits] [Gerrit] Some cleanup to Daddio skin. - change (mediawiki...Daddio)

2014-08-23 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change and it was merged.

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(-)

Approvals:
  Legoktm: Looks good to me, approved
  jenkins-bot: Verified



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