protected function alterForm(HTMLForm $form)
 {
     $form->setId('mw-resetpass-form');
     $form->setTableId('mw-resetpass-table');
     $form->setWrapperLegendMsg('resetpass_header');
     $form->setSubmitTextMsg($this->getUser()->isLoggedIn() ? 'resetpass-submit-loggedin' : 'resetpass_submit');
     $form->addButton('wpCancel', $this->msg('resetpass-submit-cancel')->text());
     $form->setHeaderText($this->msg('resetpass_text')->parseAsBlock());
     $form->addHiddenFields($this->getRequest()->getValues('wpName', 'wpDomain', 'returnto', 'returntoquery'));
 }
Exemplo n.º 2
0
 /**
  * Customizes the HTMLForm a bit
  *
  * @param $form HTMLForm
  */
 protected function alterForm(HTMLForm $form)
 {
     $form->setWrapperLegendMsg('blockip-legend');
     $form->setHeaderText('');
     $form->setSubmitCallback(array(__CLASS__, 'processUIForm'));
     $msg = $this->alreadyBlocked ? 'ipb-change-block' : 'ipbsubmit';
     $form->setSubmitTextMsg($msg);
     # Don't need to do anything if the form has been posted
     if (!$this->getRequest()->wasPosted() && $this->preErrors) {
         $s = HTMLForm::formatErrors($this->preErrors);
         if ($s) {
             $form->addHeaderText(Html::rawElement('div', array('class' => 'error'), $s));
         }
     }
 }
Exemplo n.º 3
0
 public function processCreateTagForm(array $data, HTMLForm $form)
 {
     $context = $form->getContext();
     $out = $context->getOutput();
     $tag = trim(strval($data['Tag']));
     $ignoreWarnings = isset($data['IgnoreWarnings']) && $data['IgnoreWarnings'] === '1';
     $status = ChangeTags::createTagWithChecks($tag, $data['Reason'], $context->getUser(), $ignoreWarnings);
     if ($status->isGood()) {
         $out->redirect($this->getPageTitle()->getLocalURL());
         return true;
     } elseif ($status->isOK()) {
         // we have some warnings, so we show a confirmation form
         $fields = ['Tag' => ['type' => 'hidden', 'default' => $data['Tag']], 'Reason' => ['type' => 'hidden', 'default' => $data['Reason']], 'IgnoreWarnings' => ['type' => 'hidden', 'default' => '1']];
         // fool HTMLForm into thinking the form hasn't been submitted yet. Otherwise
         // we get into an infinite loop!
         $context->getRequest()->unsetVal('wpEditToken');
         $headerText = $this->msg('tags-create-warnings-above', $tag, count($status->getWarningsArray()))->parseAsBlock() . $out->parse($status->getWikiText()) . $this->msg('tags-create-warnings-below')->parseAsBlock();
         $subform = new HTMLForm($fields, $this->getContext());
         $subform->setAction($this->getPageTitle('create')->getLocalURL());
         $subform->setWrapperLegendMsg('tags-create-heading');
         $subform->setHeaderText($headerText);
         $subform->setSubmitCallback([$this, 'processCreateTagForm']);
         $subform->setSubmitTextMsg('htmlform-yes');
         $subform->show();
         $out->addBacklinkSubtitle($this->getPageTitle());
         return true;
     } else {
         $out->addWikiText("<div class=\"error\">\n" . $status->getWikiText() . "\n</div>");
         return false;
     }
 }
Exemplo n.º 4
0
 /**
  * Customizes the HTMLForm a bit
  *
  * @param HTMLForm $form
  */
 protected function alterForm(HTMLForm $form)
 {
     $form->setWrapperLegendMsg('blockip-legend');
     $form->setHeaderText('');
     $form->setSubmitDestructive();
     $msg = $this->alreadyBlocked ? 'ipb-change-block' : 'ipbsubmit';
     $form->setSubmitTextMsg($msg);
     $this->addHelpLink('Help:Blocking users');
     # Don't need to do anything if the form has been posted
     if (!$this->getRequest()->wasPosted() && $this->preErrors) {
         $s = $form->formatErrors($this->preErrors);
         if ($s) {
             $form->addHeaderText(Html::rawElement('div', array('class' => 'error'), $s));
         }
     }
 }
 public function alterForm(HTMLForm $form)
 {
     global $wgPasswordResetRoutes;
     $form->setDisplayFormat('vform');
     // Turn the old-school line around the form off.
     // XXX This wouldn't be necessary here if we could set the format of
     // the HTMLForm to 'vform' at its creation, but there's no way to do so
     // from a FormSpecialPage class.
     $form->setWrapperLegend(false);
     $form->addHiddenFields($this->getRequest()->getValues('returnto', 'returntoquery'));
     $i = 0;
     if (isset($wgPasswordResetRoutes['username']) && $wgPasswordResetRoutes['username']) {
         $i++;
     }
     if (isset($wgPasswordResetRoutes['email']) && $wgPasswordResetRoutes['email']) {
         $i++;
     }
     if (isset($wgPasswordResetRoutes['domain']) && $wgPasswordResetRoutes['domain']) {
         $i++;
     }
     $message = $i > 1 ? 'passwordreset-text-many' : 'passwordreset-text-one';
     $form->setHeaderText($this->msg($message, $i)->parseAsBlock());
     $form->setSubmitTextMsg('mailmypassword');
 }
 protected function alterForm(HTMLForm $form)
 {
     $form->setWrapperLegend(false);
     $form->setHeaderText($this->msg('lockdbtext')->parseAsBlock());
     $form->setSubmitTextMsg('lockbtn');
 }
 public function alterForm(HTMLForm $form)
 {
     $resetRoutes = $this->getConfig()->get('PasswordResetRoutes');
     $form->addHiddenFields($this->getRequest()->getValues('returnto', 'returntoquery'));
     $i = 0;
     if (isset($resetRoutes['username']) && $resetRoutes['username']) {
         $i++;
     }
     if (isset($resetRoutes['email']) && $resetRoutes['email']) {
         $i++;
     }
     if (isset($resetRoutes['domain']) && $resetRoutes['domain']) {
         $i++;
     }
     $message = $i > 1 ? 'passwordreset-text-many' : 'passwordreset-text-one';
     $form->setHeaderText($this->msg($message, $i)->parseAsBlock());
     $form->setSubmitTextMsg('mailmypassword');
 }