$wgOut->addModules( 'mediawiki.action.edit' );
$wgOut->addModuleStyles( 'mediawiki.action.edit.styles' );
- if ( $wgUser->getOption( 'uselivepreview', false ) ) {
+ if ( $wgUser->getOption( 'showtoolbar' ) ) {
+ // The addition of default buttons is handled by getEditToolbar() which
+ // has its own dependency on this module. The call here ensures the module
+ // is loaded in time (it has position "top") for other modules to register
+ // buttons (e.g. extensions, gadgets, user scripts).
+ $wgOut->addModules( 'mediawiki.toolbar' );
+ }
+
+ if ( $wgUser->getOption( 'uselivepreview' ) ) {
$wgOut->addModules( 'mediawiki.action.edit.preview' );
}
- if ( $wgUser->getOption( 'useeditwarning', false ) ) {
+ if ( $wgUser->getOption( 'useeditwarning' ) ) {
$wgOut->addModules( 'mediawiki.action.edit.editWarning' );
}
$output .= ' GMT';
}
+ if ( $style == TS_MW && strlen( $output ) !== 14 ) {
+ throw new TimestampException( __METHOD__ . ': The timestamp cannot be represented in ' .
+ 'the specified format' );
+ }
+
return $output;
}
* - reason : HTTP response reason (empty if there was a serious cURL error)
* - headers : <header name/value associative array>
* - body : HTTP response body or resource (if "stream" was set)
- * - err : Any cURL error string
+ * - error : Any cURL error string
* The map also stores integer-indexed copies of these values. This lets callers do:
* <code>
* list( $rcode, $rdesc, $rhdrs, $rbody, $rerr ) = $http->run( $req );
* - reason : HTTP response reason (empty if there was a serious cURL error)
* - headers : <header name/value associative array>
* - body : HTTP response body or resource (if "stream" was set)
- * - err : Any cURL error string
+ * - error : Any cURL error string
* The map also stores integer-indexed copies of these values. This lets callers do:
* <code>
* list( $rcode, $rdesc, $rhdrs, $rbody, $rerr ) = $req['response'];
* - reason : HTTP response reason (empty if there was a serious cURL error)
* - headers : <header name/value associative array>
* - body : HTTP response body or resource (if "stream" was set)
- * - err : Any cURL error string
+ * - error : Any cURL error string
* The map also stores integer-indexed copies of these values. This lets callers do:
* <code>
* list( $rcode, $rdesc, $rhdrs, $rbody, $rerr ) = $client->run( $req );
* - reason : HTTP response reason (empty if there was a serious cURL error)
* - headers : <header name/value associative array>
* - body : HTTP response body or resource (if "stream" was set)
- * - err : Any cURL error string
+ * - error : Any cURL error string
* The map also stores integer-indexed copies of these values. This lets callers do:
* <code>
* list( $rcode, $rdesc, $rhdrs, $rbody, $rerr ) = $responses[0];
'class' => 'ResourceLoaderEditToolbarModule',
'scripts' => 'resources/src/mediawiki.toolbar/toolbar.js',
'styles' => 'resources/src/mediawiki.toolbar/toolbar.less',
+ 'position' => 'top',
),
/* MediaWiki Action */
'styles' => 'resources/src/mediawiki.action/mediawiki.action.edit.css',
'dependencies' => array(
'mediawiki.action.edit.styles',
- 'mediawiki.toolbar',
'jquery.textSelection',
'jquery.byteLimit',
),
/*!
- * Scripts for action=edit
+ * Scripts for action=edit at domready
*/
-( function ( mw, $ ) {
+jQuery( function ( $ ) {
+ var editBox, scrollTop, $editForm;
- $( function () {
- var editBox, scrollTop, $editForm;
+ // Make sure edit summary does not exceed byte limit
+ $( '#wpSummary' ).byteLimit( 255 );
- // Make sure edit summary does not exceed byte limit
- $( '#wpSummary' ).byteLimit( 255 );
-
- // Restore the edit box scroll state following a preview operation,
- // and set up a form submission handler to remember this state.
- editBox = document.getElementById( 'wpTextbox1' );
- scrollTop = document.getElementById( 'wpScrolltop' );
- $editForm = $( '#editform' );
- if ( $editForm.length && editBox && scrollTop ) {
- if ( scrollTop.value ) {
- editBox.scrollTop = scrollTop.value;
- }
- $editForm.submit( function () {
- scrollTop.value = editBox.scrollTop;
- } );
+ // Restore the edit box scroll state following a preview operation,
+ // and set up a form submission handler to remember this state.
+ editBox = document.getElementById( 'wpTextbox1' );
+ scrollTop = document.getElementById( 'wpScrolltop' );
+ $editForm = $( '#editform' );
+ if ( $editForm.length && editBox && scrollTop ) {
+ if ( scrollTop.value ) {
+ editBox.scrollTop = scrollTop.value;
}
- } );
-
-}( mediaWiki, jQuery ) );
+ $editForm.submit( function () {
+ scrollTop.value = editBox.scrollTop;
+ } );
+ }
+} );
new MWTimestamp( "This is not a timestamp." );
}
+ /**
+ * Test an out of range timestamp
+ * @dataProvider provideOutOfRangeTimestamps
+ * @expectedException TimestampException
+ * @covers MWTimestamp
+ */
+ public function testOutOfRangeTimestamps( $format, $input ) {
+ $timestamp = new MWTimestamp( $input );
+ $timestamp->getTimestamp( $format );
+ }
+
/**
* Test requesting an invalid output format.
* @expectedException TimestampException
);
}
+ /**
+ * Returns a list of out of range timestamps in the format:
+ * array( type, timestamp_of_type )
+ */
+ public static function provideOutOfRangeTimestamps() {
+ return array(
+ // Various formats
+ array( TS_MW, '-62167219201' ), // -0001-12-31T23:59:59Z
+ array( TS_MW, '253402300800' ), // 10000-01-01T00:00:00Z
+ );
+ }
+
/**
* @dataProvider provideHumanTimestampTests
* @covers MWTimestamp::getHumanTimestamp