Merge "Resources: Remove pointless 'position' => 'top' for ResourceLoaderImageModule...
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Thu, 7 May 2015 15:34:32 +0000 (15:34 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Thu, 7 May 2015 15:34:32 +0000 (15:34 +0000)
13 files changed:
includes/exception/BadTitleError.php
includes/htmlform/HTMLForm.php
includes/htmlform/HTMLFormField.php
includes/htmlform/HTMLTextField.php
includes/jobqueue/JobQueueRedis.php
includes/resourceloader/ResourceLoader.php
includes/specials/SpecialLinkSearch.php
includes/title/MalformedTitleException.php
resources/Resources.php
resources/src/mediawiki/mediawiki.notification.common.css [new file with mode: 0644]
resources/src/mediawiki/mediawiki.notification.css
resources/src/startup.js
tests/qunit/suites/resources/startup.test.js

index 4710022..039b9c6 100644 (file)
@@ -39,10 +39,6 @@ class BadTitleError extends ErrorPageError {
                                parent::__construct( 'badtitle', 'badtitletext', array() );
                        } else {
                                $errorMessageParams = $msg->getErrorMessageParameters();
-                               $titleText = $msg->getTitleText();
-                               if ( $titleText ) {
-                                       $errorMessageParams[] = $titleText;
-                               }
                                parent::__construct( 'badtitle', $errorMessage, $errorMessageParams );
                        }
                } else {
index ce14003..738fec3 100644 (file)
@@ -51,6 +51,7 @@
  *    'id'                  -- HTML id attribute
  *    'cssclass'            -- CSS class
  *    'csshelpclass'        -- CSS class used to style help text
+ *    'dir'                 -- Direction of the element.
  *    'options'             -- associative array mapping labels to values.
  *                             Some field types support multi-level arrays.
  *    'options-messages'    -- associative array mapping message keys to values.
index 9576c77..0c3fe44 100644 (file)
@@ -10,6 +10,7 @@ abstract class HTMLFormField {
        protected $mValidationCallback;
        protected $mFilterCallback;
        protected $mName;
+       protected $mDir;
        protected $mLabel; # String label.  Set on construction
        protected $mID;
        protected $mClass = '';
@@ -377,6 +378,10 @@ abstract class HTMLFormField {
                        $this->mName = $params['name'];
                }
 
+               if ( isset( $params['dir'] ) ) {
+                       $this->mDir = $params['dir'];
+               }
+
                $validName = Sanitizer::escapeId( $this->mName );
                $validName = str_replace( array( '.5B', '.5D' ), array( '[', ']' ), $validName );
                if ( $this->mName != $validName && !isset( $params['nodata'] ) ) {
index 88df49d..a67e52e 100644 (file)
@@ -11,6 +11,7 @@ class HTMLTextField extends HTMLFormField {
                                'name' => $this->mName,
                                'size' => $this->getSize(),
                                'value' => $value,
+                               'dir' => $this->mDir,
                        ) + $this->getTooltipAndAccessKey();
 
                if ( $this->mClass !== '' ) {
index 275d027..c0d3bec 100644 (file)
@@ -611,13 +611,6 @@ LUA;
                }
        }
 
-       /**
-        * @return array
-        */
-       protected function doGetPeriodicTasks() {
-               return array(); // managed in the runner loop
-       }
-
        /**
         * @param IJobSpecification $job
         * @return array
index 7da3aec..ce18c32 100644 (file)
@@ -339,7 +339,7 @@ class ResourceLoader {
                                        } elseif ( isset( $skinStyles['+' . $name] ) ) {
                                                $paths = (array)$skinStyles['+' . $name];
                                                $styleFiles = isset( $this->moduleInfos[$name]['skinStyles']['default'] ) ?
-                                                       $this->moduleInfos[$name]['skinStyles']['default'] :
+                                                       (array)$this->moduleInfos[$name]['skinStyles']['default'] :
                                                        array();
                                        } else {
                                                continue;
index 75ff8f3..0c02628 100644 (file)
@@ -121,43 +121,39 @@ class LinkSearchPage extends QueryPage {
                        '<nowiki>' . $this->getLanguage()->commaList( $protocols_list ) . '</nowiki>',
                        count( $protocols_list )
                );
-               $s = Html::openElement(
-                       'form',
-                       array( 'id' => 'mw-linksearch-form', 'method' => 'get', 'action' => wfScript() )
-               ) . "\n" .
-                       Html::hidden( 'title', $this->getPageTitle()->getPrefixedDBkey() ) . "\n" .
-                       Html::openElement( 'fieldset' ) . "\n" .
-                       Html::element( 'legend', array(), $this->msg( 'linksearch' )->text() ) . "\n" .
-                       Xml::inputLabel(
-                               $this->msg( 'linksearch-pat' )->text(),
-                               'target',
-                               'target',
-                               50,
-                               $target,
-                               array(
-                                       // URLs are always ltr
-                                       'dir' => 'ltr',
-                               )
-                       ) . "\n";
-
+               $fields = array(
+                       'target' => array(
+                               'type' => 'text',
+                               'name' => 'target',
+                               'id' => 'target',
+                               'size' => 50,
+                               'label-message' => 'linksearch-pat',
+                               'default' => $target,
+                               'dir' => 'ltr',
+                       )
+               );
                if ( !$this->getConfig()->get( 'MiserMode' ) ) {
-                       $s .= Html::namespaceSelector(
-                               array(
-                                       'selected' => $namespace,
-                                       'all' => '',
-                                       'label' => $this->msg( 'linksearch-ns' )->text()
-                               ), array(
+                       $fields += array(
+                               'namespace' => array(
+                                       'class' => 'HTMLSelectNamespace',
                                        'name' => 'namespace',
+                                       'label-message' => 'linksearch-ns',
+                                       'default' => $namespace,
                                        'id' => 'namespace',
-                                       'class' => 'namespaceselector',
-                               )
+                                       'cssclass' => 'namespaceselector',
+                               ),
                        );
                }
-
-               $s .= Xml::submitButton( $this->msg( 'linksearch-ok' )->text() ) . "\n" .
-                       Html::closeElement( 'fieldset' ) . "\n" .
-                       Html::closeElement( 'form' ) . "\n";
-               $out->addHTML( $s );
+               $hiddenFields = array(
+                       'title' => $this->getPageTitle()->getPrefixedDBkey(),
+               );
+               $htmlForm = HTMLForm::factory( 'inline', $fields, $this->getContext() );
+               $htmlForm->addHiddenFields( $hiddenFields );
+               $htmlForm->setSubmitTextMsg( 'linksearch-ok' );
+               $htmlForm->setWrapperLegendMsg( 'linksearch' );
+               $htmlForm->setAction( wfScript() );
+               $htmlForm->setMethod( 'get' );
+               $htmlForm->prepareForm()->displayForm( false );
 
                if ( $target != '' ) {
                        $this->setParams( array(
index e747778..fb89e4f 100644 (file)
@@ -30,12 +30,20 @@ class MalformedTitleException extends Exception {
        /**
         * @param string $errorMessage Localisation message describing the error (since MW 1.26)
         * @param string $titleText The invalid title text (since MW 1.26)
-        * @param string[] $errorMessageParameters Additional parameters for the error message (since MW 1.26)
+        * @param string[] $errorMessageParameters Additional parameters for the error message. $titleText will be appended if it's not null. (since MW 1.26)
         */
        public function __construct( $errorMessage = null, $titleText = null, $errorMessageParameters = array() ) {
                $this->errorMessage = $errorMessage;
                $this->titleText = $titleText;
+               if ( $titleText !== null ) {
+                       $errorMessageParameters[] = $titleText;
+               }
                $this->errorMessageParameters = $errorMessageParameters;
+
+               // Supply something useful for Exception::getMessage() to return.
+               $enMsg = wfMessage( $errorMessage, $errorMessageParameters );
+               $enMsg->inLanguage( 'en' )->useDatabase( false );
+               parent::__construct( $enMsg->text() );
        }
 
        /**
@@ -45,7 +53,7 @@ class MalformedTitleException extends Exception {
        public function getTitleText() {
                return $this->titleText;
        }
-       
+
        /**
         * @since 1.26
         * @return string|null
@@ -53,7 +61,7 @@ class MalformedTitleException extends Exception {
        public function getErrorMessage() {
                return $this->errorMessage;
        }
-       
+
        /**
         * @since 1.26
         * @return string[]
index 02d7874..ae5b3f9 100644 (file)
@@ -981,10 +981,13 @@ return array(
        ),
        'mediawiki.notification' => array(
                'styles' => array(
-                       'resources/src/mediawiki/mediawiki.notification.css',
+                       'resources/src/mediawiki/mediawiki.notification.common.css',
                        'resources/src/mediawiki/mediawiki.notification.hideForPrint.css'
                                => array( 'media' => 'print' ),
                ),
+               'skinStyles' => array(
+                       'default' => 'resources/src/mediawiki/mediawiki.notification.css',
+               ),
                'scripts' => 'resources/src/mediawiki/mediawiki.notification.js',
                'dependencies' => 'mediawiki.page.startup',
                'targets' => array( 'desktop', 'mobile' ),
diff --git a/resources/src/mediawiki/mediawiki.notification.common.css b/resources/src/mediawiki/mediawiki.notification.common.css
new file mode 100644 (file)
index 0000000..a1309c2
--- /dev/null
@@ -0,0 +1,7 @@
+.mw-notification-area {
+       position: absolute;
+}
+
+.mw-notification-area-floating {
+       position: fixed;
+}
index ae399ce..954de22 100644 (file)
@@ -1,5 +1,4 @@
 .mw-notification-area {
-       position: absolute;
        top: 0;
        right: 0;
        padding: 1em 1em 0 0;
@@ -8,10 +7,6 @@
        z-index: 10000;
 }
 
-.mw-notification-area-floating {
-       position: fixed;
-}
-
 .mw-notification {
        padding: 0.25em 1em;
        margin-bottom: 0.5em;
index a62cc9d..80cc7d9 100644 (file)
@@ -52,6 +52,8 @@ function isCompatible( ua ) {
                ua.match( /Opera Mini/ ) ||
                // Nokia's Ovi Browser
                ua.match( /S40OviBrowser/ ) ||
+               // MeeGo's browser
+               ua.match( /MeeGo/ ) ||
                // Google Glass browser groks JS but UI is too limited
                ( ua.match( /Glass/ ) && ua.match( /Android/ ) )
        );
index 6011961..5ea7a81 100644 (file)
@@ -86,7 +86,9 @@
                        'Mozilla/5.0 (Series40; NokiaX3-02/05.60; Profile/MIDP-2.1 Configuration/CLDC-1.1) Gecko/20100401 S40OviBrowser/3.2.0.0.6',
                        'Mozilla/5.0 (Series40; Nokia305/05.92; Profile/MIDP-2.1 Configuration/CLDC-1.1) Gecko/20100401 S40OviBrowser/3.7.0.0.11',
                        // Google Glass
-                       'Mozilla/5.0 (Linux; U; Android 4.0.4; en-us; Glass 1 Build/IMM76L; XE11) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30'
+                       'Mozilla/5.0 (Linux; U; Android 4.0.4; en-us; Glass 1 Build/IMM76L; XE11) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30',
+                       // MeeGo
+                       'Mozilla/5.0 (MeeGo; NokiaN9) AppleWebKit/534.13 (KHTML, like Gecko) NokiaBrowser/8.5.0 Mobile Safari/534.13'
                ],
                // No explicit support for or against these browsers, they're given a shot at Grade A.
                gradeX: [