parent::__construct( 'badtitle', 'badtitletext', array() );
} else {
$errorMessageParams = $msg->getErrorMessageParameters();
- $titleText = $msg->getTitleText();
- if ( $titleText ) {
- $errorMessageParams[] = $titleText;
- }
parent::__construct( 'badtitle', $errorMessage, $errorMessageParams );
}
} else {
* '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.
protected $mValidationCallback;
protected $mFilterCallback;
protected $mName;
+ protected $mDir;
protected $mLabel; # String label. Set on construction
protected $mID;
protected $mClass = '';
$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'] ) ) {
'name' => $this->mName,
'size' => $this->getSize(),
'value' => $value,
+ 'dir' => $this->mDir,
) + $this->getTooltipAndAccessKey();
if ( $this->mClass !== '' ) {
}
}
- /**
- * @return array
- */
- protected function doGetPeriodicTasks() {
- return array(); // managed in the runner loop
- }
-
/**
* @param IJobSpecification $job
* @return array
} 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;
'<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(
/**
* @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() );
}
/**
public function getTitleText() {
return $this->titleText;
}
-
+
/**
* @since 1.26
* @return string|null
public function getErrorMessage() {
return $this->errorMessage;
}
-
+
/**
* @since 1.26
* @return string[]
),
'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' ),
--- /dev/null
+.mw-notification-area {
+ position: absolute;
+}
+
+.mw-notification-area-floating {
+ position: fixed;
+}
.mw-notification-area {
- position: absolute;
top: 0;
right: 0;
padding: 1em 1em 0 0;
z-index: 10000;
}
-.mw-notification-area-floating {
- position: fixed;
-}
-
.mw-notification {
padding: 0.25em 1em;
margin-bottom: 0.5em;
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/ ) )
);
'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: [