X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=blobdiff_plain;f=includes%2FEditPage.php;h=fc770068f5640ec0272c43cac9d02dc5c2ca6dc8;hp=6be8771121f9aa79ba941ded413f32512d9943d7;hb=4838f88d844056d475967a96d592f1271cc987bf;hpb=38a2a5661e1c7a3ac3f2a5688a806ed4b67c757f diff --git a/includes/EditPage.php b/includes/EditPage.php index 6be8771121..fc770068f5 100644 --- a/includes/EditPage.php +++ b/includes/EditPage.php @@ -422,8 +422,6 @@ class EditPage { * @param Article $article */ public function __construct( Article $article ) { - global $wgOOUIEditPage; - $this->mArticle = $article; $this->page = $article->getPage(); // model object $this->mTitle = $article->getTitle(); @@ -434,7 +432,7 @@ class EditPage { $handler = ContentHandler::getForModelID( $this->contentModel ); $this->contentFormat = $handler->getDefaultFormat(); - $this->oouiEnabled = $wgOOUIEditPage; + $this->oouiEnabled = $this->context->getConfig()->get( 'OOUIEditPage' ); } /** @@ -1493,6 +1491,20 @@ class EditPage { return $status; } + /** + * Log when a page was successfully saved after the edit conflict view + */ + private function incrementResolvedConflicts() { + global $wgRequest; + + if ( $wgRequest->getText( 'mode' ) !== 'conflict' ) { + return; + } + + $stats = MediaWikiServices::getInstance()->getStatsdDataFactory(); + $stats->increment( 'edit.failures.conflict.resolved' ); + } + /** * Handle status, such as after attempt save * @@ -1512,6 +1524,8 @@ class EditPage { if ( $status->value == self::AS_SUCCESS_UPDATE || $status->value == self::AS_SUCCESS_NEW_ARTICLE ) { + $this->incrementResolvedConflicts(); + $this->didSave = true; if ( !$resultDetails['nullEdit'] ) { $this->setPostEditCookie( $status->value ); @@ -2769,7 +2783,7 @@ class EditPage { $wgOut->addHTML( $this->editFormTextBeforeContent ); if ( !$this->isCssJsSubpage && $showToolbar && $wgUser->getOption( 'showtoolbar' ) ) { - $wgOut->addHTML( EditPage::getEditToolbar( $this->mTitle ) ); + $wgOut->addHTML( self::getEditToolbar( $this->mTitle ) ); } if ( $this->blankArticle ) { @@ -3062,7 +3076,7 @@ class EditPage { 'tabindex' => 1, 'size' => 60, 'spellcheck' => 'true', - ] + Linker::tooltipAndAccesskeyAttribs( 'summary' ); + ]; } /** @@ -3083,6 +3097,7 @@ class EditPage { $inputAttrs = null, $spanLabelAttrs = null ) { $inputAttrs = $this->getSummaryInputAttributes( $inputAttrs ); + $inputAttrs += Linker::tooltipAndAccesskeyAttribs( 'summary' ); $spanLabelAttrs = ( is_array( $spanLabelAttrs ) ? $spanLabelAttrs : [] ) + [ 'class' => $this->missingSummary ? 'mw-summarymissed' : 'mw-summary', @@ -3118,6 +3133,10 @@ class EditPage { $inputAttrs = OOUI\Element::configFromHtmlAttributes( $this->getSummaryInputAttributes( $inputAttrs ) ); + $inputAttrs += [ + 'title' => Linker::titleAttrib( 'summary' ), + 'accessKey' => Linker::accesskey( 'summary' ), + ]; // For compatibility with old scripts and extensions, we want the legacy 'id' on the `` $inputAttrs['inputId'] = $inputAttrs['id']; @@ -3478,6 +3497,10 @@ HTML } } + /** + * Inserts optional text shown below edit and upload forms. Can be used to offer special characters not present on + * most keyboards for copying/pasting. + */ protected function showEditTools() { global $wgOut; $wgOut->addHTML( '
' . @@ -4259,7 +4282,7 @@ HTML $accesskey = null; if ( isset( $options['tooltip'] ) ) { $accesskey = $this->context->msg( "accesskey-{$options['tooltip']}" )->text(); - $title = Linker::titleAttrib( $options['tooltip'], 'withaccess' ); + $title = Linker::titleAttrib( $options['tooltip'] ); } if ( isset( $options['title-message'] ) ) { $title = $this->context->msg( $options['title-message'] )->text(); @@ -4337,8 +4360,7 @@ HTML $attribs = [ 'name' => 'wpSave', 'tabindex' => ++$tabindex, - ] + Linker::tooltipAndAccesskeyAttribs( 'save' ); - + ]; if ( $this->oouiEnabled ) { $saveConfig = OOUI\Element::configFromHtmlAttributes( $attribs ); $buttons['save'] = new OOUI\ButtonInputWidget( [ @@ -4350,11 +4372,13 @@ HTML 'label' => $buttonLabel, 'infusable' => true, 'type' => 'submit', + 'title' => Linker::titleAttrib( 'save' ), + 'accessKey' => Linker::accesskey( 'save' ), ] + $saveConfig ); } else { $buttons['save'] = Html::submitButton( $buttonLabel, - $attribs + [ 'id' => 'wpSave' ], + $attribs + Linker::tooltipAndAccesskeyAttribs( 'save' ) + [ 'id' => 'wpSave' ], [ 'mw-ui-progressive' ] ); } @@ -4362,7 +4386,7 @@ HTML $attribs = [ 'name' => 'wpPreview', 'tabindex' => ++$tabindex, - ] + Linker::tooltipAndAccesskeyAttribs( 'preview' ); + ]; if ( $this->oouiEnabled ) { $previewConfig = OOUI\Element::configFromHtmlAttributes( $attribs ); $buttons['preview'] = new OOUI\ButtonInputWidget( [ @@ -4372,18 +4396,20 @@ HTML 'useInputTag' => true, 'label' => $this->context->msg( 'showpreview' )->text(), 'infusable' => true, - 'type' => 'submit' + 'type' => 'submit', + 'title' => Linker::titleAttrib( 'preview' ), + 'accessKey' => Linker::accesskey( 'preview' ), ] + $previewConfig ); } else { $buttons['preview'] = Html::submitButton( $this->context->msg( 'showpreview' )->text(), - $attribs + [ 'id' => 'wpPreview' ] + $attribs + Linker::tooltipAndAccesskeyAttribs( 'preview' ) + [ 'id' => 'wpPreview' ] ); } $attribs = [ 'name' => 'wpDiff', 'tabindex' => ++$tabindex, - ] + Linker::tooltipAndAccesskeyAttribs( 'diff' ); + ]; if ( $this->oouiEnabled ) { $diffConfig = OOUI\Element::configFromHtmlAttributes( $attribs ); $buttons['diff'] = new OOUI\ButtonInputWidget( [ @@ -4394,11 +4420,13 @@ HTML 'label' => $this->context->msg( 'showdiff' )->text(), 'infusable' => true, 'type' => 'submit', + 'title' => Linker::titleAttrib( 'diff' ), + 'accessKey' => Linker::accesskey( 'diff' ), ] + $diffConfig ); } else { $buttons['diff'] = Html::submitButton( $this->context->msg( 'showdiff' )->text(), - $attribs + [ 'id' => 'wpDiff' ] + $attribs + Linker::tooltipAndAccesskeyAttribs( 'diff' ) + [ 'id' => 'wpDiff' ] ); }