/** * Generate the content of each table row (1 row = 1 ad) */ function formatRow($row) { // Begin ad row $htmlOut = Xml::openElement('tr'); if ($this->editable) { // Add box $htmlOut .= Xml::tags('td', array('valign' => 'top'), Xml::check('addAds[]', '', array('value' => $row->ad_name))); // Weight select $htmlOut .= Xml::tags('td', array('valign' => 'top', 'class' => 'pr-weight'), Xml::listDropDown("weight[{$row->ad_id}]", Promoter::dropDownList($this->msg('promoter-weight')->text(), range(0, 100, 5)), '', '25', '', '')); } // Link and Preview $ad = Ad::fromName($row->ad_name); $htmlOut .= Xml::tags('td', array('valign' => 'top'), $ad->linkToPreview()); // End ad row $htmlOut .= Xml::closeElement('tr'); return $htmlOut; }
/** * Generate a "deletion nomination" form. * @param $article Article object to nominate. */ public function buildForm($article, $queue) { global $wgOut, $wgScript, $wgUser, $wgRequest; // Check for submission if ($this->trySubmit($article, $queue)) { return; } $wgOut->setPageTitle(wfMsg("deletequeue-{$queue}-title", $article->mTitle->getPrefixedText())); $wgOut->addWikiMsg("deletequeue-{$queue}-text", $article->mTitle->getPrefixedText()); // Build deletion form. $fields = array(); $fields['deletequeue-delnom-reason'] = Xml::listDropDown('wpReason', DeleteQueueInterface::getReasonList($queue), wfMsg("deletequeue-delnom-otherreason")); $fields['deletequeue-delnom-extra'] = Xml::input('wpExtra', 45); $article_id = $article->getId(); $title = $this->getTitle("nominate/{$article_id}/{$queue}"); $form = Xml::buildForm($fields, "deletequeue-delnom-submit"); $form .= Html::Hidden('title', $title->getPrefixedText()); $form .= Html::Hidden('queue', $queue); $form .= Html::Hidden('wpEditToken', $wgUser->editToken()); $form = Xml::tags('form', array('action' => $title->getLocalUrl(), 'method' => 'POST'), $form); $wgOut->addHTML($form); }
/** * Generate the content of each table row (1 row = 1 banner) */ function formatRow($row) { // Begin banner row $htmlOut = Xml::openElement('tr'); if ($this->editable) { // Add box $htmlOut .= Xml::tags('td', array('valign' => 'top'), Xml::check('addTemplates[]', '', array('value' => $row->tmp_name))); // Weight select $htmlOut .= Xml::tags('td', array('valign' => 'top'), Xml::listDropDown("weight[{$row->tmp_id}]", CentralNotice::dropDownList(wfMsg('centralnotice-weight'), range(0, 100, 5)), '', '25', '', '')); } // Link and Preview $render = new SpecialBannerLoader(); $render->siteName = 'Wikipedia'; $render->language = $this->mRequest->getVal('wpUserLanguage'); try { $preview = $render->getHtmlNotice($row->tmp_name); } catch (SpecialBannerLoaderException $e) { $preview = wfMsg('centralnotice-nopreview'); } $htmlOut .= Xml::tags('td', array('valign' => 'top'), $this->getSkin()->makeLinkObj($this->viewPage, htmlspecialchars($row->tmp_name), 'template=' . urlencode($row->tmp_name)) . Xml::fieldset(wfMsg('centralnotice-preview'), $preview, array('class' => 'cn-bannerpreview'))); // End banner row $htmlOut .= Xml::closeElement('tr'); return $htmlOut; }
/** * Build the input form * * @return string HTML form */ function buildForm() { $context = $this->mContext; $user = $context->getUser(); $output = $context->getOutput(); $lang = $context->getLanguage(); $cascadingRestrictionLevels = $context->getConfig()->get('CascadingRestrictionLevels'); $out = ''; if (!$this->disabled) { $output->addModules('mediawiki.legacy.protect'); $output->addJsConfigVars('wgCascadeableLevels', $cascadingRestrictionLevels); $out .= Xml::openElement('form', ['method' => 'post', 'action' => $this->mTitle->getLocalURL('action=protect'), 'id' => 'mw-Protect-Form']); } $out .= Xml::openElement('fieldset') . Xml::element('legend', null, $context->msg('protect-legend')->text()) . Xml::openElement('table', ['id' => 'mwProtectSet']) . Xml::openElement('tbody'); $scExpiryOptions = wfMessage('protect-expiry-options')->inContentLanguage()->text(); $showProtectOptions = $scExpiryOptions !== '-' && !$this->disabled; // Not all languages have V_x <-> N_x relation foreach ($this->mRestrictions as $action => $selected) { // Messages: // restriction-edit, restriction-move, restriction-create, restriction-upload $msg = $context->msg('restriction-' . $action); $out .= "<tr><td>" . Xml::openElement('fieldset') . Xml::element('legend', null, $msg->exists() ? $msg->text() : $action) . Xml::openElement('table', ['id' => "mw-protect-table-{$action}"]) . "<tr><td>" . $this->buildSelector($action, $selected) . "</td></tr><tr><td>"; $mProtectexpiry = Xml::label($context->msg('protectexpiry')->text(), "mwProtectExpirySelection-{$action}"); $mProtectother = Xml::label($context->msg('protect-othertime')->text(), "mwProtect-{$action}-expires"); $expiryFormOptions = new XmlSelect("wpProtectExpirySelection-{$action}", "mwProtectExpirySelection-{$action}", $this->mExpirySelection[$action]); $expiryFormOptions->setAttribute('tabindex', '2'); if ($this->disabled) { $expiryFormOptions->setAttribute('disabled', 'disabled'); } if ($this->mExistingExpiry[$action]) { if ($this->mExistingExpiry[$action] == 'infinity') { $existingExpiryMessage = $context->msg('protect-existing-expiry-infinity'); } else { $timestamp = $lang->userTimeAndDate($this->mExistingExpiry[$action], $user); $d = $lang->userDate($this->mExistingExpiry[$action], $user); $t = $lang->userTime($this->mExistingExpiry[$action], $user); $existingExpiryMessage = $context->msg('protect-existing-expiry', $timestamp, $d, $t); } $expiryFormOptions->addOption($existingExpiryMessage->text(), 'existing'); } $expiryFormOptions->addOption($context->msg('protect-othertime-op')->text(), 'othertime'); foreach (explode(',', $scExpiryOptions) as $option) { if (strpos($option, ":") === false) { $show = $value = $option; } else { list($show, $value) = explode(":", $option); } $expiryFormOptions->addOption($show, htmlspecialchars($value)); } # Add expiry dropdown if ($showProtectOptions && !$this->disabled) { $out .= "\n\t\t\t\t\t<table><tr>\n\t\t\t\t\t\t<td class='mw-label'>\n\t\t\t\t\t\t\t{$mProtectexpiry}\n\t\t\t\t\t\t</td>\n\t\t\t\t\t\t<td class='mw-input'>" . $expiryFormOptions->getHTML() . "</td>\n\t\t\t\t\t</tr></table>"; } # Add custom expiry field $attribs = ['id' => "mwProtect-{$action}-expires"] + $this->disabledAttrib; $out .= "<table><tr>\n\t\t\t\t\t<td class='mw-label'>" . $mProtectother . '</td> <td class="mw-input">' . Xml::input("mwProtect-expiry-{$action}", 50, $this->mExpiry[$action], $attribs) . '</td> </tr></table>'; $out .= "</td></tr>" . Xml::closeElement('table') . Xml::closeElement('fieldset') . "</td></tr>"; } # Give extensions a chance to add items to the form Hooks::run('ProtectionForm::buildForm', [$this->mArticle, &$out]); $out .= Xml::closeElement('tbody') . Xml::closeElement('table'); // JavaScript will add another row with a value-chaining checkbox if ($this->mTitle->exists()) { $out .= Xml::openElement('table', ['id' => 'mw-protect-table2']) . Xml::openElement('tbody'); $out .= '<tr> <td></td> <td class="mw-input">' . Xml::checkLabel($context->msg('protect-cascade')->text(), 'mwProtect-cascade', 'mwProtect-cascade', $this->mCascade, $this->disabledAttrib) . "</td>\n\t\t\t\t</tr>\n"; $out .= Xml::closeElement('tbody') . Xml::closeElement('table'); } # Add manual and custom reason field/selects as well as submit if (!$this->disabled) { $mProtectreasonother = Xml::label($context->msg('protectcomment')->text(), 'wpProtectReasonSelection'); $mProtectreason = Xml::label($context->msg('protect-otherreason')->text(), 'mwProtect-reason'); $reasonDropDown = Xml::listDropDown('wpProtectReasonSelection', wfMessage('protect-dropdown')->inContentLanguage()->text(), wfMessage('protect-otherreason-op')->inContentLanguage()->text(), $this->mReasonSelection, 'mwProtect-reason', 4); $out .= Xml::openElement('table', ['id' => 'mw-protect-table3']) . Xml::openElement('tbody'); $out .= "\n\t\t\t\t<tr>\n\t\t\t\t\t<td class='mw-label'>\n\t\t\t\t\t\t{$mProtectreasonother}\n\t\t\t\t\t</td>\n\t\t\t\t\t<td class='mw-input'>\n\t\t\t\t\t\t{$reasonDropDown}\n\t\t\t\t\t</td>\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\t<td class='mw-label'>\n\t\t\t\t\t\t{$mProtectreason}\n\t\t\t\t\t</td>\n\t\t\t\t\t<td class='mw-input'>" . Xml::input('mwProtect-reason', 60, $this->mReason, ['type' => 'text', 'id' => 'mwProtect-reason', 'maxlength' => 180]) . "</td>\n\t\t\t\t</tr>"; # Disallow watching is user is not logged in if ($user->isLoggedIn()) { $out .= "\n\t\t\t\t<tr>\n\t\t\t\t\t<td></td>\n\t\t\t\t\t<td class='mw-input'>" . Xml::checkLabel($context->msg('watchthis')->text(), 'mwProtectWatch', 'mwProtectWatch', $user->isWatched($this->mTitle) || $user->getOption('watchdefault')) . "</td>\n\t\t\t\t</tr>"; } $out .= "\n\t\t\t\t<tr>\n\t\t\t\t\t<td></td>\n\t\t\t\t\t<td class='mw-submit'>" . Xml::submitButton($context->msg('confirm')->text(), ['id' => 'mw-Protect-submit']) . "</td>\n\t\t\t\t</tr>\n"; $out .= Xml::closeElement('tbody') . Xml::closeElement('table'); } $out .= Xml::closeElement('fieldset'); if ($user->isAllowed('editinterface')) { $link = Linker::linkKnown($context->msg('protect-dropdown')->inContentLanguage()->getTitle(), $context->msg('protect-edit-reasonlist')->escaped(), [], ['action' => 'edit']); $out .= '<p class="mw-protect-editreasons">' . $link . '</p>'; } if (!$this->disabled) { $out .= Html::hidden('wpEditToken', $user->getEditToken(['protect', $this->mTitle->getPrefixedDBkey()])); $out .= Xml::closeElement('form'); } return $out; }
/** * Show the confirmation form */ private function showForm() { global $wgOut, $wgUser, $wgRequest; if ($wgUser->isAllowed('suppressrevision')) { $suppress = "<tr id=\"wpDeleteSuppressRow\">\n\t\t\t\t\t<td></td>\n\t\t\t\t\t<td class='mw-input'><strong>" . Xml::checkLabel(wfMessage('revdelete-suppress')->text(), 'wpSuppress', 'wpSuppress', false, array('tabindex' => '3')) . "</strong></td>\n\t\t\t\t</tr>"; } else { $suppress = ''; } $checkWatch = $wgUser->getBoolOption('watchdeletion') || $wgUser->isWatched($this->title); $form = Xml::openElement('form', array('method' => 'post', 'action' => $this->getAction(), 'id' => 'mw-img-deleteconfirm')) . Xml::openElement('fieldset') . Xml::element('legend', null, wfMessage('filedelete-legend')->text()) . Html::hidden('wpEditToken', $wgUser->getEditToken($this->oldimage)) . $this->prepareMessage('filedelete-intro') . Xml::openElement('table', array('id' => 'mw-img-deleteconfirm-table')) . "<tr>\n\t\t\t\t<td class='mw-label'>" . Xml::label(wfMessage('filedelete-comment')->text(), 'wpDeleteReasonList') . "</td>\n\t\t\t\t<td class='mw-input'>" . Xml::listDropDown('wpDeleteReasonList', wfMessage('filedelete-reason-dropdown')->inContentLanguage()->text(), wfMessage('filedelete-reason-otherlist')->inContentLanguage()->text(), '', 'wpReasonDropDown', 1) . "</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td class='mw-label'>" . Xml::label(wfMessage('filedelete-otherreason')->text(), 'wpReason') . "</td>\n\t\t\t\t<td class='mw-input'>" . Xml::input('wpReason', 60, $wgRequest->getText('wpReason'), array('type' => 'text', 'maxlength' => '255', 'tabindex' => '2', 'id' => 'wpReason')) . "</td>\n\t\t\t</tr>\n\t\t\t{$suppress}"; if ($wgUser->isLoggedIn()) { $form .= "\n\t\t\t<tr>\n\t\t\t\t<td></td>\n\t\t\t\t<td class='mw-input'>" . Xml::checkLabel(wfMessage('watchthis')->text(), 'wpWatch', 'wpWatch', $checkWatch, array('tabindex' => '3')) . "</td>\n\t\t\t</tr>"; } $form .= "\n\t\t\t<tr>\n\t\t\t\t<td></td>\n\t\t\t\t<td class='mw-submit'>" . Xml::submitButton(wfMessage('filedelete-submit')->text(), array('name' => 'mw-filedelete-submit', 'id' => 'mw-filedelete-submit', 'tabindex' => '4')) . "</td>\n\t\t\t</tr>" . Xml::closeElement('table') . Xml::closeElement('fieldset') . Xml::closeElement('form'); if ($wgUser->isAllowed('editinterface')) { $title = Title::makeTitle(NS_MEDIAWIKI, 'Filedelete-reason-dropdown'); $link = Linker::link($title, wfMessage('filedelete-edit-reasonlist')->escaped(), array(), array('action' => 'edit')); $form .= '<p class="mw-filedelete-editreasons">' . $link . '</p>'; } $wgOut->addHTML($form); }
function weightDropDown($name, $selected) { if ($this->editable) { return Xml::listDropDown($name, $this->dropDownList(wfMsg('centralnotice-weight'), range(0, 100, 5)), '', $selected, '', 1); } else { return htmlspecialchars($selected); } }
/** * Output deletion confirmation dialog * @todo FIXME: Move to another file? * @param string $reason Prefilled reason */ public function confirmDelete($reason) { wfDebug("Article::confirmDelete\n"); $title = $this->getTitle(); $ctx = $this->getContext(); $outputPage = $ctx->getOutput(); $useMediaWikiUIEverywhere = $ctx->getConfig()->get('UseMediaWikiUIEverywhere'); $outputPage->setPageTitle(wfMessage('delete-confirm', $title->getPrefixedText())); $outputPage->addBacklinkSubtitle($title); $outputPage->setRobotPolicy('noindex,nofollow'); $backlinkCache = $title->getBacklinkCache(); if ($backlinkCache->hasLinks('pagelinks') || $backlinkCache->hasLinks('templatelinks')) { $outputPage->wrapWikiMsg("<div class='mw-warning plainlinks'>\n\$1\n</div>\n", 'deleting-backlinks-warning'); } $outputPage->addWikiMsg('confirmdeletetext'); Hooks::run('ArticleConfirmDelete', array($this, $outputPage, &$reason)); $user = $this->getContext()->getUser(); if ($user->isAllowed('suppressrevision')) { $suppress = Html::openElement('div', array('id' => 'wpDeleteSuppressRow')) . Xml::checkLabel(wfMessage('revdelete-suppress')->text(), 'wpSuppress', 'wpSuppress', false, array('tabindex' => '4')) . Html::closeElement('div'); } else { $suppress = ''; } $checkWatch = $user->getBoolOption('watchdeletion') || $user->isWatched($title); $form = Html::openElement('form', array('method' => 'post', 'action' => $title->getLocalURL('action=delete'), 'id' => 'deleteconfirm')) . Html::openElement('fieldset', array('id' => 'mw-delete-table')) . Html::element('legend', null, wfMessage('delete-legend')->text()) . Html::openElement('div', array('id' => 'mw-deleteconfirm-table')) . Html::openElement('div', array('id' => 'wpDeleteReasonListRow')) . Html::label(wfMessage('deletecomment')->text(), 'wpDeleteReasonList') . ' ' . Xml::listDropDown('wpDeleteReasonList', wfMessage('deletereason-dropdown')->inContentLanguage()->text(), wfMessage('deletereasonotherlist')->inContentLanguage()->text(), '', 'wpReasonDropDown', 1) . Html::closeElement('div') . Html::openElement('div', array('id' => 'wpDeleteReasonRow')) . Html::label(wfMessage('deleteotherreason')->text(), 'wpReason') . ' ' . Html::input('wpReason', $reason, 'text', array('size' => '60', 'maxlength' => '255', 'tabindex' => '2', 'id' => 'wpReason', 'class' => 'mw-ui-input-inline', 'autofocus')) . Html::closeElement('div'); # Disallow watching if user is not logged in if ($user->isLoggedIn()) { $form .= Xml::checkLabel(wfMessage('watchthis')->text(), 'wpWatch', 'wpWatch', $checkWatch, array('tabindex' => '3')); } $form .= Html::openElement('div') . $suppress . Xml::submitButton(wfMessage('deletepage')->text(), array('name' => 'wpConfirmB', 'id' => 'wpConfirmB', 'tabindex' => '5', 'class' => $useMediaWikiUIEverywhere ? 'mw-ui-button mw-ui-destructive' : '')) . Html::closeElement('div') . Html::closeElement('div') . Xml::closeElement('fieldset') . Html::hidden('wpEditToken', $user->getEditToken(array('delete', $title->getPrefixedText()))) . Xml::closeElement('form'); if ($user->isAllowed('editinterface')) { $link = Linker::linkKnown($ctx->msg('deletereason-dropdown')->inContentLanguage()->getTitle(), wfMessage('delete-edit-reasonlist')->escaped(), array(), array('action' => 'edit')); $form .= '<p class="mw-delete-editreasons">' . $link . '</p>'; } $outputPage->addHTML($form); $deleteLogPage = new LogPage('delete'); $outputPage->addHTML(Xml::element('h2', null, $deleteLogPage->getName()->text())); LogEventsList::showLogExtract($outputPage, 'delete', $title); }
/** * Show a list of items that we will operate on, and show a form with checkboxes * which will allow the user to choose new visibility settings. */ protected function showForm() { $UserAllowed = true; if ($this->typeName == 'logging') { $this->getOutput()->addWikiMsg('logdelete-selected', $this->getLanguage()->formatNum(count($this->ids))); } else { $this->getOutput()->addWikiMsg('revdelete-selected', $this->targetObj->getPrefixedText(), count($this->ids)); } $this->getOutput()->addHTML("<ul>"); $numRevisions = 0; // Live revisions... $list = $this->getList(); for ($list->reset(); $list->current(); $list->next()) { $item = $list->current(); if (!$item->canView()) { if (!$this->submitClicked) { throw new PermissionsError('suppressrevision'); } $UserAllowed = false; } $numRevisions++; $this->getOutput()->addHTML($item->getHTML()); } if (!$numRevisions) { throw new ErrorPageError('revdelete-nooldid-title', 'revdelete-nooldid-text'); } $this->getOutput()->addHTML("</ul>"); // Explanation text $this->addUsageText(); // Normal sysops can always see what they did, but can't always change it if (!$UserAllowed) { return; } // Show form if the user can submit if ($this->mIsAllowed) { $out = Xml::openElement('form', array('method' => 'post', 'action' => $this->getPageTitle()->getLocalURL(array('action' => 'submit')), 'id' => 'mw-revdel-form-revisions')) . Xml::fieldset($this->msg('revdelete-legend')->text()) . $this->buildCheckBoxes() . Xml::openElement('table') . "<tr>\n" . '<td class="mw-label">' . Xml::label($this->msg('revdelete-log')->text(), 'wpRevDeleteReasonList') . '</td>' . '<td class="mw-input">' . Xml::listDropDown('wpRevDeleteReasonList', $this->msg('revdelete-reason-dropdown')->inContentLanguage()->text(), $this->msg('revdelete-reasonotherlist')->inContentLanguage()->text(), $this->getRequest()->getText('wpRevDeleteReasonList', 'other'), 'wpReasonDropDown', 1) . '</td>' . "</tr><tr>\n" . '<td class="mw-label">' . Xml::label($this->msg('revdelete-otherreason')->text(), 'wpReason') . '</td>' . '<td class="mw-input">' . Xml::input('wpReason', 60, $this->otherReason, array('id' => 'wpReason', 'maxlength' => 100)) . '</td>' . "</tr><tr>\n" . '<td></td>' . '<td class="mw-submit">' . Xml::submitButton($this->msg('revdelete-submit', $numRevisions)->text(), array('name' => 'wpSubmit')) . '</td>' . "</tr>\n" . Xml::closeElement('table') . Html::hidden('wpEditToken', $this->getUser()->getEditToken()) . Html::hidden('target', $this->targetObj->getPrefixedText()) . Html::hidden('type', $this->typeName) . Html::hidden('ids', implode(',', $this->ids)) . Xml::closeElement('fieldset') . "\n"; } else { $out = ''; } if ($this->mIsAllowed) { $out .= Xml::closeElement('form') . "\n"; // Show link to edit the dropdown reasons if ($this->getUser()->isAllowed('editinterface')) { $title = Title::makeTitle(NS_MEDIAWIKI, 'Revdelete-reason-dropdown'); $link = Linker::link($title, $this->msg('revdelete-edit-reasonlist')->escaped(), array(), array('action' => 'edit')); $out .= Xml::tags('p', array('class' => 'mw-revdel-editreasons'), $link) . "\n"; } } $this->getOutput()->addHTML($out); }
/** * Process the "Review Speedy" action * @param $article Article object being reviewed */ public function show($params) { global $wgOut, $wgScript, $wgUser, $wgRequest; list($action, $case_id) = $params; $dqi = DeleteQueueItem::newFromId($case_id); $article = $this->mArticle = $dqi->getArticle(); $queue = $dqi->getQueue(); if (!$queue) { // ... $wgOut->addWikiMsg('deletequeue-notqueued'); return; } // Check permissions $editErrors = $article->mTitle->getUserPermissionsErrors('edit', $wgUser); $nomErrors = $article->mTitle->getUserPermissionsErrors("{$queue}-review", $wgUser); if (count(array_merge($editErrors, $nomErrors))) { // Permissions errors. if (count($editErrors)) { $editError = $wgOut->formatPermissionsErrorMessage($editErrors, 'edit'); $nomErrors[] = array('deletequeue-permissions-noedit', $editError); } $wgOut->showPermissionsErrorPage($nomErrors, "{$queue}-review"); return; } list($enabledActions, $disabledActions) = $this->availableActions(); $haveRequeueOption = false; $shownActions = array_merge(array_keys($disabledActions), $enabledActions); foreach ($shownActions as $val) { if (strpos($val, 'requeue') == 0) { $haveRequeueOption = true; } } if (($error = $this->submit($article)) === true) { $wgOut->setPageTitle(wfMsg("deletequeue-review-success-title")); $wgOut->addWikiMsg("deletequeue-review-success"); return; } $wgOut->setPageTitle(wfMsg("deletequeue-review{$queue}-title", $article->mTitle->getPrefixedText())); $discussionPage = $queue == 'deletediscuss' ? $dqi->getDiscussionPage()->mTitle->getPrefixedText() : null; $wgOut->addWikiMsg("deletequeue-review{$queue}-text", $article->mTitle->getPrefixedText(), $discussionPage); // Cautions if there's an objection if (count($dqi->mVotesObject) > 0) { $wgOut->addWikiMsg("deletequeue-review-objections", count($dqi->mVotesObject)); } if ($error) { $wgOut->addHTML('<p>' . $error . '</p>'); } // Details of nomination $wgOut->addHTML(Xml::openElement('fieldset') . Xml::element('legend', array(), wfMsg('deletequeue-review-original'))); $wgOut->addWikitext($dqi->getReason()); $wgOut->addHTML(Xml::closeElement('fieldset')); $output = ''; // Give the user options $option_selection = ''; // // Action radio buttons // Accept the nomination as-is $accept = Xml::radioLabel(wfMsg('deletequeue-review-delete'), 'wpSpeedyAction', 'delete', 'mw-review-accept'); $option_selection .= $this->getActionOrError('delete', $accept, null, Xml::tags('li', array(), '$1')); // Accept nomination, but with a different reasoning. $change_option = Xml::radioLabel(wfMsg('deletequeue-review-change'), 'wpSpeedyAction', 'change', 'mw-review-change'); $change_fields = array(); $change_fields['deletequeue-review-newreason'] = Xml::listDropDown('wpSpeedyNewReason', DeleteQueueInterface::getReasonList($queue), wfMsg('deletequeue-delnom-otherreason')); $change_fields['deletequeue-review-newextra'] = Xml::input('wpSpeedyNewExtra', 45, ''); $change_option .= Xml::buildForm($change_fields); $option_selection .= $this->getActionOrError('delete', $change_option, wfMsgExt('deletequeue-review-change', array('parseinline')), Xml::tags('li', array(), '$1')); // Reject nomination, queue into a different deletion queue. if ($haveRequeueOption) { $requeue_option = Xml::radioLabel(wfMsg('deletequeue-review-requeue'), 'wpSpeedyAction', 'requeue', 'mw-review-requeue'); $new_queues = array('prod', 'deletediscuss'); $requeue_queues = ''; foreach ($new_queues as $option) { $this_queue = Xml::radioLabel(wfMsg("deletequeue-queue-{$option}"), 'wpSpeedyRequeue', $option, "mw-review-requeue-{$option}"); $disabledMsg = wfMsgExt("deletequeue-requeuedisabled", array('parseinline'), array(wfMsgNoTrans("deletequeue-queue-{$option}"))); $requeue_queues .= $this->getActionOrError("requeue-{$option}", $this_queue, $disabledMsg, Xml::tags('li', array(), '$1')); } $requeue_option .= Xml::tags('ul', array(), $requeue_queues); $requeue_fields = array(); $requeue_fields['deletequeue-review-newreason'] = Xml::listDropDown('wpSpeedyNewReason', DeleteQueueInterface::getReasonList('generic'), wfMsg("deletequeue-delnom-otherreason")); $requeue_fields['deletequeue-review-newextra'] = Xml::input('wpSpeedyNewExtra', 45, ''); $requeue_option .= Xml::buildForm($requeue_fields); $option_selection .= Xml::tags('li', array(), $requeue_option); } // Reject nomination outright. $dq = Xml::radioLabel(wfMsg('deletequeue-review-dequeue'), 'wpSpeedyAction', 'dequeue', 'mw-review-dequeue'); $option_selection .= $this->getActionOrError('dequeue', $dq, null, Xml::tags('li', array(), '$1')); // // Convert to a list. $option_selection = Xml::tags('ul', array(), $option_selection); $option_selection = Xml::fieldset(wfMsg('deletequeue-review-action'), $option_selection); $output .= $option_selection; // Reason etc. $fields = array('deletequeue-review-reason' => Xml::input('wpReason', 45, null)); $output .= Xml::buildForm($fields, 'deletequeue-review-submit'); // Form stuff $output .= Html::Hidden('title', $this->getTitle("case/" . $dqi->getCaseID() . "/review")); $output .= Html::Hidden('wpEditToken', $wgUser->editToken()); $output = Xml::tags('form', array('action' => $article->mTitle->getLocalURL(), 'method' => 'POST'), $output); $wgOut->addHTML($output); }
public function showForm($err = null) { $out = $this->getOutput(); $form = $this->form; // convenience $title = $this->form->getPage(); $oldConfig = $form->getOldConfig(); $s = ''; // form HTML string # Add any error messages if ("" != $err) { $out->setSubtitle(wfMsgHtml('formerror')); $out->addHTML("<p class='error'>{$err}</p>\n"); } # Add header text if (!$form->isAllowed()) { $s .= wfMsgExt('stabilization-perm', 'parse', $title->getPrefixedText()); } else { $s .= wfMsgExt('stabilization-text', 'parse', $title->getPrefixedText()); } # Borrow some protection messages for dropdowns $reasonDropDown = Xml::listDropDown('wpReasonSelection', wfMsgForContent('protect-dropdown'), wfMsgForContent('protect-otherreason-op'), $form->getReasonSelection(), 'mwStabilize-reason', 4); $scExpiryOptions = wfMsgForContent('protect-expiry-options'); $showProtectOptions = $scExpiryOptions !== '-' && $form->isAllowed(); $dropdownOptions = array(); // array of <label,value> # Add the current expiry as a dropdown option if ($oldConfig['expiry'] && $oldConfig['expiry'] != Block::infinity()) { $timestamp = $this->getLang()->timeanddate($oldConfig['expiry']); $d = $this->getLang()->date($oldConfig['expiry']); $t = $this->getLang()->time($oldConfig['expiry']); $dropdownOptions[] = array(wfMsg('protect-existing-expiry', $timestamp, $d, $t), 'existing'); } # Add "other time" expiry dropdown option $dropdownOptions[] = array(wfMsg('protect-othertime-op'), 'othertime'); # Add custom expiry dropdown options (from MediaWiki message) foreach (explode(',', $scExpiryOptions) as $option) { if (strpos($option, ":") === false) { $show = $value = $option; } else { list($show, $value) = explode(":", $option); } $dropdownOptions[] = array($show, $value); } # Actually build the options HTML... $expiryFormOptions = ''; foreach ($dropdownOptions as $option) { $show = htmlspecialchars($option[0]); $value = htmlspecialchars($option[1]); $expiryFormOptions .= Xml::option($show, $value, $form->getExpirySelection() === $value) . "\n"; } # Build up the form... $s .= Xml::openElement('form', array('name' => 'stabilization', 'action' => $this->getTitle()->getLocalUrl(), 'method' => 'post')); # Add stable version override and selection options $s .= Xml::fieldset(wfMsg('stabilization-def'), false) . "\n" . Xml::radioLabel(wfMsg('stabilization-def1'), 'wpStableconfig-override', 1, 'default-stable', 1 == $form->getOverride(), $this->disabledAttr()) . '<br />' . "\n" . Xml::radioLabel(wfMsg('stabilization-def2'), 'wpStableconfig-override', 0, 'default-current', 0 == $form->getOverride(), $this->disabledAttr()) . "\n" . Xml::closeElement('fieldset'); # Add autoreview restriction select $s .= Xml::fieldset(wfMsg('stabilization-restrict'), false) . $this->buildSelector($form->getAutoreview()) . Xml::closeElement('fieldset') . Xml::fieldset(wfMsg('stabilization-leg'), false) . Xml::openElement('table'); # Add expiry dropdown to form... if ($showProtectOptions && $form->isAllowed()) { $s .= "\n\t\t\t\t<tr>\n\t\t\t\t\t<td class='mw-label'>" . Xml::label(wfMsg('stabilization-expiry'), 'mwStabilizeExpirySelection') . "</td>\n\t\t\t\t\t<td class='mw-input'>" . Xml::tags('select', array('id' => 'mwStabilizeExpirySelection', 'name' => 'wpExpirySelection', 'onchange' => 'onFRChangeExpiryDropdown()') + $this->disabledAttr(), $expiryFormOptions) . "</td>\n\t\t\t\t</tr>"; } # Add custom expiry field to form... $attribs = array('id' => "mwStabilizeExpiryOther", 'onkeyup' => 'onFRChangeExpiryField()') + $this->disabledAttr(); $s .= "\n\t\t\t<tr>\n\t\t\t\t<td class='mw-label'>" . Xml::label(wfMsg('stabilization-othertime'), 'mwStabilizeExpiryOther') . '</td> <td class="mw-input">' . Xml::input("mwStabilize-expiry", 50, $form->getExpiryCustom(), $attribs) . '</td> </tr>'; # Add comment input and submit button if ($form->isAllowed()) { $watchLabel = wfMsgExt('watchthis', 'parseinline'); $watchAttribs = array('accesskey' => wfMsg('accesskey-watch'), 'id' => 'wpWatchthis'); $watchChecked = $this->getUser()->getOption('watchdefault') || $title->userIsWatching(); $reviewLabel = wfMsgExt('stabilization-review', 'parseinline'); $s .= ' <tr> <td class="mw-label">' . xml::label(wfMsg('stabilization-comment'), 'wpReasonSelection') . '</td> <td class="mw-input">' . $reasonDropDown . '</td> </tr> <tr> <td class="mw-label">' . Xml::label(wfMsg('stabilization-otherreason'), 'wpReason') . '</td> <td class="mw-input">' . Xml::input('wpReason', 70, $form->getReasonExtra(), array('id' => 'wpReason', 'maxlength' => 255)) . '</td> </tr> <tr> <td></td> <td class="mw-input">' . Xml::check('wpReviewthis', $form->getReviewThis(), array('id' => 'wpReviewthis')) . "<label for='wpReviewthis'>{$reviewLabel}</label>" . '     ' . Xml::check('wpWatchthis', $watchChecked, $watchAttribs) . " <label for='wpWatchthis' " . Xml::expandAttributes(array('title' => Linker::titleAttrib('watch', 'withaccess'))) . ">{$watchLabel}</label>" . '</td> </tr> <tr> <td></td> <td class="mw-submit">' . Xml::submitButton(wfMsg('stabilization-submit')) . '</td> </tr>' . Xml::closeElement('table') . Html::hidden('title', $this->getTitle()->getPrefixedDBKey()) . Html::hidden('page', $title->getPrefixedText()) . Html::hidden('wpEditToken', $this->getUser()->editToken()); } else { $s .= Xml::closeElement('table'); } $s .= Xml::closeElement('fieldset') . Xml::closeElement('form'); $out->addHTML($s); $out->addHTML(Xml::element('h2', null, htmlspecialchars(LogPage::logName('stable')))); LogEventsList::showLogExtract($out, 'stable', $title->getPrefixedText(), '', array('lim' => 25)); # Add some javascript for expiry dropdowns $out->addScript("<script type=\"text/javascript\">\n\t\t\t\tfunction onFRChangeExpiryDropdown() {\n\t\t\t\t\tdocument.getElementById('mwStabilizeExpiryOther').value = '';\n\t\t\t\t}\n\t\t\t\tfunction onFRChangeExpiryField() {\n\t\t\t\t\tdocument.getElementById('mwStabilizeExpirySelection').value = 'othertime';\n\t\t\t\t}\n\t\t\t</script>"); }
/** * Output deletion confirmation dialog * @todo FIXME: Move to another file? * @param string $reason prefilled reason */ public function confirmDelete($reason) { wfDebug("Article::confirmDelete\n"); $outputPage = $this->getContext()->getOutput(); $outputPage->setPageTitle(wfMessage('delete-confirm', $this->getTitle()->getPrefixedText())); $outputPage->addBacklinkSubtitle($this->getTitle()); $outputPage->setRobotPolicy('noindex,nofollow'); $backlinkCache = $this->getTitle()->getBacklinkCache(); if ($backlinkCache->hasLinks('pagelinks') || $backlinkCache->hasLinks('templatelinks')) { $outputPage->wrapWikiMsg("<div class='mw-warning plainlinks'>\n\$1\n</div>\n", 'deleting-backlinks-warning'); } $outputPage->addWikiMsg('confirmdeletetext'); wfRunHooks('ArticleConfirmDelete', array($this, $outputPage, &$reason)); $user = $this->getContext()->getUser(); if ($user->isAllowed('suppressrevision')) { $suppress = "<tr id=\"wpDeleteSuppressRow\">\n\t\t\t\t\t<td></td>\n\t\t\t\t\t<td class='mw-input'><strong>" . Xml::checkLabel(wfMessage('revdelete-suppress')->text(), 'wpSuppress', 'wpSuppress', false, array('tabindex' => '4')) . "</strong></td>\n\t\t\t\t</tr>"; } else { $suppress = ''; } $checkWatch = $user->getBoolOption('watchdeletion') || $user->isWatched($this->getTitle()); $form = Xml::openElement('form', array('method' => 'post', 'action' => $this->getTitle()->getLocalURL('action=delete'), 'id' => 'deleteconfirm')) . Xml::openElement('fieldset', array('id' => 'mw-delete-table')) . Xml::tags('legend', null, wfMessage('delete-legend')->escaped()) . Xml::openElement('table', array('id' => 'mw-deleteconfirm-table')) . "<tr id=\"wpDeleteReasonListRow\">\n\t\t\t\t<td class='mw-label'>" . Xml::label(wfMessage('deletecomment')->text(), 'wpDeleteReasonList') . "</td>\n\t\t\t\t<td class='mw-input'>" . Xml::listDropDown('wpDeleteReasonList', wfMessage('deletereason-dropdown')->inContentLanguage()->text(), wfMessage('deletereasonotherlist')->inContentLanguage()->text(), '', 'wpReasonDropDown', 1) . "</td>\n\t\t\t</tr>\n\t\t\t<tr id=\"wpDeleteReasonRow\">\n\t\t\t\t<td class='mw-label'>" . Xml::label(wfMessage('deleteotherreason')->text(), 'wpReason') . "</td>\n\t\t\t\t<td class='mw-input'>" . Html::input('wpReason', $reason, 'text', array('size' => '60', 'maxlength' => '255', 'tabindex' => '2', 'id' => 'wpReason', 'autofocus', 'class' => 'input_med')) . "</td>\n\t\t\t</tr>"; # Disallow watching if user is not logged in if ($user->isLoggedIn()) { $form .= "\n\t\t\t<tr>\n\t\t\t\t<td></td>\n\t\t\t\t<td class='mw-input'>" . Xml::checkLabel(wfMessage('watchthis')->text(), 'wpWatch', 'wpWatch', $checkWatch, array('tabindex' => '3')) . "</td>\n\t\t\t</tr>"; } $form .= "\n\t\t\t{$suppress}\n\t\t\t<tr>\n\t\t\t\t<td></td>\n\t\t\t\t<td class='mw-submit'>" . Xml::submitButton(wfMessage('deletepage')->text(), array('name' => 'wpConfirmB', 'id' => 'wpConfirmB', 'tabindex' => '5', 'class' => 'button primary')) . "</td>\n\t\t\t</tr>" . Xml::closeElement('table') . Xml::closeElement('fieldset') . Html::hidden('wpEditToken', $user->getEditToken(array('delete', $this->getTitle()->getPrefixedText()))) . Xml::closeElement('form'); if ($user->isAllowed('editinterface')) { $title = Title::makeTitle(NS_MEDIAWIKI, 'Deletereason-dropdown'); $link = Linker::link($title, wfMessage('delete-edit-reasonlist')->escaped(), array(), array('action' => 'edit')); $form .= '<p class="mw-delete-editreasons">' . $link . '</p>'; } $outputPage->addHTML($form); $deleteLogPage = new LogPage('delete'); $outputPage->addHTML(Xml::element('h2', null, $deleteLogPage->getName()->text())); LogEventsList::showLogExtract($outputPage, 'delete', $this->getTitle()); }
/** * Output deletion confirmation dialog * @param $par string FIXME: do we need this parameter? One Call from Article::delete with '' only. * @param $reason string Prefilled reason */ function confirmDelete($par, $reason) { global $wgOut, $wgUser, $wgContLang; $align = $wgContLang->isRtl() ? 'left' : 'right'; // Try to choose the right dropdown if possible $defaultReason = ""; wfRunHooks('ArticleConfirmDelete', array($this, &$defaultReason)); wfDebug("Article::confirmDelete\n"); $wgOut->setSubtitle(wfMsg('delete-backlink', $wgUser->getSkin()->makeKnownLinkObj($this->mTitle))); $wgOut->setRobotpolicy('noindex,nofollow'); $wgOut->addWikiMsg('confirmdeletetext'); $form = Xml::openElement('form', array('method' => 'post', 'action' => $this->mTitle->getLocalURL('action=delete' . $par), 'id' => 'deleteconfirm')) . Xml::openElement('table') . "<tr id=\"wpDeleteReasonListRow\">\n\t\t\t\t<td align='{$align}'>" . Xml::label(wfMsg('deletecomment'), 'wpDeleteReasonList') . "</td>\n\t\t\t\t<td>" . Xml::listDropDown('wpDeleteReasonList', wfMsgForContent('deletereason-dropdown'), wfMsgForContent('deletereasonotherlist'), $defaultReason, 'wpReasonDropDown input_med', 1) . "</td>\n\t\t\t</tr>\n\t\t\t<tr id=\"wpDeleteReasonRow\">\n\t\t\t\t<td align='{$align}'>" . Xml::label(wfMsg('deleteotherreason'), 'wpReason') . "</td>\n\t\t\t\t<td>" . Xml::input('wpReason', 60, $reason, array('type' => 'text', 'maxlength' => '255', 'tabindex' => '2', 'id' => 'wpReason', 'class' => 'input_med')) . "</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td></td>\n\t\t\t\t<td>" . Xml::checkLabel(wfMsg('watchthis'), 'wpWatch', 'wpWatch', $wgUser->getBoolOption('watchdeletion') || $this->mTitle->userIsWatching(), array('tabindex' => '3')) . "</td>\n\t\t\t</tr>\n\t\t\t{$r_confirm}\n\t\t\t<tr>\n\t\t\t\t<td></td>\n\t\t\t\t<td>" . Xml::submitButton(wfMsg('deletepage'), array('name' => 'wpConfirmB', 'id' => 'wpConfirmB', 'tabindex' => '4', 'class' => 'button primary')) . "</td>\n\t\t\t</tr>" . Xml::closeElement('table') . Xml::hidden('wpEditToken', $wgUser->editToken()) . Xml::closeElement('form'); $wgOut->addHTML($form); $this->showLogExtract($wgOut); }
/** * Constructs the form which can be used to generate custom graphs. * @param $opts FormOptions */ protected function form(FormOptions $opts) { global $wgOut, $wgScript; $this->setHeaders(); $wgOut->addWikiMsg('translate-statsf-intro'); $wgOut->addHTML(Xml::fieldset(wfMsg('translate-statsf-options')) . Html::openElement('form', array('action' => $wgScript)) . Html::hidden('title', $this->getTitle()->getPrefixedText()) . Html::hidden('preview', 1) . '<table>'); $submit = Xml::submitButton(wfMsg('translate-statsf-submit')); $days = ''; for ($i = 1; $i <= 31; $i++) { $days .= "{$i}\n"; } $years = ''; $currentYear = date('Y'); for ($i = 0; $i < 10; $i++) { $years .= $currentYear - $i . "\n"; } $wgOut->addHTML($this->eInput('width', $opts) . $this->eInput('height', $opts) . '<tr><td colspan="2"><hr /></td></tr>' . '<tr>' . '<td>' . wfMsg('label-for-date') . '</td>' . '<td>' . wfMsg('translationstats-from') . Xml::listDropDown('startday', $days, null, $opts->getValue('startday')) . $this->monthSelector($opts->getValue('startmonth'), null, 'startmonth', 'startmonth') . Xml::listDropDown('startyear', $years, null, $opts->getValue('startyear')) . wfMsg('translationstats-to') . Xml::listDropDown('endday', $days, null, $opts->getValue('endday')) . $this->monthSelector($opts->getValue('endmonth'), null, 'endmonth', 'endmonth') . Xml::listDropDown('endyear', $years, null, $opts->getValue('endyear')) . '</td>' . '</tr>' . $this->eRadio('scale', $opts, array('months', 'weeks', 'days', 'hours')) . $this->eRadio('count', $opts, array('edits', 'users', 'registrations')) . '<tr><td colspan="2"><hr /></td></tr>' . $this->eLanguage('language', $opts) . $this->eGroup('group', $opts) . '<tr><td colspan="2"><hr /></td></tr>' . '<tr><td colspan="2">' . $submit . '</td></tr>'); $wgOut->addHTML('</table>' . '</form>' . '</fieldset>'); if (!$opts['preview']) { return; } $spiParams = ''; foreach ($opts->getChangedValues() as $key => $v) { if ($key === 'preview') { continue; } if ($spiParams !== '') { $spiParams .= ';'; } $spiParams .= wfEscapeWikiText("{$key}={$v}"); } if ($spiParams !== '') { $spiParams = '/' . $spiParams; } $titleText = $this->getTitle()->getPrefixedText(); $wgOut->addHTML(Html::element('hr') . Html::rawElement('div', array('style' => 'margin: 1em auto; text-align: center;'), $this->image($opts))); }
private function dateSelector($prefix, $year = 0, $month = 0, $day = 0) { $dateRanges = CentralNotice::getDateRanges(); $fields = array(array($prefix . "_month", "centralnotice-month", $dateRanges['months'], $month), array($prefix . "_day", "centralnotice-day", $dateRanges['days'], $day), array($prefix . "_year", "centralnotice-year", $dateRanges['years'], $year)); $out = ''; foreach ($fields as $data) { list($field, $label, $set, $current) = $data; $out .= Xml::listDropDown($field, CentralNotice::dropDownList(wfMsg($label), $set), '', $current); } return $out; }
function showForm($err) { global $wgOut, $wgUser, $wgSysopUserBans; $wgOut->setPagetitle(wfMsg('blockip')); $wgOut->addWikiMsg('blockiptext'); if ($wgSysopUserBans) { $mIpaddress = Xml::label(wfMsg('ipadressorusername'), 'mw-bi-target'); } else { $mIpaddress = Xml::label(wfMsg('ipaddress'), 'mw-bi-target'); } $mIpbexpiry = Xml::label(wfMsg('ipbexpiry'), 'wpBlockExpiry'); $mIpbother = Xml::label(wfMsg('ipbother'), 'mw-bi-other'); $mIpbreasonother = Xml::label(wfMsg('ipbreason'), 'wpBlockReasonList'); $mIpbreason = Xml::label(wfMsg('ipbotherreason'), 'mw-bi-reason'); $titleObj = SpecialPage::getTitleFor('Blockip'); $user = User::newFromName($this->BlockAddress); $alreadyBlocked = false; if ($err && $err[0] != 'ipb_already_blocked') { $key = array_shift($err); $msg = wfMsgReal($key, $err); $wgOut->setSubtitle(wfMsgHtml('formerror')); $wgOut->addHTML(Xml::tags('p', array('class' => 'error'), $msg)); } elseif ($this->BlockAddress) { $userId = 0; if (is_object($user)) { $userId = $user->getId(); } $currentBlock = Block::newFromDB($this->BlockAddress, $userId); if (!is_null($currentBlock) && !$currentBlock->mAuto && ($currentBlock->mRangeStart == $currentBlock->mRangeEnd || $currentBlock->mAddress == $this->BlockAddress)) { $wgOut->addWikiMsg('ipb-needreblock', $this->BlockAddress); $alreadyBlocked = true; } } $scBlockExpiryOptions = wfMsgForContent('ipboptions'); $showblockoptions = $scBlockExpiryOptions != '-'; if (!$showblockoptions) { $mIpbother = $mIpbexpiry; } $blockExpiryFormOptions = Xml::option(wfMsg('ipbotheroption'), 'other'); foreach (explode(',', $scBlockExpiryOptions) as $option) { if (strpos($option, ":") === false) { $option = "{$option}:{$option}"; } list($show, $value) = explode(":", $option); $show = htmlspecialchars($show); $value = htmlspecialchars($value); $blockExpiryFormOptions .= Xml::option($show, $value, $this->BlockExpiry === $value ? true : false) . "\n"; } $reasonDropDown = Xml::listDropDown('wpBlockReasonList', wfMsgForContent('ipbreason-dropdown'), wfMsgForContent('ipbreasonotherlist'), $this->BlockReasonList, 'wpBlockDropDown', 4); global $wgStylePath, $wgStyleVersion; $wgOut->addHTML(Xml::tags('script', array('type' => 'text/javascript', 'src' => "{$wgStylePath}/common/block.js?{$wgStyleVersion}"), '') . Xml::openElement('form', array('method' => 'post', 'action' => $titleObj->getLocalURL("action=submit"), 'id' => 'blockip')) . Xml::openElement('fieldset') . Xml::element('legend', null, wfMsg('blockip-legend')) . Xml::openElement('table', array('border' => '0', 'id' => 'mw-blockip-table')) . "<tr>\n\t\t\t\t<td class='mw-label'>\n\t\t\t\t\t{$mIpaddress}\n\t\t\t\t</td>\n\t\t\t\t<td class='mw-input'>" . Xml::input('wpBlockAddress', 45, $this->BlockAddress, array('tabindex' => '1', 'id' => 'mw-bi-target', 'onchange' => 'updateBlockOptions()')) . "\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t\t<tr>"); if ($showblockoptions) { $wgOut->addHTML("\n\t\t\t\t<td class='mw-label'>\n\t\t\t\t\t{$mIpbexpiry}\n\t\t\t\t</td>\n\t\t\t\t<td class='mw-input'>" . Xml::tags('select', array('id' => 'wpBlockExpiry', 'name' => 'wpBlockExpiry', 'onchange' => 'considerChangingExpiryFocus()', 'tabindex' => '2'), $blockExpiryFormOptions) . "</td>"); } $wgOut->addHTML("\n\t\t\t</tr>\n\t\t\t<tr id='wpBlockOther'>\n\t\t\t\t<td class='mw-label'>\n\t\t\t\t\t{$mIpbother}\n\t\t\t\t</td>\n\t\t\t\t<td class='mw-input'>" . Xml::input('wpBlockOther', 45, $this->BlockOther, array('tabindex' => '3', 'id' => 'mw-bi-other')) . "\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td class='mw-label'>\n\t\t\t\t\t{$mIpbreasonother}\n\t\t\t\t</td>\n\t\t\t\t<td class='mw-input'>\n\t\t\t\t\t{$reasonDropDown}\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t\t<tr id=\"wpBlockReason\">\n\t\t\t\t<td class='mw-label'>\n\t\t\t\t\t{$mIpbreason}\n\t\t\t\t</td>\n\t\t\t\t<td class='mw-input'>" . Xml::input('wpBlockReason', 45, $this->BlockReason, array('tabindex' => '5', 'id' => 'mw-bi-reason', 'maxlength' => '200')) . "\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t\t<tr id='wpAnonOnlyRow'>\n\t\t\t\t<td> </td>\n\t\t\t\t<td class='mw-input'>" . Xml::checkLabel(wfMsg('ipbanononly'), 'wpAnonOnly', 'wpAnonOnly', $this->BlockAnonOnly, array('tabindex' => '6')) . "\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t\t<tr id='wpCreateAccountRow'>\n\t\t\t\t<td> </td>\n\t\t\t\t<td class='mw-input'>" . Xml::checkLabel(wfMsg('ipbcreateaccount'), 'wpCreateAccount', 'wpCreateAccount', $this->BlockCreateAccount, array('tabindex' => '7')) . "\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t\t<tr id='wpEnableAutoblockRow'>\n\t\t\t\t<td> </td>\n\t\t\t\t<td class='mw-input'>" . Xml::checkLabel(wfMsg('ipbenableautoblock'), 'wpEnableAutoblock', 'wpEnableAutoblock', $this->BlockEnableAutoblock, array('tabindex' => '8')) . "\n\t\t\t\t</td>\n\t\t\t</tr>"); global $wgSysopEmailBans, $wgBlockAllowsUTEdit; if ($wgSysopEmailBans && $wgUser->isAllowed('blockemail')) { $wgOut->addHTML("\n\t\t\t\t<tr id='wpEnableEmailBan'>\n\t\t\t\t\t<td> </td>\n\t\t\t\t\t<td class='mw-input'>" . Xml::checkLabel(wfMsg('ipbemailban'), 'wpEmailBan', 'wpEmailBan', $this->BlockEmail, array('tabindex' => '9')) . "\n\t\t\t\t\t</td>\n\t\t\t\t</tr>"); } // Allow some users to hide name from block log, blocklist and listusers if ($wgUser->isAllowed('hideuser')) { $wgOut->addHTML("\n\t\t\t\t<tr id='wpEnableHideUser'>\n\t\t\t\t\t<td> </td>\n\t\t\t\t\t<td class='mw-input'>" . Xml::checkLabel(wfMsg('ipbhidename'), 'wpHideName', 'wpHideName', $this->BlockHideName, array('tabindex' => '10')) . "\n\t\t\t\t\t</td>\n\t\t\t\t</tr>"); } # Watchlist their user page? $wgOut->addHTML("\n\t\t\t<tr id='wpEnableWatchUser'>\n\t\t\t\t<td> </td>\n\t\t\t\t<td class='mw-input'>" . Xml::checkLabel(wfMsg('ipbwatchuser'), 'wpWatchUser', 'wpWatchUser', $this->BlockWatchUser, array('tabindex' => '11')) . "\n\t\t\t\t</td>\n\t\t\t</tr>"); if ($wgBlockAllowsUTEdit) { $wgOut->addHTML("\n\t\t\t\t<tr id='wpAllowUsertalkRow'>\n\t\t\t\t\t<td> </td>\n\t\t\t\t\t<td class='mw-input'>" . Xml::checkLabel(wfMsg('ipballowusertalk'), 'wpAllowUsertalk', 'wpAllowUsertalk', $this->BlockAllowUsertalk, array('tabindex' => '12')) . "\n\t\t\t\t\t</td>\n\t\t\t\t</tr>"); } $wgOut->addHTML("\n\t\t\t<tr>\n\t\t\t\t<td style='padding-top: 1em'> </td>\n\t\t\t\t<td class='mw-submit' style='padding-top: 1em'>" . Xml::submitButton(wfMsg($alreadyBlocked ? 'ipb-change-block' : 'ipbsubmit'), array('name' => 'wpBlock', 'tabindex' => '13', 'accesskey' => 's')) . "\n\t\t\t\t</td>\n\t\t\t</tr>" . Xml::closeElement('table') . Xml::hidden('wpEditToken', $wgUser->editToken()) . ($alreadyBlocked ? Xml::hidden('wpChangeBlock', 1) : "") . Xml::closeElement('fieldset') . Xml::closeElement('form') . Xml::tags('script', array('type' => 'text/javascript'), 'updateBlockOptions()') . "\n"); $wgOut->addHTML($this->getConvenienceLinks()); if (is_object($user)) { $this->showLogFragment($wgOut, $user->getUserPage()); } elseif (preg_match('/^\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}/', $this->BlockAddress)) { $this->showLogFragment($wgOut, Title::makeTitle(NS_USER, $this->BlockAddress)); } elseif (preg_match('/^\\w{1,4}:\\w{1,4}:\\w{1,4}:\\w{1,4}:\\w{1,4}:\\w{1,4}:\\w{1,4}:\\w{1,4}/', $this->BlockAddress)) { $this->showLogFragment($wgOut, Title::makeTitle(NS_USER, $this->BlockAddress)); } }
public function showForm($err) { global $wgOut, $wgUser, $wgSysopUserBans; $wgOut->setPageTitle(wfMsg('blockip-title')); $wgOut->addWikiMsg('blockiptext'); if ($wgSysopUserBans) { $mIpaddress = Xml::label(wfMsg('ipadressorusername'), 'mw-bi-target'); } else { $mIpaddress = Xml::label(wfMsg('ipaddress'), 'mw-bi-target'); } $mIpbexpiry = Xml::label(wfMsg('ipbexpiry'), 'wpBlockExpiry'); $mIpbother = Xml::label(wfMsg('ipbother'), 'mw-bi-other'); $mIpbreasonother = Xml::label(wfMsg('ipbreason'), 'wpBlockReasonList'); $mIpbreason = Xml::label(wfMsg('ipbotherreason'), 'mw-bi-reason'); $titleObj = SpecialPage::getTitleFor('Blockip'); $user = User::newFromName($this->BlockAddress); $alreadyBlocked = false; $otherBlockedMsgs = array(); if ($err && $err[0] != 'ipb_already_blocked') { $key = array_shift($err); $msg = wfMsgReal($key, $err); $wgOut->setSubtitle(wfMsgHtml('formerror')); $wgOut->addHTML(Xml::tags('p', array('class' => 'error'), $msg)); } elseif ($this->BlockAddress) { # Get other blocks, i.e. from GlobalBlocking or TorBlock extension wfRunHooks('OtherBlockLogLink', array(&$otherBlockedMsgs, $this->BlockAddress)); $userId = is_object($user) ? $user->getId() : 0; $currentBlock = Block::newFromDB($this->BlockAddress, $userId); if (!is_null($currentBlock) && !$currentBlock->mAuto && ($currentBlock->mRangeStart == $currentBlock->mRangeEnd || $currentBlock->mAddress == $this->BlockAddress)) { $alreadyBlocked = true; # Set the block form settings to the existing block if (!$this->wasPosted) { $this->BlockAnonOnly = $currentBlock->mAnonOnly; $this->BlockCreateAccount = $currentBlock->mCreateAccount; $this->BlockEnableAutoblock = $currentBlock->mEnableAutoblock; $this->BlockEmail = $currentBlock->mBlockEmail; $this->BlockHideName = $currentBlock->mHideName; $this->BlockAllowUsertalk = $currentBlock->mAllowUsertalk; if ($currentBlock->mExpiry == 'infinity') { $this->BlockOther = 'indefinite'; } else { $this->BlockOther = wfTimestamp(TS_ISO_8601, $currentBlock->mExpiry); } $this->BlockReason = $currentBlock->mReason; } } } # Show other blocks from extensions, i.e. GlockBlocking and TorBlock if (count($otherBlockedMsgs)) { $wgOut->addHTML(Html::rawElement('h2', array(), wfMsgExt('ipb-otherblocks-header', 'parseinline', count($otherBlockedMsgs))) . "\n"); $list = ''; foreach ($otherBlockedMsgs as $link) { $list .= Html::rawElement('li', array(), $link) . "\n"; } $wgOut->addHTML(Html::rawElement('ul', array('class' => 'mw-blockip-alreadyblocked'), $list) . "\n"); } # Username/IP is blocked already locally if ($alreadyBlocked) { $wgOut->addWikiMsg('ipb-needreblock', $this->BlockAddress); } $scBlockExpiryOptions = wfMsgForContent('ipboptions'); $showblockoptions = $scBlockExpiryOptions != '-'; if (!$showblockoptions) { $mIpbother = $mIpbexpiry; } $blockExpiryFormOptions = Xml::option(wfMsg('ipbotheroption'), 'other'); foreach (explode(',', $scBlockExpiryOptions) as $option) { if (strpos($option, ':') === false) { $option = "{$option}:{$option}"; } list($show, $value) = explode(':', $option); $show = htmlspecialchars($show); $value = htmlspecialchars($value); $blockExpiryFormOptions .= Xml::option($show, $value, $this->BlockExpiry === $value ? true : false) . "\n"; } $reasonDropDown = Xml::listDropDown('wpBlockReasonList', wfMsgForContent('ipbreason-dropdown'), wfMsgForContent('ipbreasonotherlist'), $this->BlockReasonList, 'wpBlockDropDown', 4); global $wgStylePath, $wgStyleVersion; $wgOut->addHTML(Xml::tags('script', array('type' => 'text/javascript', 'src' => "{$wgStylePath}/common/block.js?{$wgStyleVersion}"), '') . Xml::openElement('form', array('method' => 'post', 'action' => $titleObj->getLocalURL('action=submit'), 'id' => 'blockip')) . Xml::openElement('fieldset') . Xml::element('legend', null, wfMsg('blockip-legend')) . Xml::openElement('table', array('border' => '0', 'id' => 'mw-blockip-table')) . "<tr>\n\t\t\t\t<td class='mw-label'>\n\t\t\t\t\t{$mIpaddress}\n\t\t\t\t</td>\n\t\t\t\t<td class='mw-input'>" . Html::input('wpBlockAddress', $this->BlockAddress, 'text', array('tabindex' => '1', 'id' => 'mw-bi-target', 'onchange' => 'updateBlockOptions()', 'size' => '45', 'required' => '') + ($this->BlockAddress ? array() : array('autofocus'))) . "\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t\t<tr>"); if ($showblockoptions) { $wgOut->addHTML("\n\t\t\t\t<td class='mw-label'>\n\t\t\t\t\t{$mIpbexpiry}\n\t\t\t\t</td>\n\t\t\t\t<td class='mw-input'>" . Xml::tags('select', array('id' => 'wpBlockExpiry', 'name' => 'wpBlockExpiry', 'onchange' => 'considerChangingExpiryFocus()', 'tabindex' => '2'), $blockExpiryFormOptions) . "</td>"); } $wgOut->addHTML("\n\t\t\t</tr>\n\t\t\t<tr id='wpBlockOther'>\n\t\t\t\t<td class='mw-label'>\n\t\t\t\t\t{$mIpbother}\n\t\t\t\t</td>\n\t\t\t\t<td class='mw-input'>" . Xml::input('wpBlockOther', 45, $this->BlockOther, array('tabindex' => '3', 'id' => 'mw-bi-other')) . "\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td class='mw-label'>\n\t\t\t\t\t{$mIpbreasonother}\n\t\t\t\t</td>\n\t\t\t\t<td class='mw-input'>\n\t\t\t\t\t{$reasonDropDown}\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t\t<tr id=\"wpBlockReason\">\n\t\t\t\t<td class='mw-label'>\n\t\t\t\t\t{$mIpbreason}\n\t\t\t\t</td>\n\t\t\t\t<td class='mw-input'>" . Html::input('wpBlockReason', $this->BlockReason, 'text', array('tabindex' => '5', 'id' => 'mw-bi-reason', 'maxlength' => '200', 'size' => '45') + ($this->BlockAddress ? array('autofocus') : array())) . "\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t\t<tr id='wpAnonOnlyRow'>\n\t\t\t\t<td> </td>\n\t\t\t\t<td class='mw-input'>" . Xml::checkLabel(wfMsg('ipbanononly'), 'wpAnonOnly', 'wpAnonOnly', $this->BlockAnonOnly, array('tabindex' => '6')) . "\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t\t<tr id='wpCreateAccountRow'>\n\t\t\t\t<td> </td>\n\t\t\t\t<td class='mw-input'>" . Xml::checkLabel(wfMsg('ipbcreateaccount'), 'wpCreateAccount', 'wpCreateAccount', $this->BlockCreateAccount, array('tabindex' => '7')) . "\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t\t<tr id='wpEnableAutoblockRow'>\n\t\t\t\t<td> </td>\n\t\t\t\t<td class='mw-input'>" . Xml::checkLabel(wfMsg('ipbenableautoblock'), 'wpEnableAutoblock', 'wpEnableAutoblock', $this->BlockEnableAutoblock, array('tabindex' => '8')) . "\n\t\t\t\t</td>\n\t\t\t</tr>"); if (self::canBlockEmail($wgUser)) { $wgOut->addHTML("\n\t\t\t\t<tr id='wpEnableEmailBan'>\n\t\t\t\t\t<td> </td>\n\t\t\t\t\t<td class='mw-input'>" . Xml::checkLabel(wfMsg('ipbemailban'), 'wpEmailBan', 'wpEmailBan', $this->BlockEmail, array('tabindex' => '9')) . "\n\t\t\t\t\t</td>\n\t\t\t\t</tr>"); } // Allow some users to hide name from block log, blocklist and listusers if ($wgUser->isAllowed('hideuser')) { $wgOut->addHTML("\n\t\t\t\t<tr id='wpEnableHideUser'>\n\t\t\t\t\t<td> </td>\n\t\t\t\t\t<td class='mw-input'><strong>" . Xml::checkLabel(wfMsg('ipbhidename'), 'wpHideName', 'wpHideName', $this->BlockHideName, array('tabindex' => '10')) . "\n\t\t\t\t\t</strong></td>\n\t\t\t\t</tr>"); } # Watchlist their user page? (Only if user is logged in) if ($wgUser->isLoggedIn()) { $wgOut->addHTML("\n\t\t\t<tr id='wpEnableWatchUser'>\n\t\t\t\t<td> </td>\n\t\t\t\t<td class='mw-input'>" . Xml::checkLabel(wfMsg('ipbwatchuser'), 'wpWatchUser', 'wpWatchUser', $this->BlockWatchUser, array('tabindex' => '11')) . "\n\t\t\t\t</td>\n\t\t\t</tr>"); } # Can we explicitly disallow the use of user_talk? global $wgBlockAllowsUTEdit; if ($wgBlockAllowsUTEdit) { $wgOut->addHTML("\n\t\t\t\t<tr id='wpAllowUsertalkRow'>\n\t\t\t\t\t<td> </td>\n\t\t\t\t\t<td class='mw-input'>" . Xml::checkLabel(wfMsg('ipballowusertalk'), 'wpAllowUsertalk', 'wpAllowUsertalk', $this->BlockAllowUsertalk, array('tabindex' => '12')) . "\n\t\t\t\t\t</td>\n\t\t\t\t</tr>"); } $wgOut->addHTML("\n\t\t\t<tr>\n\t\t\t\t<td style='padding-top: 1em'> </td>\n\t\t\t\t<td class='mw-submit' style='padding-top: 1em'>" . Xml::submitButton(wfMsg($alreadyBlocked ? 'ipb-change-block' : 'ipbsubmit'), array('name' => 'wpBlock', 'tabindex' => '13', 'accesskey' => 's')) . "\n\t\t\t\t</td>\n\t\t\t</tr>" . Xml::closeElement('table') . Xml::hidden('wpEditToken', $wgUser->editToken()) . ($alreadyBlocked ? Xml::hidden('wpChangeBlock', 1) : "") . Xml::closeElement('fieldset') . Xml::closeElement('form') . Xml::tags('script', array('type' => 'text/javascript'), 'updateBlockOptions()') . "\n"); $wgOut->addHTML($this->getConvenienceLinks()); if (is_object($user)) { $this->showLogFragment($wgOut, $user->getUserPage()); } elseif (preg_match('/^\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}/', $this->BlockAddress)) { $this->showLogFragment($wgOut, Title::makeTitle(NS_USER, $this->BlockAddress)); } elseif (preg_match('/^\\w{1,4}:\\w{1,4}:\\w{1,4}:\\w{1,4}:\\w{1,4}:\\w{1,4}:\\w{1,4}:\\w{1,4}/', $this->BlockAddress)) { $this->showLogFragment($wgOut, Title::makeTitle(NS_USER, $this->BlockAddress)); } }
/** * Show the Lock and/or Hide form, appropriate for this admin user's rights. * The <form> and <fieldset> were started in showTableHeader() */ private function showStatusForm() { $form = ''; $radioLocked = Xml::radioLabel($this->msg('centralauth-admin-action-lock-nochange')->parse(), 'wpActionLock', 'nochange', 'mw-centralauth-status-locked-no', true) . '<br />' . Xml::radioLabel($this->msg('centralauth-admin-action-lock-unlock')->parse(), 'wpActionLock', 'unlock', 'centralauth-admin-action-lock-unlock', false) . '<br />' . Xml::radioLabel($this->msg('centralauth-admin-action-lock-lock')->parse(), 'wpActionLock', 'lock', 'centralauth-admin-action-lock-lock', false); $radioHidden = Xml::radioLabel($this->msg('centralauth-admin-action-hide-nochange')->parse(), 'wpActionHide', 'nochange', 'mw-centralauth-status-hidden-nochange', true) . '<br />'; if ($this->mCanOversight) { $radioHidden .= Xml::radioLabel($this->msg('centralauth-admin-action-hide-none')->parse(), 'wpActionHide', CentralAuthUser::HIDDEN_NONE, 'mw-centralauth-status-hidden-no', false) . '<br />' . Xml::radioLabel($this->msg('centralauth-admin-action-hide-lists')->parse(), 'wpActionHide', CentralAuthUser::HIDDEN_LISTS, 'mw-centralauth-status-hidden-list', false) . '<br />' . Xml::radioLabel($this->msg('centralauth-admin-action-hide-oversight')->parse(), 'wpActionHide', CentralAuthUser::HIDDEN_OVERSIGHT, 'mw-centralauth-status-hidden-oversight', false); } $reasonList = Xml::listDropDown('wpReasonList', $this->msg('centralauth-admin-status-reasons')->inContentLanguage()->text(), $this->msg('centralauth-admin-reason-other-select')->inContentLanguage()->text()); $reasonField = Xml::input('wpReason', 45, false); $botField = Xml::check('markasbot') . $this->msg('centralauth-admin-multi-botcheck'); $form .= Xml::buildForm(array('centralauth-admin-status-locked' => $radioLocked, 'centralauth-admin-status-hidden' => $radioHidden, 'centralauth-admin-reason' => $reasonList, 'centralauth-admin-reason-other' => $reasonField, 'centralauth-admin-multi-bot' => $botField), 'centralauth-admin-status-submit'); $searchlist = $this->mUserNames; if (is_array($this->mUserNames)) { $searchlist = implode("\n", $this->mUserNames); } $form .= Html::hidden('wpTarget', $searchlist); $form .= '</fieldset></form>'; $this->getOutput()->addHTML($form); }
private function showStatusForm() { // Allows locking, hiding, locking and hiding. $form = ''; $form .= Xml::fieldset($this->msg('centralauth-admin-status')->text()); $form .= Html::hidden('wpMethod', 'set-status'); $form .= Html::hidden('wpEditToken', $this->getUser()->getEditToken()); $form .= Html::hidden('wpUserState', $this->mGlobalUser->getStateHash(false)); $form .= $this->msg('centralauth-admin-status-intro')->parseAsBlock(); // Radio buttons $radioLocked = Xml::radioLabel($this->msg('centralauth-admin-status-locked-no')->parse(), 'wpStatusLocked', '0', 'mw-centralauth-status-locked-no', !$this->mGlobalUser->isLocked()) . '<br />' . Xml::radioLabel($this->msg('centralauth-admin-status-locked-yes')->parse(), 'wpStatusLocked', '1', 'mw-centralauth-status-locked-yes', $this->mGlobalUser->isLocked()); $radioHidden = Xml::radioLabel($this->msg('centralauth-admin-status-hidden-no')->parse(), 'wpStatusHidden', CentralAuthUser::HIDDEN_NONE, 'mw-centralauth-status-hidden-no', $this->mGlobalUser->getHiddenLevel() == CentralAuthUser::HIDDEN_NONE); if ($this->mCanOversight) { $radioHidden .= '<br />' . Xml::radioLabel($this->msg('centralauth-admin-status-hidden-list')->parse(), 'wpStatusHidden', CentralAuthUser::HIDDEN_LISTS, 'mw-centralauth-status-hidden-list', $this->mGlobalUser->getHiddenLevel() == CentralAuthUser::HIDDEN_LISTS) . '<br />' . Xml::radioLabel($this->msg('centralauth-admin-status-hidden-oversight')->parse(), 'wpStatusHidden', CentralAuthUser::HIDDEN_OVERSIGHT, 'mw-centralauth-status-hidden-oversight', $this->mGlobalUser->getHiddenLevel() == CentralAuthUser::HIDDEN_OVERSIGHT); } // Reason $reasonList = Xml::listDropDown('wpReasonList', $this->msg('centralauth-admin-status-reasons')->inContentLanguage()->text(), $this->msg('centralauth-admin-reason-other-select')->inContentLanguage()->text()); $reasonField = Xml::input('wpReason', 45, false); $form .= Xml::buildForm(array('centralauth-admin-status-locked' => $radioLocked, 'centralauth-admin-status-hidden' => $radioHidden, 'centralauth-admin-reason' => $reasonList, 'centralauth-admin-reason-other' => $reasonField), 'centralauth-admin-status-submit'); $form .= Xml::closeElement('fieldset'); $form = Xml::tags('form', array('method' => 'POST', 'action' => $this->getPageTitle()->getFullURL(array('target' => $this->mUserName))), $form); $this->getOutput()->addHTML($form); }
/** * Output deletion confirmation dialog * FIXME: Move to another file? * @param $reason String: prefilled reason */ public function confirmDelete($reason) { global $wgOut, $wgUser; wfDebug("Article::confirmDelete\n"); $deleteBackLink = $wgUser->getSkin()->linkKnown($this->mTitle); $wgOut->setSubtitle(wfMsgHtml('delete-backlink', $deleteBackLink)); $wgOut->setRobotPolicy('noindex,nofollow'); $wgOut->addWikiMsg('confirmdeletetext'); wfRunHooks('ArticleConfirmDelete', array($this, $wgOut, &$reason)); if ($wgUser->isAllowed('suppressrevision')) { $suppress = "<tr id=\"wpDeleteSuppressRow\" name=\"wpDeleteSuppressRow\">\n\t\t\t\t\t<td></td>\n\t\t\t\t\t<td class='mw-input'><strong>" . Xml::checkLabel(wfMsg('revdelete-suppress'), 'wpSuppress', 'wpSuppress', false, array('tabindex' => '4')) . "</strong></td>\n\t\t\t\t</tr>"; } else { $suppress = ''; } $checkWatch = $wgUser->getBoolOption('watchdeletion') || $this->mTitle->userIsWatching(); $form = Xml::openElement('form', array('method' => 'post', 'action' => $this->mTitle->getLocalURL('action=delete'), 'id' => 'deleteconfirm')) . Xml::openElement('fieldset', array('id' => 'mw-delete-table')) . Xml::tags('legend', null, wfMsgExt('delete-legend', array('parsemag', 'escapenoentities'))) . Xml::openElement('table', array('id' => 'mw-deleteconfirm-table')) . "<tr id=\"wpDeleteReasonListRow\">\n\t\t\t\t<td class='mw-label'>" . Xml::label(wfMsg('deletecomment'), 'wpDeleteReasonList') . "</td>\n\t\t\t\t<td class='mw-input'>" . Xml::listDropDown('wpDeleteReasonList', wfMsgForContent('deletereason-dropdown'), wfMsgForContent('deletereasonotherlist'), '', 'wpReasonDropDown', 1) . "</td>\n\t\t\t</tr>\n\t\t\t<tr id=\"wpDeleteReasonRow\">\n\t\t\t\t<td class='mw-label'>" . Xml::label(wfMsg('deleteotherreason'), 'wpReason') . "</td>\n\t\t\t\t<td class='mw-input'>" . Html::input('wpReason', $reason, 'text', array('size' => '60', 'maxlength' => '255', 'tabindex' => '2', 'id' => 'wpReason', 'autofocus')) . "</td>\n\t\t\t</tr>"; # Disallow watching if user is not logged in if ($wgUser->isLoggedIn()) { $form .= "\n\t\t\t<tr>\n\t\t\t\t<td></td>\n\t\t\t\t<td class='mw-input'>" . Xml::checkLabel(wfMsg('watchthis'), 'wpWatch', 'wpWatch', $checkWatch, array('tabindex' => '3')) . "</td>\n\t\t\t</tr>"; } $form .= "\n\t\t\t{$suppress}\n\t\t\t<tr>\n\t\t\t\t<td></td>\n\t\t\t\t<td class='mw-submit'>" . Xml::submitButton(wfMsg('deletepage'), array('name' => 'wpConfirmB', 'id' => 'wpConfirmB', 'tabindex' => '5')) . "</td>\n\t\t\t</tr>" . Xml::closeElement('table') . Xml::closeElement('fieldset') . Html::hidden('wpEditToken', $wgUser->editToken()) . Xml::closeElement('form'); if ($wgUser->isAllowed('editinterface')) { $skin = $wgUser->getSkin(); $title = Title::makeTitle(NS_MEDIAWIKI, 'Deletereason-dropdown'); $link = $skin->link($title, wfMsgHtml('delete-edit-reasonlist'), array(), array('action' => 'edit')); $form .= '<p class="mw-delete-editreasons">' . $link . '</p>'; } $wgOut->addHTML($form); $wgOut->addHTML(Xml::element('h2', null, LogPage::logName('delete'))); LogEventsList::showLogExtract($wgOut, 'delete', $this->mTitle->getPrefixedText()); }
/** * Show the confirmation form */ private function showForm() { global $wgOut, $wgUser, $wgRequest, $wgContLang; $align = $wgContLang->isRtl() ? 'left' : 'right'; $form = Xml::openElement('form', array('method' => 'post', 'action' => $this->getAction())) . Xml::openElement('fieldset') . Xml::element('legend', null, wfMsg('filedelete-legend')) . Xml::hidden('wpEditToken', $wgUser->editToken($this->oldimage)) . $this->prepareMessage('filedelete-intro') . Xml::openElement('table') . "<tr>\n\t\t\t\t<td align='{$align}'>" . Xml::label(wfMsg('filedelete-comment'), 'wpDeleteReasonList') . "</td>\n\t\t\t\t<td>" . Xml::listDropDown('wpDeleteReasonList', wfMsgForContent('filedelete-reason-dropdown'), wfMsgForContent('filedelete-reason-otherlist'), '', 'wpReasonDropDown', 1) . "</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td align='{$align}'>" . Xml::label(wfMsg('filedelete-otherreason'), 'wpReason') . "</td>\n\t\t\t\t<td>" . Xml::input('wpReason', 60, $wgRequest->getText('wpReason'), array('type' => 'text', 'maxlength' => '255', 'tabindex' => '2', 'id' => 'wpReason')) . "</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td></td>\n\t\t\t\t<td>" . Xml::submitButton(wfMsg('filedelete-submit'), array('name' => 'mw-filedelete-submit', 'id' => 'mw-filedelete-submit', 'tabindex' => '3')) . "</td>\n\t\t\t</tr>" . Xml::closeElement('table') . Xml::closeElement('fieldset') . Xml::closeElement('form'); $wgOut->addHtml($form); }
/** * Build the input form * * @return String: HTML form */ function buildForm() { global $wgUser, $wgLang, $wgOut; $mProtectreasonother = Xml::label(wfMessage('protectcomment')->text(), 'wpProtectReasonSelection'); $mProtectreason = Xml::label(wfMessage('protect-otherreason')->text(), 'mwProtect-reason'); $out = ''; if (!$this->disabled) { $wgOut->addModules('mediawiki.legacy.protect'); $out .= Xml::openElement('form', array('method' => 'post', 'action' => $this->mTitle->getLocalURL('action=protect'), 'id' => 'mw-Protect-Form', 'onsubmit' => 'ProtectionForm.enableUnchainedInputs(true)')); } $out .= Xml::openElement('fieldset') . Xml::element('legend', null, wfMessage('protect-legend')->text()) . Xml::openElement('table', array('id' => 'mwProtectSet')) . Xml::openElement('tbody'); // Not all languages have V_x <-> N_x relation foreach ($this->mRestrictions as $action => $selected) { // Messages: // restriction-edit, restriction-move, restriction-create, restriction-upload $msg = wfMessage('restriction-' . $action); $out .= "<tr><td>" . Xml::openElement('fieldset') . Xml::element('legend', null, $msg->exists() ? $msg->text() : $action) . Xml::openElement('table', array('id' => "mw-protect-table-{$action}")) . "<tr><td>" . $this->buildSelector($action, $selected) . "</td></tr><tr><td>"; $reasonDropDown = Xml::listDropDown('wpProtectReasonSelection', wfMessage('protect-dropdown')->inContentLanguage()->text(), wfMessage('protect-otherreason-op')->inContentLanguage()->text(), $this->mReasonSelection, 'mwProtect-reason', 4); $scExpiryOptions = wfMessage('protect-expiry-options')->inContentLanguage()->text(); $showProtectOptions = $scExpiryOptions !== '-' && !$this->disabled; $mProtectexpiry = Xml::label(wfMessage('protectexpiry')->text(), "mwProtectExpirySelection-{$action}"); $mProtectother = Xml::label(wfMessage('protect-othertime')->text(), "mwProtect-{$action}-expires"); $expiryFormOptions = ''; if ($this->mExistingExpiry[$action] && $this->mExistingExpiry[$action] != 'infinity') { $timestamp = $wgLang->timeanddate($this->mExistingExpiry[$action], true); $d = $wgLang->date($this->mExistingExpiry[$action], true); $t = $wgLang->time($this->mExistingExpiry[$action], true); $expiryFormOptions .= Xml::option(wfMessage('protect-existing-expiry', $timestamp, $d, $t)->text(), 'existing', $this->mExpirySelection[$action] == 'existing') . "\n"; } $expiryFormOptions .= Xml::option(wfMessage('protect-othertime-op')->text(), "othertime") . "\n"; foreach (explode(',', $scExpiryOptions) as $option) { if (strpos($option, ":") === false) { $show = $value = $option; } else { list($show, $value) = explode(":", $option); } $show = htmlspecialchars($show); $value = htmlspecialchars($value); $expiryFormOptions .= Xml::option($show, $value, $this->mExpirySelection[$action] === $value) . "\n"; } # Add expiry dropdown if ($showProtectOptions && !$this->disabled) { $out .= "\n\t\t\t\t\t<table><tr>\n\t\t\t\t\t\t<td class='mw-label'>\n\t\t\t\t\t\t\t{$mProtectexpiry}\n\t\t\t\t\t\t</td>\n\t\t\t\t\t\t<td class='mw-input'>" . Xml::tags('select', array('id' => "mwProtectExpirySelection-{$action}", 'name' => "wpProtectExpirySelection-{$action}", 'onchange' => "ProtectionForm.updateExpiryList(this)", 'tabindex' => '2') + $this->disabledAttrib, $expiryFormOptions) . "</td>\n\t\t\t\t\t</tr></table>"; } # Add custom expiry field $attribs = array('id' => "mwProtect-{$action}-expires", 'onkeyup' => 'ProtectionForm.updateExpiry(this)', 'onchange' => 'ProtectionForm.updateExpiry(this)') + $this->disabledAttrib; $out .= "<table><tr>\n\t\t\t\t\t<td class='mw-label'>" . $mProtectother . '</td> <td class="mw-input">' . Xml::input("mwProtect-expiry-{$action}", 50, $this->mExpiry[$action], $attribs) . '</td> </tr></table>'; $out .= "</td></tr>" . Xml::closeElement('table') . Xml::closeElement('fieldset') . "</td></tr>"; } # Give extensions a chance to add items to the form wfRunHooks('ProtectionForm::buildForm', array($this->mArticle, &$out)); $out .= Xml::closeElement('tbody') . Xml::closeElement('table'); // JavaScript will add another row with a value-chaining checkbox if ($this->mTitle->exists()) { $out .= Xml::openElement('table', array('id' => 'mw-protect-table2')) . Xml::openElement('tbody'); $out .= '<tr> <td></td> <td class="mw-input">' . Xml::checkLabel(wfMessage('protect-cascade')->text(), 'mwProtect-cascade', 'mwProtect-cascade', $this->mCascade, $this->disabledAttrib) . "</td>\n\t\t\t\t</tr>\n"; $out .= Xml::closeElement('tbody') . Xml::closeElement('table'); } # Add manual and custom reason field/selects as well as submit if (!$this->disabled) { $out .= Xml::openElement('table', array('id' => 'mw-protect-table3')) . Xml::openElement('tbody'); $out .= "\n\t\t\t\t<tr>\n\t\t\t\t\t<td class='mw-label'>\n\t\t\t\t\t\t{$mProtectreasonother}\n\t\t\t\t\t</td>\n\t\t\t\t\t<td class='mw-input'>\n\t\t\t\t\t\t{$reasonDropDown}\n\t\t\t\t\t</td>\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\t<td class='mw-label'>\n\t\t\t\t\t\t{$mProtectreason}\n\t\t\t\t\t</td>\n\t\t\t\t\t<td class='mw-input'>" . Xml::input('mwProtect-reason', 60, $this->mReason, array('type' => 'text', 'id' => 'mwProtect-reason', 'maxlength' => 180)) . "</td>\n\t\t\t\t</tr>"; # Disallow watching is user is not logged in if ($wgUser->isLoggedIn()) { $out .= "\n\t\t\t\t<tr>\n\t\t\t\t\t<td></td>\n\t\t\t\t\t<td class='mw-input'>" . Xml::checkLabel(wfMessage('watchthis')->text(), 'mwProtectWatch', 'mwProtectWatch', $wgUser->isWatched($this->mTitle) || $wgUser->getOption('watchdefault')) . "</td>\n\t\t\t\t</tr>"; } $out .= "\n\t\t\t\t<tr>\n\t\t\t\t\t<td></td>\n\t\t\t\t\t<td class='mw-submit'>" . Xml::submitButton(wfMessage('confirm')->text(), array('id' => 'mw-Protect-submit')) . "</td>\n\t\t\t\t</tr>\n"; $out .= Xml::closeElement('tbody') . Xml::closeElement('table'); } $out .= Xml::closeElement('fieldset'); if ($wgUser->isAllowed('editinterface')) { $title = Title::makeTitle(NS_MEDIAWIKI, 'Protect-dropdown'); $link = Linker::link($title, wfMessage('protect-edit-reasonlist')->escaped(), array(), array('action' => 'edit')); $out .= '<p class="mw-protect-editreasons">' . $link . '</p>'; } if (!$this->disabled) { $out .= Html::hidden('wpEditToken', $wgUser->getEditToken(array('protect', $this->mTitle->getPrefixedDBkey()))); $out .= Xml::closeElement('form'); $wgOut->addScript($this->buildCleanupScript()); } return $out; }
function showForm($err) { global $wgOut, $wgUser, $wgSysopUserBans, $wgContLang; $wgOut->setPagetitle(wfMsg('blockip')); $wgOut->addWikiMsg('blockiptext', $this->BlockAddress); if ($wgSysopUserBans) { $mIpaddress = Xml::label(wfMsg('ipadressorusername'), 'mw-bi-target'); } else { $mIpaddress = Xml::label(wfMsg('ipaddress'), 'mw-bi-target'); } $mIpbexpiry = Xml::label(wfMsg('ipbexpiry'), 'wpBlockExpiry'); $mIpbother = Xml::label(wfMsg('ipbother'), 'mw-bi-other'); $mIpbothertime = wfMsgHtml('ipbotheroption'); $mIpbreasonother = Xml::label(wfMsg('ipbreason'), 'wpBlockReasonList'); $mIpbreason = Xml::label(wfMsg('ipbotherreason'), 'mw-bi-reason'); $titleObj = SpecialPage::getTitleFor('Blockip'); $action = $titleObj->escapeLocalURL("action=submit"); $alignRight = $wgContLang->isRtl() ? 'left' : 'right'; if ("" != $err) { $wgOut->setSubtitle(wfMsgHtml('formerror')); $wgOut->addHTML("<p class='error'>{$err}</p>\n"); } $scBlockExpiryOptions = wfMsgForContent('ipboptions'); $showblockoptions = $scBlockExpiryOptions != '-'; if (!$showblockoptions) { $mIpbother = $mIpbexpiry; } $blockExpiryFormOptions = "<option value=\"other\">{$mIpbothertime}</option>"; foreach (explode(',', $scBlockExpiryOptions) as $option) { if (strpos($option, ":") === false) { $option = "{$option}:{$option}"; } list($show, $value) = explode(":", $option); $show = htmlspecialchars($show); $value = htmlspecialchars($value); $selected = ""; if ($this->BlockExpiry === $value) { $selected = ' selected="selected"'; } $blockExpiryFormOptions .= "<option value=\"{$value}\"{$selected}>{$show}</option>"; } $reasonDropDown = Xml::listDropDown('wpBlockReasonList', wfMsgForContent('ipbreason-dropdown'), wfMsgForContent('ipbreasonotherlist'), '', 'wpBlockDropDown', 4); $token = $wgUser->editToken(); global $wgStylePath, $wgStyleVersion; $wgOut->addHTML("\n<script type=\"text/javascript\" src=\"{$wgStylePath}/common/block.js?{$wgStyleVersion}\">\n</script>\n<form id=\"blockip\" method=\"post\" action=\"{$action}\">\n\t<table border='0'>\n\t\t<tr>\n\t\t\t<td align=\"{$alignRight}\">{$mIpaddress}</td>\n\t\t\t<td>\n\t\t\t\t" . Xml::input('wpBlockAddress', 45, $this->BlockAddress, array('tabindex' => '1', 'id' => 'mw-bi-target', 'onchange' => 'updateBlockOptions()')) . "\n\t\t\t</td>\n\t\t</tr>\n\t\t<tr>"); if ($showblockoptions) { $wgOut->addHTML("\n\t\t\t<td align=\"{$alignRight}\">{$mIpbexpiry}</td>\n\t\t\t<td>\n\t\t\t\t<select tabindex='2' id='wpBlockExpiry' name=\"wpBlockExpiry\" onchange=\"considerChangingExpiryFocus()\">\n\t\t\t\t\t{$blockExpiryFormOptions}\n\t\t\t\t</select>\n\t\t\t</td>\n\t\t\t"); } $wgOut->addHTML("\n\t\t</tr>\n\t\t<tr id='wpBlockOther'>\n\t\t\t<td align=\"{$alignRight}\">{$mIpbother}</td>\n\t\t\t<td>\n\t\t\t\t" . Xml::input('wpBlockOther', 45, $this->BlockOther, array('tabindex' => '3', 'id' => 'mw-bi-other')) . "\n\t\t\t</td>\n\t\t</tr>"); $wgOut->addHTML("\n\t\t<tr>\n\t\t\t<td align=\"{$alignRight}\">{$mIpbreasonother}</td>\n\t\t\t<td>\n\t\t\t\t{$reasonDropDown}\n\t\t\t</td>\n\t\t</tr>"); $wgOut->addHTML("\n\t\t<tr id=\"wpBlockReason\">\n\t\t\t<td align=\"{$alignRight}\">{$mIpbreason}</td>\n\t\t\t<td>\n\t\t\t\t" . Xml::input('wpBlockReason', 45, $this->BlockReason, array('tabindex' => '5', 'id' => 'mw-bi-reason', 'maxlength' => '200')) . "\n\t\t\t</td>\n\t\t</tr>\n\t\t<tr id='wpAnonOnlyRow'>\n\t\t\t<td> </td>\n\t\t\t<td>\n\t\t\t\t" . wfCheckLabel(wfMsgHtml('ipbanononly'), 'wpAnonOnly', 'wpAnonOnly', $this->BlockAnonOnly, array('tabindex' => '6')) . "\n\t\t\t</td>\n\t\t</tr>\n\t\t<tr id='wpCreateAccountRow'>\n\t\t\t<td> </td>\n\t\t\t<td>\n\t\t\t\t" . wfCheckLabel(wfMsgHtml('ipbcreateaccount'), 'wpCreateAccount', 'wpCreateAccount', $this->BlockCreateAccount, array('tabindex' => '7')) . "\n\t\t\t</td>\n\t\t</tr>\n\t\t<tr id='wpEnableAutoblockRow'>\n\t\t\t<td> </td>\n\t\t\t<td>\n\t\t\t\t" . wfCheckLabel(wfMsgHtml('ipbenableautoblock'), 'wpEnableAutoblock', 'wpEnableAutoblock', $this->BlockEnableAutoblock, array('tabindex' => '8')) . "\n\t\t\t</td>\n\t\t</tr>\n\t\t"); global $wgSysopEmailBans; if ($wgSysopEmailBans && $wgUser->isAllowed('blockemail')) { $wgOut->addHTML("\n\t\t\t<tr id='wpEnableEmailBan'>\n\t\t\t<td> </td>\n\t\t\t\t<td>\n\t\t\t\t\t" . wfCheckLabel(wfMsgHtml('ipbemailban'), 'wpEmailBan', 'wpEmailBan', $this->BlockEmail, array('tabindex' => '10')) . "\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t\t"); } // Allow some users to hide name from block log, blocklist and listusers if ($wgUser->isAllowed('hideuser')) { $wgOut->addHTML("\n\t\t\t<tr id='wpEnableHideUser'>\n\t\t\t<td> </td>\n\t\t\t\t<td>\n\t\t\t\t\t" . wfCheckLabel(wfMsgHtml('ipbhidename'), 'wpHideName', 'wpHideName', $this->BlockHideName, array('tabindex' => '9')) . "\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t\t"); } $wgOut->addHTML("\n\t\t<tr>\n\t\t\t<td style='padding-top: 1em'> </td>\n\t\t\t<td style='padding-top: 1em'>\n\t\t\t\t" . Xml::submitButton(wfMsg('ipbsubmit'), array('name' => 'wpBlock', 'tabindex' => '11')) . "\n\t\t\t</td>\n\t\t</tr>\n\t</table>" . Xml::hidden('wpEditToken', $token) . "</form>\n<script type=\"text/javascript\">updateBlockOptions()</script>\n\n"); $wgOut->addHtml($this->getConvenienceLinks()); $user = User::newFromName($this->BlockAddress); if (is_object($user)) { $this->showLogFragment($wgOut, $user->getUserPage()); } elseif (preg_match('/^\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}/', $this->BlockAddress)) { $this->showLogFragment($wgOut, Title::makeTitle(NS_USER, $this->BlockAddress)); } elseif (preg_match('/^\\w{1,4}:\\w{1,4}:\\w{1,4}:\\w{1,4}:\\w{1,4}:\\w{1,4}:\\w{1,4}:\\w{1,4}/', $this->BlockAddress)) { $this->showLogFragment($wgOut, Title::makeTitle(NS_USER, $this->BlockAddress)); } }
/** * Show a list of items that we will operate on, and show a form with checkboxes * which will allow the user to choose new visibility settings. */ protected function showForm() { $userAllowed = true; // Messages: revdelete-selected-text, revdelete-selected-file, logdelete-selected $out = $this->getOutput(); $out->wrapWikiMsg("<strong>\$1</strong>", array($this->typeLabels['selected'], $this->getLanguage()->formatNum(count($this->ids)), $this->targetObj->getPrefixedText())); $this->addHelpLink('Help:RevisionDelete'); $out->addHTML("<ul>"); $numRevisions = 0; // Live revisions... $list = $this->getList(); // @codingStandardsIgnoreStart Generic.CodeAnalysis.ForLoopWithTestFunctionCall.NotAllowed for ($list->reset(); $list->current(); $list->next()) { // @codingStandardsIgnoreEnd $item = $list->current(); if (!$item->canView()) { if (!$this->submitClicked) { throw new PermissionsError('suppressrevision'); } $userAllowed = false; } $numRevisions++; $out->addHTML($item->getHTML()); } if (!$numRevisions) { throw new ErrorPageError('revdelete-nooldid-title', 'revdelete-nooldid-text'); } $out->addHTML("</ul>"); // Explanation text $this->addUsageText(); // Normal sysops can always see what they did, but can't always change it if (!$userAllowed) { return; } // Show form if the user can submit if ($this->mIsAllowed) { $form = Xml::openElement('form', array('method' => 'post', 'action' => $this->getPageTitle()->getLocalURL(array('action' => 'submit')), 'id' => 'mw-revdel-form-revisions')) . Xml::fieldset($this->msg('revdelete-legend')->text()) . $this->buildCheckBoxes() . Xml::openElement('table') . "<tr>\n" . '<td class="mw-label">' . Xml::label($this->msg('revdelete-log')->text(), 'wpRevDeleteReasonList') . '</td>' . '<td class="mw-input">' . Xml::listDropDown('wpRevDeleteReasonList', $this->msg('revdelete-reason-dropdown')->inContentLanguage()->text(), $this->msg('revdelete-reasonotherlist')->inContentLanguage()->text(), $this->getRequest()->getText('wpRevDeleteReasonList', 'other'), 'wpReasonDropDown') . '</td>' . "</tr><tr>\n" . '<td class="mw-label">' . Xml::label($this->msg('revdelete-otherreason')->text(), 'wpReason') . '</td>' . '<td class="mw-input">' . Xml::input('wpReason', 60, $this->otherReason, array('id' => 'wpReason', 'maxlength' => 100)) . '</td>' . "</tr><tr>\n" . '<td></td>' . '<td class="mw-submit">' . Xml::submitButton($this->msg('revdelete-submit', $numRevisions)->text(), array('name' => 'wpSubmit')) . '</td>' . "</tr>\n" . Xml::closeElement('table') . Html::hidden('wpEditToken', $this->getUser()->getEditToken()) . Html::hidden('target', $this->targetObj->getPrefixedText()) . Html::hidden('type', $this->typeName) . Html::hidden('ids', implode(',', $this->ids)) . Xml::closeElement('fieldset') . "\n" . Xml::closeElement('form') . "\n"; // Show link to edit the dropdown reasons if ($this->getUser()->isAllowed('editinterface')) { $link = Linker::linkKnown($this->msg('revdelete-reason-dropdown')->inContentLanguage()->getTitle(), $this->msg('revdelete-edit-reasonlist')->escaped(), array(), array('action' => 'edit')); $form .= Xml::tags('p', array('class' => 'mw-revdel-editreasons'), $link) . "\n"; } } else { $form = ''; } $out->addHTML($form); }
function form($error) { global $wgUser, $wgScript, $wgOut; $form = ''; // Introduction if ($this->mModifyForm) { $wgOut->addWikiMsg('globalblocking-modify-intro'); } else { $wgOut->addWikiMsg('globalblocking-block-intro'); } // Add errors $wgOut->addHTML($error); $form .= Xml::fieldset(wfMsg('globalblocking-block-legend')); $form .= Xml::openElement('form', array('method' => 'post', 'action' => $wgScript, 'name' => 'uluser', 'id' => 'mw-globalblock-form')); $form .= Html::hidden('title', SpecialPage::getTitleFor('GlobalBlock')->getPrefixedText()); $fields = array(); // Who to block $fields['globalblocking-ipaddress'] = Xml::input('wpAddress', 45, $this->mAddress, array('id' => 'mw-globalblock-address')); // How long to block them for $dropdown = wfMsgForContentNoTrans('globalblocking-expiry-options'); if ($dropdown === '' || $dropdown == '-') { // 'globalblocking-expiry-options' is empty, try the message from core $dropdown = wfMsgForContentNoTrans('ipboptions'); if (wfEmptyMsg('ipboptions', $dropdown) || $dropdown === '' || $dropdown == '-') { // 'ipboptions' is empty too. Do not show a dropdown // Do not assume that 'ipboptions' exists forever, therefore check with wfEmptyMsg too $dropdown = false; } } if ($dropdown == false) { $fields['globalblocking-block-expiry'] = Xml::input('wpExpiry', 45, $this->mExpiry, array('id' => 'mw-globalblock-expiry')); } else { $fields['globalblocking-block-expiry'] = $this->buildExpirySelector('wpExpiry', 'mw-globalblock-expiry-selector', $this->mExpirySelection, $dropdown); $fields['globalblocking-block-expiry-otherfield'] = Xml::input('wpExpiryOther', 45, $this->mExpiry == $this->mExpirySelection ? '' : $this->mExpiry, array('id' => 'mw-globalblock-expiry-selector-other')); } // Why to block them $fields['globalblocking-block-reason'] = Xml::listDropDown('wpBlockReasonList', wfMsgForContent('globalblocking-block-reason-dropdown'), wfMsgForContent('globalblocking-block-reasonotherlist'), $this->mReasonList, 'mw-globalblock-reasonlist'); $fields['globalblocking-block-otherreason'] = Xml::input('wpReason', 45, $this->mReason, array('id' => 'mw-globalblock-reason')); // Block all users, or just anonymous ones $fields['globalblocking-block-options'] = Xml::checkLabel(wfMsg('globalblocking-ipbanononly'), 'wpAnonOnly', 'mw-globalblock-anon-only', $this->mAnonOnly); // Build a form. $submitMsg = $this->mModifyForm ? 'globalblocking-modify-submit' : 'globalblocking-block-submit'; $form .= Xml::buildForm($fields, $submitMsg); $form .= Html::hidden('wpEditToken', $wgUser->editToken()); if ($this->mModifyForm) { $form .= Html::hidden('wpModify', 1); } $form .= Xml::closeElement('form'); $form .= Xml::closeElement('fieldset'); #FIXME: make this actually use HTMLForm, instead of just its JavaScript $wgOut->addModules('mediawiki.htmlform'); $wgOut->addHTML($form); // Show loglist of previous blocks if ($this->mAddress) { $title = Title::makeTitleSafe(NS_USER, $this->mAddress); LogEventsList::showLogExtract($wgOut, 'gblblock', $title->getPrefixedText(), '', array('lim' => 10, 'msgKey' => 'globalblocking-showlog', 'showIfEmpty' => false)); } }