Index: trunk/extensions/FlaggedRevs/language/FlaggedRevs.alias.php |
— | — | @@ -11,13 +11,9 @@ |
12 | 12 | * @author Aaron Schulz |
13 | 13 | */ |
14 | 14 | $aliases['en'] = array( |
15 | | - 'LikedPages' => array( 'LikedPages' ), |
16 | 15 | 'OldReviewedPages' => array( 'OldReviewedPages' ), |
17 | 16 | 'ProblemChanges' => array( 'ProblemChanges' ), |
18 | | - 'ProblemPages' => array( 'ProblemPages' ), |
19 | 17 | 'QualityOversight' => array( 'QualityOversight' ), |
20 | | - 'RatingHistory' => array( 'RatingHistory' ), |
21 | | - 'ReaderFeedback' => array( 'ReaderFeedback' ), |
22 | 18 | 'ReviewedPages' => array( 'ReviewedPages' ), |
23 | 19 | 'RevisionReview' => array( 'RevisionReview' ), |
24 | 20 | 'Stabilization' => array( 'Stabilization', 'Stabilisation' ), |
Index: trunk/extensions/FlaggedRevs/specialpages/ProblemPages_body.php |
— | — | @@ -1,153 +0,0 @@ |
2 | | -<?php |
3 | | -if ( !defined( 'MEDIAWIKI' ) ) { |
4 | | - echo "FlaggedRevs extension\n"; |
5 | | - exit( 1 ); |
6 | | -} |
7 | | - |
8 | | -class ProblemPages extends SpecialPage |
9 | | -{ |
10 | | - public function __construct() { |
11 | | - SpecialPage::SpecialPage( 'ProblemPages' ); |
12 | | - wfLoadExtensionMessages( 'ProblemPages' ); |
13 | | - wfLoadExtensionMessages( 'FlaggedRevs' ); |
14 | | - } |
15 | | - |
16 | | - public function execute( $par ) { |
17 | | - global $wgRequest, $wgOut, $wgUser; |
18 | | - $this->setHeaders(); |
19 | | - if( $wgUser->isAllowed( 'feedback' ) ) { |
20 | | - if( $wgUser->isBlocked() ) { |
21 | | - $wgOut->blockedPage(); |
22 | | - return; |
23 | | - } |
24 | | - } else { |
25 | | - $wgOut->permissionRequired( 'feedback' ); |
26 | | - return; |
27 | | - } |
28 | | - if( wfReadOnly() ) { |
29 | | - $wgOut->readOnlyPage(); |
30 | | - return; |
31 | | - } |
32 | | - $this->skin = $wgUser->getSkin(); |
33 | | - # Check if there is a featured level |
34 | | - $this->namespace = $wgRequest->getInt( 'namespace' ); |
35 | | - $this->tag = $wgRequest->getVal( 'ratingtag' ); |
36 | | - $this->showForm(); |
37 | | - $this->showPageList(); |
38 | | - } |
39 | | - |
40 | | - protected function showForm() { |
41 | | - global $wgOut, $wgScript, $wgFlaggedRevsNamespaces; |
42 | | - $form = Xml::openElement( 'form', |
43 | | - array( 'name' => 'reviewedpages', 'action' => $wgScript, 'method' => 'get' ) ); |
44 | | - $form .= "<fieldset><legend>".wfMsgHtml('problempages-leg')."</legend>\n"; |
45 | | - $form .= Xml::hidden( 'title', $this->getTitle()->getPrefixedDBKey() ); |
46 | | - if( count($wgFlaggedRevsNamespaces) > 1 ) { |
47 | | - $form .= FlaggedRevsXML::getNamespaceMenu( $this->namespace ) . ' '; |
48 | | - } |
49 | | - if( count( FlaggedRevs::getFeedbackTags() ) > 0 ) { |
50 | | - $form .= FlaggedRevsXML::getTagMenu( $this->tag ); |
51 | | - } |
52 | | - $form .= " ".Xml::submitButton( wfMsg( 'go' ) ); |
53 | | - $form .= "</fieldset></form>\n"; |
54 | | - $wgOut->addHTML( $form ); |
55 | | - } |
56 | | - |
57 | | - protected function showPageList() { |
58 | | - global $wgOut; |
59 | | - $tags = FlaggedRevs::getFeedbackTags(); |
60 | | - $pager = new ProblemPagesPager( $this, array(), $this->namespace, $this->tag ); |
61 | | - if( isset($tags[$this->tag]) && $pager->getNumRows() ) { |
62 | | - $wgOut->addHTML( wfMsgExt('problempages-list', array('parse') ) ); |
63 | | - $wgOut->addHTML( $pager->getNavigationBar() ); |
64 | | - $wgOut->addHTML( $pager->getBody() ); |
65 | | - $wgOut->addHTML( $pager->getNavigationBar() ); |
66 | | - } elseif( $this->tag ) { // must select first... |
67 | | - $wgOut->addHTML( wfMsgExt('problempages-none', array('parse') ) ); |
68 | | - } |
69 | | - } |
70 | | - |
71 | | - public function formatRow( $row ) { |
72 | | - global $wgLang; |
73 | | - $title = Title::makeTitle( $row->page_namespace, $row->page_title ); |
74 | | - $link = $this->skin->makeKnownLinkObj( $title, $title->getPrefixedText() ); |
75 | | - $hist = $this->skin->makeKnownLinkObj( $title, wfMsgHtml('hist'), 'action=history' ); |
76 | | - $stxt = ''; |
77 | | - if( !is_null($size = $row->page_len) ) { |
78 | | - if($size == 0) |
79 | | - $stxt = ' <small>' . wfMsgHtml('historyempty') . '</small>'; |
80 | | - else |
81 | | - $stxt = ' <small>' . wfMsgExt('historysize', array('parsemag'), |
82 | | - $wgLang->formatNum( $size ) ) . '</small>'; |
83 | | - } |
84 | | - $ratinghist = SpecialPage::getTitleFor( 'RatingHistory' ); |
85 | | - $graph = $this->skin->makeKnownLinkObj( $ratinghist, wfMsg('problempages-graphs'), |
86 | | - 'target='.$title->getPrefixedUrl() ); |
87 | | - return "<li>$link $stxt ($hist) ($graph)</li>"; |
88 | | - } |
89 | | -} |
90 | | - |
91 | | -/** |
92 | | - * Query to list out problematic pages |
93 | | - */ |
94 | | -class ProblemPagesPager extends AlphabeticPager { |
95 | | - public $mForm, $mConds, $namespace, $tag; |
96 | | - |
97 | | - function __construct( $form, $conds = array(), $namespace=0, $tag ) { |
98 | | - $this->mForm = $form; |
99 | | - $this->mConds = $conds; |
100 | | - # Must be a content page... |
101 | | - global $wgFlaggedRevsNamespaces; |
102 | | - if( !is_null($namespace) ) { |
103 | | - $namespace = intval($namespace); |
104 | | - } |
105 | | - if( is_null($namespace) || !in_array($namespace,$wgFlaggedRevsNamespaces) ) { |
106 | | - $namespace = empty($wgFlaggedRevsNamespaces) ? -1 : $wgFlaggedRevsNamespaces[0]; |
107 | | - } |
108 | | - $this->namespace = $namespace; |
109 | | - $this->tag = $tag; |
110 | | - parent::__construct(); |
111 | | - } |
112 | | - |
113 | | - function formatRow( $row ) { |
114 | | - return $this->mForm->formatRow( $row ); |
115 | | - } |
116 | | - |
117 | | - function getQueryInfo() { |
118 | | - $conds = $this->mConds; |
119 | | - $conds[] = 'rfp_page_id = page_id'; |
120 | | - $conds['rfp_tag'] = $this->tag; |
121 | | - $conds['page_namespace'] = $this->namespace; |
122 | | - // Has to be bad enough |
123 | | - $x = 2; |
124 | | - $conds[] = "rfp_ave_val < $x"; |
125 | | - // Reasonable sample |
126 | | - $conds[] = 'rfp_count >= '.READER_FEEDBACK_SIZE; |
127 | | - return array( |
128 | | - 'tables' => array('reader_feedback_pages','page'), |
129 | | - 'fields' => 'page_namespace,page_title,page_len,rfp_ave_val', |
130 | | - 'conds' => $conds, |
131 | | - 'options' => array( 'USE INDEX' => array('reader_feedback_pages' => 'rfp_tag_val_page') ) |
132 | | - ); |
133 | | - } |
134 | | - |
135 | | - function getIndexField() { |
136 | | - return 'rfp_ave_val'; |
137 | | - } |
138 | | - |
139 | | - function getStartBody() { |
140 | | - wfProfileIn( __METHOD__ ); |
141 | | - # Do a link batch query |
142 | | - $lb = new LinkBatch(); |
143 | | - while( $row = $this->mResult->fetchObject() ) { |
144 | | - $lb->add( $row->page_namespace, $row->page_title ); |
145 | | - } |
146 | | - $lb->execute(); |
147 | | - wfProfileOut( __METHOD__ ); |
148 | | - return '<ul>'; |
149 | | - } |
150 | | - |
151 | | - function getEndBody() { |
152 | | - return '</ul>'; |
153 | | - } |
154 | | -} |
Index: trunk/extensions/FlaggedRevs/specialpages/LikedPages_body.php |
— | — | @@ -1,157 +0,0 @@ |
2 | | -<?php |
3 | | -if ( !defined( 'MEDIAWIKI' ) ) { |
4 | | - echo "FlaggedRevs extension\n"; |
5 | | - exit( 1 ); |
6 | | -} |
7 | | - |
8 | | -class LikedPages extends SpecialPage |
9 | | -{ |
10 | | - public function __construct() { |
11 | | - SpecialPage::SpecialPage( 'LikedPages' ); |
12 | | - wfLoadExtensionMessages( 'LikedPages' ); |
13 | | - wfLoadExtensionMessages( 'FlaggedRevs' ); |
14 | | - } |
15 | | - |
16 | | - public function execute( $par ) { |
17 | | - global $wgRequest, $wgOut, $wgUser; |
18 | | - $this->setHeaders(); |
19 | | - if( $wgUser->isAllowed( 'feedback' ) ) { |
20 | | - if( $wgUser->isBlocked() ) { |
21 | | - $wgOut->blockedPage(); |
22 | | - return; |
23 | | - } |
24 | | - } else { |
25 | | - $wgOut->permissionRequired( 'feedback' ); |
26 | | - return; |
27 | | - } |
28 | | - if( wfReadOnly() ) { |
29 | | - $wgOut->readOnlyPage(); |
30 | | - return; |
31 | | - } |
32 | | - $this->skin = $wgUser->getSkin(); |
33 | | - # Check if there is a featured level |
34 | | - $this->namespace = $wgRequest->getInt( 'namespace' ); |
35 | | - $this->tag = $wgRequest->getVal( 'ratingtag' ); |
36 | | - $this->showForm(); |
37 | | - $this->showPageList(); |
38 | | - } |
39 | | - |
40 | | - protected function showForm() { |
41 | | - global $wgOut, $wgTitle, $wgScript, $wgFlaggedRevsNamespaces; |
42 | | - $form = Xml::openElement( 'form', |
43 | | - array( 'name' => 'reviewedpages', 'action' => $wgScript, 'method' => 'get' ) ); |
44 | | - $form .= "<fieldset><legend>".wfMsgHtml('likedpages-leg')."</legend>\n"; |
45 | | - $form .= Xml::hidden( 'title', $wgTitle->getPrefixedDBKey() ); |
46 | | - if( count($wgFlaggedRevsNamespaces) > 1 ) { |
47 | | - $form .= FlaggedRevsXML::getNamespaceMenu( $this->namespace ) . ' '; |
48 | | - } |
49 | | - if( count( FlaggedRevs::getFeedbackTags() ) > 0 ) { |
50 | | - $form .= FlaggedRevsXML::getTagMenu( $this->tag ); |
51 | | - } |
52 | | - $form .= " ".Xml::submitButton( wfMsg( 'go' ) ); |
53 | | - $form .= "</fieldset></form>\n"; |
54 | | - $wgOut->addHTML( $form ); |
55 | | - } |
56 | | - |
57 | | - protected function showPageList() { |
58 | | - global $wgOut; |
59 | | - $tags = FlaggedRevs::getFeedbackTags(); |
60 | | - $pager = new LikedPagesPager( $this, array(), $this->namespace, $this->tag ); |
61 | | - if( isset($tags[$this->tag]) && $pager->getNumRows() ) { |
62 | | - $wgOut->addHTML( wfMsgExt('likedpages-list', array('parse') ) ); |
63 | | - $wgOut->addHTML( $pager->getNavigationBar() ); |
64 | | - $wgOut->addHTML( $pager->getBody() ); |
65 | | - $wgOut->addHTML( $pager->getNavigationBar() ); |
66 | | - } elseif( $this->tag ) { // must select first... |
67 | | - $wgOut->addHTML( wfMsgExt('likedpages-none', array('parse') ) ); |
68 | | - } |
69 | | - } |
70 | | - |
71 | | - public function formatRow( $row ) { |
72 | | - global $wgLang; |
73 | | - $title = Title::makeTitle( $row->page_namespace, $row->page_title ); |
74 | | - $link = $this->skin->makeKnownLinkObj( $title, $title->getPrefixedText() ); |
75 | | - $hist = $this->skin->makeKnownLinkObj( $title, wfMsgHtml('hist'), 'action=history' ); |
76 | | - $stxt = ''; |
77 | | - if( !is_null($size = $row->page_len) ) { |
78 | | - if( $size == 0 ) |
79 | | - $stxt = ' <small>' . wfMsgHtml('historyempty') . '</small>'; |
80 | | - else |
81 | | - $stxt = ' <small>' . wfMsgExt('historysize', array('parsemag'), |
82 | | - $wgLang->formatNum( $size ) ) . '</small>'; |
83 | | - } |
84 | | - $ratinghist = SpecialPage::getTitleFor( 'RatingHistory' ); |
85 | | - $graph = $this->skin->makeKnownLinkObj( $ratinghist, wfMsg('likedpages-graphs'), |
86 | | - 'target='.$title->getPrefixedUrl() ); |
87 | | - return "<li>$link $stxt ($hist) ($graph)</li>"; |
88 | | - } |
89 | | -} |
90 | | - |
91 | | -/** |
92 | | - * Query to list out well recieved pages |
93 | | - */ |
94 | | -class LikedPagesPager extends AlphabeticPager { |
95 | | - public $mForm, $mConds, $namespace, $tag; |
96 | | - |
97 | | - function __construct( $form, $conds = array(), $namespace=0, $tag ) { |
98 | | - $this->mForm = $form; |
99 | | - $this->mConds = $conds; |
100 | | - # Must be a content page... |
101 | | - global $wgFlaggedRevsNamespaces; |
102 | | - if( !is_null($namespace) ) { |
103 | | - $namespace = intval($namespace); |
104 | | - } |
105 | | - if( is_null($namespace) || !in_array($namespace,$wgFlaggedRevsNamespaces) ) { |
106 | | - $namespace = empty($wgFlaggedRevsNamespaces) ? -1 : $wgFlaggedRevsNamespaces[0]; |
107 | | - } |
108 | | - $this->namespace = $namespace; |
109 | | - $this->tag = $tag; |
110 | | - parent::__construct(); |
111 | | - } |
112 | | - |
113 | | - function formatRow( $row ) { |
114 | | - return $this->mForm->formatRow( $row ); |
115 | | - } |
116 | | - |
117 | | - function getQueryInfo() { |
118 | | - $conds = $this->mConds; |
119 | | - $conds[] = 'rfp_page_id = page_id'; |
120 | | - $conds['rfp_tag'] = $this->tag; |
121 | | - $conds['page_namespace'] = $this->namespace; |
122 | | - // Has to be good enough |
123 | | - $x = 3.5; |
124 | | - $conds[] = "rfp_ave_val > $x"; |
125 | | - // Reasonable sample |
126 | | - $conds[] = 'rfp_count >= '.READER_FEEDBACK_SIZE; |
127 | | - return array( |
128 | | - 'tables' => array('reader_feedback_pages','page'), |
129 | | - 'fields' => 'page_namespace,page_title,page_len,rfp_ave_val', |
130 | | - 'conds' => $conds, |
131 | | - 'options' => array( 'USE INDEX' => array('reader_feedback_pages' => 'rfp_tag_val_page') ) |
132 | | - ); |
133 | | - } |
134 | | - |
135 | | - function getDefaultDirections() { |
136 | | - return false; |
137 | | - } |
138 | | - |
139 | | - function getIndexField() { |
140 | | - return 'rfp_ave_val'; |
141 | | - } |
142 | | - |
143 | | - function getStartBody() { |
144 | | - wfProfileIn( __METHOD__ ); |
145 | | - # Do a link batch query |
146 | | - $lb = new LinkBatch(); |
147 | | - while( $row = $this->mResult->fetchObject() ) { |
148 | | - $lb->add( $row->page_namespace, $row->page_title ); |
149 | | - } |
150 | | - $lb->execute(); |
151 | | - wfProfileOut( __METHOD__ ); |
152 | | - return '<ul>'; |
153 | | - } |
154 | | - |
155 | | - function getEndBody() { |
156 | | - return '</ul>'; |
157 | | - } |
158 | | -} |