r61189 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r61188‎ | r61189 | r61190 >
Date:00:58, 18 January 2010
Author:aaron
Status:ok
Tags:
Comment:
* EditPageNoSuchSection hook
* Added message to bad section error for reviewed pages
* A few tiny cleanups
Modified paths:
  • /trunk/extensions/FlaggedRevs/FlaggedArticleView.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/FlaggedRevs.hooks.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/FlaggedRevs.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/FlaggedRevsXML.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/language/FlaggedRevs.i18n.php (modified) (history)
  • /trunk/phase3/docs/hooks.txt (modified) (history)
  • /trunk/phase3/includes/EditPage.php (modified) (history)

Diff [purge]

Index: trunk/phase3/docs/hooks.txt
@@ -694,6 +694,10 @@
695695 $title: title of page being edited
696696 &$msg: localization message name, overridable. Default is either 'copyrightwarning' or 'copyrightwarning2'
697697
 698+'EditPageNoSuchSection': When a section edit request is given for an non-existent section
 699+&$editpage: The current EditPage object
 700+&$res: the HTML of the error text
 701+
698702 'EditPageTosSummary': Give a chance for site and per-namespace customizations
699703 of terms of service summary link that might exist separately from the copyright
700704 notice.
Index: trunk/phase3/includes/EditPage.php
@@ -2056,7 +2056,10 @@
20572057 $wgOut->setRobotPolicy( 'noindex,nofollow' );
20582058 $wgOut->setArticleRelated( false );
20592059
2060 - $wgOut->addWikiMsg( 'nosuchsectiontext', $this->section );
 2060+ $res = wfMsgExt( 'nosuchsectiontext', 'parse', $this->section );
 2061+ wfRunHooks( 'EditPageNoSuchSection', array( &$this, &$res ) );
 2062+ $wgOut->addHTML( $res );
 2063+
20612064 $wgOut->returnToMain( false, $this->mTitle );
20622065 }
20632066
Index: trunk/extensions/FlaggedRevs/FlaggedRevs.php
@@ -430,6 +430,8 @@
431431 $wgHooks['SkinTemplateNavigation'][] = 'FlaggedRevsHooks::setNavigation';
432432 # Add notice tags to edit view
433433 $wgHooks['EditPage::showEditForm:initial'][] = 'FlaggedRevsHooks::addToEditView';
 434+# Add draft link to section edit error
 435+$wgHooks['EditPageNoSuchSection'][] = 'FlaggedRevsHooks::onNoSuchSection';
434436 # Add notice tags to history
435437 $wgHooks['PageHistoryBeforeList'][] = 'FlaggedRevsHooks::addToHistView';
436438 # Add review form and visiblity settings link
@@ -452,6 +454,7 @@
453455 $wgHooks['ContributionsLineEnding'][] = 'FlaggedRevsHooks::addToContribsLine';
454456 # Page review on edit
455457 $wgHooks['ArticleUpdateBeforeRedirect'][] = 'FlaggedRevsHooks::injectReviewDiffURLParams';
 458+# Diff-to-stable
456459 $wgHooks['DiffViewHeader'][] = 'FlaggedRevsHooks::onDiffViewHeader';
457460 # Autoreview stuff
458461 $wgHooks['EditPage::showEditForm:fields'][] = 'FlaggedRevsHooks::addRevisionIDField';
Index: trunk/extensions/FlaggedRevs/language/FlaggedRevs.i18n.php
@@ -100,7 +100,7 @@
101101 'revreview-edited' => '\'\'\'Changes will be [[{{MediaWiki:Validationpage}}|published]] once an authorised user [[{{MediaWiki:Validationpage}}|reviews]] them.\'\'\'
102102 The \'\'draft\'\', shown below, contains [{{fullurl:{{FULLPAGENAMEE}}|oldid=$1&diff=cur&diffonly=0}} $2 pending {{PLURAL:$2|change|changes}}].',
103103 'revreview-flag' => 'Review this revision',
104 - 'revreview-reflag' => 'Re-review/unreview this revision',
 104+ 'revreview-reflag' => 'Re-review this revision',
105105 'revreview-invalid' => '\'\'\'Invalid target:\'\'\' no [[{{MediaWiki:Validationpage}}|reviewed]] revision corresponds to the given ID.',
106106 'revreview-legend' => 'Rate revision content',
107107 'revreview-log' => 'Comment:',
@@ -119,6 +119,8 @@
120120 [{{fullurl:{{FULLPAGENAMEE}}|oldid=$1&diff=cur&diffonly=0}} $3 pending {{PLURAL:$3|change|changes}}].',
121121 'revreview-pending-quality' => 'The [{{fullurl:{{FULLPAGENAMEE}}|stable=1}} stable version] was [{{fullurl:{{#Special:Log}}|type=review&page={{FULLPAGENAMEE}}}} approved] on <i>$2</i>. The [{{fullurl:{{FULLPAGENAMEE}}|stable=0}} draft] contains
122122 [{{fullurl:{{FULLPAGENAMEE}}|oldid=$1&diff=cur&diffonly=0}} $3 pending {{PLURAL:$3|change|changes}}].',
 123+ 'revreview-pending-nosection' => 'Try viewing the [{{fullurl:{{FULLPAGENAMEE}}|stable=0}} draft], which includes
 124+[{{fullurl:{{FULLPAGENAMEE}}|oldid=$1&diff=cur&diffonly=0}} $2 pending {{PLURAL:$2|change|changes}}], to see if the section was moved or deleted.',
123125 'revreview-noflagged' => 'There are no reviewed revisions of this page, so it may \'\'\'not\'\'\' have been [[{{MediaWiki:Validationpage}}|checked]] for quality.',
124126 'revreview-note' => '[[User:$1|$1]] made the following notes [[{{MediaWiki:Validationpage}}|reviewing]] this revision:',
125127 'revreview-notes' => 'Observations or notes to display:',
@@ -186,7 +188,6 @@
187189 'revreview-visibility3' => '\'\'\'This page does not have a [[{{MediaWiki:Validationpage}}|stable version]]; page stability settings can be [{{fullurl:{{#Special:Stabilization}}|page={{FULLPAGENAMEE}}}} configured].\'\'\'',
188190 'revreview-revnotfound' => 'The old revision of the page you asked for could not be found.
189191 Please check the URL you used to access this page.',
190 - #'right-autopatrol' => 'Automatically mark revisions in non-main namespaces patrolled',
191192 'right-autoreview' => 'Automatically mark revisions as sighted',
192193 'right-movestable' => 'Move stable pages',
193194 'right-review' => 'Mark revisions as sighted',
Index: trunk/extensions/FlaggedRevs/FlaggedRevsXML.php
@@ -441,7 +441,7 @@
442442 * @param FlaggedRevision $frev
443443 * @param int $revsSince
444444 * @returns string
445 - * Creates "there are x pending edits" message in a div
 445+ * Creates "stable rev reviewed on"/"x pending edits" message
446446 */
447447 public static function pendingEditNotice( $flaggedArticle, $frev, $revsSince ) {
448448 global $wgLang;
@@ -449,10 +449,9 @@
450450 return ''; // only for pending edits
451451 }
452452 $flags = $frev->getTags();
453 - $quality = FlaggedRevs::isQuality( $flags );
454453 $time = $wgLang->date( $frev->getTimestamp(), true );
455454 # Add message text for pending edits
456 - $msg = $quality
 455+ $msg = FlaggedRevs::isQuality( $flags )
457456 ? 'revreview-pending-quality'
458457 : 'revreview-pending-basic';
459458 $tag = wfMsgExt( $msg, array( 'parseinline' ), $frev->getRevId(), $time, $revsSince );
Index: trunk/extensions/FlaggedRevs/FlaggedRevs.hooks.php
@@ -1605,6 +1605,12 @@
16061606 return true;
16071607 }
16081608
 1609+ public static function onNoSuchSection( &$editPage, &$s ) {
 1610+ $view = FlaggedArticleView::singleton();
 1611+ $view->addToNoSuchSection( $editPage, $s );
 1612+ return true;
 1613+ }
 1614+
16091615 public static function addToHistView( &$article ) {
16101616 $view = FlaggedArticleView::singleton();
16111617 $view->addToHistView();
Index: trunk/extensions/FlaggedRevs/FlaggedArticleView.php
@@ -842,6 +842,21 @@
843843 }
844844 return $s;
845845 }
 846+
 847+ public function addToNoSuchSection( $editPage, &$s ) {
 848+ $this->load();
 849+ if( !$this->article->isReviewable() ) {
 850+ return true; // nothing to do
 851+ }
 852+ $frev = $this->article->getStableRev();
 853+ if( $frev ) {
 854+ $revsSince = FlaggedRevs::getRevCountSince( $this->article, $frev->getRevId() );
 855+ $s .= "<div class='flaggedrevs_editnotice plainlinks'>" .
 856+ wfMsgExt( 'revreview-pending-nosection', array( 'parseinline' ),
 857+ $frev->getRevId(), $revsSince ) . "</div>";
 858+ }
 859+ return true;
 860+ }
846861
847862 /**
848863 * Add unreviewed pages links

Follow-up revisions

RevisionCommit summaryAuthorDate
r63308MFT r61189, r60760 (needed for FlaggedRevs_alpha)aaron04:13, 6 March 2010

Status & tagging log