Index: trunk/extensions/FlaggedRevs/FlaggedRevsPage_body.php |
— | — | @@ -14,7 +14,8 @@ |
15 | 15 | } |
16 | 16 | |
17 | 17 | function execute( $par ) { |
18 | | - global $wgRequest, $wgUser, $wgOut, $wgFlaggedRevComments, $wgFlaggedRevs; |
| 18 | + global $wgRequest, $wgUser, $wgOut, $wgFlaggedRevs, |
| 19 | + $wgFlaggedRevTags, $wgFlaggedRevValues; |
19 | 20 | |
20 | 21 | $confirm = $wgRequest->wasPosted() && |
21 | 22 | $wgUser->matchEditToken( $wgRequest->getVal( 'wpEditToken' ) ); |
— | — | @@ -28,8 +29,7 @@ |
29 | 30 | $wgOut->permissionRequired( 'review' ); |
30 | 31 | return; |
31 | 32 | } |
32 | | - |
33 | | - if ( wfReadOnly() ) { |
| 33 | + if( wfReadOnly() ) { |
34 | 34 | $wgOut->readOnlyPage(); |
35 | 35 | return; |
36 | 36 | } |
— | — | @@ -41,7 +41,7 @@ |
42 | 42 | $this->oldid = $wgRequest->getIntOrNull( 'oldid' ); |
43 | 43 | // Must be a valid content page |
44 | 44 | $this->page = Title::newFromUrl( $this->target ); |
45 | | - if ( !$this->target || !$this->oldid || !$this->page->isContentPage() ) { |
| 45 | + if( !$this->target || !$this->oldid || !$this->page->isContentPage() ) { |
46 | 46 | $wgOut->addHTML( wfMsgExt('revreview-main',array('parse')) ); |
47 | 47 | return; |
48 | 48 | } |
— | — | @@ -60,20 +60,20 @@ |
61 | 61 | // Log comment |
62 | 62 | $this->comment = $wgRequest->getText( 'wpReason' ); |
63 | 63 | // Additional notes |
64 | | - $this->notes = ($wgFlaggedRevComments) ? $wgRequest->getText('wpNotes') : ''; |
| 64 | + $this->notes = $wgFlaggedRevs->allowComments() ? $wgRequest->getText('wpNotes') : ''; |
65 | 65 | // Get the revision's current flags, if any |
66 | 66 | $this->oflags = $wgFlaggedRevs->getFlagsForRevision( $this->oldid ); |
67 | 67 | // Get our accuracy/quality dimensions |
68 | 68 | $this->dims = array(); |
69 | 69 | $this->upprovedTags = 0; |
70 | | - foreach ( array_keys($wgFlaggedRevs->dimensions) as $tag ) { |
| 70 | + foreach( $wgFlaggedRevTags as $tag => $minQL ) { |
71 | 71 | $this->dims[$tag] = $wgRequest->getIntOrNull( "wp$tag" ); |
72 | 72 | // Must be greater than zero |
73 | | - if ( $this->dims[$tag] < 0 ) { |
| 73 | + if( $this->dims[$tag] < 0 || $this->dims[$tag] > $wgFlaggedRevValues ) { |
74 | 74 | $wgOut->showErrorPage('notargettitle', 'notargettext' ); |
75 | 75 | return; |
76 | 76 | } |
77 | | - if ( $this->dims[$tag]==0 ) |
| 77 | + if( $this->dims[$tag]==0 ) |
78 | 78 | $this->upprovedTags++; |
79 | 79 | // Check permissions |
80 | 80 | if( !$this->userCan( $tag, $this->oflags[$tag] ) ) { |
— | — | @@ -89,7 +89,7 @@ |
90 | 90 | // We must at least rate each category as 1, the minimum |
91 | 91 | // Exception: we can rate ALL as unapproved to depreciate a revision |
92 | 92 | $valid = true; |
93 | | - if ( $this->upprovedTags && ($this->upprovedTags < count($wgFlaggedRevTags) || !$this->oflags) ) |
| 93 | + if( $this->upprovedTags && ($this->upprovedTags < count($wgFlaggedRevTags) || !$this->oflags) ) |
94 | 94 | $valid = false; |
95 | 95 | if( !$wgUser->matchEditToken( $wgRequest->getVal('wpEditToken') ) ) |
96 | 96 | $valid = false; |
— | — | @@ -97,7 +97,7 @@ |
98 | 98 | if( $valid && $wgRequest->wasPosted() ) { |
99 | 99 | $this->submit( $wgRequest ); |
100 | 100 | } else { |
101 | | - $this->showRevision( $wgRequest ); |
| 101 | + $this->showRevision(); |
102 | 102 | } |
103 | 103 | } |
104 | 104 | |
— | — | @@ -109,15 +109,15 @@ |
110 | 110 | public static function userCan( $tag, $value ) { |
111 | 111 | global $wgFlagRestrictions, $wgUser; |
112 | 112 | |
113 | | - if ( !isset($wgFlagRestrictions[$tag]) ) |
| 113 | + if( !isset($wgFlagRestrictions[$tag]) ) |
114 | 114 | return true; |
115 | 115 | // Validators always have full access |
116 | | - if ( $wgUser->isAllowed('validate') ) |
| 116 | + if( $wgUser->isAllowed('validate') ) |
117 | 117 | return true; |
118 | 118 | // Check if this user has any right that lets him/her set |
119 | 119 | // 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) ) { |
122 | 122 | return true; |
123 | 123 | } |
124 | 124 | } |
— | — | @@ -125,13 +125,13 @@ |
126 | 126 | } |
127 | 127 | |
128 | 128 | /** |
129 | | - * @param webrequest $request |
| 129 | + * Show revision review form |
130 | 130 | */ |
131 | | - function showRevision( $request ) { |
| 131 | + function showRevision() { |
132 | 132 | global $wgOut, $wgUser, $wgTitle, $wgFlaggedRevComments, $wgFlaggedRevsOverride, |
133 | 133 | $wgFlaggedRevTags, $wgFlaggedRevValues; |
134 | 134 | |
135 | | - if ( !$this->isValid ) |
| 135 | + if( !$this->upprovedTags ) |
136 | 136 | $wgOut->addWikiText( '<strong>' . wfMsg( 'revreview-toolow' ) . '</strong>' ); |
137 | 137 | |
138 | 138 | $wgOut->addWikiText( wfMsg( 'revreview-selected', $this->page->getPrefixedText() ) ); |
— | — | @@ -154,7 +154,7 @@ |
155 | 155 | |
156 | 156 | $formradios = array(); |
157 | 157 | // Dynamically contruct our radio options |
158 | | - foreach ( array_keys($wgFlaggedRevTags) as $tag ) { |
| 158 | + foreach( $wgFlaggedRevTags as $tag => $minQL ) { |
159 | 159 | $formradios[$tag] = array(); |
160 | 160 | for ($i=0; $i <= $wgFlaggedRevValues; $i++) { |
161 | 161 | $formradios[$tag][] = array( "revreview-$tag-$i", "wp$tag", $i ); |
— | — | @@ -172,11 +172,11 @@ |
173 | 173 | $form = "<form name='revisionreview' action='$action' method='post'>"; |
174 | 174 | $form .= '<fieldset><legend>' . wfMsgHtml( 'revreview-legend' ) . '</legend><table><tr>'; |
175 | 175 | // Dynamically contruct our review types |
176 | | - foreach ( array_keys($wgFlaggedRevTags) as $tag ) { |
| 176 | + foreach( $wgFlaggedRevTags as $tag => $minQL ) { |
177 | 177 | $form .= '<td><strong>' . wfMsgHtml( "revreview-$tag" ) . '</strong></td><td width=\'20\'></td>'; |
178 | 178 | } |
179 | 179 | $form .= '</tr><tr>'; |
180 | | - foreach ( $formradios as $set => $ratioset ) { |
| 180 | + foreach( $formradios as $set => $ratioset ) { |
181 | 181 | $form .= '<td>'; |
182 | 182 | foreach( $ratioset as $item ) { |
183 | 183 | list( $message, $name, $field ) = $item; |
— | — | @@ -193,7 +193,7 @@ |
194 | 194 | } |
195 | 195 | $form .= '</tr></table></fieldset>'; |
196 | 196 | // Add box to add live notes to a flagged revision |
197 | | - if ( $wgFlaggedRevComments ) { |
| 197 | + if( $wgFlaggedRevComments ) { |
198 | 198 | $form .= "<fieldset><legend>" . wfMsgHtml( 'revreview-notes' ) . "</legend>" . |
199 | 199 | "<textarea tabindex='1' name='wpNotes' id='wpNotes' rows='3' cols='80' style='width:100%'>$this->notes</textarea>" . |
200 | 200 | "</fieldset>"; |
— | — | @@ -242,17 +242,17 @@ |
243 | 243 | } |
244 | 244 | } |
245 | 245 | // We can only approve actual revisions... |
246 | | - if ( $approved ) { |
| 246 | + if( $approved ) { |
247 | 247 | $rev = Revision::newFromTitle( $this->page, $this->oldid ); |
248 | 248 | // Do not mess with archived/deleted revisions |
249 | | - if ( is_null($rev) || $rev->mDeleted ) { |
| 249 | + if( is_null($rev) || $rev->mDeleted ) { |
250 | 250 | $wgOut->showErrorPage( 'internalerror', 'revnotfoundtext' ); |
251 | 251 | return; |
252 | 252 | } |
253 | 253 | } else { |
254 | 254 | $frev = FlaggedRevs::getFlaggedRev( $this->oldid ); |
255 | 255 | // If we can't find this flagged rev, return to page??? |
256 | | - if ( is_null($frev) ) { |
| 256 | + if( is_null($frev) ) { |
257 | 257 | $wgOut->redirect( $this->page->escapeLocalUrl() ); |
258 | 258 | return; |
259 | 259 | } |
— | — | @@ -261,7 +261,7 @@ |
262 | 262 | $success = $approved ? $this->approveRevision( $rev, $this->notes ) : $this->unapproveRevision( $frev ); |
263 | 263 | |
264 | 264 | // Return to our page |
265 | | - if ( $success ) { |
| 265 | + if( $success ) { |
266 | 266 | if( $request->getCheck( 'wpWatchthis' ) ) { |
267 | 267 | $wgUser->addWatch( $this->page ); |
268 | 268 | } else { |
— | — | @@ -286,7 +286,7 @@ |
287 | 287 | $title = $rev->getTitle(); |
288 | 288 | |
289 | 289 | $quality = 0; |
290 | | - if ( FlaggedRevs::isQuality($this->dims) ) { |
| 290 | + if( FlaggedRevs::isQuality($this->dims) ) { |
291 | 291 | $quality = FlaggedRevs::getLCQuality($this->dims); |
292 | 292 | $quality = ($quality > 1) ? $quality : 1; |
293 | 293 | } |
— | — | @@ -441,7 +441,7 @@ |
442 | 442 | // may now be the default page. |
443 | 443 | $parserCache =& ParserCache::singleton(); |
444 | 444 | $poutput = $parserCache->get( $article, $wgUser ); |
445 | | - if ( $poutput==false ) { |
| 445 | + if( $poutput==false ) { |
446 | 446 | $text = $article->getContent(); |
447 | 447 | $poutput = $wgParser->parse($text, $article->mTitle, ParserOptions::newFromUser($wgUser)); |
448 | 448 | } |
— | — | @@ -568,13 +568,13 @@ |
569 | 569 | $tag = wfMsgExt('revreview-static', array('parseinline'), urlencode($page->getPrefixedText()), $time, $page->getPrefixedText()); |
570 | 570 | $tag .= ' <a id="mwrevisiontoggle" style="display:none;" href="javascript:toggleRevRatings()">' . wfMsg('revreview-toggle') . '</a>'; |
571 | 571 | $tag .= '<span id="mwrevisionratings" style="display:block;">' . |
572 | | - wfMsg('revreview-oldrating') . $RevFlagging->addTagRatings( $flags ) . |
| 572 | + wfMsg('revreview-oldrating') . $wgFlaggedRevs->addTagRatings( $flags ) . |
573 | 573 | '</span>'; |
574 | 574 | // Parse the text... |
575 | | - $text = $RevFlagging->getFlaggedRevText( $this->oldid ); |
| 575 | + $text = $wgFlaggedRevs->getFlaggedRevText( $this->oldid ); |
576 | 576 | $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 ); |
579 | 579 | // Set the new body HTML, place a tag on top |
580 | 580 | $wgOut->addHTML('<div id="mwrevisiontag" class="flaggedrevs_notice plainlinks">'.$tag.'</div>' . $parserOutput->getText() . $notes); |
581 | 581 | // Show stable categories and interwiki links only |
— | — | @@ -599,7 +599,7 @@ |
600 | 600 | return; |
601 | 601 | } |
602 | 602 | $pager = new StableRevisionsPager( $this, array(), $page->getNamespace(), $page->getDBkey() ); |
603 | | - if ( $pager->getNumRows() ) { |
| 603 | + if( $pager->getNumRows() ) { |
604 | 604 | $wgOut->addHTML( wfMsgExt('stableversions-list', array('parse'), $page->getPrefixedText() ) ); |
605 | 605 | $wgOut->addHTML( $pager->getNavigationBar() ); |
606 | 606 | $wgOut->addHTML( "<ul>" . $pager->getBody() . "</ul>" ); |
— | — | @@ -723,13 +723,14 @@ |
724 | 724 | |
725 | 725 | $s .= "\t" . Xml::element("option", array("value" => "all"), "all") . "\n"; |
726 | 726 | |
727 | | - foreach ($arr as $index => $name) { |
| 727 | + foreach($arr as $index => $name) { |
728 | 728 | # Content only |
729 | | - if ($index < NS_MAIN || !in_array($index, $wgContentNamespaces) ) continue; |
| 729 | + if($index < NS_MAIN || !in_array($index, $wgContentNamespaces) ) |
| 730 | + continue; |
730 | 731 | |
731 | 732 | $name = $index !== 0 ? $name : wfMsg('blanknamespace'); |
732 | 733 | |
733 | | - if ($index === $selected) { |
| 734 | + if($index === $selected) { |
734 | 735 | $s .= "\t" . Xml::element("option", |
735 | 736 | array("value" => $index, "selected" => "selected"), |
736 | 737 | $name) . "\n"; |
— | — | @@ -801,8 +802,8 @@ |
802 | 803 | $title = Title::makeTitle( $result->page_namespace, $result->page_title ); |
803 | 804 | $link = $skin->makeKnownLinkObj( $title ); |
804 | 805 | $stxt = ''; |
805 | | - if (!is_null($size = $result->size)) { |
806 | | - if ($size == 0) |
| 806 | + if(!is_null($size = $result->size)) { |
| 807 | + if($size == 0) |
807 | 808 | $stxt = ' <small>' . wfMsgHtml('historyempty') . '</small>'; |
808 | 809 | else |
809 | 810 | $stxt = ' <small>' . wfMsgHtml('historysize', $wgLang->formatNum( $size ) ) . '</small>'; |
Index: trunk/extensions/FlaggedRevs/FlaggedRevsPage.i18n.php |
— | — | @@ -43,7 +43,7 @@ |
44 | 44 | {{plural:$3|awaits|await}} review.', |
45 | 45 | 'revreview-static' => 'This is a [[Help:Article validation|reviewed]] revision of \'\'\'[[:$3|this page]]\'\'\', |
46 | 46 | [{{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].', |
48 | 48 | 'revreview-toggle' => '(details)', |
49 | 49 | 'revreview-note' => '[[User:$1]] made the following notes [[Help:Article validation|reviewing]] this revision:', |
50 | 50 | |