/** * Tag output function must be called by caller * Parser cache control deferred to caller * @param $srev stable version * @param $tag review box/bar info * @param $prot protection notice icon * @return void */ protected function showDraftVersion(FlaggedRevision $srev, &$tag, $prot) { $request = $this->getRequest(); $reqUser = $this->getUser(); $this->load(); if ($this->out->isPrintable()) { return; // all this function does is add notices; don't show them } $flags = $srev->getTags(); $time = $this->getLang()->date($srev->getTimestamp(), true); # Get quality level $quality = FlaggedRevs::isQuality($flags); # Get stable version sync status $synced = $this->article->stableVersionIsSynced(); if ($synced) { // draft == stable $diffToggle = ''; // no diff to show } else { // draft != stable # The user may want the diff (via prefs) $diffToggle = $this->getTopDiffToggle($srev, $quality); if ($diffToggle != '') { $diffToggle = " {$diffToggle}"; } # Make sure there is always a notice bar when viewing the draft. if ($this->useSimpleUI()) { // we already one for detailed UI $this->setPendingNotice($srev, $diffToggle); } } # Give a "your edit is pending" notice to newer users if # an unreviewed edit was completed... if ($request->getVal('shownotice') && $this->article->getUserText(Revision::RAW) == $reqUser->getName() && $this->article->revsArePending() && !$reqUser->isAllowed('review')) { $revsSince = $this->article->getPendingRevCount(); $pending = $prot; if ($this->showRatingIcon()) { $pending .= FlaggedRevsXML::draftStatusIcon(); } $pending .= wfMsgExt('revreview-edited', 'parseinline', $srev->getRevId(), $revsSince); $anchor = $request->getVal('fromsection'); if ($anchor != null) { $section = str_replace('_', ' ', $anchor); // prettify $pending .= wfMsgExt('revreview-edited-section', 'parse', $anchor, $section); } # Notice should always use subtitle $this->reviewNotice = "<div id='mw-fr-reviewnotice' " . "class='flaggedrevs_preview plainlinks'>{$pending}</div>"; # Otherwise, construct some tagging info for non-printable outputs. # Also, if low profile UI is enabled and the page is synced, skip the tag. # Note: the "your edit is pending" notice has all this info, so we never add both. } elseif (!($this->article->lowProfileUI() && $synced)) { $revsSince = $this->article->getPendingRevCount(); // Simple icon-based UI if ($this->useSimpleUI()) { if (!$reqUser->getId()) { $msgHTML = ''; // Anons just see simple icons } elseif ($synced) { $msg = $quality ? 'revreview-quick-quality-same' : 'revreview-quick-basic-same'; $msgHTML = wfMsgExt($msg, 'parseinline', $srev->getRevId(), $revsSince); } else { $msg = $quality ? 'revreview-quick-see-quality' : 'revreview-quick-see-basic'; $msgHTML = wfMsgExt($msg, 'parseinline', $srev->getRevId(), $revsSince); } $icon = ''; # For protection based configs, show lock only if it's not redundant. if ($this->showRatingIcon()) { $icon = $synced ? FlaggedRevsXML::stableStatusIcon($quality) : FlaggedRevsXML::draftStatusIcon(); } $msgHTML = $prot . $icon . $msgHTML; $tag .= FlaggedRevsXML::prettyRatingBox($srev, $msgHTML, $revsSince, 'draft', $synced, false); // Standard UI } else { if ($synced) { if ($quality) { $msg = 'revreview-quality-same'; } else { $msg = 'revreview-basic-same'; } $msgHTML = wfMsgExt($msg, 'parseinline', $srev->getRevId(), $time, $revsSince); } else { $msg = $quality ? 'revreview-newest-quality' : 'revreview-newest-basic'; $msg .= $revsSince == 0 ? '-i' : ''; $msgHTML = wfMsgExt($msg, 'parseinline', $srev->getRevId(), $time, $revsSince); } $icon = $synced ? FlaggedRevsXML::stableStatusIcon($quality) : FlaggedRevsXML::draftStatusIcon(); $tag .= $prot . $icon . $msgHTML . $diffToggle; } } }