r61320 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r61319‎ | r61320 | r61321 >
Date:00:20, 21 January 2010
Author:aaron
Status:ok (Comments)
Tags:
Comment:
Added stability log excerpt back to review form, but hidden by default
Modified paths:
  • /trunk/extensions/FlaggedRevs/FRCacheUpdate.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/FlaggedArticleView.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/FlaggedRevsXML.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/client/flaggedrevs.js (modified) (history)
  • /trunk/extensions/FlaggedRevs/language/FlaggedRevs.i18n.php (modified) (history)

Diff [purge]

Index: trunk/extensions/FlaggedRevs/language/FlaggedRevs.i18n.php
@@ -52,6 +52,7 @@
5353 'revreview-diff-toggle-show' => '(show changes)',
5454 'revreview-diff-toggle-hide' => '(hide changes)',
5555 'revreview-diff-toggle-title' => 'Toggle display of changes between draft and the published version',
 56+ 'revreview-log-toggle-show' => '(show stability log)',
5657 'review-diff2stable' => 'View pending changes to published version',
5758 'review-logentry-app' => 'reviewed a version of [[$1]]',
5859 'review-logentry-dis' => 'deprecated a version of [[$1]]',
Index: trunk/extensions/FlaggedRevs/FRCacheUpdate.php
@@ -1,5 +1,9 @@
22 <?php
3 -
 3+/**
 4+ * Class containing cache update methods and job construction
 5+ * for the special case of purging pages due to links contained
 6+ * only in the stable version of pages
 7+ */
48 class FRCacheUpdate {
59 public $mTitle, $mTable;
610 public $mRowsPerJob, $mRowsPerQuery;
Index: trunk/extensions/FlaggedRevs/FlaggedRevsXML.php
@@ -1,5 +1,8 @@
22 <?php
3 -
 3+/**
 4+ * Class containing utility XML functions for a FlaggedRevs.
 5+ * Includes functions for selectors, icons, notices, CSS, and form aspects.
 6+ */
47 class FlaggedRevsXML {
58 /**
69 * Get a selector of reviewable namespaces
@@ -242,7 +245,7 @@
243246 $box .= "</td><td></td></tr></table>";
244247 return $box;
245248 }
246 -
 249+
247250 /**
248251 * @returns string
249252 * Generates (+/-) JS toggle HTML
@@ -253,7 +256,7 @@
254257 wfMsgHtml( 'revreview-toggle-title' ) . '" >' .
255258 wfMsgHtml( 'revreview-toggle' ) . '</a>';
256259 }
257 -
 260+
258261 /**
259262 * @returns string
260263 * Generates (+/-) JS toggle HTML
@@ -264,6 +267,17 @@
265268 wfMsgHtml( 'revreview-diff-toggle-title' ) . '" >' .
266269 wfMsgHtml( 'revreview-diff-toggle-show' ) . '</a>';
267270 }
 271+
 272+ /**
 273+ * @returns string
 274+ * Generates (+/-) JS toggle HTML
 275+ */
 276+ public static function logToggle() {
 277+ return '<a id="mw-fr-logtoggle" class="flaggedrevs_toggle" style="display:none;"' .
 278+ ' onclick="FlaggedRevs.toggleLog()" title="' .
 279+ wfMsgHtml( 'revreview-log-toggle-show' ) . '" >' .
 280+ wfMsgHtml( 'revreview-log-toggle-show' ) . '</a>';
 281+ }
268282
269283 /**
270284 * @param array $flags, selected flags
@@ -481,4 +495,16 @@
482496 $tag = wfMsgExt( $msg, array( 'parseinline' ), $frev->getRevId(), $time, $revsSince );
483497 return $tag;
484498 }
 499+
 500+ /*
 501+ * @param Article $article
 502+ * @returns string
 503+ * Creates a stability log excerpt
 504+ */
 505+ public static function stabilityLogExcerpt( $article ) {
 506+ $logHtml = '';
 507+ LogEventsList::showLogExtract( $logHtml, 'stable',
 508+ $article->getTitle()->getPrefixedText(), '', array( 'lim' => 1 ) );
 509+ return "<div id=\"mw-fr-logexcerpt\">$logHtml</div>";
 510+ }
485511 }
Index: trunk/extensions/FlaggedRevs/client/flaggedrevs.js
@@ -25,6 +25,14 @@
2626 diff.style.display = 'none';
2727 }
2828 }
 29+ toggle = document.getElementById('mw-fr-logtoggle');
 30+ if( toggle ) {
 31+ toggle.style.display = 'inline';
 32+ var log = document.getElementById('mw-fr-logexcerpt');
 33+ if( log ) {
 34+ log.style.display = 'none';
 35+ }
 36+ }
2937 },
3038
3139 /* Toggles ratings */
@@ -54,6 +62,19 @@
5563 toggle.innerHTML = this.messages.revreviewDiffToggleShow;
5664 }
5765 }
 66+ },
 67+
 68+ /* Toggles log excerpts */
 69+ 'toggleLog': function() {
 70+ var log = document.getElementById('mw-fr-logexcerpt');
 71+ if( !log ) return;
 72+ var toggle = document.getElementById('mw-fr-logtoggle');
 73+ if( log.style.display == 'none' ) {
 74+ log.style.display = 'inline';
 75+ if( toggle ) {
 76+ toggle.innerHTML = '';
 77+ }
 78+ }
5879 }
5980 };
6081
Index: trunk/extensions/FlaggedRevs/FlaggedArticleView.php
@@ -737,7 +737,7 @@
738738 $items = array();
739739 $tag = $warning = $prot = '';
740740 # Show stabilization log
741 - $log = $this->stabilityLogExcerpt();
 741+ $log = $this->stabilityLogNotice();
742742 if ( $log ) $items[] = $log;
743743 # Check the newest stable version
744744 $quality = 0;
@@ -825,7 +825,7 @@
826826 return true;
827827 }
828828
829 - protected function stabilityLogExcerpt() {
 829+ protected function stabilityLogNotice() {
830830 $this->load();
831831 $s = '';
832832 # Only for pages manually made to be stable...
@@ -1594,8 +1594,15 @@
15951595 }
15961596 # Add the submit buttons
15971597 $form .= FlaggedRevsXML::ratingSubmitButtons( $frev, (bool)$toggle, $allowRereview );
1598 -
 1598+ # Show stability log if there is anything interesting...
 1599+ if( $this->article->isPageLocked() ) {
 1600+ $form .= ' ' . FlaggedRevsXML::logToggle();
 1601+ }
15991602 $form .= Xml::closeElement( 'span' );
 1603+ # ..add the actual stability log body here
 1604+ if( $this->article->isPageLocked() ) {
 1605+ $form .= FlaggedRevsXML::stabilityLogExcerpt( $this->article );
 1606+ }
16001607 $form .= Xml::closeElement( 'div' ) . "\n";
16011608
16021609 # Hidden params

Comments

#Comment by Aaron Schulz (talk | contribs)   00:21, 21 January 2010

Also renamed stabilityLogExcerpt() and added a few class docs.

Status & tagging log