r24305 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r24304‎ | r24305 | r24306 >
Date:04:51, 21 July 2007
Author:aaron
Status:old
Tags:
Comment:
*opps
Modified paths:
  • /trunk/extensions/FlaggedRevs/FlaggedRevsPage.i18n.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/FlaggedRevsPage_body.php (modified) (history)

Diff [purge]

Index: trunk/extensions/FlaggedRevs/FlaggedRevsPage_body.php
@@ -14,7 +14,8 @@
1515 }
1616
1717 function execute( $par ) {
18 - global $wgRequest, $wgUser, $wgOut, $wgFlaggedRevComments, $wgFlaggedRevs;
 18+ global $wgRequest, $wgUser, $wgOut, $wgFlaggedRevs,
 19+ $wgFlaggedRevTags, $wgFlaggedRevValues;
1920
2021 $confirm = $wgRequest->wasPosted() &&
2122 $wgUser->matchEditToken( $wgRequest->getVal( 'wpEditToken' ) );
@@ -28,8 +29,7 @@
2930 $wgOut->permissionRequired( 'review' );
3031 return;
3132 }
32 -
33 - if ( wfReadOnly() ) {
 33+ if( wfReadOnly() ) {
3434 $wgOut->readOnlyPage();
3535 return;
3636 }
@@ -41,7 +41,7 @@
4242 $this->oldid = $wgRequest->getIntOrNull( 'oldid' );
4343 // Must be a valid content page
4444 $this->page = Title::newFromUrl( $this->target );
45 - if ( !$this->target || !$this->oldid || !$this->page->isContentPage() ) {
 45+ if( !$this->target || !$this->oldid || !$this->page->isContentPage() ) {
4646 $wgOut->addHTML( wfMsgExt('revreview-main',array('parse')) );
4747 return;
4848 }
@@ -60,20 +60,20 @@
6161 // Log comment
6262 $this->comment = $wgRequest->getText( 'wpReason' );
6363 // Additional notes
64 - $this->notes = ($wgFlaggedRevComments) ? $wgRequest->getText('wpNotes') : '';
 64+ $this->notes = $wgFlaggedRevs->allowComments() ? $wgRequest->getText('wpNotes') : '';
6565 // Get the revision's current flags, if any
6666 $this->oflags = $wgFlaggedRevs->getFlagsForRevision( $this->oldid );
6767 // Get our accuracy/quality dimensions
6868 $this->dims = array();
6969 $this->upprovedTags = 0;
70 - foreach ( array_keys($wgFlaggedRevs->dimensions) as $tag ) {
 70+ foreach( $wgFlaggedRevTags as $tag => $minQL ) {
7171 $this->dims[$tag] = $wgRequest->getIntOrNull( "wp$tag" );
7272 // Must be greater than zero
73 - if ( $this->dims[$tag] < 0 ) {
 73+ if( $this->dims[$tag] < 0 || $this->dims[$tag] > $wgFlaggedRevValues ) {
7474 $wgOut->showErrorPage('notargettitle', 'notargettext' );
7575 return;
7676 }
77 - if ( $this->dims[$tag]==0 )
 77+ if( $this->dims[$tag]==0 )
7878 $this->upprovedTags++;
7979 // Check permissions
8080 if( !$this->userCan( $tag, $this->oflags[$tag] ) ) {
@@ -89,7 +89,7 @@
9090 // We must at least rate each category as 1, the minimum
9191 // Exception: we can rate ALL as unapproved to depreciate a revision
9292 $valid = true;
93 - if ( $this->upprovedTags && ($this->upprovedTags < count($wgFlaggedRevTags) || !$this->oflags) )
 93+ if( $this->upprovedTags && ($this->upprovedTags < count($wgFlaggedRevTags) || !$this->oflags) )
9494 $valid = false;
9595 if( !$wgUser->matchEditToken( $wgRequest->getVal('wpEditToken') ) )
9696 $valid = false;
@@ -97,7 +97,7 @@
9898 if( $valid && $wgRequest->wasPosted() ) {
9999 $this->submit( $wgRequest );
100100 } else {
101 - $this->showRevision( $wgRequest );
 101+ $this->showRevision();
102102 }
103103 }
104104
@@ -109,15 +109,15 @@
110110 public static function userCan( $tag, $value ) {
111111 global $wgFlagRestrictions, $wgUser;
112112
113 - if ( !isset($wgFlagRestrictions[$tag]) )
 113+ if( !isset($wgFlagRestrictions[$tag]) )
114114 return true;
115115 // Validators always have full access
116 - if ( $wgUser->isAllowed('validate') )
 116+ if( $wgUser->isAllowed('validate') )
117117 return true;
118118 // Check if this user has any right that lets him/her set
119119 // up to this particular value
120 - foreach ( $wgFlagRestrictions[$tag] as $right => $level ) {
121 - if ( $value <= $level && $wgUser->isAllowed($right) ) {
 120+ foreach( $wgFlagRestrictions[$tag] as $right => $level ) {
 121+ if( $value <= $level && $wgUser->isAllowed($right) ) {
122122 return true;
123123 }
124124 }
@@ -125,13 +125,13 @@
126126 }
127127
128128 /**
129 - * @param webrequest $request
 129+ * Show revision review form
130130 */
131 - function showRevision( $request ) {
 131+ function showRevision() {
132132 global $wgOut, $wgUser, $wgTitle, $wgFlaggedRevComments, $wgFlaggedRevsOverride,
133133 $wgFlaggedRevTags, $wgFlaggedRevValues;
134134
135 - if ( !$this->isValid )
 135+ if( !$this->upprovedTags )
136136 $wgOut->addWikiText( '<strong>' . wfMsg( 'revreview-toolow' ) . '</strong>' );
137137
138138 $wgOut->addWikiText( wfMsg( 'revreview-selected', $this->page->getPrefixedText() ) );
@@ -154,7 +154,7 @@
155155
156156 $formradios = array();
157157 // Dynamically contruct our radio options
158 - foreach ( array_keys($wgFlaggedRevTags) as $tag ) {
 158+ foreach( $wgFlaggedRevTags as $tag => $minQL ) {
159159 $formradios[$tag] = array();
160160 for ($i=0; $i <= $wgFlaggedRevValues; $i++) {
161161 $formradios[$tag][] = array( "revreview-$tag-$i", "wp$tag", $i );
@@ -172,11 +172,11 @@
173173 $form = "<form name='revisionreview' action='$action' method='post'>";
174174 $form .= '<fieldset><legend>' . wfMsgHtml( 'revreview-legend' ) . '</legend><table><tr>';
175175 // Dynamically contruct our review types
176 - foreach ( array_keys($wgFlaggedRevTags) as $tag ) {
 176+ foreach( $wgFlaggedRevTags as $tag => $minQL ) {
177177 $form .= '<td><strong>' . wfMsgHtml( "revreview-$tag" ) . '</strong></td><td width=\'20\'></td>';
178178 }
179179 $form .= '</tr><tr>';
180 - foreach ( $formradios as $set => $ratioset ) {
 180+ foreach( $formradios as $set => $ratioset ) {
181181 $form .= '<td>';
182182 foreach( $ratioset as $item ) {
183183 list( $message, $name, $field ) = $item;
@@ -193,7 +193,7 @@
194194 }
195195 $form .= '</tr></table></fieldset>';
196196 // Add box to add live notes to a flagged revision
197 - if ( $wgFlaggedRevComments ) {
 197+ if( $wgFlaggedRevComments ) {
198198 $form .= "<fieldset><legend>" . wfMsgHtml( 'revreview-notes' ) . "</legend>" .
199199 "<textarea tabindex='1' name='wpNotes' id='wpNotes' rows='3' cols='80' style='width:100%'>$this->notes</textarea>" .
200200 "</fieldset>";
@@ -242,17 +242,17 @@
243243 }
244244 }
245245 // We can only approve actual revisions...
246 - if ( $approved ) {
 246+ if( $approved ) {
247247 $rev = Revision::newFromTitle( $this->page, $this->oldid );
248248 // Do not mess with archived/deleted revisions
249 - if ( is_null($rev) || $rev->mDeleted ) {
 249+ if( is_null($rev) || $rev->mDeleted ) {
250250 $wgOut->showErrorPage( 'internalerror', 'revnotfoundtext' );
251251 return;
252252 }
253253 } else {
254254 $frev = FlaggedRevs::getFlaggedRev( $this->oldid );
255255 // If we can't find this flagged rev, return to page???
256 - if ( is_null($frev) ) {
 256+ if( is_null($frev) ) {
257257 $wgOut->redirect( $this->page->escapeLocalUrl() );
258258 return;
259259 }
@@ -261,7 +261,7 @@
262262 $success = $approved ? $this->approveRevision( $rev, $this->notes ) : $this->unapproveRevision( $frev );
263263
264264 // Return to our page
265 - if ( $success ) {
 265+ if( $success ) {
266266 if( $request->getCheck( 'wpWatchthis' ) ) {
267267 $wgUser->addWatch( $this->page );
268268 } else {
@@ -286,7 +286,7 @@
287287 $title = $rev->getTitle();
288288
289289 $quality = 0;
290 - if ( FlaggedRevs::isQuality($this->dims) ) {
 290+ if( FlaggedRevs::isQuality($this->dims) ) {
291291 $quality = FlaggedRevs::getLCQuality($this->dims);
292292 $quality = ($quality > 1) ? $quality : 1;
293293 }
@@ -441,7 +441,7 @@
442442 // may now be the default page.
443443 $parserCache =& ParserCache::singleton();
444444 $poutput = $parserCache->get( $article, $wgUser );
445 - if ( $poutput==false ) {
 445+ if( $poutput==false ) {
446446 $text = $article->getContent();
447447 $poutput = $wgParser->parse($text, $article->mTitle, ParserOptions::newFromUser($wgUser));
448448 }
@@ -568,13 +568,13 @@
569569 $tag = wfMsgExt('revreview-static', array('parseinline'), urlencode($page->getPrefixedText()), $time, $page->getPrefixedText());
570570 $tag .= ' <a id="mwrevisiontoggle" style="display:none;" href="javascript:toggleRevRatings()">' . wfMsg('revreview-toggle') . '</a>';
571571 $tag .= '<span id="mwrevisionratings" style="display:block;">' .
572 - wfMsg('revreview-oldrating') . $RevFlagging->addTagRatings( $flags ) .
 572+ wfMsg('revreview-oldrating') . $wgFlaggedRevs->addTagRatings( $flags ) .
573573 '</span>';
574574 // Parse the text...
575 - $text = $RevFlagging->getFlaggedRevText( $this->oldid );
 575+ $text = $wgFlaggedRevs->getFlaggedRevText( $this->oldid );
576576 $options = ParserOptions::newFromUser($wgUser);
577 - $parserOutput = $RevFlagging->parseStableText( $page, $text, $this->oldid, $options );
578 - $notes = $RevFlagging->ReviewNotes( $frev );
 577+ $parserOutput = $wgFlaggedRevs->parseStableText( $page, $text, $this->oldid, $options );
 578+ $notes = $wgFlaggedRevs->ReviewNotes( $frev );
579579 // Set the new body HTML, place a tag on top
580580 $wgOut->addHTML('<div id="mwrevisiontag" class="flaggedrevs_notice plainlinks">'.$tag.'</div>' . $parserOutput->getText() . $notes);
581581 // Show stable categories and interwiki links only
@@ -599,7 +599,7 @@
600600 return;
601601 }
602602 $pager = new StableRevisionsPager( $this, array(), $page->getNamespace(), $page->getDBkey() );
603 - if ( $pager->getNumRows() ) {
 603+ if( $pager->getNumRows() ) {
604604 $wgOut->addHTML( wfMsgExt('stableversions-list', array('parse'), $page->getPrefixedText() ) );
605605 $wgOut->addHTML( $pager->getNavigationBar() );
606606 $wgOut->addHTML( "<ul>" . $pager->getBody() . "</ul>" );
@@ -723,13 +723,14 @@
724724
725725 $s .= "\t" . Xml::element("option", array("value" => "all"), "all") . "\n";
726726
727 - foreach ($arr as $index => $name) {
 727+ foreach($arr as $index => $name) {
728728 # Content only
729 - if ($index < NS_MAIN || !in_array($index, $wgContentNamespaces) ) continue;
 729+ if($index < NS_MAIN || !in_array($index, $wgContentNamespaces) )
 730+ continue;
730731
731732 $name = $index !== 0 ? $name : wfMsg('blanknamespace');
732733
733 - if ($index === $selected) {
 734+ if($index === $selected) {
734735 $s .= "\t" . Xml::element("option",
735736 array("value" => $index, "selected" => "selected"),
736737 $name) . "\n";
@@ -801,8 +802,8 @@
802803 $title = Title::makeTitle( $result->page_namespace, $result->page_title );
803804 $link = $skin->makeKnownLinkObj( $title );
804805 $stxt = '';
805 - if (!is_null($size = $result->size)) {
806 - if ($size == 0)
 806+ if(!is_null($size = $result->size)) {
 807+ if($size == 0)
807808 $stxt = ' <small>' . wfMsgHtml('historyempty') . '</small>';
808809 else
809810 $stxt = ' <small>' . wfMsgHtml('historysize', $wgLang->formatNum( $size ) ) . '</small>';
Index: trunk/extensions/FlaggedRevs/FlaggedRevsPage.i18n.php
@@ -43,7 +43,7 @@
4444 {{plural:$3|awaits|await}} review.',
4545 'revreview-static' => 'This is a [[Help:Article validation|reviewed]] revision of \'\'\'[[:$3|this page]]\'\'\',
4646 [{{fullurl:Special:Log/review|page=$1}} approved] on <i>$2</i>. The [{{fullurl:$3|stable=0}} current revision]
47 - is usually editable and more up to date.',
 47+ can be [{{fullurl:$3|action=edit}} modified].',
4848 'revreview-toggle' => '(details)',
4949 'revreview-note' => '[[User:$1]] made the following notes [[Help:Article validation|reviewing]] this revision:',
5050

Status & tagging log