protected function showForm() { global $wgScript; # Explanatory text $this->getOutput()->addWikiMsg('configuredpages-list', $this->getLang()->formatNum($this->pager->getNumRows())); $fields = array(); # Namespace selector if (count(FlaggedRevs::getReviewNamespaces()) > 1) { $fields[] = FlaggedRevsXML::getNamespaceMenu($this->namespace, ''); } # Default version selector $fields[] = FlaggedRevsXML::getDefaultFilterMenu($this->override); # Restriction level selector if (FlaggedRevs::getRestrictionLevels()) { $fields[] = FlaggedRevsXML::getRestrictionFilterMenu($this->autoreview); } $form = Html::openElement('form', array('name' => 'configuredpages', 'action' => $wgScript, 'method' => 'get')); $form .= Html::hidden('title', $this->getTitle()->getPrefixedDBKey()); $form .= "<fieldset><legend>" . wfMsg('configuredpages') . "</legend>\n"; $form .= implode(' ', $fields) . '<br/>'; $form .= Xml::submitButton(wfMsg('go')); $form .= "</fieldset>\n"; $form .= Html::closeElement('form') . "\n"; $this->getOutput()->addHTML($form); }
public function showForm() { global $wgScript; // Text to explain level select (if there are several levels) if (FlaggedRevs::qualityVersions()) { $this->getOutput()->addWikiMsg('reviewedpages-list', $this->getLanguage()->formatNum($this->pager->getNumRows())); } $form = Html::openElement('form', array('name' => 'reviewedpages', 'action' => $wgScript, 'method' => 'get')); $form .= "<fieldset><legend>" . $this->msg('reviewedpages-leg')->escaped() . "</legend>\n"; // show/hide links $showhide = array($this->msg('show')->escaped(), $this->msg('hide')->escaped()); $onoff = 1 - $this->hideRedirs; $link = Linker::link($this->getPageTitle(), $showhide[$onoff], array(), array('hideredirs' => $onoff, 'namespace' => $this->namespace)); $showhideredirs = $this->msg('whatlinkshere-hideredirs')->rawParams($link)->escaped(); $fields = array(); $namespaces = FlaggedRevs::getReviewNamespaces(); if (count($namespaces) > 1) { $fields[] = FlaggedRevsXML::getNamespaceMenu($this->namespace) . ' '; } if (FlaggedRevs::qualityVersions()) { $fields[] = FlaggedRevsXML::getLevelMenu($this->type) . ' '; } $form .= implode(' ', $fields) . ' '; $form .= $showhideredirs; if (count($fields)) { $form .= " " . Xml::submitButton($this->msg('go')->text()); } $form .= Html::hidden('title', $this->getPageTitle()->getPrefixedDBKey()) . "\n"; $form .= "</fieldset>"; $form .= Html::closeElement('form ') . "\n"; $this->getOutput()->addHTML($form); }
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); }
protected function showForm() { global $wgScript; # Add explanatory text $this->getOutput()->addWikiMsg('unreviewedpages-list', $this->getLanguage()->formatNum($this->pager->getNumRows())); # show/hide links $showhide = array($this->msg('show')->escaped(), $this->msg('hide')->escaped()); $onoff = 1 - $this->hideRedirs; $link = Linker::link($this->getPageTitle(), $showhide[$onoff], array(), array('hideredirs' => $onoff, 'category' => $this->category, 'namespace' => $this->namespace)); $showhideredirs = $this->msg('whatlinkshere-hideredirs')->rawParams($link)->escaped(); # Add form... $form = Html::openElement('form', array('name' => 'unreviewedpages', 'action' => $wgScript, 'method' => 'get')) . "\n"; $form .= "<fieldset><legend>" . $this->msg('unreviewedpages-legend')->escaped() . "</legend>\n"; $form .= Html::hidden('title', $this->getPageTitle()->getPrefixedDBKey()) . "\n"; # Add dropdowns as needed if (count(FlaggedRevs::getReviewNamespaces()) > 1) { $form .= FlaggedRevsXML::getNamespaceMenu($this->namespace) . ' '; } if (FlaggedRevs::qualityVersions()) { $form .= FlaggedRevsXML::getLevelMenu($this->level, false, 1) . ' '; } $form .= "<span style='white-space: nowrap;'>" . Xml::label($this->msg('unreviewedpages-category')->text(), 'category') . ' ' . Xml::input('category', 30, $this->category, array('id' => 'category')) . '</span><br />'; $form .= $showhideredirs . '  '; $form .= Xml::submitButton($this->msg('allpagessubmit')->text()); $form .= '</fieldset>'; $form .= Html::closeElement('form') . "\n"; # Query may get too slow to be live... if (!$this->live) { $dbr = wfGetDB(DB_SLAVE); $ts = $dbr->selectField('querycache_info', 'qci_timestamp', array('qci_type' => 'fr_unreviewedpages'), __METHOD__); if ($ts) { $ts = wfTimestamp(TS_MW, $ts); $td = $this->getLanguage()->timeanddate($ts); $d = $this->getLanguage()->date($ts); $t = $this->getLanguage()->time($ts); $form .= $this->msg('perfcachedts', $td, $d, $t)->parseAsBlock(); } else { $form .= $this->msg('perfcached')->parseAsBlock(); } } $this->getOutput()->addHTML($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); }
protected function showForm() { global $wgScript; $this->getOutput()->addWikiMsg('stablepages-list', $this->getLang()->formatNum($this->pager->getNumRows())); $fields = array(); // Namespace selector if (count(FlaggedRevs::getReviewNamespaces()) > 1) { $fields[] = FlaggedRevsXML::getNamespaceMenu($this->namespace, ''); } // Restriction level selector if (FlaggedRevs::getRestrictionLevels()) { $fields[] = FlaggedRevsXML::getRestrictionFilterMenu($this->autoreview); } $fields[] = Xml::checkLabel(wfMsg('stablepages-indef'), 'indef', 'stablepages-indef', $this->indef); $form = Html::openElement('form', array('name' => 'stablepages', 'action' => $wgScript, 'method' => 'get')); $form .= Html::hidden('title', $this->getTitle()->getPrefixedDBKey()); $form .= "<fieldset><legend>" . wfMsg('stablepages') . "</legend>\n"; $form .= implode(' ', $fields) . ' '; $form .= " " . Xml::submitButton(wfMsg('go')); $form .= "</fieldset>\n"; $form .= Html::closeElement('form') . "\n"; $this->getOutput()->addHTML($form); }
protected static function getDiffRevMsgAndClass(Revision $rev, FlaggedRevision $srev = null) { $tier = FlaggedRevision::getRevQuality($rev->getId()); if ($tier !== false) { $msg = $tier ? 'revreview-hist-quality' : 'revreview-hist-basic'; } else { $msg = $srev && $rev->getTimestamp() > $srev->getRevTimestamp() ? 'revreview-hist-pending' : 'revreview-hist-draft'; } $css = FlaggedRevsXML::getQualityColor($tier); return array($msg, $css); }
private function showForm() { global $wgScript; $this->getOutput()->addHTML(Xml::openElement('form', array('name' => 'qualityoversight', 'action' => $wgScript, 'method' => 'get')) . '<fieldset><legend>' . $this->msg('qualityoversight-legend')->escaped() . '</legend><p>' . Html::hidden('title', $this->getPageTitle()->getPrefixedDBKey()) . FlaggedRevsXML::getNamespaceMenu($this->namespace) . ' ' . (FlaggedRevs::qualityVersions() ? FlaggedRevsXML::getLevelMenu($this->level, 'revreview-filter-all', 1) . ' ' : "") . Xml::inputLabel($this->msg('specialloguserlabel')->text(), 'user', 'user', 20, $this->user) . '<br />' . FlaggedRevsXML::getStatusFilterMenu($this->status) . ' ' . FlaggedRevsXML::getAutoFilterMenu($this->automatic) . ' ' . Xml::submitButton($this->msg('go')->text()) . '</p></fieldset>' . Xml::closeElement('form')); }
/** * Generates a brief review form for a page * @return array (html string, error string or true) */ public function getHtml() { global $wgLang; $revId = $this->rev->getId(); if ($this->rev->isDeleted(Revision::DELETED_TEXT)) { return array('', 'review_bad_oldid'); # The revision must be valid and public } $article = $this->article; // convenience $srev = $article->getStableRev(); # See if the version being displayed is flagged... if ($revId == $article->getStable()) { $frev = $srev; // avoid query } else { $frev = FlaggedRevision::newFromTitle($article->getTitle(), $revId); } $oldFlags = $frev ? $frev->getTags() : FlaggedRevs::quickTags(FR_CHECKED); // basic tags $reviewTime = $frev ? $frev->getTimestamp() : ''; // last review of rev $priorRevId = $this->refRev ? $this->refRev->getId() : 0; # If we are reviewing updates to a page, start off with the stable revision's # flags. Otherwise, we just fill them in with the selected revision's flags. # @TODO: do we want to carry over info for other diffs? if ($srev && $srev->getRevId() == $priorRevId) { // diff-to-stable $flags = $srev->getTags(); # Check if user is allowed to renew the stable version. # If not, then get the flags for the new revision itself. if (!FlaggedRevs::userCanSetFlags($this->user, $oldFlags)) { $flags = $oldFlags; } # Re-review button is need for template/file only review case $reviewIncludes = $srev->getRevId() == $revId && !$article->stableVersionIsSynced(); } else { // views $flags = $oldFlags; $reviewIncludes = false; // re-review button not needed } # Disable form for unprivileged users $disabled = array(); if (!$article->getTitle()->quickUserCan('review') || !FlaggedRevs::userCanSetFlags($this->user, $flags)) { $disabled = array('disabled' => 'disabled'); } # Begin form... $reviewTitle = SpecialPage::getTitleFor('RevisionReview'); $action = $reviewTitle->getLocalUrl('action=submit'); $params = array('method' => 'post', 'action' => $action, 'id' => 'mw-fr-reviewform'); $form = Xml::openElement('form', $params) . "\n"; $form .= Xml::openElement('fieldset', array('class' => 'flaggedrevs_reviewform noprint')) . "\n"; # Add appropriate legend text $legendMsg = $frev ? 'revreview-reflag' : 'revreview-flag'; $form .= Xml::openElement('legend', array('id' => 'mw-fr-reviewformlegend')); $form .= "<strong>" . wfMessage($legendMsg)->escaped() . "</strong>"; $form .= Xml::closeElement('legend') . "\n"; # Show explanatory text $form .= $this->topNotice; # Check if anyone is reviewing this already and # show a conflict warning message as needed... if ($priorRevId) { list($u, $ts) = FRUserActivity::getUserReviewingDiff($priorRevId, $this->rev->getId()); } else { list($u, $ts) = FRUserActivity::getUserReviewingPage($this->rev->getPage()); } $form .= Xml::openElement('p'); // Page under review (and not by this user)... if ($u !== null && $u != $this->user->getName()) { $form .= '<span class="fr-under-review">'; $msg = $priorRevId ? 'revreview-poss-conflict-c' : 'revreview-poss-conflict-p'; $form .= wfMessage($msg, $u, $wgLang->date($ts, true), $wgLang->time($ts, true))->parse(); $form .= "</span>"; // Page not under review or under review by this user... } elseif (!$frev) { // rev not already reviewed $form .= '<span id="mw-fr-reviewing-status" style="display:none;"></span>'; // JS widget } $form .= Xml::closeElement('p') . "\n"; # Start rating controls $css = $disabled ? 'fr-rating-controls-disabled' : 'fr-rating-controls'; $form .= Xml::openElement('p', array('class' => $css, 'id' => 'fr-rating-controls')) . "\n"; # Add main checkboxes/selects $form .= Xml::openElement('span', array('id' => 'mw-fr-ratingselects', 'class' => 'fr-rating-options')) . "\n"; $form .= self::ratingInputs($this->user, $flags, (bool) $disabled, (bool) $frev) . "\n"; $form .= Xml::closeElement('span') . "\n"; # Don't put buttons & comment field on the same line as tag inputs. if (!$disabled && !FlaggedRevs::binaryFlagging()) { // $disabled => no comment/buttons $form .= "<br />"; } # Start comment & buttons $form .= Xml::openElement('span', array('id' => 'mw-fr-confirmreview')) . "\n"; # Hide comment input if needed if (!$disabled) { $form .= Xml::inputLabel(wfMessage('revreview-log')->text(), 'wpReason', 'mw-fr-commentbox', 40, '', array('maxlength' => 255, 'class' => 'fr-comment-box')); } # Add the submit buttons... $rejectId = $this->rejectRefRevId(); // determine if there will be reject button $form .= self::submitButtons($rejectId, $frev, (bool) $disabled, $reviewIncludes); # Show stability log if there is anything interesting... if ($article->isPageLocked()) { $form .= ' ' . FlaggedRevsXML::logToggle('revreview-log-toggle-show'); } # End comment & buttons $form .= Xml::closeElement('span') . "\n"; # ..add the actual stability log body here if ($article->isPageLocked()) { $form .= FlaggedRevsXML::stabilityLogExcerpt($article); } # End rating controls $form .= Xml::closeElement('p') . "\n"; # Show explanatory text $form .= $this->bottomNotice; # Get the file version used for File: pages as needed $fileKey = $this->getFileVersion(); # Get template/file version info as needed list($templateIDs, $imageSHA1Keys) = $this->getIncludeVersions(); # Convert these into flat string params list($templateParams, $imageParams, $fileVersion) = RevisionReviewForm::getIncludeParams($templateIDs, $imageSHA1Keys, $fileKey); # Hidden params $form .= Html::hidden('title', $reviewTitle->getPrefixedText()) . "\n"; $form .= Html::hidden('target', $article->getTitle()->getPrefixedDBKey()) . "\n"; $form .= Html::hidden('refid', $priorRevId, array('id' => 'mw-fr-input-refid')) . "\n"; $form .= Html::hidden('oldid', $revId, array('id' => 'mw-fr-input-oldid')) . "\n"; $form .= Html::hidden('wpEditToken', $this->user->getEditToken()) . "\n"; $form .= Html::hidden('changetime', $reviewTime, array('id' => 'mw-fr-input-changetime')) . "\n"; // id for JS $form .= Html::hidden('userreviewing', (int) ($u === $this->user->getName()), array('id' => 'mw-fr-user-reviewing')) . "\n"; // id for JS # Add review parameters $form .= Html::hidden('templateParams', $templateParams) . "\n"; $form .= Html::hidden('imageParams', $imageParams) . "\n"; $form .= Html::hidden('fileVersion', $fileVersion) . "\n"; # Special token to discourage fiddling... $key = $this->request->getSessionData('wsFlaggedRevsKey'); $checkCode = RevisionReviewForm::validationKey($templateParams, $imageParams, $fileVersion, $revId, $key); $form .= Html::hidden('validatedParams', $checkCode) . "\n"; $form .= Xml::closeElement('fieldset') . "\n"; $form .= Xml::closeElement('form') . "\n"; return array($form, true); }
public static function addToContribsLine($contribs, &$ret, $row) { $namespaces = FlaggedRevs::getReviewNamespaces(); if (!in_array($row->page_namespace, $namespaces)) { // do nothing } elseif (isset($row->fr_quality)) { $ret = '<span class="' . FlaggedRevsXML::getQualityColor($row->fr_quality) . '">' . $ret . '</span>'; } elseif (isset($row->fp_pending_since) && $row->rev_timestamp >= $row->fp_pending_since) { $ret = '<span class="flaggedrevs-pending">' . $ret . '</span>'; } elseif (!isset($row->fp_stable)) { $ret = '<span class="flaggedrevs-unreviewed">' . $ret . '</span>'; } return true; }
/** * Intercept contribution entries and format them to FlaggedRevs standards * * @param $contribs SpecialPage object for contributions * @param $ret string the HTML line * @param $row Row the DB row for this line * @param $classes the classes to add to the surrounding <li> * @return bool */ public static function addToContribsLine($contribs, &$ret, $row, &$classes) { // make sure that we're parsing revisions data if (isset($row->rev_id)) { $namespaces = FlaggedRevs::getReviewNamespaces(); if (!in_array($row->page_namespace, $namespaces)) { // do nothing } elseif (isset($row->fr_quality)) { $classes[] = FlaggedRevsXML::getQualityColor($row->fr_quality); } elseif (isset($row->fp_pending_since) && $row->rev_timestamp >= $row->fp_pending_since) { $classes[] = 'flaggedrevs-pending'; } elseif (!isset($row->fp_stable)) { $classes[] = 'flaggedrevs-unreviewed'; } } return true; }