Legoktm has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/87646


Change subject: Add EditPage::getCopyrightWarning before "Send" button
......................................................................

Add EditPage::getCopyrightWarning before "Send" button

Unfortunately EditPage::getCopyrightWarning returns wikitext, and
HTMLForm wants raw HTML, so we have to implement a simplified
version of OutputPage::addWikiText for our needs.

Bug: 54982
Change-Id: I0161e93e4f4f432878ab0b3e9aaca1a655f25c7d
---
M SpecialMassMessage.php
1 file changed, 20 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MassMessage 
refs/changes/46/87646/1

diff --git a/SpecialMassMessage.php b/SpecialMassMessage.php
index 8141463..e29e517 100644
--- a/SpecialMassMessage.php
+++ b/SpecialMassMessage.php
@@ -133,6 +133,7 @@
                );
 
                if ( $this->state == 'preview' ) {
+                       $m['message']['help'] = $this->makeCopyrightWarning(); 
// Adds it right before the 'Send' button
                        $m['submit-button'] = array(
                                'id' => 'mw-massmessage-form-submit-button',
                                'type' => 'submit',
@@ -150,6 +151,25 @@
        }
 
        /**
+        * Wrapper around EditPage::getCopyrightWarning to return HTML, not 
wikitext
+        *
+        * Basically from OutputPage::addWikiTextTitle
+        * @return string HTML output
+        */
+       function makeCopyrightWarning() {
+               global $wgParser;
+               $title = Title::newFromText( 'Special:MassMessage' );
+               $text = EditPage::getCopyrightWarning( $title );
+               $opts = ParserOptions::newFromContext( $this->getContext() );
+               $opts->setEditSection( false );
+               $parserOutput = $wgParser->parse(
+                       $text, $title, $opts,
+                       true, true
+               );
+               return $parserOutput->getText();
+       }
+
+       /**
         * Log the spamming to Special:Log/massmessage
         *
         * @param $spamlist Title

-- 
To view, visit https://gerrit.wikimedia.org/r/87646
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I0161e93e4f4f432878ab0b3e9aaca1a655f25c7d
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/MassMessage
Gerrit-Branch: master
Gerrit-Owner: Legoktm <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to