/** * Show options for the log list * * @param array|string $types * @param string $user * @param string $page * @param string $pattern * @param int $year Year * @param int $month Month * @param array $filter * @param string $tagFilter Tag to select by default */ public function showOptions($types = array(), $user = '', $page = '', $pattern = '', $year = 0, $month = 0, $filter = null, $tagFilter = '') { global $wgScript, $wgMiserMode; $title = SpecialPage::getTitleFor('Log'); // For B/C, we take strings, but make sure they are converted... $types = $types === '' ? array() : (array) $types; $tagSelector = ChangeTags::buildTagFilterSelector($tagFilter); $html = Html::hidden('title', $title->getPrefixedDBkey()); // Basic selectors $html .= $this->getTypeMenu($types) . "\n"; $html .= $this->getUserInput($user) . "\n"; $html .= $this->getTitleInput($page) . "\n"; $html .= $this->getExtraInputs($types) . "\n"; // Title pattern, if allowed if (!$wgMiserMode) { $html .= $this->getTitlePattern($pattern) . "\n"; } // date menu $html .= Xml::tags('p', null, Xml::dateMenu((int) $year, (int) $month)); // Tag filter if ($tagSelector) { $html .= Xml::tags('p', null, implode(' ', $tagSelector)); } // Filter links if ($filter) { $html .= Xml::tags('p', null, $this->getFilterLinks($filter)); } // Submit button $html .= Xml::submitButton($this->msg('logeventslist-submit')->text()); // Fieldset $html = Xml::fieldset($this->msg('log')->text(), $html); // Form wrapping $html = Xml::tags('form', array('action' => $wgScript, 'method' => 'get'), $html); $this->getOutput()->addHTML($html); }
/** * Display a list with the passed revisions. * * @since 0.1 * * @param EPPageObject $object */ protected function displayRevisions(EPPageObject $object) { $conditions = array('type' => get_class($object)); if ($object->hasIdField()) { $conditions['object_id'] = $object->getId(); } $action = htmlspecialchars($GLOBALS['wgScript']); $request = $this->getRequest(); $out = $this->getOutput(); /** * Add date selector to quickly get to a certain time */ $year = $request->getInt('year'); $month = $request->getInt('month'); $tagFilter = $request->getVal('tagfilter'); $tagSelector = ChangeTags::buildTagFilterSelector($tagFilter); /** * Option to show only revisions that have been (partially) hidden via RevisionDelete */ if ($request->getBool('deleted')) { $conditions['deleted'] = true; } $checkDeleted = Xml::checkLabel($this->msg('history-show-deleted')->text(), 'deleted', 'mw-show-deleted-only', $request->getBool('deleted')) . "\n"; $out->addHTML("<form action=\"{$action}\" method=\"get\" id=\"mw-history-searchform\">" . Xml::fieldset($this->msg('history-fieldset-title')->text(), false, array('id' => 'mw-history-search')) . Html::hidden('title', $this->getTitle()->getPrefixedDBKey()) . "\n" . Html::hidden('action', 'history') . "\n" . Xml::dateMenu($year, $month) . ' ' . ($tagSelector ? implode(' ', $tagSelector) . ' ' : '') . $checkDeleted . Xml::submitButton($this->msg('allpagessubmit')->text()) . "\n" . '</fieldset></form>'); $pager = new EPRevisionPager($this->getContext(), $conditions); if ($pager->getNumRows()) { $out->addHTML($pager->getNavigationBar() . $pager->getBody() . $pager->getNavigationBar()); } else { // TODO } }
function getDiv($value) { $this->tagFilter = ChangeTags::buildTagFilterSelector($value); if ($this->tagFilter) { return parent::getDiv($value); } return ''; }
/** * Show options for the log list * @param $type String * @param $user String * @param $page String * @param $pattern String * @param $year Integer: year * @param $month Integer: month * @param $filter: array * @param $tagFilter: array? */ public function showOptions($type = '', $user = '', $page = '', $pattern = '', $year = '', $month = '', $filter = null, $tagFilter = '') { global $wgScript, $wgMiserMode; $action = htmlspecialchars($wgScript); $title = SpecialPage::getTitleFor('Log'); $special = htmlspecialchars($title->getPrefixedDBkey()); $tagSelector = ChangeTags::buildTagFilterSelector($tagFilter); $this->out->addHTML("<form action=\"{$action}\" method=\"get\"><fieldset>" . Xml::element('legend', array(), wfMsg('log')) . Xml::hidden('title', $special) . "\n" . $this->getTypeMenu($type) . "\n" . $this->getUserInput($user) . "\n" . $this->getTitleInput($page) . "\n" . (!$wgMiserMode ? $this->getTitlePattern($pattern) . "\n" : "") . "<p>" . Xml::dateMenu($year, $month) . "\n" . ($tagSelector ? Xml::tags('p', null, implode(' ', $tagSelector)) : '') . "\n" . ($filter ? "</p><p>" . $this->getFilterLinks($type, $filter) . "\n" : "") . "\n" . Xml::submitButton(wfMsg('allpagessubmit')) . "</p>\n" . "</fieldset></form>"); }
public function showForm() { global $wgScript; // Add explanatory text $this->getOutput()->addWikiMsg('problemchanges-list', $this->getLanguage()->formatNum($this->pager->getNumRows())); $form = Html::openElement('form', array('name' => 'problemchanges', 'action' => $wgScript, 'method' => 'get')) . "\n"; $form .= "<fieldset><legend>" . $this->msg('problemchanges-legend')->escaped() . "</legend>\n"; $form .= Html::hidden('title', $this->getPageTitle()->getPrefixedDBKey()) . "\n"; $form .= FlaggedRevs::qualityVersions() ? "<span style='white-space: nowrap;'>" . FlaggedRevsXML::getLevelMenu($this->level, 'revreview-filter-stable') . '</span> ' : ""; $tagForm = ChangeTags::buildTagFilterSelector($this->tag); if (count($tagForm)) { $form .= Xml::tags('td', array('class' => 'mw-label'), $tagForm[0]); $form .= Xml::tags('td', array('class' => 'mw-input'), $tagForm[1]); } $form .= '<br />' . Xml::label($this->msg("problemchanges-category")->text(), 'wpCategory') . ' ' . Xml::input('category', 30, $this->category, array('id' => 'wpCategory')) . ' '; $form .= Xml::submitButton($this->msg('allpagessubmit')->text()) . "\n"; $form .= '</fieldset>'; $form .= Html::closeElement('form') . "\n"; $this->getOutput()->addHTML($form); }
/** * Get options to be displayed in a form * * @param FormOptions $opts * @return array */ function getExtraOptions($opts) { $extraOpts = array(); $extraOpts['namespace'] = $this->namespaceFilterForm($opts); global $wgAllowCategorizedRecentChanges; if ($wgAllowCategorizedRecentChanges) { $extraOpts['category'] = $this->categoryFilterForm($opts); } $tagFilter = ChangeTags::buildTagFilterSelector($opts['tagfilter']); if (count($tagFilter)) { $extraOpts['tagfilter'] = $tagFilter; } wfRunHooks('SpecialRecentChangesPanel', array(&$extraOpts, $opts)); return $extraOpts; }
/** * Generates the namespace selector form with hidden attributes. * @return String: HTML fragment */ protected function getForm() { global $wgScript; $this->opts['title'] = $this->getTitle()->getPrefixedText(); if (!isset($this->opts['target'])) { $this->opts['target'] = ''; } else { $this->opts['target'] = str_replace('_', ' ', $this->opts['target']); } if (!isset($this->opts['namespace'])) { $this->opts['namespace'] = ''; } if (!isset($this->opts['nsInvert'])) { $this->opts['nsInvert'] = ''; } if (!isset($this->opts['associated'])) { $this->opts['associated'] = false; } if (!isset($this->opts['contribs'])) { $this->opts['contribs'] = 'user'; } if (!isset($this->opts['year'])) { $this->opts['year'] = ''; } if (!isset($this->opts['month'])) { $this->opts['month'] = ''; } if ($this->opts['contribs'] == 'newbie') { $this->opts['target'] = ''; } if (!isset($this->opts['tagfilter'])) { $this->opts['tagfilter'] = ''; } if (!isset($this->opts['topOnly'])) { $this->opts['topOnly'] = false; } $form = Xml::openElement('form', array('method' => 'get', 'action' => $wgScript, 'class' => 'mw-contributions-form')); # Add hidden params for tracking except for parameters in $skipParameters $skipParameters = array('namespace', 'nsInvert', 'deletedOnly', 'target', 'contribs', 'year', 'month', 'topOnly', 'associated'); foreach ($this->opts as $name => $value) { if (in_array($name, $skipParameters)) { continue; } $form .= "\t" . Html::hidden($name, $value) . "\n"; } $tagFilter = ChangeTags::buildTagFilterSelector($this->opts['tagfilter']); if ($tagFilter) { $filterSelection = Xml::tags('td', array('class' => 'mw-label'), array_shift($tagFilter)) . Xml::tags('td', array('class' => 'mw-input'), implode(' ', $tagFilter)); } else { $filterSelection = Xml::tags('td', array('colspan' => 2), ''); } $targetSelection = Xml::tags('td', array('colspan' => 2), Xml::radioLabel($this->msg('sp-contributions-newbies')->text(), 'contribs', 'newbie', 'newbie', $this->opts['contribs'] == 'newbie', array('class' => 'mw-input')) . '<br />' . Xml::radioLabel($this->msg('sp-contributions-username')->text(), 'contribs', 'user', 'user', $this->opts['contribs'] == 'user', array('class' => 'mw-input')) . ' ' . Html::input('target', $this->opts['target'], 'text', array('size' => '40', 'required' => '', 'class' => 'mw-input') + ($this->opts['target'] ? array() : array('autofocus'))) . ' '); $namespaceSelection = Xml::tags('td', array('class' => 'mw-label'), Xml::label($this->msg('namespace')->text(), 'namespace', '')) . Xml::tags('td', null, Html::namespaceSelector(array('selected' => $this->opts['namespace'], 'all' => ''), array('name' => 'namespace', 'id' => 'namespace', 'class' => 'namespaceselector')) . ' ' . Html::rawElement('span', array('style' => 'white-space: nowrap'), Xml::checkLabel($this->msg('invert')->text(), 'nsInvert', 'nsInvert', $this->opts['nsInvert'], array('title' => $this->msg('tooltip-invert')->text(), 'class' => 'mw-input')) . ' ') . Html::rawElement('span', array('style' => 'white-space: nowrap'), Xml::checkLabel($this->msg('namespace_association')->text(), 'associated', 'associated', $this->opts['associated'], array('title' => $this->msg('tooltip-namespace_association')->text(), 'class' => 'mw-input')) . ' ')); $extraOptions = Xml::tags('td', array('colspan' => 2), Html::rawElement('span', array('style' => 'white-space: nowrap'), Xml::checkLabel($this->msg('history-show-deleted')->text(), 'deletedOnly', 'mw-show-deleted-only', $this->opts['deletedOnly'], array('class' => 'mw-input'))) . Html::rawElement('span', array('style' => 'white-space: nowrap'), Xml::checkLabel($this->msg('sp-contributions-toponly')->text(), 'topOnly', 'mw-show-top-only', $this->opts['topOnly'], array('class' => 'mw-input')))); $dateSelectionAndSubmit = Xml::tags('td', array('colspan' => 2), Xml::dateMenu($this->opts['year'], $this->opts['month']) . ' ' . Xml::submitButton($this->msg('sp-contributions-submit')->text(), array('class' => 'mw-submit'))); $form .= Xml::fieldset($this->msg('sp-contributions-search')->text()) . Xml::openElement('table', array('class' => 'mw-contributions-table')) . Xml::openElement('tr') . $targetSelection . Xml::closeElement('tr') . Xml::openElement('tr') . $namespaceSelection . Xml::closeElement('tr') . Xml::openElement('tr') . $filterSelection . Xml::closeElement('tr') . Xml::openElement('tr') . $extraOptions . Xml::closeElement('tr') . Xml::openElement('tr') . $dateSelectionAndSubmit . Xml::closeElement('tr') . Xml::closeElement('table'); $explain = $this->msg('sp-contributions-explain'); if ($explain->exists()) { $form .= "<p id='mw-sp-contributions-explain'>{$explain}</p>"; } $form .= Xml::closeElement('fieldset') . Xml::closeElement('form'); return $form; }
protected function form() { global $wgEnableNewpagesUserFilter, $wgScript; // Consume values $this->opts->consumeValue('offset'); // don't carry offset, DWIW $namespace = $this->opts->consumeValue('namespace'); $username = $this->opts->consumeValue('username'); $tagFilterVal = $this->opts->consumeValue('tagfilter'); $nsinvert = $this->opts->consumeValue('invert'); // Check username input validity $ut = Title::makeTitleSafe(NS_USER, $username); $userText = $ut ? $ut->getText() : ''; // Store query values in hidden fields so that form submission doesn't lose them $hidden = array(); foreach ($this->opts->getUnconsumedValues() as $key => $value) { $hidden[] = Html::hidden($key, $value); } $hidden = implode("\n", $hidden); $tagFilter = ChangeTags::buildTagFilterSelector($tagFilterVal); if ($tagFilter) { list($tagFilterLabel, $tagFilterSelector) = $tagFilter; } $form = Xml::openElement('form', array('action' => $wgScript)) . Html::hidden('title', $this->getTitle()->getPrefixedDBkey()) . Xml::fieldset($this->msg('newpages')->text()) . Xml::openElement('table', array('id' => 'mw-newpages-table')) . '<tr> <td class="mw-label">' . Xml::label($this->msg('namespace')->text(), 'namespace') . '</td> <td class="mw-input">' . Html::namespaceSelector(array('selected' => $namespace, 'all' => 'all'), array('name' => 'namespace', 'id' => 'namespace', 'class' => 'namespaceselector')) . ' ' . Xml::checkLabel($this->msg('invert')->text(), 'invert', 'nsinvert', $nsinvert, array('title' => $this->msg('tooltip-invert')->text())) . '</td> </tr>' . ($tagFilter ? '<tr> <td class="mw-label">' . $tagFilterLabel . '</td> <td class="mw-input">' . $tagFilterSelector . '</td> </tr>' : '') . ($wgEnableNewpagesUserFilter ? '<tr> <td class="mw-label">' . Xml::label($this->msg('newpages-username')->text(), 'mw-np-username') . '</td> <td class="mw-input">' . Xml::input('username', 30, $userText, array('id' => 'mw-np-username')) . '</td> </tr>' : '') . '<tr> <td></td> <td class="mw-submit">' . Xml::submitButton($this->msg('allpagessubmit')->text()) . '</td> </tr>' . '<tr> <td></td> <td class="mw-input">' . $this->filterLinks() . '</td> </tr>' . Xml::closeElement('table') . Xml::closeElement('fieldset') . $hidden . Xml::closeElement('form'); $this->getOutput()->addHTML($form); }
function getExtraOptions($opts) { $opts->consumeValues(array('showlinkedto', 'target')); $extraOpts = array(); $extraOpts['namespace'] = $this->namespaceFilterForm($opts); $extraOpts['target'] = array(wfMsg('recentchangeslinked-page'), Xml::input('target', 40, str_replace('_', ' ', $opts['target'])) . Xml::check('showlinkedto', $opts['showlinkedto'], array('id' => 'showlinkedto')) . ' ' . Xml::label(wfMsg("recentchangeslinked-to"), 'showlinkedto')); $tagFilter = ChangeTags::buildTagFilterSelector($opts['tagfilter']); if ($tagFilter) { $extraOpts['tagfilter'] = $tagFilter; } return $extraOpts; }
/** * Generates the namespace selector form with hidden attributes. * @return string HTML fragment */ protected function getForm() { $this->opts['title'] = $this->getPageTitle()->getPrefixedText(); if (!isset($this->opts['target'])) { $this->opts['target'] = ''; } else { $this->opts['target'] = str_replace('_', ' ', $this->opts['target']); } if (!isset($this->opts['namespace'])) { $this->opts['namespace'] = ''; } if (!isset($this->opts['nsInvert'])) { $this->opts['nsInvert'] = ''; } if (!isset($this->opts['associated'])) { $this->opts['associated'] = false; } if (!isset($this->opts['contribs'])) { $this->opts['contribs'] = 'user'; } if (!isset($this->opts['year'])) { $this->opts['year'] = ''; } if (!isset($this->opts['month'])) { $this->opts['month'] = ''; } if ($this->opts['contribs'] == 'newbie') { $this->opts['target'] = ''; } if (!isset($this->opts['tagfilter'])) { $this->opts['tagfilter'] = ''; } if (!isset($this->opts['topOnly'])) { $this->opts['topOnly'] = false; } if (!isset($this->opts['newOnly'])) { $this->opts['newOnly'] = false; } if (!isset($this->opts['hideMinor'])) { $this->opts['hideMinor'] = false; } $form = Html::openElement('form', ['method' => 'get', 'action' => wfScript(), 'class' => 'mw-contributions-form']); # Add hidden params for tracking except for parameters in $skipParameters $skipParameters = ['namespace', 'nsInvert', 'deletedOnly', 'target', 'contribs', 'year', 'month', 'topOnly', 'newOnly', 'hideMinor', 'associated', 'tagfilter']; foreach ($this->opts as $name => $value) { if (in_array($name, $skipParameters)) { continue; } $form .= "\t" . Html::hidden($name, $value) . "\n"; } $tagFilter = ChangeTags::buildTagFilterSelector($this->opts['tagfilter']); if ($tagFilter) { $filterSelection = Html::rawElement('div', [], implode(' ', $tagFilter)); } else { $filterSelection = Html::rawElement('div', [], ''); } $this->getOutput()->addModules('mediawiki.userSuggest'); $labelNewbies = Xml::radioLabel($this->msg('sp-contributions-newbies')->text(), 'contribs', 'newbie', 'newbie', $this->opts['contribs'] == 'newbie', ['class' => 'mw-input']); $labelUsername = Xml::radioLabel($this->msg('sp-contributions-username')->text(), 'contribs', 'user', 'user', $this->opts['contribs'] == 'user', ['class' => 'mw-input']); $input = Html::input('target', $this->opts['target'], 'text', ['size' => '40', 'required' => '', 'class' => ['mw-input', 'mw-ui-input-inline', 'mw-autocomplete-user']] + ($this->opts['contribs'] === 'newbie' || $this->opts['target'] ? [] : ['autofocus' => true])); $targetSelection = Html::rawElement('div', [], $labelNewbies . '<br>' . $labelUsername . ' ' . $input . ' '); $namespaceSelection = Xml::tags('div', [], Xml::label($this->msg('namespace')->text(), 'namespace', '') . ' ' . Html::namespaceSelector(['selected' => $this->opts['namespace'], 'all' => ''], ['name' => 'namespace', 'id' => 'namespace', 'class' => 'namespaceselector']) . ' ' . Html::rawElement('span', ['class' => 'mw-input-with-label'], Xml::checkLabel($this->msg('invert')->text(), 'nsInvert', 'nsInvert', $this->opts['nsInvert'], ['title' => $this->msg('tooltip-invert')->text(), 'class' => 'mw-input']) . ' ') . Html::rawElement('span', ['class' => 'mw-input-with-label'], Xml::checkLabel($this->msg('namespace_association')->text(), 'associated', 'associated', $this->opts['associated'], ['title' => $this->msg('tooltip-namespace_association')->text(), 'class' => 'mw-input']) . ' ')); $filters = []; if ($this->getUser()->isAllowed('deletedhistory')) { $filters[] = Html::rawElement('span', ['class' => 'mw-input-with-label'], Xml::checkLabel($this->msg('history-show-deleted')->text(), 'deletedOnly', 'mw-show-deleted-only', $this->opts['deletedOnly'], ['class' => 'mw-input'])); } $filters[] = Html::rawElement('span', ['class' => 'mw-input-with-label'], Xml::checkLabel($this->msg('sp-contributions-toponly')->text(), 'topOnly', 'mw-show-top-only', $this->opts['topOnly'], ['class' => 'mw-input'])); $filters[] = Html::rawElement('span', ['class' => 'mw-input-with-label'], Xml::checkLabel($this->msg('sp-contributions-newonly')->text(), 'newOnly', 'mw-show-new-only', $this->opts['newOnly'], ['class' => 'mw-input'])); $filters[] = Html::rawElement('span', ['class' => 'mw-input-with-label'], Xml::checkLabel($this->msg('sp-contributions-hideminor')->text(), 'hideMinor', 'mw-hide-minor-edits', $this->opts['hideMinor'], ['class' => 'mw-input'])); Hooks::run('SpecialContributions::getForm::filters', [$this, &$filters]); $extraOptions = Html::rawElement('div', [], implode('', $filters)); $dateSelectionAndSubmit = Xml::tags('div', [], Xml::dateMenu($this->opts['year'] === '' ? MWTimestamp::getInstance()->format('Y') : $this->opts['year'], $this->opts['month']) . ' ' . Html::submitButton($this->msg('sp-contributions-submit')->text(), ['class' => 'mw-submit'], ['mw-ui-progressive'])); $form .= Xml::fieldset($this->msg('sp-contributions-search')->text(), $targetSelection . $namespaceSelection . $filterSelection . $extraOptions . $dateSelectionAndSubmit, ['class' => 'mw-contributions-table']); $explain = $this->msg('sp-contributions-explain'); if (!$explain->isBlank()) { $form .= "<p id='mw-sp-contributions-explain'>{$explain->parse()}</p>"; } $form .= Xml::closeElement('form'); return $form; }
/** * Print the history page for an article. * * @returns nothing */ function history() { global $wgOut, $wgRequest, $wgTitle, $wgScript; /* * Allow client caching. */ if ($wgOut->checkLastModified($this->mArticle->getTouched())) { return; } // Client cache fresh and headers sent, nothing more to do. wfProfileIn(__METHOD__); /* * Setup page variables. */ $wgOut->setPageTitle(wfMsg('history-title', $this->mTitle->getPrefixedText())); $wgOut->setPageTitleActionText(wfMsg('history_short')); $wgOut->setArticleFlag(false); $wgOut->setArticleRelated(true); $wgOut->setRobotPolicy('noindex,nofollow'); $wgOut->setSyndicated(true); $wgOut->setFeedAppendQuery('action=history'); $wgOut->addScriptFile('history.js'); $logPage = SpecialPage::getTitleFor('Log'); $logLink = $this->mSkin->makeKnownLinkObj($logPage, wfMsgHtml('viewpagelogs'), 'page=' . $this->mTitle->getPrefixedUrl()); $wgOut->setSubtitle($logLink); $feedType = $wgRequest->getVal('feed'); if ($feedType) { wfProfileOut(__METHOD__); return $this->feed($feedType); } /* * Fail if article doesn't exist. */ if (!$this->mTitle->exists()) { $wgOut->addWikiMsg('nohistory'); wfProfileOut(__METHOD__); return; } /** * Add date selector to quickly get to a certain time */ $year = $wgRequest->getInt('year'); $month = $wgRequest->getInt('month'); $tagFilter = $wgRequest->getVal('tagfilter'); $tagSelector = ChangeTags::buildTagFilterSelector($tagFilter); $action = htmlspecialchars($wgScript); $wgOut->addHTML("<form action=\"{$action}\" method=\"get\" id=\"mw-history-searchform\">" . Xml::fieldset(wfMsg('history-fieldset-title'), false, array('id' => 'mw-history-search')) . Xml::hidden('title', $this->mTitle->getPrefixedDBKey()) . "\n" . Xml::hidden('action', 'history') . "\n" . xml::dateMenu($year, $month) . ' ' . ($tagSelector ? implode(' ', $tagSelector) . ' ' : '') . Xml::submitButton(wfMsg('allpagessubmit')) . "\n" . '</fieldset></form>'); wfRunHooks('PageHistoryBeforeList', array(&$this->mArticle)); /** * Do the list */ $pager = new PageHistoryPager($this, $year, $month, $tagFilter); $this->linesonpage = $pager->getNumRows(); $wgOut->addHTML($pager->getNavigationBar() . $this->beginHistoryList() . $pager->getBody() . $this->endHistoryList() . $pager->getNavigationBar()); wfProfileOut(__METHOD__); }
/** * Print the history page for an article. * @return nothing */ function history() { global $wgOut, $wgRequest, $wgScript; /** * Allow client caching. */ if ($wgOut->checkLastModified($this->article->getTouched())) { return; } // Client cache fresh and headers sent, nothing more to do. wfProfileIn(__METHOD__); // Setup page variables. $wgOut->setPageTitle(wfMsg('history-title', $this->title->getPrefixedText())); $wgOut->setPageTitleActionText(wfMsg('history_short')); $wgOut->setArticleFlag(false); $wgOut->setArticleRelated(true); $wgOut->setRobotPolicy('noindex,nofollow'); $wgOut->setSyndicated(true); $wgOut->setFeedAppendQuery('action=history'); $wgOut->addModules(array('mediawiki.legacy.history', 'mediawiki.action.history')); // Creation of a subtitle link pointing to [[Special:Log]] $logPage = SpecialPage::getTitleFor('Log'); $logLink = $this->skin->link($logPage, wfMsgHtml('viewpagelogs'), array(), array('page' => $this->title->getPrefixedText()), array('known', 'noclasses')); $wgOut->setSubtitle($logLink); // Handle atom/RSS feeds. $feedType = $wgRequest->getVal('feed'); if ($feedType) { wfProfileOut(__METHOD__); return $this->feed($feedType); } // Fail nicely if article doesn't exist. if (!$this->title->exists()) { $wgOut->addWikiMsg('nohistory'); # show deletion/move log if there is an entry LogEventsList::showLogExtract($wgOut, array('delete', 'move'), $this->title->getPrefixedText(), '', array('lim' => 10, 'conds' => array("log_action != 'revision'"), 'showIfEmpty' => false, 'msgKey' => array('moveddeleted-notice'))); wfProfileOut(__METHOD__); return; } /** * Add date selector to quickly get to a certain time */ $year = $wgRequest->getInt('year'); $month = $wgRequest->getInt('month'); $tagFilter = $wgRequest->getVal('tagfilter'); $tagSelector = ChangeTags::buildTagFilterSelector($tagFilter); /** * Option to show only revisions that have been (partially) hidden via RevisionDelete */ if ($wgRequest->getBool('deleted')) { $conds = array("rev_deleted != '0'"); } else { $conds = array(); } $checkDeleted = Xml::checkLabel(wfMsg('history-show-deleted'), 'deleted', 'mw-show-deleted-only', $wgRequest->getBool('deleted')) . "\n"; // Add the general form $action = htmlspecialchars($wgScript); $wgOut->addHTML("<form action=\"{$action}\" method=\"get\" id=\"mw-history-searchform\">" . Xml::fieldset(wfMsg('history-fieldset-title'), false, array('id' => 'mw-history-search')) . Html::hidden('title', $this->title->getPrefixedDBKey()) . "\n" . Html::hidden('action', 'history') . "\n" . Xml::dateMenu($year, $month) . ' ' . ($tagSelector ? implode(' ', $tagSelector) . ' ' : '') . $checkDeleted . Xml::submitButton(wfMsg('allpagessubmit')) . "\n" . '</fieldset></form>'); wfRunHooks('PageHistoryBeforeList', array(&$this->article)); // Create and output the list. $pager = new HistoryPager($this, $year, $month, $tagFilter, $conds); $wgOut->addHTML($pager->getNavigationBar() . $pager->getBody() . $pager->getNavigationBar()); $wgOut->preventClickjacking($pager->getPreventClickjacking()); wfProfileOut(__METHOD__); }
/** * Generates the namespace selector form with hidden attributes. * @return String: HTML fragment */ protected function getForm() { global $wgScript; $this->opts['title'] = $this->getTitle()->getPrefixedText(); if (!isset($this->opts['target'])) { $this->opts['target'] = ''; } else { $this->opts['target'] = str_replace('_', ' ', $this->opts['target']); } if (!isset($this->opts['namespace'])) { $this->opts['namespace'] = ''; } if (!isset($this->opts['contribs'])) { $this->opts['contribs'] = 'user'; } if (!isset($this->opts['year'])) { $this->opts['year'] = ''; } if (!isset($this->opts['month'])) { $this->opts['month'] = ''; } if ($this->opts['contribs'] == 'newbie') { $this->opts['target'] = ''; } if (!isset($this->opts['tagFilter'])) { $this->opts['tagFilter'] = ''; } if (!isset($this->opts['topOnly'])) { $this->opts['topOnly'] = false; } $f = Xml::openElement('form', array('method' => 'get', 'action' => $wgScript, 'class' => 'mw-contributions-form')); # Add hidden params for tracking except for parameters in $skipParameters $skipParameters = array('namespace', 'deletedOnly', 'target', 'contribs', 'year', 'month', 'topOnly'); foreach ($this->opts as $name => $value) { if (in_array($name, $skipParameters)) { continue; } $f .= "\t" . Html::hidden($name, $value) . "\n"; } $tagFilter = ChangeTags::buildTagFilterSelector($this->opts['tagFilter']); $f .= Xml::fieldset(wfMsg('sp-contributions-search')) . Xml::radioLabel(wfMsgExt('sp-contributions-newbies', array('parsemag')), 'contribs', 'newbie', 'newbie', $this->opts['contribs'] == 'newbie') . '<br />' . Xml::radioLabel(wfMsgExt('sp-contributions-username', array('parsemag')), 'contribs', 'user', 'user', $this->opts['contribs'] == 'user') . ' ' . Html::input('target', $this->opts['target'], 'text', array('size' => '20', 'required' => '') + ($this->opts['target'] ? array() : array('autofocus'))) . ' ' . Html::rawElement('span', array('style' => 'white-space: nowrap'), Xml::label(wfMsg('namespace'), 'namespace') . ' ' . Xml::namespaceSelector($this->opts['namespace'], '')) . Xml::checkLabel(wfMsg('history-show-deleted'), 'deletedOnly', 'mw-show-deleted-only', $this->opts['deletedOnly']) . '<br />' . Xml::tags('p', null, Xml::checkLabel(wfMsg('sp-contributions-toponly'), 'topOnly', 'mw-show-top-only', $this->opts['topOnly'])) . ($tagFilter ? Xml::tags('p', null, implode(' ', $tagFilter)) : '') . Html::rawElement('p', array('style' => 'white-space: nowrap'), Xml::dateMenu($this->opts['year'], $this->opts['month']) . ' ' . Xml::submitButton(wfMsg('sp-contributions-submit'))) . ' '; $explain = wfMessage('sp-contributions-explain'); if ($explain->exists()) { $f .= "<p id='mw-sp-contributions-explain'>{$explain}</p>"; } $f .= Xml::closeElement('fieldset') . Xml::closeElement('form'); return $f; }
protected function form() { global $wgOut, $wgEnableNewpagesUserFilter, $wgScript; // Consume values $this->opts->consumeValue('offset'); // don't carry offset, DWIW $namespace = $this->opts->consumeValue('namespace'); $username = $this->opts->consumeValue('username'); // Check username input validity $ut = Title::makeTitleSafe(NS_USER, $username); $userText = $ut ? $ut->getText() : ''; // Store query values in hidden fields so that form submission doesn't lose them $hidden = array(); foreach ($this->opts->getUnconsumedValues() as $key => $value) { $hidden[] = Xml::hidden($key, $value); } $hidden = implode("\n", $hidden); $tagFilter = ChangeTags::buildTagFilterSelector($this->opts['tagfilter']); if ($tagFilter) { list($tagFilterLabel, $tagFilterSelector) = $tagFilter; } $form = Xml::openElement('form', array('action' => $wgScript)) . Xml::hidden('title', $this->getTitle()->getPrefixedDBkey()) . Xml::fieldset(wfMsg('newpages')) . Xml::openElement('table', array('id' => 'mw-newpages-table')) . "<tr>\n\t\t\t\t<td class='mw-label'>" . Xml::label(wfMsg('namespace'), 'namespace') . "</td>\n\t\t\t\t<td class='mw-input'>" . Xml::namespaceSelector($namespace, 'all') . "</td>\n\t\t\t</tr>" . ($tagFilter ? "<tr>\n\t\t\t\t<td class='mw-label'>" . $tagFilterLabel . "</td>\n\t\t\t\t<td class='mw-input'>" . $tagFilterSelector . "</td>\n\t\t\t</tr>" : '') . ($wgEnableNewpagesUserFilter ? "<tr>\n\t\t\t\t<td class='mw-label'>" . Xml::label(wfMsg('newpages-username'), 'mw-np-username') . "</td>\n\t\t\t\t<td class='mw-input'>" . Xml::input('username', 30, $userText, array('id' => 'mw-np-username')) . "</td>\n\t\t\t</tr>" : "") . "<tr> <td></td>\n\t\t\t\t<td class='mw-submit'>" . Xml::submitButton(wfMsg('allpagessubmit')) . "</td>\n\t\t\t</tr>" . "<tr>\n\t\t\t\t<td></td>\n\t\t\t\t<td class='mw-input'>" . $this->filterLinks() . "</td>\n\t\t\t</tr>" . Xml::closeElement('table') . Xml::closeElement('fieldset') . $hidden . Xml::closeElement('form'); $wgOut->addHTML($form); }
/** * Print the history page for an article. */ function onView() { $out = $this->getOutput(); $request = $this->getRequest(); /** * Allow client caching. */ if ($out->checkLastModified($this->page->getTouched())) { return; // Client cache fresh and headers sent, nothing more to do. } wfProfileIn(__METHOD__); $this->preCacheMessages(); $config = $this->context->getConfig(); # Fill in the file cache if not set already $useFileCache = $config->get('UseFileCache'); if ($useFileCache && HTMLFileCache::useFileCache($this->getContext())) { $cache = HTMLFileCache::newFromTitle($this->getTitle(), 'history'); if (!$cache->isCacheGood()) { ob_start(array(&$cache, 'saveToFileCache')); } } // Setup page variables. $out->setFeedAppendQuery('action=history'); $out->addModules('mediawiki.action.history'); if ($config->get('UseMediaWikiUIEverywhere')) { $out = $this->getOutput(); $out->addModuleStyles(array('mediawiki.ui.input', 'mediawiki.ui.checkbox')); } // Handle atom/RSS feeds. $feedType = $request->getVal('feed'); if ($feedType) { $this->feed($feedType); wfProfileOut(__METHOD__); return; } // Fail nicely if article doesn't exist. if (!$this->page->exists()) { $out->addWikiMsg('nohistory'); # show deletion/move log if there is an entry LogEventsList::showLogExtract($out, array('delete', 'move'), $this->getTitle(), '', array('lim' => 10, 'conds' => array("log_action != 'revision'"), 'showIfEmpty' => false, 'msgKey' => array('moveddeleted-notice'))); wfProfileOut(__METHOD__); return; } /** * Add date selector to quickly get to a certain time */ $year = $request->getInt('year'); $month = $request->getInt('month'); $tagFilter = $request->getVal('tagfilter'); $tagSelector = ChangeTags::buildTagFilterSelector($tagFilter); /** * Option to show only revisions that have been (partially) hidden via RevisionDelete */ if ($request->getBool('deleted')) { $conds = array('rev_deleted != 0'); } else { $conds = array(); } if ($this->getUser()->isAllowed('deletedhistory')) { $checkDeleted = Xml::checkLabel($this->msg('history-show-deleted')->text(), 'deleted', 'mw-show-deleted-only', $request->getBool('deleted')) . "\n"; } else { $checkDeleted = ''; } // Add the general form $action = htmlspecialchars(wfScript()); $out->addHTML("<form action=\"{$action}\" method=\"get\" id=\"mw-history-searchform\">" . Xml::fieldset($this->msg('history-fieldset-title')->text(), false, array('id' => 'mw-history-search')) . Html::hidden('title', $this->getTitle()->getPrefixedDBkey()) . "\n" . Html::hidden('action', 'history') . "\n" . Xml::dateMenu($year == null ? MWTimestamp::getLocalInstance()->format('Y') : $year, $month) . ' ' . ($tagSelector ? implode(' ', $tagSelector) . ' ' : '') . $checkDeleted . Xml::submitButton($this->msg('allpagessubmit')->text()) . "\n" . '</fieldset></form>'); wfRunHooks('PageHistoryBeforeList', array(&$this->page, $this->getContext())); // Create and output the list. $pager = new HistoryPager($this, $year, $month, $tagFilter, $conds); $out->addHTML($pager->getNavigationBar() . $pager->getBody() . $pager->getNavigationBar()); $out->preventClickjacking($pager->getPreventClickjacking()); wfProfileOut(__METHOD__); }
/** * Generates the namespace selector form with hidden attributes. * @param $this->opts Array: the options to be included. */ protected function getForm() { global $wgScript; $this->opts['title'] = $this->getTitle()->getPrefixedText(); if (!isset($this->opts['target'])) { $this->opts['target'] = ''; } else { $this->opts['target'] = str_replace('_', ' ', $this->opts['target']); } if (!isset($this->opts['namespace'])) { $this->opts['namespace'] = ''; } if (!isset($this->opts['contribs'])) { $this->opts['contribs'] = 'user'; } if (!isset($this->opts['year'])) { $this->opts['year'] = ''; } if (!isset($this->opts['month'])) { $this->opts['month'] = ''; } if ($this->opts['contribs'] == 'newbie') { $this->opts['target'] = ''; } if (!isset($this->opts['tagfilter'])) { $this->opts['tagfilter'] = ''; } $f = Xml::openElement('form', array('method' => 'get', 'action' => $wgScript)); # Add hidden params for tracking foreach ($this->opts as $name => $value) { if (in_array($name, array('namespace', 'target', 'contribs', 'year', 'month'))) { continue; } $f .= "\t" . Xml::hidden($name, $value) . "\n"; } $tagFilter = ChangeTags::buildTagFilterSelector($this->opts['tagfilter']); $f .= '<fieldset>' . Xml::element('legend', array(), wfMsg('sp-contributions-search')) . Xml::radioLabel(wfMsgExt('sp-contributions-newbies', array('parsemag')), 'contribs', 'newbie', 'newbie', $this->opts['contribs'] == 'newbie' ? true : false) . '<br />' . Xml::radioLabel(wfMsgExt('sp-contributions-username', array('parsemag')), 'contribs', 'user', 'user', $this->opts['contribs'] == 'user' ? true : false) . ' ' . Html::input('target', $this->opts['target'], 'text', array('size' => '20', 'required' => '') + ($this->opts['target'] ? array() : array('autofocus'))) . ' ' . '<span style="white-space: nowrap">' . Xml::label(wfMsg('namespace'), 'namespace') . ' ' . Xml::namespaceSelector($this->opts['namespace'], '') . '</span>' . ($tagFilter ? Xml::tags('p', null, implode(' ', $tagFilter)) : '') . Xml::openElement('p') . '<span style="white-space: nowrap">' . Xml::dateMenu($this->opts['year'], $this->opts['month']) . '</span>' . ' ' . Xml::submitButton(wfMsg('sp-contributions-submit')) . Xml::closeElement('p'); $explain = wfMsgExt('sp-contributions-explain', 'parseinline'); if (!wfEmptyMsg('sp-contributions-explain', $explain)) { $f .= "<p id='mw-sp-contributions-explain'>{$explain}</p>"; } $f .= '</fieldset>' . Xml::closeElement('form'); return $f; }
/** * Get options to be displayed in a form * * @param FormOptions $opts * @return array */ function getExtraOptions($opts) { $opts->consumeValues(array('namespace', 'invert', 'associated', 'tagfilter', 'categories', 'categories_any')); $extraOpts = array(); $extraOpts['namespace'] = $this->namespaceFilterForm($opts); if ($this->getConfig()->get('AllowCategorizedRecentChanges')) { $extraOpts['category'] = $this->categoryFilterForm($opts); } $tagFilter = ChangeTags::buildTagFilterSelector($opts['tagfilter']); if (count($tagFilter)) { $extraOpts['tagfilter'] = $tagFilter; } // Don't fire the hook for subclasses. (Or should we?) if ($this->getName() === 'Recentchanges') { Hooks::run('SpecialRecentChangesPanel', array(&$extraOpts, $opts)); } return $extraOpts; }
/** * Generates the namespace selector form with hidden attributes. * @return String: HTML fragment */ protected function getForm() { global $wgScript; $this->opts['title'] = $this->getPageTitle()->getPrefixedText(); if (!isset($this->opts['target'])) { $this->opts['target'] = ''; } else { $this->opts['target'] = str_replace('_', ' ', $this->opts['target']); } if (!isset($this->opts['namespace'])) { $this->opts['namespace'] = ''; } if (!isset($this->opts['nsInvert'])) { $this->opts['nsInvert'] = ''; } if (!isset($this->opts['associated'])) { $this->opts['associated'] = false; } if (!isset($this->opts['contribs'])) { $this->opts['contribs'] = 'user'; } if (!isset($this->opts['year'])) { $this->opts['year'] = ''; } if (!isset($this->opts['month'])) { $this->opts['month'] = ''; } if ($this->opts['contribs'] == 'newbie') { $this->opts['target'] = ''; } if (!isset($this->opts['tagfilter'])) { $this->opts['tagfilter'] = ''; } if (!isset($this->opts['topOnly'])) { $this->opts['topOnly'] = false; } // JRS 12/5/13 Redesign styling $form = Html::openElement('div', array('class' => 'section_text')); $form .= Html::openElement('form', array('method' => 'get', 'action' => $wgScript, 'class' => 'mw-contributions-form')); # Add hidden params for tracking except for parameters in $skipParameters $skipParameters = array('namespace', 'nsInvert', 'deletedOnly', 'target', 'contribs', 'year', 'month', 'topOnly', 'associated'); foreach ($this->opts as $name => $value) { if (in_array($name, $skipParameters)) { continue; } $form .= "\t" . Html::hidden($name, $value) . "\n"; } $tagFilter = ChangeTags::buildTagFilterSelector($this->opts['tagfilter']); if ($tagFilter) { $filterSelection = Html::rawElement('td', array('class' => 'mw-label'), array_shift($tagFilter)); $filterSelection .= Html::rawElement('td', array('class' => 'mw-input'), implode(' ', $tagFilter)); } else { $filterSelection = Html::rawElement('td', array('colspan' => 2), ''); } $labelNewbies = Xml::radioLabel($this->msg('sp-contributions-newbies')->text(), 'contribs', 'newbie', 'newbie', $this->opts['contribs'] == 'newbie', array('class' => 'mw-input')); $labelUsername = Xml::radioLabel($this->msg('sp-contributions-username')->text(), 'contribs', 'user', 'user', $this->opts['contribs'] == 'user', array('class' => 'mw-input')); $input = Html::input('target', $this->opts['target'], 'text', array('size' => '40', 'required' => '', 'class' => 'input_med') + ($this->opts['target'] ? array() : array('autofocus'))); $targetSelection = Html::rawElement('td', array('colspan' => 2), $labelNewbies . '<br />' . $labelUsername . ' ' . $input . ' '); // $namespaceSelection = Xml::tags( // 'td', // array( 'class' => 'mw-label' ), // Xml::label( // $this->msg( 'namespace' )->text(), // 'namespace', // '' // ) // ); // $namespaceSelection .= Html::rawElement( // 'td', // null, // Html::namespaceSelector( // array( 'selected' => $this->opts['namespace'], 'all' => '' ), // array( // 'name' => 'namespace', // 'id' => 'namespace', // 'class' => 'namespaceselector', // ) // ) . ' ' . // Html::rawElement( // 'span', // array( 'style' => 'white-space: nowrap' ), // Xml::checkLabel( // $this->msg( 'invert' )->text(), // 'nsInvert', // 'nsInvert', // $this->opts['nsInvert'], // array( // 'title' => $this->msg( 'tooltip-invert' )->text(), // 'class' => 'mw-input' // ) // ) . ' ' // ) . // Html::rawElement( 'span', array( 'style' => 'white-space: nowrap' ), // Xml::checkLabel( // $this->msg( 'namespace_association' )->text(), // 'associated', // 'associated', // $this->opts['associated'], // array( // 'title' => $this->msg( 'tooltip-namespace_association' )->text(), // 'class' => 'mw-input' // ) // ) . ' ' // ) // ); $namespaceSelection = Xml::tags('td', null, Xml::label($this->msg('namespace')->text(), 'namespace', '') . ' ' . Html::namespaceSelector(array('selected' => $this->opts['namespace'], 'all' => ''), array('name' => 'namespace', 'id' => 'namespace', 'class' => 'namespaceselector'))); $namespaceSelectionOptions = Xml::tags('td', null, Html::rawElement('span', array('style' => 'white-space: nowrap'), Xml::checkLabel($this->msg('invert')->text(), 'nsInvert', 'nsInvert', $this->opts['nsInvert'], array('title' => $this->msg('tooltip-invert')->text(), 'class' => 'mw-input')) . ' ') . Html::rawElement('span', array('style' => 'white-space: nowrap'), Xml::checkLabel($this->msg('namespace_association')->text(), 'associated', 'associated', $this->opts['associated'], array('title' => $this->msg('tooltip-namespace_association')->text(), 'class' => 'mw-input')) . ' ')); if ($this->getUser()->isAllowed('deletedhistory')) { $deletedOnlyCheck = Html::rawElement('span', array('style' => 'white-space: nowrap'), Xml::checkLabel($this->msg('history-show-deleted')->text(), 'deletedOnly', 'mw-show-deleted-only', $this->opts['deletedOnly'], array('class' => 'mw-input'))); } else { $deletedOnlyCheck = ''; } $checkLabelTopOnly = Html::rawElement('span', array('style' => 'white-space: nowrap'), Xml::checkLabel($this->msg('sp-contributions-toponly')->text(), 'topOnly', 'mw-show-top-only', $this->opts['topOnly'], array('class' => 'mw-input'))); $extraOptions = Html::rawElement('td', array('colspan' => 2), $deletedOnlyCheck . $checkLabelTopOnly); $dateSelectionAndSubmit = Xml::tags('td', array('colspan' => 2), Xml::dateMenu($this->opts['year'] === '' ? MWTimestamp::getInstance()->format('Y') : $this->opts['year'], $this->opts['month']) . ' ' . Xml::submitButton($this->msg('sp-contributions-submit')->text(), array('class' => 'mw-submit button primary', 'style' => 'float:right;margin:5px;'))); $form .= Xml::fieldset($this->msg('sp-contributions-search')->text()); $form .= Html::rawElement('table', array('class' => 'mw-contributions-table'), "\n" . Html::rawElement('tr', array(), $targetSelection) . "\n" . Html::rawElement('tr', array(), $namespaceSelection) . "\n" . Html::rawElement('tr', array(), $namespaceSelectionOptions) . "\n" . Html::rawElement('tr', array(), $filterSelection) . "\n" . Html::rawElement('tr', array(), $extraOptions) . "\n" . Html::rawElement('tr', array(), $dateSelectionAndSubmit) . "\n"); $explain = $this->msg('sp-contributions-explain'); if (!$explain->isBlank()) { $form .= "<p id='mw-sp-contributions-explain'>{$explain->parse()}</p>"; } $form .= Xml::closeElement('fieldset') . Xml::closeElement('form'); return $form; }