public function showForm() { global $wgScript; # Explanatory text $this->getOutput()->addWikiMsg('pendingchanges-list', $this->getLang()->formatNum($this->pager->getNumRows())); $form = Html::openElement('form', array('name' => 'pendingchanges', 'action' => $wgScript, 'method' => 'get')) . "\n"; $form .= "<fieldset><legend>" . wfMsgHtml('pendingchanges-legend') . "</legend>\n"; $form .= Html::hidden('title', $this->getTitle()->getPrefixedDBKey()) . "\n"; $items = array(); if (count(FlaggedRevs::getReviewNamespaces()) > 1) { $items[] = "<span style='white-space: nowrap;'>" . FlaggedRevsXML::getNamespaceMenu($this->namespace, '') . '</span>'; } if (FlaggedRevs::qualityVersions()) { $items[] = "<span style='white-space: nowrap;'>" . FlaggedRevsXML::getLevelMenu($this->level, 'revreview-filter-stable') . '</span>'; } if (!FlaggedRevs::isStableShownByDefault() && !FlaggedRevs::useOnlyIfProtected()) { $items[] = "<span style='white-space: nowrap;'>" . Xml::check('stable', $this->stable, array('id' => 'wpStable')) . Xml::label(wfMsg('pendingchanges-stable'), 'wpStable') . '</span>'; } if ($items) { $form .= implode(' ', $items) . '<br />'; } $items = array(); $items[] = Xml::label(wfMsg("pendingchanges-category"), 'wpCategory') . ' ' . Xml::input('category', 30, $this->category, array('id' => 'wpCategory')); if ($this->getUser()->getId()) { $items[] = Xml::check('watched', $this->watched, array('id' => 'wpWatched')) . Xml::label(wfMsg('pendingchanges-onwatchlist'), 'wpWatched'); } $form .= implode(' ', $items) . '<br />'; $form .= Xml::label(wfMsg('pendingchanges-size'), 'wpSize') . Xml::input('size', 4, $this->size, array('id' => 'wpSize')) . ' ' . Xml::submitButton(wfMsg('allpagessubmit')) . "\n"; $form .= "</fieldset>"; $form .= Html::closeElement('form') . "\n"; $this->getOutput()->addHTML($form); }
function addRequestWikiForm() { $localpage = $this->getPageTitle()->getLocalUrl(); $form = Xml::openElement('form', array('action' => $localpage, 'method' => 'post')); $form .= '<fieldset><legend>' . $this->msg('requestwiki')->escaped() . '</legend>'; $form .= Xml::openElement('table'); $form .= '<tr><td>' . $this->msg('requestwiki-label-siteurl')->escaped() . '</td>'; $form .= '<td>' . Xml::input('subdomain', 20, '') . '.miraheze.org' . '</td></tr>'; $form .= '<tr><td>' . $this->msg('requestwiki-label-sitename')->escaped() . '</td>'; $form .= '<td>' . Xml::input('sitename', 20, '', array('required' => '')) . '</td></tr>'; $form .= '<tr><td>' . $this->msg('requestwiki-label-customdomain')->escaped() . '</td>'; $form .= '<td>' . Xml::input('customdomain', 20, '') . '</td></tr>'; $form .= '<tr><td>' . $this->msg('requestwiki-label-language')->escaped() . '</td>'; $form .= '<td>' . Xml::languageSelector('en', true, null, array('name' => 'language'))[1] . '</td></tr>'; $form .= '<tr><td>' . $this->msg('requestwiki-label-private')->escaped() . '</td>'; $form .= '<td>' . Xml::check('private', false, array('value' => 0)) . '</td></tr>'; $form .= '<tr><td>' . $this->msg('requestwiki-label-comments')->escaped() . '</td>'; $form .= '<td>' . Xml::textarea('comments', '', 40, 5, array('required' => '')) . '</td></tr>'; $form .= '<tr><td>' . Xml::submitButton($this->msg('requestwiki-submit')->plain()) . '</td></tr>'; $form .= Xml::closeElement('table'); $form .= '</fieldset>'; $form .= Html::hidden('token', $this->getUser()->getEditToken()); $form .= Xml::closeElement('form'); $this->getOutput()->addHTML($form); }
function meaneditor_checkboxes(&$editpage, &$checkboxes, &$tabindex) { $checkboxes['want_traditional_editor'] = ''; $attribs = array('tabindex' => ++$tabindex, 'id' => 'wpWantTraditionalEditor'); $checkboxes['want_traditional_editor'] = Xml::check('wpWantTraditionalEditor', $editpage->userWantsTraditionalEditor, $attribs) . " <label for='wpWantTraditionalEditor'>" . wfMsg('checkbox_force_traditional') . "</label>"; return true; }
private function makeSearchForm( $process, $wild = false ) { $self = SpecialPage::getTitleFor( 'Profiling' ); $html = Xml::openElement( 'form', array( 'method' => 'post', 'action' => $self->getLocalUrl() ) ); $html .= '<table><tr><td>' . wfMsgHtml( 'profiling-process' ) . '</td><td>'; $html .= Xml::input( 'process', 50, $process ) . '</td></tr><td align="right">' . Xml::check( 'wildcard', $wild ) . '</td>'; $html .= '<td>' . wfMsgHtml( 'profiling-wildcard' ) . '</td></tr>'; $html .= '<tr><td> </td><td>' . Xml::submitButton( wfMsg( 'profiling-ok' ), array( 'name' => 'submit' ) ) . '</td></table></form>'; return $html; }
protected function getOneCheckbox($checked, $attribs, $label) { if ($this->mParent instanceof OOUIHTMLForm) { throw new MWException('HTMLMultiSelectField#getOneCheckbox() is not supported'); } else { $elementFunc = ['Html', $this->mOptionsLabelsNotFromMessage ? 'rawElement' : 'element']; $checkbox = Xml::check("{$this->mName}[]", $checked, $attribs) . ' ' . call_user_func($elementFunc, 'label', ['for' => $attribs['id']], $label); if ($this->mParent->getConfig()->get('UseMediaWikiUIEverywhere')) { $checkbox = Html::openElement('div', ['class' => 'mw-ui-checkbox']) . $checkbox . Html::closeElement('div'); } return $checkbox; } }
public static function getHTML($cur_value, $input_name, $is_mandatory, $is_disabled, $other_args) { global $sfgTabIndex, $sfgFieldNum, $sfgShowOnSelect; $className = $is_mandatory ? 'mandatoryField' : 'createboxInput'; if (array_key_exists('class', $other_args)) { $className .= ' ' . $other_args['class']; } $inputID = "input_{$sfgFieldNum}"; if (array_key_exists('show on select', $other_args)) { $className .= ' sfShowIfCheckedCheckbox'; foreach ($other_args['show on select'] as $div_id => $options) { // We don't actually use "$options" for // anything, because it's just a checkbox. if (array_key_exists($inputID, $sfgShowOnSelect)) { $sfgShowOnSelect[$inputID][] = $div_id; } else { $sfgShowOnSelect[$inputID] = array($div_id); } } } // Can show up here either as an array or a string, depending on // whether it came from user input or a wiki page if (is_array($cur_value)) { $isChecked = array_key_exists('value', $cur_value) && $cur_value['value'] == 'on'; } else { // Default to false - no need to check if it matches // a 'false' word. $lowercaseCurValue = strtolower(trim($cur_value)); $possibleYesMessages = array(strtolower(wfMessage('htmlform-yes')->inContentLanguage()->text()), '1', 'yes', 'true'); // Add values from Semantic MediaWiki, if it's installed. if (wfMessage('smw_true_words')->exists()) { $smwTrueWords = explode(',', wfMessage('smw_true_words')->inContentLanguage()->text()); foreach ($smwTrueWords as $smwTrueWord) { $possibleYesMessages[] = strtolower(trim($smwTrueWord)); } } $isChecked = in_array($lowercaseCurValue, $possibleYesMessages); } $text = "\t" . Html::hidden($input_name . '[is_checkbox]', 'true') . "\n"; $checkboxAttrs = array('id' => $inputID, 'class' => $className, 'tabindex' => $sfgTabIndex); if ($is_disabled) { $checkboxAttrs['disabled'] = true; } if (method_exists('Html', 'check')) { // MW 1.24+ $text .= "\t" . Html::check("{$input_name}[value]", $isChecked, $checkboxAttrs); } else { $text .= "\t" . Xml::check("{$input_name}[value]", $isChecked, $checkboxAttrs); } return $text; }
function showUserForm() { global $wgOut, $wgUser; $names = BanPests::getBannableUsers(); $whitelist = BanPests::getWhitelist(); $wgOut->addWikiMsg('blockandnuke-tools'); $wgOut->addHTML(Xml::openElement('form', array('action' => $this->getTitle()->getLocalURL('action=submit'), 'method' => 'post')) . HTML::hidden('wpEditToken', $wgUser->getEditToken()) . '<ul>'); //make into links $sk = $wgUser->getSkin(); foreach ($names as $user) { if (!in_array($user, $whitelist)) { $wgOut->addHTML('<li>' . Xml::check('names[]', true, array('value' => $user)) . $user . "</li>\n"); } } $wgOut->addHTML("</ul>\n" . Xml::submitButton(wfMsg('blockandnuke-submit-user')) . "</form>"); }
/** * Generate the content of each table row (1 row = 1 ad) * * @param $row object: database row * * @return string HTML */ function formatRow($row) { // Begin ad row $htmlOut = Xml::openElement('tr'); if ($this->editable) { // Remove box $htmlOut .= Xml::tags('td', array('valign' => 'top'), Xml::check('removeAds[]', false, array('value' => $row->ad_name, 'onchange' => $this->onRemoveChange))); } // 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; }
protected function getOneCheckbox($checked, $attribs, $label) { if ($this->mParent instanceof OOUIHTMLForm) { if ($this->mOptionsLabelsNotFromMessage) { $label = new OOUI\HtmlSnippet($label); } return new OOUI\FieldLayout(new OOUI\CheckboxInputWidget(['name' => "{$this->mName}[]", 'selected' => $checked] + OOUI\Element::configFromHtmlAttributes($attribs)), ['label' => $label, 'align' => 'inline']); } else { $elementFunc = ['Html', $this->mOptionsLabelsNotFromMessage ? 'rawElement' : 'element']; $checkbox = Xml::check("{$this->mName}[]", $checked, $attribs) . ' ' . call_user_func($elementFunc, 'label', ['for' => $attribs['id']], $label); if ($this->mParent->getConfig()->get('UseMediaWikiUIEverywhere')) { $checkbox = Html::openElement('div', ['class' => 'mw-ui-checkbox']) . $checkbox . Html::closeElement('div'); } return $checkbox; } }
/** * 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; }
function getInputHTML($value) { global $wgUseMediaWikiUIEverywhere; if (!empty($this->mParams['invert'])) { $value = !$value; } $attr = $this->getTooltipAndAccessKey(); $attr['id'] = $this->mID; $attr += $this->getAttributes(array('disabled', 'tabindex')); if ($this->mClass !== '') { $attr['class'] = $this->mClass; } $chkLabel = Xml::check($this->mName, $value, $attr) . ' ' . Html::rawElement('label', array('for' => $this->mID), $this->mLabel); if ($wgUseMediaWikiUIEverywhere || $this->mParent instanceof VFormHTMLForm) { $chkLabel = Html::rawElement('div', array('class' => 'mw-ui-checkbox'), $chkLabel); } return $chkLabel; }
function getInputHTML($value) { if (!empty($this->mParams['invert'])) { $value = !$value; } $attr = $this->getTooltipAndAccessKey(); $attr['id'] = $this->mID; $attr += $this->getAttributes(array('disabled', 'tabindex')); if ($this->mClass !== '') { $attr['class'] = $this->mClass; } if ($this->mParent->isVForm()) { // Nest checkbox inside label. return Html::rawElement('label', array('class' => 'mw-ui-checkbox-label'), Xml::check($this->mName, $value, $attr) . htmlspecialchars($this->mLabel)); } else { return Xml::check($this->mName, $value, $attr) . ' ' . Html::rawElement('label', array('for' => $this->mID), $this->mLabel); } }
function formatOptions($options, $value) { $html = ''; $attribs = $this->getAttributes(array('disabled', 'tabindex')); $elementFunc = array('Html', $this->mOptionsLabelsNotFromMessage ? 'rawElement' : 'element'); foreach ($options as $label => $info) { if (is_array($info)) { $html .= Html::rawElement('h1', array(), $label) . "\n"; $html .= $this->formatOptions($info, $value); } else { $thisAttribs = array('id' => "{$this->mID}-{$info}", 'value' => $info); $checkbox = Xml::check($this->mName . '[]', in_array($info, $value, true), $attribs + $thisAttribs); $checkbox .= ' ' . call_user_func($elementFunc, 'label', array('for' => "{$this->mID}-{$info}"), $label); $html .= ' ' . Html::rawElement('div', array('class' => 'mw-htmlform-flatlist-item'), $checkbox); } } return $html; }
function getQuestionForm( $question, $options ) { global $wgRequest; $name = 'securepoll_q' . $question->getId(); $s = ''; foreach ( $options as $option ) { $optionHTML = $option->parseMessageInline( 'text' ); $optionId = $option->getId(); $inputId = "{$name}_opt{$optionId}"; $oldValue = $wgRequest->getBool( $inputId ); $s .= '<div class="securepoll-option-approval">' . Xml::check( $inputId, $oldValue, array( 'id' => $inputId ) ) . ' ' . Xml::tags( 'label', array( 'for' => $inputId ), $optionHTML ) . ' ' . "</div>\n"; } return $s; }
private function displayNavigation() { global $wgOut; $groupSelector = new XmlSelect('group', 'group-select'); // pull groups $groups = MessageGroups::singleton()->getGroups(); foreach ($groups as $group) { if (!$group->isMeta()) { continue; } $groupSelector->addOption($group->getLabel(), $group->getId()); } $fields = array(); $fields['transstats-choose-group'] = $groupSelector->getHTML(); $fields['transstats-breakdown'] = Xml::check('breakdown', false); $out = Xml::openElement('form'); $out .= Xml::buildForm($fields); $out .= Xml::submitButton(wfMsg('transstats-submit')); $out .= Xml::closeElement('form'); $wgOut->addHTML($out); }
/** * Generate the content of each table row (1 row = 1 banner) * @param $row object: database row * @return string HTML */ function formatRow($row) { // Begin banner row $htmlOut = Xml::openElement('tr'); if ($this->editable) { // Remove box $htmlOut .= Xml::tags('td', array('valign' => 'top'), Xml::check('removeTemplates[]', false, array('value' => $row->tmp_name, 'onchange' => $this->onRemoveChange))); } // 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; }
/** * This method actually generates the output * @return string HTML output */ public function execute($params = false) { $this->setTemplate(''); $bChecked = $this->iEntriesChecked > 0 ? true : false; $sFacetHead = '<div class="bs-facet-title bs-extendedsearch-default-textspacing">'; $sFacetHead .= Xml::check('', $bChecked, array('urldiff' => $this->getOption('uri-facet-all-diff'))); $sFacetHead .= '<label>' . wfMessage($this->getOption('title'))->plain() . '</label>'; $sFacetHead .= '</div>'; $this->addCompleteDataset($this->aEntriesChecked); $body = parent::execute(); if (!empty($this->aEntriesChecked) && !empty($this->aEntriesUnChecked)) { $body .= Xml::element('span', array('class' => 'bs-extendedsearch-facet-separator'), '', false); } $this->addCompleteDataset($this->aEntriesUnChecked); $body .= parent::execute(); if (empty($body)) { return ''; } $body .= '<div class="bs-extendedsearch-facetend"></div><div class="bs-extendedsearch-facetbox-more"></div>'; $body = Xml::openElement('div', array('class' => 'bs-extendedsearch-facetbox-container')) . $body . Xml::closeElement('div'); $body = Xml::openElement('div', array('class' => 'bs-extendedsearch-facetbox')) . $body . Xml::closeElement('div'); return $sFacetHead . $body; }
function listForm($username, $reason) { global $wgUser, $wgOut, $wgLang; $pages = $this->getNewPages($username); if (count($pages) == 0) { $wgOut->addWikiMsg('nuke-nopages', $username); return $this->promptForm(); } $wgOut->addWikiMsg('nuke-list', $username); $nuke = $this->getTitle(); $submit = Xml::submitButton(wfMsg('nuke-submit-delete')); $wgOut->addHTML(Xml::openElement('form', array('action' => $nuke->getLocalURL('action=delete'), 'method' => 'post')) . Xml::hidden('wpEditToken', $wgUser->editToken()) . Xml::inputLabel(wfMsg('deletecomment'), 'wpReason', 'wpReason', 60, $reason) . '<br /><br />' . Xml::submitButton(wfMsg('nuke-submit-delete'))); $wgOut->addHTML('<ul>'); $sk = $wgUser->getSkin(); foreach ($pages as $info) { list($title, $edits) = $info; $image = $title->getNamespace() == NS_IMAGE ? wfLocalFile($title) : false; $thumb = $image && $image->exists() ? $image->getThumbnail(120, 120) : false; $changes = wfMsgExt('nchanges', 'parsemag', $wgLang->formatNum($edits)); $wgOut->addHTML('<li>' . Xml::check('pages[]', true, array('value' => $title->getPrefixedDbKey())) . ' ' . ($thumb ? $thumb->toHtml(array('desc-link' => true)) : '') . $sk->makeKnownLinkObj($title) . ' (' . $sk->makeKnownLinkObj($title, $changes, 'action=history') . ")</li>\n"); } $wgOut->addHTML("</ul>\n" . Xml::submitButton(wfMsg('nuke-submit-delete')) . "</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; }
/** * @param $group * @return string */ function buildCheckboxes($group) { $editable = $this->userCanEdit($this->getUser()); $assignedRights = $this->getAssignedRights($group); $checkboxes = array(); $attribs = array(); if (!$editable) { $attribs['disabled'] = 'disabled'; if (!$assignedRights) { $this->getOutput()->wrapWikiMsg('<div class="error">$1</div>', array('centralauth-editgroup-nonexistent', $group)); } } $rights = User::getAllRights(); sort($rights); foreach ($rights as $right) { // Build a checkbox $checked = in_array($right, $assignedRights); $desc = $this->getOutput()->parseInline(User::getRightDescription($right)) . ' ' . Xml::element('code', null, $this->msg('parentheses', $right)->text()); $checkbox = Xml::check("wpRightAssigned-{$right}", $checked, array_merge($attribs, array('id' => "wpRightAssigned-{$right}"))); $label = Xml::tags('label', array('for' => "wpRightAssigned-{$right}"), $desc); $liClass = $checked ? 'mw-centralauth-editgroup-checked' : 'mw-centralauth-editgroup-unchecked'; $checkboxes[] = Html::rawElement('li', array('class' => $liClass), "{$checkbox} {$label}"); } $count = count($checkboxes); $html = Html::openElement('div', array('class' => 'mw-centralauth-rights')) . '<ul>'; foreach ($checkboxes as $cb) { $html .= $cb; } $html .= '</ul>' . Html::closeElement('div'); return $html; }
function formatOptions($options, $value) { $html = ''; $attribs = array(); if (!empty($this->mParams['disabled'])) { $attribs['disabled'] = 'disabled'; } foreach ($options as $label => $info) { if (is_array($info)) { $html .= Html::rawElement('h1', array(), $label) . "\n"; $html .= $this->formatOptions($info, $value); } else { $thisAttribs = array('id' => "{$this->mID}-{$info}", 'value' => $info); $checkbox = Xml::check($this->mName . '[]', in_array($info, $value, true), $attribs + $thisAttribs); $checkbox .= ' ' . Html::rawElement('label', array('for' => "{$this->mID}-{$info}"), $label); $html .= ' ' . Html::rawElement('div', array('class' => 'mw-htmlform-flatlist-item'), $checkbox); } } return $html; }
private function formatFileRow($row) { $file = ArchivedFile::newFromRow($row); $ts = wfTimestamp(TS_MW, $row->fa_timestamp); $user = $this->getUser(); $checkBox = ''; if ($this->mCanView && $row->fa_storage_key) { if ($this->mAllowed) { $checkBox = Xml::check('fileid' . $row->fa_id); } $key = urlencode($row->fa_storage_key); $pageLink = $this->getFileLink($file, $this->getPageTitle(), $ts, $key); } else { $pageLink = $this->getLanguage()->userTimeAndDate($ts, $user); } $userLink = $this->getFileUser($file); $data = $this->msg('widthheight')->numParams($row->fa_width, $row->fa_height)->text(); $bytes = $this->msg('parentheses')->rawParams($this->msg('nbytes')->numParams($row->fa_size)->text())->plain(); $data = htmlspecialchars($data . ' ' . $bytes); $comment = $this->getFileComment($file); // Add show/hide deletion links if available $canHide = $this->isAllowed('deleterevision'); if ($canHide || $file->getVisibility() && $this->isAllowed('deletedhistory')) { if (!$file->userCan(File::DELETED_RESTRICTED, $user)) { // Revision was hidden from sysops $revdlink = Linker::revDeleteLinkDisabled($canHide); } else { $query = array('type' => 'filearchive', 'target' => $this->mTargetObj->getPrefixedDBkey(), 'ids' => $row->fa_id); $revdlink = Linker::revDeleteLink($query, $file->isDeleted(File::DELETED_RESTRICTED), $canHide); } } else { $revdlink = ''; } return "<li>{$checkBox} {$revdlink} {$pageLink} . . {$userLink} {$data} {$comment}</li>\n"; }
function meaneditor_checkboxes(&$editpage, &$checkboxes, &$tabindex) { wfLoadExtensionMessages('MeanEditor'); $checkboxes['want_traditional_editor'] = ''; $attribs = array('tabindex' => ++$tabindex, 'id' => 'wpWantTraditionalEditor'); $checkboxes['want_traditional_editor'] = Xml::check('wpWantTraditionalEditor', $checked['want_traditional_editor'], $attribs) . " <label for='wpWantTraditionalEditor'>" . wfMsg('checkbox_force_traditional') . "</label>"; return true; }
protected function _executeDelete($wgFarmer) { global $wgOut, $wgUser, $wgRequest; if (!$wgFarmer->getActiveWiki()->isDefaultWiki()) { $wgOut->wrapWikiMsg("== \$1 ==\n\$2", 'farmer-notaccessible', 'farmer-notaccessible-test'); return; } if (!MediaWikiFarmer::userIsFarmerAdmin($wgUser)) { $wgOut->wrapWikiMsg("== \$1 ==\n\$2", 'farmer-permissiondenied', 'farmer-permissiondenied-text'); return; } if ($wgRequest->wasPosted() && ($wiki = $wgRequest->getVal('wpWiki')) && $wiki != '-1') { if ($wgRequest->getCheck('wpConfirm')) { $wgOut->wrapWikiMsg('<div class="successbox">$1</div>', array('farmer-deleting', $wiki)); $log = new LogPage('farmer'); $log->addEntry('delete', $this->getTitle(), $wgRequest->getVal('wpReason'), array($wiki)); $deleteWiki = MediaWikiFarmer_Wiki::factory($wiki); $deleteWiki->deleteWiki(); } else { $wgOut->addWikiMsg('farmer-delete-confirm-wiki', $wiki); $wgOut->addHTML(Xml::openElement('form', array('method' => 'post', 'name' => 'deleteWiki')) . "\n" . Xml::buildForm(array('farmer-delete-reason' => Xml::input('wpReason', false, $wgRequest->getVal('wpReason')), 'farmer-delete-confirm' => Xml::check('wpConfirm')), 'farmer-delete-form-submit') . "\n" . Html::Hidden('wpWiki', $wiki) . "\n" . Xml::closeElement('form')); } return; } $list = $wgFarmer->getFarmList(); $wgOut->wrapWikiMsg("== \$1 ==\n\$2", 'farmer-delete-title', 'farmer-delete-text'); $select = new XmlSelect('wpWiki', false, $wgRequest->getVal('wpWiki')); $select->addOption(wfMsg('farmer-delete-form'), '-1'); foreach ($list as $wiki) { if ($wiki['name'] != $wgFarmer->getDefaultWiki()) { $name = $wiki['name']; $title = $wiki['title']; $select->addOption("{$name} - {$title}", $name); } } $wgOut->addHTML(Xml::openElement('form', array('method' => 'post', 'name' => 'deleteWiki')) . "\n" . $select->getHTML() . "\n" . Xml::submitButton(wfMsg('farmer-delete-form-submit')) . "\n" . Xml::closeElement('form')); }
function showForm($action) { $request = $this->getRequest(); $prefix = $request->getVal('prefix'); $wpPrefix = ''; $label = array('class' => 'mw-label'); $input = array('class' => 'mw-input'); if ($action == 'delete') { $topmessage = wfMessage('interwiki_delquestion', $prefix)->text(); $intromessage = wfMessage('interwiki_deleting', $prefix)->text(); $wpPrefix = Html::hidden('wpInterwikiPrefix', $prefix); $button = 'delete'; $formContent = ''; } elseif ($action == 'edit') { $dbr = wfGetDB(DB_SLAVE); $row = $dbr->selectRow('interwiki', '*', array('iw_prefix' => $prefix), __METHOD__); if (!$row) { $this->error('interwiki_editerror', $prefix); return; } $prefix = $row->iw_prefix; $defaulturl = $row->iw_url; $trans = $row->iw_trans; $local = $row->iw_local; $wpPrefix = Html::hidden('wpInterwikiPrefix', $row->iw_prefix); $topmessage = wfMessage('interwiki_edittext')->text(); $intromessage = wfMessage('interwiki_editintro')->text(); $button = 'edit'; } elseif ($action == 'add') { $prefix = $request->getVal('wpInterwikiPrefix', $request->getVal('prefix')); $prefix = Xml::input('wpInterwikiPrefix', 20, $prefix, array('tabindex' => 1, 'id' => 'mw-interwiki-prefix', 'maxlength' => 20)); $local = $request->getCheck('wpInterwikiLocal'); $trans = $request->getCheck('wpInterwikiTrans'); $defaulturl = $request->getVal('wpInterwikiURL', wfMessage('interwiki-defaulturl')->text()); $topmessage = wfMessage('interwiki_addtext')->text(); $intromessage = wfMessage('interwiki_addintro')->text(); $button = 'interwiki_addbutton'; } if ($action == 'add' || $action == 'edit') { $formContent = Html::rawElement('tr', null, Html::element('td', $label, wfMessage('interwiki-prefix-label')->text()) . Html::rawElement('td', null, '<tt>' . $prefix . '</tt>')) . Html::rawElement('tr', null, Html::rawElement('td', $label, Xml::label(wfMessage('interwiki-local-label')->text(), 'mw-interwiki-local')) . Html::rawElement('td', $input, Xml::check('wpInterwikiLocal', $local, array('id' => 'mw-interwiki-local')))) . Html::rawElement('tr', null, Html::rawElement('td', $label, Xml::label(wfMessage('interwiki-trans-label')->text(), 'mw-interwiki-trans')) . Html::rawElement('td', $input, Xml::check('wpInterwikiTrans', $trans, array('id' => 'mw-interwiki-trans')))) . Html::rawElement('tr', null, Html::rawElement('td', $label, Xml::label(wfMessage('interwiki-url-label')->text(), 'mw-interwiki-url')) . Html::rawElement('td', $input, Xml::input('wpInterwikiURL', 60, $defaulturl, array('tabindex' => 1, 'maxlength' => 200, 'id' => 'mw-interwiki-url')))); } return Xml::fieldset($topmessage, Html::rawElement('form', array('id' => "mw-interwiki-{$action}form", 'method' => 'post', 'action' => $this->getTitle()->getLocalURL('action=submit')), Html::rawElement('p', null, $intromessage) . Html::rawElement('table', array('id' => "mw-interwiki-{$action}"), $formContent . Html::rawElement('tr', null, Html::rawElement('td', $label, Xml::label(wfMessage('interwiki_reasonfield')->text(), "mw-interwiki-{$action}reason")) . Html::rawElement('td', $input, Xml::input('wpInterwikiReason', 60, '', array('tabindex' => 1, 'id' => "mw-interwiki-{$action}reason", 'maxlength' => 200)))) . Html::rawElement('tr', null, Html::rawElement('td', null, '') . Html::rawElement('td', array('class' => 'mw-submit'), Xml::submitButton(wfMessage($button)->text(), array('id' => 'mw-interwiki-submit')))) . $wpPrefix . Html::hidden('wpEditToken', $this->getUser()->editToken()) . Html::hidden('wpInterwikiAction', $action)))); }
/** * Returns a row from the history printout. * * @todo document some more, and maybe clean up the code (some params redundant?) * * @param stdClass $row The database row corresponding to the previous line. * @param mixed $next The database row corresponding to the next line * (chronologically previous) * @param bool|string $notificationtimestamp * @param bool $latest Whether this row corresponds to the page's latest revision. * @param bool $firstInList Whether this row corresponds to the first * displayed on this history page. * @return string HTML output for the row */ function historyLine($row, $next, $notificationtimestamp = false, $latest = false, $firstInList = false) { $rev = new Revision($row); $rev->setTitle($this->getTitle()); if (is_object($next)) { $prevRev = new Revision($next); $prevRev->setTitle($this->getTitle()); } else { $prevRev = null; } $curlink = $this->curLink($rev, $latest); $lastlink = $this->lastLink($rev, $next); $curLastlinks = $curlink . $this->historyPage->message['pipe-separator'] . $lastlink; $histLinks = Html::rawElement('span', array('class' => 'mw-history-histlinks'), $this->msg('parentheses')->rawParams($curLastlinks)->escaped()); $diffButtons = $this->diffButtons($rev, $firstInList); $s = $histLinks . $diffButtons; $link = $this->revLink($rev); $classes = array(); $del = ''; $user = $this->getUser(); // Show checkboxes for each revision if ($user->isAllowed('deleterevision')) { $this->preventClickjacking(); // If revision was hidden from sysops, disable the checkbox if (!$rev->userCan(Revision::DELETED_RESTRICTED, $user)) { $del = Xml::check('deleterevisions', false, array('disabled' => 'disabled')); // Otherwise, enable the checkbox... } else { $del = Xml::check('showhiderevisions', false, array('name' => 'ids[' . $rev->getId() . ']')); } // User can only view deleted revisions... } elseif ($rev->getVisibility() && $user->isAllowed('deletedhistory')) { // If revision was hidden from sysops, disable the link if (!$rev->userCan(Revision::DELETED_RESTRICTED, $user)) { $del = Linker::revDeleteLinkDisabled(false); // Otherwise, show the link... } else { $query = array('type' => 'revision', 'target' => $this->getTitle()->getPrefixedDBkey(), 'ids' => $rev->getId()); $del .= Linker::revDeleteLink($query, $rev->isDeleted(Revision::DELETED_RESTRICTED), false); } } if ($del) { $s .= " {$del} "; } $lang = $this->getLanguage(); $dirmark = $lang->getDirMark(); $s .= " {$link}"; $s .= $dirmark; $s .= " <span class='history-user'>" . Linker::revUserTools($rev, true) . "</span>"; $s .= $dirmark; if ($rev->isMinor()) { $s .= ' ' . ChangesList::flag('minor'); } # Sometimes rev_len isn't populated if ($rev->getSize() !== null) { # Size is always public data $prevSize = isset($this->parentLens[$row->rev_parent_id]) ? $this->parentLens[$row->rev_parent_id] : 0; $sDiff = ChangesList::showCharacterDifference($prevSize, $rev->getSize()); $fSize = Linker::formatRevisionSize($rev->getSize()); $s .= ' <span class="mw-changeslist-separator">. .</span> ' . "{$fSize} {$sDiff}"; } # Text following the character difference is added just before running hooks $s2 = Linker::revComment($rev, false, true); if ($notificationtimestamp && $row->rev_timestamp >= $notificationtimestamp) { $s2 .= ' <span class="updatedmarker">' . $this->msg('updatedmarker')->escaped() . '</span>'; $classes[] = 'mw-history-line-updated'; } $tools = array(); # Rollback and undo links if ($prevRev && $this->getTitle()->quickUserCan('edit', $user)) { if ($latest && $this->getTitle()->quickUserCan('rollback', $user)) { // Get a rollback link without the brackets $rollbackLink = Linker::generateRollback($rev, $this->getContext(), array('verify', 'noBrackets')); if ($rollbackLink) { $this->preventClickjacking(); $tools[] = $rollbackLink; } } if (!$rev->isDeleted(Revision::DELETED_TEXT) && !$prevRev->isDeleted(Revision::DELETED_TEXT)) { # Create undo tooltip for the first (=latest) line only $undoTooltip = $latest ? array('title' => $this->msg('tooltip-undo')->text()) : array(); $undolink = Linker::linkKnown($this->getTitle(), $this->msg('editundo')->escaped(), $undoTooltip, array('action' => 'edit', 'undoafter' => $prevRev->getId(), 'undo' => $rev->getId())); $tools[] = "<span class=\"mw-history-undo\">{$undolink}</span>"; } } // Allow extension to add their own links here wfRunHooks('HistoryRevisionTools', array($rev, &$tools)); if ($tools) { $s2 .= ' ' . $this->msg('parentheses')->rawParams($lang->pipeList($tools))->escaped(); } # Tags list($tagSummary, $newClasses) = ChangeTags::formatSummaryRow($row->ts_tags, 'history'); $classes = array_merge($classes, $newClasses); if ($tagSummary !== '') { $s2 .= " {$tagSummary}"; } # Include separator between character difference and following text if ($s2 !== '') { $s .= ' <span class="mw-changeslist-separator">. .</span> ' . $s2; } wfRunHooks('PageHistoryLineEnding', array($this, &$row, &$s, &$classes)); $attribs = array(); if ($classes) { $attribs['class'] = implode(' ', $classes); } return Xml::tags('li', $attribs, $s) . "\n"; }
/** * @param stdClass $row Row * @return string */ private function getShowHideLinks($row) { // We don't want to see the links and if ($this->flags == self::NO_ACTION_LINK) { return ''; } $user = $this->getUser(); // If change tag editing is available to this user, return the checkbox if ($this->flags & self::USE_CHECKBOXES && $this->showTagEditUI) { return Xml::check('showhiderevisions', false, array('name' => 'ids[' . $row->log_id . ']')); } // no one can hide items from the suppress log. if ($row->log_type == 'suppress') { return ''; } $del = ''; // Don't show useless checkbox to people who cannot hide log entries if ($user->isAllowed('deletedhistory')) { $canHide = $user->isAllowed('deletelogentry'); $canViewSuppressedOnly = $user->isAllowed('viewsuppressed') && !$user->isAllowed('suppressrevision'); $entryIsSuppressed = self::isDeleted($row, LogPage::DELETED_RESTRICTED); $canViewThisSuppressedEntry = $canViewSuppressedOnly && $entryIsSuppressed; if ($row->log_deleted || $canHide) { // Show checkboxes instead of links. if ($canHide && $this->flags & self::USE_CHECKBOXES && !$canViewThisSuppressedEntry) { // If event was hidden from sysops if (!self::userCan($row, LogPage::DELETED_RESTRICTED, $user)) { $del = Xml::check('deleterevisions', false, array('disabled' => 'disabled')); } else { $del = Xml::check('showhiderevisions', false, array('name' => 'ids[' . $row->log_id . ']')); } } else { // If event was hidden from sysops if (!self::userCan($row, LogPage::DELETED_RESTRICTED, $user)) { $del = Linker::revDeleteLinkDisabled($canHide); } else { $query = array('target' => SpecialPage::getTitleFor('Log', $row->log_type)->getPrefixedDBkey(), 'type' => 'logging', 'ids' => $row->log_id); $del = Linker::revDeleteLink($query, $entryIsSuppressed, $canHide && !$canViewThisSuppressedEntry); } } } } return $del; }
/** * Display list of pages to delete. * * @param string $username * @param string $reason * @param integer $limit */ protected function listForm($username, $reason, $limit) { $out = $this->getOutput(); $pages = $this->getNewPages($username, $limit); if (count($pages) == 0) { if ($username === '') { $out->addWikiMsg('nuke-nopages-global'); } else { $out->addWikiMsg('nuke-nopages', $username); } $this->promptForm($username); return; } if ($username === '') { $out->addWikiMsg('nuke-list-multiple'); } else { $out->addWikiMsg('nuke-list', $username); } $nuke = $this->getTitle(); $out->addModules('ext.nuke'); $out->addHTML(Xml::openElement('form', array('action' => $nuke->getLocalURL('action=delete'), 'method' => 'post', 'name' => 'nukelist')) . Html::hidden('wpEditToken', $this->getUser()->editToken()) . Xml::tags('p', null, Xml::inputLabel(wfMsg('deletecomment'), 'wpReason', 'wpReason', 70, $reason))); // Select: All, None $links = array(); $links[] = '<a href="#" id="toggleall">' . wfMsg('powersearch-toggleall') . '</a>'; $links[] = '<a href="#" id="togglenone">' . wfMsg('powersearch-togglenone') . '</a>'; $out->addHTML(Xml::tags('p', null, wfMsg('nuke-select', $this->getLanguage()->commaList($links)))); // Delete button $out->addHTML(Xml::submitButton(wfMsg('nuke-submit-delete'))); $out->addHTML('<ul>'); foreach ($pages as $info) { /** * @var $title Title */ list($title, $userName) = $info; $image = $title->getNamespace() == NS_IMAGE ? wfLocalFile($title) : false; $thumb = $image && $image->exists() ? $image->transform(array('width' => 120, 'height' => 120), 0) : false; $out->addHTML('<li>' . Xml::check('pages[]', true, array('value' => $title->getPrefixedDbKey())) . ' ' . ($thumb ? $thumb->toHtml(array('desc-link' => true)) : '') . Linker::linkKnown($title) . ' (' . ($userName ? wfMsgExt('nuke-editby', 'parseinline', $userName) . ', ' : '') . Linker::linkKnown($title, wfMsg('nuke-viewchanges'), array(), array('action' => 'history')) . ")</li>\n"); } $out->addHTML("</ul>\n" . Xml::submitButton(wfMsg('nuke-submit-delete')) . '</form>'); }
function pageListForm( $titles_for_edit, $titles_for_move, $unmoveable_titles ) { global $wgOut, $wgLang, $wgScriptPath; $linker = class_exists( 'DummyLinker' ) ? new DummyLinker : new Linker; $formOpts = array( 'id' => 'choose_pages', 'method' => 'post', 'action' => $this->getTitle()->getFullUrl() ); $wgOut->addHTML( Xml::openElement( 'form', $formOpts ) . "\n" . self::hiddenField( 'title', $this->getTitle()->getPrefixedText() ) . self::hiddenField( 'target', $this->target ) . self::hiddenField( 'replacement', $this->replacement ) . self::hiddenField( 'use_regex', $this->use_regex ) ); $wgOut->addScriptFile( "$wgScriptPath/extensions/ReplaceText/ReplaceText.js" ); if ( count( $titles_for_edit ) > 0 ) { $wgOut->addWikiMsg( 'replacetext_choosepagesforedit', "<tt><nowiki>{$this->target}</nowiki></tt>", "<tt><nowiki>{$this->replacement}</nowiki></tt>", $wgLang->formatNum( count( $titles_for_edit ) ) ); foreach ( $titles_for_edit as $title_and_context ) { list( $title, $context ) = $title_and_context; $wgOut->addHTML( Xml::check( $title->getArticleID(), true ) . $linker->link( $title ) . " - <small>$context</small><br />\n" ); } $wgOut->addHTML( '<br />' ); } if ( count( $titles_for_move ) > 0 ) { $wgOut->addWikiMsg( 'replacetext_choosepagesformove', $this->target, $this->replacement, $wgLang->formatNum( count( $titles_for_move ) ) ); foreach ( $titles_for_move as $title ) { $wgOut->addHTML( Xml::check( 'move-' . $title->getArticleID(), true ) . $linker->link( $title ) . "<br />\n" ); } $wgOut->addHTML( '<br />' ); $wgOut->addWikiMsg( 'replacetext_formovedpages' ); $wgOut->addHTML( Xml::checkLabel( wfMsg( 'replacetext_savemovedpages' ), 'create-redirect', 'create-redirect', true ) . "<br />\n" . Xml::checkLabel( wfMsg( 'replacetext_watchmovedpages' ), 'watch-pages', 'watch-pages', false ) ); $wgOut->addHTML( '<br />' ); } $wgOut->addHTML( "<br />\n" . Xml::submitButton( wfMsg( 'replacetext_replace' ) ) . "\n" . self::hiddenField( 'replace', 1 ) ); // Only show "invert selections" link if there are more than // five pages. if ( count( $titles_for_edit ) + count( $titles_for_move ) > 5 ) { $buttonOpts = array( 'type' => 'button', 'value' => wfMsg( 'replacetext_invertselections' ), 'onclick' => 'invertSelections(); return false;' ); $wgOut->addHTML( Xml::element( 'input', $buttonOpts ) ); } $wgOut->addHTML( '</form>' ); if ( count( $unmoveable_titles ) > 0 ) { $wgOut->addWikiMsg( 'replacetext_cannotmove', $wgLang->formatNum( count( $unmoveable_titles ) ) ); $text = "<ul>\n"; foreach ( $unmoveable_titles as $title ) { $text .= "<li>{$linker->link( $title )}<br />\n"; } $text .= "</ul>\n"; $wgOut->addHTML( $text ); } }
/** * Add a "review pending changes" checkbox to the edit form iff: * (a) there are currently any revisions pending (bug 16713) * (b) this is an unreviewed page (bug 23970) */ public function addReviewCheck(EditPage $editPage, array &$checkboxes, &$tabindex) { $request = $this->getRequest(); $title = $this->article->getTitle(); // convenience if (!$this->article->isReviewable() || !$title->userCan('review')) { return true; // not needed } elseif ($this->editWillBeAutoreviewed($editPage)) { return true; // edit will be auto-reviewed } if (self::getBaseRevId($editPage, $request) == $this->article->getLatest()) { # For pages with either no stable version, or an outdated one, let # the user decide if he/she wants it reviewed on the spot. One might # do this if he/she just saw the diff-to-stable and *then* decided to edit. # Note: check not shown when editing old revisions, which is confusing. $checkbox = Xml::check('wpReviewEdit', $request->getCheck('wpReviewEdit'), array('tabindex' => ++$tabindex, 'id' => 'wpReviewEdit')); $attribs = array('for' => 'wpReviewEdit'); // For reviewed pages... if ($this->article->getStable()) { // For pending changes... if ($this->article->revsArePending()) { $n = $this->article->getPendingRevCount(); $attribs['title'] = wfMsg('revreview-check-flag-p-title'); $labelMsg = wfMsgExt('revreview-check-flag-p', 'parseinline', $n); // For just the user's changes... } else { $attribs['title'] = wfMsgExt('revreview-check-flag-y-title', 'parsemag'); $labelMsg = wfMsgExt('revreview-check-flag-y', 'parseinline'); } // For unreviewed pages... } else { $attribs['title'] = wfMsg('revreview-check-flag-u-title'); $labelMsg = wfMsgExt('revreview-check-flag-u', 'parseinline'); } $label = Xml::element('label', $attribs, $labelMsg); $checkboxes['reviewed'] = $checkbox . ' ' . $label; } return true; }