public function execute($par)
 {
     $request = $this->getRequest();
     $context = $this->getContext();
     $output = $this->getOutput();
     $output->addModules('ext.MassMessage.special.js');
     $output->addModuleStyles('ext.MassMessage.special');
     $this->setHeaders();
     $this->outputHeader();
     $this->checkPermissions();
     // Some variables...
     $this->status = new Status();
     // Figure out what state we're in.
     if ($request->getText('submit-button') == $this->msg('massmessage-form-submit')->text()) {
         $this->state = 'submit';
     } elseif ($request->getText('preview-button') == $this->msg('massmessage-form-preview')->text()) {
         $this->state = 'preview';
     } else {
         $this->state = 'form';
     }
     $form = new HtmlForm($this->createForm(), $context);
     $form->setId('mw-massmessage-form');
     $form->setDisplayFormat('div');
     if ($this->state == 'form') {
         $form->addPreText($this->msg('massmessage-form-header')->parse());
     }
     $form->setWrapperLegendMsg('massmessage');
     $form->suppressDefaultSubmit();
     // We use our own buttons.
     $form->setSubmitCallback(array($this, 'callback'));
     $form->setMethod('post');
     $form->prepareForm();
     $result = $form->tryAuthorizedSubmit();
     if ($result === true || $result instanceof Status && $result->isGood()) {
         if ($this->state == 'submit') {
             // If it's preview, everything is shown already.
             $msg = $this->msg('massmessage-submitted')->params($this->count)->plain();
             $output->addWikiText($msg);
             $output->addWikiMsg('massmessage-nextsteps');
         }
     } else {
         $form->displayForm($result);
     }
 }