Localisation updates from https://translatewiki.net.
[lhc/web/wiklou.git] / includes / EditPage.php
index 3370622..a423f26 100644 (file)
@@ -1944,9 +1944,7 @@ class EditPage {
                        // Do this in its own transaction to reduce contention...
                        $dbw = wfGetDB( DB_MASTER );
                        $dbw->onTransactionIdle( function () use ( $dbw, $title, $watch, $wgUser, $fname ) {
-                               $dbw->begin( $fname );
                                WatchAction::doWatchOrUnwatch( $watch, $title, $wgUser );
-                               $dbw->commit( $fname );
                        } );
                }
        }
@@ -2232,11 +2230,7 @@ class EditPage {
         *   $this->allowNonTextContent is not true.
         */
        protected function toEditText( $content ) {
-               if ( $content === null || $content === false ) {
-                       return $content;
-               }
-
-               if ( is_string( $content ) ) {
+               if ( $content === null || $content === false || is_string( $content ) ) {
                        return $content;
                }
 
@@ -3196,7 +3190,7 @@ HTML
        }
 
        protected function showStandardInputs( &$tabindex = 2 ) {
-               global $wgOut, $wgUseMediaWikiUIEverywhere;
+               global $wgOut;
                $wgOut->addHTML( "<div class='editOptions'>\n" );
 
                if ( $this->section != 'new' ) {
@@ -3228,10 +3222,8 @@ HTML
                        'target' => 'helpwindow',
                        'href' => $edithelpurl,
                );
-               if ( $wgUseMediaWikiUIEverywhere ) {
-                       $attrs['class'] = 'mw-ui-button mw-ui-quiet';
-               }
-               $edithelp = Html::element( 'a', $attrs, wfMessage( 'edithelp' )->text() ) .
+               $edithelp = Html::linkButton( wfMessage( 'edithelp' )->text(),
+                       $attrs, array( 'mw-ui-quiet' ) ) .
                        wfMessage( 'word-separator' )->escaped() .
                        wfMessage( 'newwindow' )->parse();
 
@@ -3274,20 +3266,16 @@ HTML
         * @return string
         */
        public function getCancelLink() {
-               global $wgUseMediaWikiUIEverywhere;
                $cancelParams = array();
                if ( !$this->isConflict && $this->oldid > 0 ) {
                        $cancelParams['oldid'] = $this->oldid;
                }
                $attrs = array( 'id' => 'mw-editform-cancel' );
-               if ( $wgUseMediaWikiUIEverywhere ) {
-                       $attrs['class'] = 'mw-ui-button mw-ui-quiet';
-               }
 
                return Linker::linkKnown(
                        $this->getContextTitle(),
                        wfMessage( 'cancel' )->parse(),
-                       $attrs,
+                       Html::buttonAttributes( $attrs, array( 'mw-ui-quiet' ) ),
                        $cancelParams
                );
        }
@@ -3642,7 +3630,7 @@ HTML
                        )
                );
 
-               $script = 'mw.loader.using("mediawiki.action.edit", function() {';
+               $script = 'mw.loader.using("mediawiki.toolbar", function () {';
                foreach ( $toolarray as $tool ) {
                        if ( !$tool ) {
                                continue;
@@ -3665,12 +3653,6 @@ HTML
                        $script .= Xml::encodeJsCall( 'mw.toolbar.addButton', $params );
                }
 
-               // This used to be called on DOMReady from mediawiki.action.edit, which
-               // ended up causing race conditions with the setup code above.
-               $script .= "\n" .
-                       "// Create button bar\n" .
-                       "$(function() { mw.toolbar.init(); } );\n";
-
                $script .= '});';
                $wgOut->addScript( Html::inlineScript( ResourceLoader::makeLoaderConditionalScript( $script ) ) );
 
@@ -3756,47 +3738,33 @@ HTML
         * @return array
         */
        public function getEditButtons( &$tabindex ) {
-               global $wgUseMediaWikiUIEverywhere;
-
                $buttons = array();
 
                $attribs = array(
                        'id' => 'wpSave',
                        'name' => 'wpSave',
-                       'type' => 'submit',
                        'tabindex' => ++$tabindex,
-                       'value' => wfMessage( 'savearticle' )->text(),
                ) + Linker::tooltipAndAccesskeyAttribs( 'save' );
-               if ( $wgUseMediaWikiUIEverywhere ) {
-                       $attribs['class'] = 'mw-ui-button mw-ui-constructive';
-               }
-               $buttons['save'] = Xml::element( 'input', $attribs, '' );
+               $buttons['save'] = Html::submitButton( wfMessage( 'savearticle' )->text(),
+                       $attribs, array( 'mw-ui-constructive' ) );
 
                ++$tabindex; // use the same for preview and live preview
                $attribs = array(
                        'id' => 'wpPreview',
                        'name' => 'wpPreview',
-                       'type' => 'submit',
                        'tabindex' => $tabindex,
-                       'value' => wfMessage( 'showpreview' )->text(),
                ) + Linker::tooltipAndAccesskeyAttribs( 'preview' );
-               if ( $wgUseMediaWikiUIEverywhere ) {
-                       $attribs['class'] = 'mw-ui-button mw-ui-progressive';
-               }
-               $buttons['preview'] = Xml::element( 'input', $attribs, '' );
+               $buttons['preview'] = Html::submitButton( wfMessage( 'showpreview' )->text(),
+                       $attribs );
                $buttons['live'] = '';
 
                $attribs = array(
                        'id' => 'wpDiff',
                        'name' => 'wpDiff',
-                       'type' => 'submit',
                        'tabindex' => ++$tabindex,
-                       'value' => wfMessage( 'showdiff' )->text(),
                ) + Linker::tooltipAndAccesskeyAttribs( 'diff' );
-               if ( $wgUseMediaWikiUIEverywhere ) {
-                       $attribs['class'] = 'mw-ui-button mw-ui-progressive';
-               }
-               $buttons['diff'] = Xml::element( 'input', $attribs, '' );
+               $buttons['diff'] = Html::submitButton( wfMessage( 'showdiff' )->text(),
+                       $attribs );
 
                wfRunHooks( 'EditPageBeforeEditButtons', array( &$this, &$buttons, &$tabindex ) );
                return $buttons;