Merge changes I4ac3bc14,I470acb8b
authorDemon <chadh@wikimedia.org>
Sun, 11 Nov 2012 19:16:38 +0000 (19:16 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Sun, 11 Nov 2012 19:16:38 +0000 (19:16 +0000)
* changes:
  make addPortletLink work with CologneBlue
  (bug 18338) WAI-ARIA landmark roles in most used skins

1  2 
resources/mediawiki/mediawiki.util.js
skins/Vector.php

@@@ -62,8 -62,7 +62,8 @@@
  
                        /* Fill $content var */
                        util.$content = ( function () {
 -                              var $content, selectors = [
 +                              var i, l, $content, selectors;
 +                              selectors = [
                                        // The preferred standard for setting $content (class="mw-body")
                                        // You may also use (class="mw-body mw-body-primary") if you use
                                        // mw-body in multiple locations.
@@@ -95,7 -94,7 +95,7 @@@
                                        // not inserted bodytext yet. But in any case <body> should always exist
                                        'body'
                                ];
 -                              for ( var i = 0, l = selectors.length; i < l; i++ ) {
 +                              for ( i = 0, l = selectors.length; i < l; i++ ) {
                                        $content = $( selectors[i] ).first();
                                        if ( $content.length ) {
                                                return $content;
                        // just add it to the bottom of their 'sidebar' element as a fallback
                        switch ( mw.config.get( 'skin' ) ) {
                        case 'standard':
-                       case 'cologneblue':
                                $( '#quickbar' ).append( $link.after( '<br/>' ) );
                                return $link[0];
                        case 'nostalgia':
                 * is determined by validation.
                 */
                validateEmail: function ( mailtxt ) {
 -                      var rfc5322_atext, rfc1034_ldh_str, HTML5_email_regexp;
 +                      var rfc5322Atext, rfc1034LdhStr, html5EmailRegexp;
  
                        if ( mailtxt === '' ) {
                                return null;
                                                 "|" / "}" /
                                                 "~"
                        */
 -                      rfc5322_atext = "a-z0-9!#$%&'*+\\-/=?^_`{|}~";
 +                      rfc5322Atext = 'a-z0-9!#$%&\'*+\\-/=?^_`{|}~';
  
                        /**
                         * Next define the RFC 1034 'ldh-str'
                         *      <let-dig-hyp> ::= <let-dig> | "-"
                         *      <let-dig> ::= <letter> | <digit>
                         */
 -                      rfc1034_ldh_str = "a-z0-9\\-";
 +                      rfc1034LdhStr = 'a-z0-9\\-';
  
 -                      HTML5_email_regexp = new RegExp(
 +                      html5EmailRegexp = new RegExp(
                                // start of string
                                '^'
                                +
                                // User part which is liberal :p
 -                              '[' + rfc5322_atext + '\\.]+'
 +                              '[' + rfc5322Atext + '\\.]+'
                                +
                                // 'at'
                                '@'
                                +
                                // Domain first part
 -                              '[' + rfc1034_ldh_str + ']+'
 +                              '[' + rfc1034LdhStr + ']+'
                                +
                                // Optional second part and following are separated by a dot
 -                              '(?:\\.[' + rfc1034_ldh_str + ']+)*'
 +                              '(?:\\.[' + rfc1034LdhStr + ']+)*'
                                +
                                // End of string
                                '$',
                                // RegExp is case insensitive
                                'i'
                        );
 -                      return (null !== mailtxt.match( HTML5_email_regexp ) );
 +                      return (null !== mailtxt.match( html5EmailRegexp ) );
                },
  
                /**
diff --combined skins/Vector.php
@@@ -156,7 -156,7 +156,7 @@@ class VectorTemplate extends BaseTempla
                <div id="mw-page-base" class="noprint"></div>
                <div id="mw-head-base" class="noprint"></div>
                <!-- content -->
-               <div id="content" class="mw-body">
+               <div id="content" class="mw-body" role="main">
                        <a id="top"></a>
                        <div id="mw-js-message" style="display:none;"<?php $this->html( 'userlangattributes' ) ?>></div>
                        <?php if ( $this->data['sitenotice'] ): ?>
                <!-- panel -->
                        <div id="mw-panel" class="noprint">
                                <!-- logo -->
-                                       <div id="p-logo"><a style="background-image: url(<?php $this->text( 'logopath' ) ?>);" href="<?php echo htmlspecialchars( $this->data['nav_urls']['mainpage']['href'] ) ?>" <?php echo Xml::expandAttributes( Linker::tooltipAndAccesskeyAttribs( 'p-logo' ) ) ?>></a></div>
+                                       <div id="p-logo" role="banner"><a style="background-image: url(<?php $this->text( 'logopath' ) ?>);" href="<?php echo htmlspecialchars( $this->data['nav_urls']['mainpage']['href'] ) ?>" <?php echo Xml::expandAttributes( Linker::tooltipAndAccesskeyAttribs( 'p-logo' ) ) ?>></a></div>
                                <!-- /logo -->
                                <?php $this->renderPortals( $this->data['sidebar'] ); ?>
                        </div>
                <!-- /panel -->
                <!-- footer -->
-               <div id="footer"<?php $this->html( 'userlangattributes' ) ?>>
+               <div id="footer" role="contentinfo"<?php $this->html( 'userlangattributes' ) ?>>
                        <?php foreach( $this->getFooterLinks() as $category => $links ): ?>
                                <ul id="footer-<?php echo $category ?>">
                                        <?php foreach( $links as $link ): ?>
                        $msg = $name;
                }
                ?>
- <div class="portal" id='<?php echo Sanitizer::escapeId( "p-$name" ) ?>'<?php echo Linker::tooltip( 'p-' . $name ) ?>>
+ <div class="portal" role="navigation" id='<?php echo Sanitizer::escapeId( "p-$name" ) ?>'<?php echo Linker::tooltip( 'p-' . $name ) ?>>
        <h5<?php $this->html( 'userlangattributes' ) ?>><?php $msgObj = wfMessage( $msg ); echo htmlspecialchars( $msgObj->exists() ? $msgObj->text() : $msg ); ?></h5>
        <div class="body">
  <?php
         * @param $elements array
         */
        protected function renderNavigation( $elements ) {
 -              global $wgVectorUseSimpleSearch;
 +              global $wgVectorUseSimpleSearch, $wgVectorCombineUserTalk;
  
                // If only one element was given, wrap it in an array, allowing more
                // flexible arguments
                        switch ( $element ) {
                                case 'NAMESPACES':
  ?>
- <div id="p-namespaces" class="vectorTabs<?php if ( count( $this->data['namespace_urls'] ) == 0 ) echo ' emptyPortlet'; ?>">
+ <div id="p-namespaces" role="navigation" class="vectorTabs<?php if ( count( $this->data['namespace_urls'] ) == 0 ) echo ' emptyPortlet'; ?>">
        <h5><?php $this->msg( 'namespaces' ) ?></h5>
        <ul<?php $this->html( 'userlangattributes' ) ?>>
                <?php foreach ( $this->data['namespace_urls'] as $link ): ?>
                                break;
                                case 'VARIANTS':
  ?>
- <div id="p-variants" class="vectorMenu<?php if ( count( $this->data['variant_urls'] ) == 0 ) echo ' emptyPortlet'; ?>">
+ <div id="p-variants" role="navigation" class="vectorMenu<?php if ( count( $this->data['variant_urls'] ) == 0 ) echo ' emptyPortlet'; ?>">
        <h4>
        <?php foreach ( $this->data['variant_urls'] as $link ): ?>
                <?php if ( stripos( $link['attributes'], 'selected' ) !== false ): ?>
                                break;
                                case 'VIEWS':
  ?>
- <div id="p-views" class="vectorTabs<?php if ( count( $this->data['view_urls'] ) == 0 ) { echo ' emptyPortlet'; } ?>">
+ <div id="p-views" role="navigation" class="vectorTabs<?php if ( count( $this->data['view_urls'] ) == 0 ) { echo ' emptyPortlet'; } ?>">
        <h5><?php $this->msg('views') ?></h5>
        <ul<?php $this->html('userlangattributes') ?>>
                <?php foreach ( $this->data['view_urls'] as $link ): ?>
                                break;
                                case 'ACTIONS':
  ?>
- <div id="p-cactions" class="vectorMenu<?php if ( count( $this->data['action_urls'] ) == 0 ) echo ' emptyPortlet'; ?>">
+ <div id="p-cactions" role="navigation" class="vectorMenu<?php if ( count( $this->data['action_urls'] ) == 0 ) echo ' emptyPortlet'; ?>">
        <h5><span><?php $this->msg( 'actions' ) ?></span><a href="#"></a></h5>
        <div class="menu">
                <ul<?php $this->html( 'userlangattributes' ) ?>>
                                break;
                                case 'PERSONAL':
  ?>
- <div id="p-personal" class="<?php if ( count( $this->data['personal_urls'] ) == 0 ) echo ' emptyPortlet'; ?>">
+ <div id="p-personal" role="navigation" class="<?php if ( count( $this->data['personal_urls'] ) == 0 ) echo ' emptyPortlet'; ?>">
        <h5><?php $this->msg( 'personaltools' ) ?></h5>
        <ul<?php $this->html( 'userlangattributes' ) ?>>
 -<?php                 foreach( $this->getPersonalTools() as $key => $item ) { ?>
 -              <?php echo $this->makeListItem( $key, $item ); ?>
 -
 -<?php                 } ?>
 +<?php
 +                                      $personalTools = $this->getPersonalTools();
 +                                      if ( $wgVectorCombineUserTalk && isset( $personalTools['userpage'] ) ) {
 +?>
 +              <li>
 +<?php
 +                                              echo $this->makeListItem( 'userpage', $personalTools['userpage'], array( 'tag' => 'span' ) );
 +?> <?php
 +                                              $personalTools['mytalk']['links'][0]['text'] = $this->getMsg( 'mytalk-parenthetical' )->text();
 +                                              $talkItem = $this->makeListItem( 'mytalk', $personalTools['mytalk'], array( 'tag' => 'span' ) );
 +                                              echo $this->getMsg( 'parentheses' )->rawParams( $talkItem )->escaped();
 +                                              unset( $personalTools['userpage'], $personalTools['mytalk'] );
 +?>
 +              </li>
 +<?php
 +                                      }
 +                                      foreach ( $personalTools as $key => $item ) {
 +                                              echo $this->makeListItem( $key, $item );
 +                                      }
 +?>
        </ul>
  </div>
  <?php
                                break;
                                case 'SEARCH':
  ?>
- <div id="p-search">
+ <div id="p-search" role="search">
        <h5<?php $this->html( 'userlangattributes' ) ?>><label for="searchInput"><?php $this->msg( 'search' ) ?></label></h5>
        <form action="<?php $this->text( 'wgScript' ) ?>" id="searchform">
                <?php if ( $wgVectorUseSimpleSearch && $this->getSkin()->getUser()->getOption( 'vector-simplesearch' ) ): ?>