Index: trunk/extensions/FlaggedRevs/presentation/FlaggedRevsUI.setup.php |
— | — | @@ -0,0 +1,129 @@ |
| 2 | +<?php |
| 3 | +/** |
| 4 | + * Class containing hooked functions for a FlaggedRevs environment |
| 5 | + */ |
| 6 | +class FlaggedRevsUISetup { |
| 7 | + /* |
| 8 | + * Register FlaggedRevs special pages as needed. |
| 9 | + * @param $pages Array $wgSpecialPages (list of special pages) |
| 10 | + * @param $groups Array $wgSpecialPageGroups (assoc array of special page groups) |
| 11 | + */ |
| 12 | + public static function defineSpecialPages( array &$pages, array &$groups ) { |
| 13 | + global $wgUseTagFilter; |
| 14 | + // Show special pages only if FlaggedRevs is enabled on some namespaces |
| 15 | + if ( !FlaggedRevs::getReviewNamespaces() ) { |
| 16 | + return true; |
| 17 | + } |
| 18 | + $pages['RevisionReview'] = 'RevisionReview'; // unlisted |
| 19 | + $pages['ReviewedVersions'] = 'ReviewedVersions'; // unlisted |
| 20 | + $pages['PendingChanges'] = 'PendingChanges'; |
| 21 | + $groups['PendingChanges'] = 'quality'; |
| 22 | + // Show tag filtered pending edit page if there are tags |
| 23 | + if ( $wgUseTagFilter ) { |
| 24 | + $pages['ProblemChanges'] = 'ProblemChanges'; |
| 25 | + $groups['ProblemChanges'] = 'quality'; |
| 26 | + } |
| 27 | + if ( !FlaggedRevs::useOnlyIfProtected() ) { |
| 28 | + $pages['ReviewedPages'] = 'ReviewedPages'; |
| 29 | + $groups['ReviewedPages'] = 'quality'; |
| 30 | + $pages['UnreviewedPages'] = 'UnreviewedPages'; |
| 31 | + $groups['UnreviewedPages'] = 'quality'; |
| 32 | + } |
| 33 | + $pages['QualityOversight'] = 'QualityOversight'; |
| 34 | + $groups['QualityOversight'] = 'quality'; |
| 35 | + $pages['ValidationStatistics'] = 'ValidationStatistics'; |
| 36 | + $groups['ValidationStatistics'] = 'quality'; |
| 37 | + // Protect levels define allowed stability settings |
| 38 | + if ( FlaggedRevs::useProtectionLevels() ) { |
| 39 | + $pages['StablePages'] = 'StablePages'; |
| 40 | + $groups['StablePages'] = 'quality'; |
| 41 | + } else { |
| 42 | + $pages['ConfiguredPages'] = 'ConfiguredPages'; |
| 43 | + $groups['ConfiguredPages'] = 'quality'; |
| 44 | + $pages['Stabilization'] = 'Stabilization'; // unlisted |
| 45 | + } |
| 46 | + return true; |
| 47 | + } |
| 48 | + |
| 49 | + /** |
| 50 | + * Append FlaggedRevs resource module definitions |
| 51 | + * @param $modules Array $wgResourceModules |
| 52 | + */ |
| 53 | + public static function defineResourceModules( &$modules ) { |
| 54 | + $localModulePath = dirname( __FILE__ ) . '/modules/'; |
| 55 | + $remoteModulePath = 'FlaggedRevs/presentation/modules'; |
| 56 | + $modules['ext.flaggedRevs.basic'] = array( |
| 57 | + 'styles' => array( 'ext.flaggedRevs.basic.css' ), |
| 58 | + 'localBasePath' => $localModulePath, |
| 59 | + 'remoteExtPath' => $remoteModulePath, |
| 60 | + ); |
| 61 | + $modules['ext.flaggedRevs.advanced'] = array( |
| 62 | + 'scripts' => array( 'ext.flaggedRevs.advanced.js' ), |
| 63 | + 'messages' => array( |
| 64 | + 'revreview-toggle-show', 'revreview-toggle-hide', |
| 65 | + 'revreview-diff-toggle-show', 'revreview-diff-toggle-hide', |
| 66 | + 'revreview-log-toggle-show', 'revreview-log-toggle-hide', |
| 67 | + 'revreview-log-details-show', 'revreview-log-details-hide' |
| 68 | + ), |
| 69 | + 'dependencies' => array( 'mediawiki.util' ), |
| 70 | + 'localBasePath' => $localModulePath, |
| 71 | + 'remoteExtPath' => $remoteModulePath, |
| 72 | + ); |
| 73 | + $modules['ext.flaggedRevs.review'] = array( |
| 74 | + 'scripts' => array( 'ext.flaggedRevs.review.js' ), |
| 75 | + 'styles' => array( 'ext.flaggedRevs.review.css' ), |
| 76 | + 'messages' => array( |
| 77 | + 'savearticle', 'tooltip-save', 'accesskey-save', |
| 78 | + 'revreview-submitedit', 'revreview-submitedit-title', |
| 79 | + 'revreview-submit-review', 'revreview-submit-unreview', |
| 80 | + 'revreview-submit-reviewed', 'revreview-submit-unreviewed', |
| 81 | + 'revreview-submitting', 'actioncomplete', 'actionfailed', |
| 82 | + 'revreview-adv-reviewing-p', 'revreview-adv-reviewing-c', |
| 83 | + 'revreview-sadv-reviewing-p', 'revreview-sadv-reviewing-c', |
| 84 | + 'revreview-adv-start-link', 'revreview-adv-stop-link' |
| 85 | + ), |
| 86 | + 'dependencies' => array( 'mediawiki.util' ), |
| 87 | + 'localBasePath' => $localModulePath, |
| 88 | + 'remoteExtPath' => $remoteModulePath, |
| 89 | + ); |
| 90 | + } |
| 91 | + |
| 92 | + /** |
| 93 | + * Append FlaggedRevs log names and set filterable logs |
| 94 | + * @param $logNames Array $wgLogNames |
| 95 | + * @param $logHeaders Array $wgLogHeaders |
| 96 | + * @param $filterLogTypes Array $wgFilterLogTypes |
| 97 | + */ |
| 98 | + public static function defineLogBasicDescription( &$logNames, &$logHeaders, &$filterLogTypes ) { |
| 99 | + $logNames['review'] = 'review-logpage'; |
| 100 | + $logHeaders['review'] = 'review-logpagetext'; |
| 101 | + |
| 102 | + $logNames['stable'] = 'stable-logpage'; |
| 103 | + $logHeaders['stable'] = 'stable-logpagetext'; |
| 104 | + |
| 105 | + $filterLogTypes['review'] = true; |
| 106 | + } |
| 107 | + |
| 108 | + /** |
| 109 | + * Append FlaggedRevs log action handlers |
| 110 | + * @param $logActions Array $wgLogActions |
| 111 | + * @param $logActionsHandlers Array $wgLogActionsHandlers |
| 112 | + */ |
| 113 | + public static function defineLogActionHanders( &$logActions, &$logActionsHandlers ) { |
| 114 | + # Various actions are used for log filtering ... |
| 115 | + $logActions['review/approve'] = 'review-logentry-app'; // checked (again) |
| 116 | + $logActions['review/approve2'] = 'review-logentry-app'; // quality (again) |
| 117 | + $logActions['review/approve-i'] = 'review-logentry-app'; // checked (first time) |
| 118 | + $logActions['review/approve2-i'] = 'review-logentry-app'; // quality (first time) |
| 119 | + $logActions['review/approve-a'] = 'review-logentry-app'; // checked (auto) |
| 120 | + $logActions['review/approve2-a'] = 'review-logentry-app'; // quality (auto) |
| 121 | + $logActions['review/approve-ia'] = 'review-logentry-app'; // checked (initial & auto) |
| 122 | + $logActions['review/approve2-ia'] = 'review-logentry-app'; // quality (initial & auto) |
| 123 | + $logActions['review/unapprove'] = 'review-logentry-dis'; // was checked |
| 124 | + $logActions['review/unapprove2'] = 'review-logentry-dis'; // was quality |
| 125 | + |
| 126 | + $logActionsHandlers['stable/config'] = 'FlaggedRevsLogView::stabilityLogText'; // customize |
| 127 | + $logActionsHandlers['stable/modify'] = 'FlaggedRevsLogView::stabilityLogText'; // re-customize |
| 128 | + $logActionsHandlers['stable/reset'] = 'FlaggedRevsLogView::stabilityLogText'; // reset |
| 129 | + } |
| 130 | +} |
Property changes on: trunk/extensions/FlaggedRevs/presentation/FlaggedRevsUI.setup.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 131 | + native |
Index: trunk/extensions/FlaggedRevs/presentation/FlaggedRevsUI.hooks.php |
— | — | @@ -3,123 +3,7 @@ |
4 | 4 | * Class containing hooked functions for a FlaggedRevs environment |
5 | 5 | */ |
6 | 6 | class FlaggedRevsUIHooks { |
7 | | - /* |
8 | | - * Register FlaggedRevs special pages as needed. |
9 | | - * Also sets $wgSpecialPages just to be consistent. |
10 | | - * @param $list Array List of special pages |
11 | | - */ |
12 | | - public static function defineSpecialPages( array &$list ) { |
13 | | - global $wgSpecialPages, $wgUseTagFilter; |
14 | | - // Show special pages only if FlaggedRevs is enabled on some namespaces |
15 | | - if ( !FlaggedRevs::getReviewNamespaces() ) { |
16 | | - return true; |
17 | | - } |
18 | | - $list['RevisionReview'] = $wgSpecialPages['RevisionReview'] = 'RevisionReview'; |
19 | | - $list['ReviewedVersions'] = $wgSpecialPages['ReviewedVersions'] = 'ReviewedVersions'; |
20 | | - $list['PendingChanges'] = $wgSpecialPages['PendingChanges'] = 'PendingChanges'; |
21 | | - // Show tag filtered pending edit page if there are tags |
22 | | - if ( $wgUseTagFilter && ChangeTags::listDefinedTags() ) { |
23 | | - $list['ProblemChanges'] = $wgSpecialPages['ProblemChanges'] = 'ProblemChanges'; |
24 | | - } |
25 | | - if ( !FlaggedRevs::useOnlyIfProtected() ) { |
26 | | - $list['ReviewedPages'] = $wgSpecialPages['ReviewedPages'] = 'ReviewedPages'; |
27 | | - $list['UnreviewedPages'] = $wgSpecialPages['UnreviewedPages'] = 'UnreviewedPages'; |
28 | | - } |
29 | | - $list['QualityOversight'] = $wgSpecialPages['QualityOversight'] = 'QualityOversight'; |
30 | | - $list['ValidationStatistics'] = $wgSpecialPages['ValidationStatistics'] = 'ValidationStatistics'; |
31 | | - // Protect levels define allowed stability settings |
32 | | - if ( FlaggedRevs::useProtectionLevels() ) { |
33 | | - $list['StablePages'] = $wgSpecialPages['StablePages'] = 'StablePages'; |
34 | | - } else { |
35 | | - $list['ConfiguredPages'] = $wgSpecialPages['ConfiguredPages'] = 'ConfiguredPages'; |
36 | | - $list['Stabilization'] = $wgSpecialPages['Stabilization'] = 'Stabilization'; |
37 | | - } |
38 | | - return true; |
39 | | - } |
40 | | - |
41 | 7 | /** |
42 | | - * Append FlaggedRevs resource module definitions |
43 | | - * @param $modules Array $wgResourceModules |
44 | | - */ |
45 | | - public static function defineResourceModules( &$modules ) { |
46 | | - $localModulePath = dirname( __FILE__ ) . '/modules/'; |
47 | | - $remoteModulePath = 'FlaggedRevs/presentation/modules'; |
48 | | - $modules['ext.flaggedRevs.basic'] = array( |
49 | | - 'styles' => array( 'ext.flaggedRevs.basic.css' ), |
50 | | - 'localBasePath' => $localModulePath, |
51 | | - 'remoteExtPath' => $remoteModulePath, |
52 | | - ); |
53 | | - $modules['ext.flaggedRevs.advanced'] = array( |
54 | | - 'scripts' => array( 'ext.flaggedRevs.advanced.js' ), |
55 | | - 'messages' => array( |
56 | | - 'revreview-toggle-show', 'revreview-toggle-hide', |
57 | | - 'revreview-diff-toggle-show', 'revreview-diff-toggle-hide', |
58 | | - 'revreview-log-toggle-show', 'revreview-log-toggle-hide', |
59 | | - 'revreview-log-details-show', 'revreview-log-details-hide' |
60 | | - ), |
61 | | - 'dependencies' => array( 'mediawiki.util' ), |
62 | | - 'localBasePath' => $localModulePath, |
63 | | - 'remoteExtPath' => $remoteModulePath, |
64 | | - ); |
65 | | - $modules['ext.flaggedRevs.review'] = array( |
66 | | - 'scripts' => array( 'ext.flaggedRevs.review.js' ), |
67 | | - 'styles' => array( 'ext.flaggedRevs.review.css' ), |
68 | | - 'messages' => array( |
69 | | - 'savearticle', 'tooltip-save', 'accesskey-save', |
70 | | - 'revreview-submitedit', 'revreview-submitedit-title', |
71 | | - 'revreview-submit-review', 'revreview-submit-unreview', |
72 | | - 'revreview-submit-reviewed', 'revreview-submit-unreviewed', |
73 | | - 'revreview-submitting', 'actioncomplete', 'actionfailed', |
74 | | - 'revreview-adv-reviewing-p', 'revreview-adv-reviewing-c', |
75 | | - 'revreview-sadv-reviewing-p', 'revreview-sadv-reviewing-c', |
76 | | - 'revreview-adv-start-link', 'revreview-adv-stop-link' |
77 | | - ), |
78 | | - 'dependencies' => array( 'mediawiki.util' ), |
79 | | - 'localBasePath' => $localModulePath, |
80 | | - 'remoteExtPath' => $remoteModulePath, |
81 | | - ); |
82 | | - } |
83 | | - |
84 | | - /** |
85 | | - * Append FlaggedRevs log names and set filterable logs |
86 | | - * @param $logNames Array $wgLogNames |
87 | | - * @param $logHeaders Array $wgLogHeaders |
88 | | - * @param $filterLogTypes Array $wgFilterLogTypes |
89 | | - */ |
90 | | - public static function defineLogBasicDesc( &$logNames, &$logHeaders, &$filterLogTypes ) { |
91 | | - $logNames['review'] = 'review-logpage'; |
92 | | - $logHeaders['review'] = 'review-logpagetext'; |
93 | | - |
94 | | - $logNames['stable'] = 'stable-logpage'; |
95 | | - $logHeaders['stable'] = 'stable-logpagetext'; |
96 | | - |
97 | | - $filterLogTypes['review'] = true; |
98 | | - } |
99 | | - |
100 | | - /** |
101 | | - * Append FlaggedRevs log action handlers |
102 | | - * @param $logActions Array $wgLogActions |
103 | | - * @param $logActionsHandlers Array $wgLogActionsHandlers |
104 | | - */ |
105 | | - public static function defineLogActionHanders( &$logActions, &$logActionsHandlers ) { |
106 | | - # Various actions are used for log filtering ... |
107 | | - $logActions['review/approve'] = 'review-logentry-app'; // checked (again) |
108 | | - $logActions['review/approve2'] = 'review-logentry-app'; // quality (again) |
109 | | - $logActions['review/approve-i'] = 'review-logentry-app'; // checked (first time) |
110 | | - $logActions['review/approve2-i'] = 'review-logentry-app'; // quality (first time) |
111 | | - $logActions['review/approve-a'] = 'review-logentry-app'; // checked (auto) |
112 | | - $logActions['review/approve2-a'] = 'review-logentry-app'; // quality (auto) |
113 | | - $logActions['review/approve-ia'] = 'review-logentry-app'; // checked (initial & auto) |
114 | | - $logActions['review/approve2-ia'] = 'review-logentry-app'; // quality (initial & auto) |
115 | | - $logActions['review/unapprove'] = 'review-logentry-dis'; // was checked |
116 | | - $logActions['review/unapprove2'] = 'review-logentry-dis'; // was quality |
117 | | - |
118 | | - $logActionsHandlers['stable/config'] = 'FlaggedRevsLogView::stabilityLogText'; // customize |
119 | | - $logActionsHandlers['stable/modify'] = 'FlaggedRevsLogView::stabilityLogText'; // re-customize |
120 | | - $logActionsHandlers['stable/reset'] = 'FlaggedRevsLogView::stabilityLogText'; // reset |
121 | | - } |
122 | | - |
123 | | - /** |
124 | 8 | * Add FlaggedRevs css/js. |
125 | 9 | */ |
126 | 10 | protected static function injectStyleAndJS() { |
Index: trunk/extensions/FlaggedRevs/FlaggedRevs.php |
— | — | @@ -98,6 +98,7 @@ |
99 | 99 | $wgAutoloadClasses['PageStabilityProtectForm'] = $dir . 'business/PageStabilityForm.php'; |
100 | 100 | |
101 | 101 | # Presentation classes... |
| 102 | +$wgAutoloadClasses['FlaggedRevsUISetup'] = $dir . 'presentation/FlaggedRevsUI.setup.php'; |
102 | 103 | $wgAutoloadClasses['FlaggablePageView'] = $dir . 'presentation/FlaggablePageView.php'; |
103 | 104 | $wgAutoloadClasses['FlaggedRevsLogView'] = $dir . 'presentation/FlaggedRevsLogView.php'; |
104 | 105 | $wgAutoloadClasses['FlaggedRevsXML'] = $dir . 'presentation/FlaggedRevsXML.php'; |
— | — | @@ -119,35 +120,27 @@ |
120 | 121 | # Unreviewed pages list |
121 | 122 | $wgAutoloadClasses['UnreviewedPages'] = $specialReportDir . 'UnreviewedPages_body.php'; |
122 | 123 | $wgExtensionMessagesFiles['UnreviewedPages'] = $langDir . 'UnreviewedPages.i18n.php'; |
123 | | -$wgSpecialPageGroups['UnreviewedPages'] = 'quality'; |
124 | 124 | # Pages with pending changes list |
125 | 125 | $wgAutoloadClasses['PendingChanges'] = $specialReportDir . 'PendingChanges_body.php'; |
126 | 126 | $wgExtensionMessagesFiles['PendingChanges'] = $langDir . 'PendingChanges.i18n.php'; |
127 | | -$wgSpecialPageGroups['PendingChanges'] = 'quality'; |
128 | 127 | # Pages with tagged pending changes list |
129 | 128 | $wgAutoloadClasses['ProblemChanges'] = $specialReportDir . 'ProblemChanges_body.php'; |
130 | 129 | $wgExtensionMessagesFiles['ProblemChanges'] = $langDir . 'ProblemChanges.i18n.php'; |
131 | | -$wgSpecialPageGroups['ProblemChanges'] = 'quality'; |
132 | 130 | # Reviewed pages list |
133 | 131 | $wgAutoloadClasses['ReviewedPages'] = $specialReportDir . 'ReviewedPages_body.php'; |
134 | 132 | $wgExtensionMessagesFiles['ReviewedPages'] = $langDir . 'ReviewedPages.i18n.php'; |
135 | | -$wgSpecialPageGroups['ReviewedPages'] = 'quality'; |
136 | 133 | # Stable pages list (for protection config) |
137 | 134 | $wgAutoloadClasses['StablePages'] = $specialReportDir . 'StablePages_body.php'; |
138 | 135 | $wgExtensionMessagesFiles['StablePages'] = $langDir . 'StablePages.i18n.php'; |
139 | | -$wgSpecialPageGroups['StablePages'] = 'quality'; |
140 | 136 | # Configured pages list (non-protection config) |
141 | 137 | $wgAutoloadClasses['ConfiguredPages'] = $specialReportDir . 'ConfiguredPages_body.php'; |
142 | 138 | $wgExtensionMessagesFiles['ConfiguredPages'] = $langDir . 'ConfiguredPages.i18n.php'; |
143 | | -$wgSpecialPageGroups['ConfiguredPages'] = 'quality'; |
144 | 139 | # Filterable review log page to oversee reviews |
145 | 140 | $wgAutoloadClasses['QualityOversight'] = $specialReportDir . 'QualityOversight_body.php'; |
146 | 141 | $wgExtensionMessagesFiles['QualityOversight'] = $langDir . 'QualityOversight.i18n.php'; |
147 | | -$wgSpecialPageGroups['QualityOversight'] = 'quality'; |
148 | 142 | # Review statistics |
149 | 143 | $wgAutoloadClasses['ValidationStatistics'] = $specialReportDir . 'ValidationStatistics_body.php'; |
150 | 144 | $wgExtensionMessagesFiles['ValidationStatistics'] = $langDir . 'ValidationStatistics.i18n.php'; |
151 | | -$wgSpecialPageGroups['ValidationStatistics'] = 'quality'; |
152 | 145 | |
153 | 146 | $apiActionDir = $dir . 'api/actions/'; |
154 | 147 | # Page review module for API |
— | — | @@ -192,12 +185,15 @@ |
193 | 186 | # Add stable version log |
194 | 187 | $wgLogTypes[] = 'stable'; |
195 | 188 | |
196 | | -# Log action handlers |
197 | | -FlaggedRevsUIHooks::defineLogBasicDesc( $wgLogNames, $wgLogHeaders, $wgFilterLogTypes ); |
198 | | -FlaggedRevsUIHooks::defineLogActionHanders( $wgLogActions, $wgLogActionsHandlers ); |
| 189 | +# Log name and description as well as action handlers |
| 190 | +FlaggedRevsUISetup::defineLogBasicDescription( $wgLogNames, $wgLogHeaders, $wgFilterLogTypes ); |
| 191 | +FlaggedRevsUISetup::defineLogActionHanders( $wgLogActions, $wgLogActionsHandlers ); |
199 | 192 | |
| 193 | +# Actually register special pages |
| 194 | +FlaggedRevsUISetup::defineSpecialPages( $wgSpecialPages, $wgSpecialPageGroups ); |
| 195 | + |
200 | 196 | # JS/CSS modules and message bundles used by JS scripts |
201 | | -FlaggedRevsUIHooks::defineResourceModules( $wgResourceModules ); |
| 197 | +FlaggedRevsUISetup::defineResourceModules( $wgResourceModules ); |
202 | 198 | |
203 | 199 | # ####### EVENT-HANDLER FUNCTIONS ######### |
204 | 200 | |
— | — | @@ -304,9 +300,6 @@ |
305 | 301 | # Implicit autoreview rights group |
306 | 302 | $wgHooks['AutopromoteCondition'][] = 'FlaggedRevsHooks::checkAutoPromoteCond'; |
307 | 303 | |
308 | | -# Actually register special pages |
309 | | -$wgHooks['SpecialPage_initList'][] = 'FlaggedRevsUIHooks::defineSpecialPages'; |
310 | | - |
311 | 304 | # Stable dump hook |
312 | 305 | $wgHooks['WikiExporter::dumpStableQuery'][] = 'FlaggedRevsHooks::stableDumpQuery'; |
313 | 306 | |