Merge "RCFilters: Style the Saved Links placeholder and add a title"
[lhc/web/wiklou.git] / includes / EditPage.php
index e98dd52..098ffbf 100644 (file)
@@ -1452,10 +1452,8 @@ class EditPage {
         * This uses a temporary cookie for each revision ID so separate saves will never
         * interfere with each other.
         *
-        * The cookie is deleted in the mediawiki.action.view.postEdit JS module after
-        * the redirect.  It must be clearable by JavaScript code, so it must not be
-        * marked HttpOnly. The JavaScript code converts the cookie to a wgPostEdit config
-        * variable.
+        * Article::view deletes the cookie on server-side after the redirect and
+        * converts the value to the global JavaScript variable wgPostEdit.
         *
         * If the variable were set on the server, it would be cached, which is unwanted
         * since the post-edit state should only apply to the load right after the save.
@@ -1474,9 +1472,7 @@ class EditPage {
                }
 
                $response = RequestContext::getMain()->getRequest()->response();
-               $response->setCookie( $postEditKey, $val, time() + self::POST_EDIT_COOKIE_DURATION, [
-                       'httpOnly' => false,
-               ] );
+               $response->setCookie( $postEditKey, $val, time() + self::POST_EDIT_COOKIE_DURATION );
        }
 
        /**
@@ -2757,6 +2753,9 @@ class EditPage {
                $wgOut->addHTML( Html::hidden( 'format', $this->contentFormat ) );
                $wgOut->addHTML( Html::hidden( 'model', $this->contentModel ) );
 
+               // Preserve &ooui=1 / &ooui=0 from URL parameters after submitting the page for preview
+               $wgOut->addHTML( Html::hidden( 'ooui', $this->oouiEnabled ? '1' : '0' ) );
+
                // following functions will need OOUI, enable it only once; here.
                if ( $this->oouiEnabled ) {
                        $wgOut->enableOOUI();
@@ -2909,24 +2908,38 @@ class EditPage {
                                }
                        }
 
+                       $buttonLabelKey = $this->getSaveButtonLabel();
+
                        if ( $this->missingComment ) {
                                $wgOut->wrapWikiMsg( "<div id='mw-missingcommenttext'>\n$1\n</div>", 'missingcommenttext' );
                        }
 
                        if ( $this->missingSummary && $this->section != 'new' ) {
-                               $wgOut->wrapWikiMsg( "<div id='mw-missingsummary'>\n$1\n</div>", 'missingsummary' );
+                               $wgOut->wrapWikiMsg(
+                                       "<div id='mw-missingsummary'>\n$1\n</div>",
+                                       [ 'missingsummary', $buttonLabelKey ]
+                               );
                        }
 
                        if ( $this->missingSummary && $this->section == 'new' ) {
-                               $wgOut->wrapWikiMsg( "<div id='mw-missingcommentheader'>\n$1\n</div>", 'missingcommentheader' );
+                               $wgOut->wrapWikiMsg(
+                                       "<div id='mw-missingcommentheader'>\n$1\n</div>",
+                                       [ 'missingcommentheader', $buttonLabelKey ]
+                               );
                        }
 
                        if ( $this->blankArticle ) {
-                               $wgOut->wrapWikiMsg( "<div id='mw-blankarticle'>\n$1\n</div>", 'blankarticle' );
+                               $wgOut->wrapWikiMsg(
+                                       "<div id='mw-blankarticle'>\n$1\n</div>",
+                                       [ 'blankarticle', $buttonLabelKey ]
+                               );
                        }
 
                        if ( $this->selfRedirect ) {
-                               $wgOut->wrapWikiMsg( "<div id='mw-selfredirect'>\n$1\n</div>", 'selfredirect' );
+                               $wgOut->wrapWikiMsg(
+                                       "<div id='mw-selfredirect'>\n$1\n</div>",
+                                       [ 'selfredirect', $buttonLabelKey ]
+                               );
                        }
 
                        if ( $this->hookError !== '' ) {
@@ -3156,7 +3169,6 @@ class EditPage {
                        );
                        $wgOut->addHTML( "{$label} {$input}" );
                }
-
        }
 
        /**
@@ -4683,7 +4695,10 @@ HTML
         * @since 1.29
         */
        protected function addExplainConflictHeader( OutputPage $out ) {
-               $out->wrapWikiMsg( "<div class='mw-explainconflict'>\n$1\n</div>", 'explainconflict' );
+               $out->wrapWikiMsg(
+                       "<div class='mw-explainconflict'>\n$1\n</div>",
+                       [ 'explainconflict', $this->getSaveButtonLabel() ]
+               );
        }
 
        /**