r84014 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r84013‎ | r84014 | r84015 >
Date:13:03, 15 March 2011
Author:mikaellindmark
Status:deferred
Tags:
Comment:
Stepped up to version 1. Removed since it was replaced by GroupPermissions ArticleToCategory2 and ArticleToCategory2AddCat
Modified paths:
  • /trunk/extensions/ArticleToCategory2/ArticleToCategory2.php (modified) (history)

Diff [purge]

Index: trunk/extensions/ArticleToCategory2/ArticleToCategory2.php
@@ -3,7 +3,7 @@
44 === MediaWiki Extension: Add Article to Category 2 ===
55 * @file
66 * @ingroup Extensions
7 - * @version 0.2
 7+ * @version 1.0
88 * @author Liang Chen <anything@liang-chen.com> (original code)
99 * @author Julien Devincre (exclude categories)
1010 * @author Cynthia Mattingly - Marketing Factory Consulting (i18n, adding category)
@@ -33,22 +33,26 @@
3434 echo <<<HEREDOC
3535 To install the ArticleToCategory2 extension, put the following line in LocalSettings.php:<P>
3636 require_once( "\$IP/extensions/ArticleToCategory2/ArticleToCategory2.php" );<br>
37 -\$wgarticletocategory2ConfigAddcat=false;<br>
3837 \$wgarticletocategory2ConfigBlacklist=false;<br>
 38+\$wgGroupPermissions['*']['ArticleToCategory2'] = true;<br>
 39+\$wgGroupPermissions['*']['ArticleToCategory2AddCat'] = false;<br>
 40+
3941 HEREDOC;
4042 exit( 1 );
4143 }
4244
43 -/* Set default values on configutation variables */
44 -$wgarticletocategory2ConfigAddcat=false;
 45+/** Set default values on configutation variables **/
4546 $wgarticletocategory2ConfigBlacklist=false;
46 -
 47+/* Set default 'true' for add article to category */
 48+$wgGroupPermissions['*']['ArticleToCategory2'] = true;
 49+/* Set default 'false' for add category to category */
 50+$wgGroupPermissions['*']['ArticleToCategory2AddCat'] = false;
4751
4852 $wgExtensionCredits['other'][] = array(
4953 'path' => __FILE__,
5054 'name' => 'Add Article to Category 2',
5155 'descriptionmsg' => 'articletocategory2-desc',
52 - 'version' => '0.2',
 56+ 'version' => '1.0',
5357 'author' => array(
5458 '[http://www.mediawiki.org/wiki/User:BiGreat Liang Chen \'BiGreat\'] (original code)',
5559 'Julien Devincre (exclude categories)',
@@ -132,18 +136,12 @@
133137 ******************************/
134138 function wfCategoryChange( $catpage ) {
135139 global $wgarticletocategory2ConfigBlacklist, $wgarticletocategory2ConfigAddcat,
136 - $wgOut, $wgScript, $wgContLang;
 140+ $wgOut, $wgScript, $wgContLang, $wgUser;
137141
138 - wfLoadExtensionMessages( 'ArticleToCategory2' );
139 -
140 - $boxtext = wfMsg( 'articletocategory2-create-article-under-category-text' );
141 - $btext = wfMsg( 'articletocategory2-create-article-under-category-button' );
142 - $boxtext2 = wfMsg( 'articletocategory2-create-category-under-category-text' );
143 - $btext2 = wfMsg( 'articletocategory2-create-category-under-category-button' );
144 -
145142 $action = htmlspecialchars( $wgScript );
146143 if ( !$catpage->mTitle->quickUserCan( 'edit' )
147 - || !$catpage->mTitle->quickUserCan( 'create') )
 144+ || !$catpage->mTitle->quickUserCan( 'create')
 145+ || !$wgUser->isAllowed( 'ArticleToCategory2') )
148146 {
149147 return true;
150148 }
@@ -155,6 +153,13 @@
156154 }
157155 }
158156 }
 157+ wfLoadExtensionMessages( 'ArticleToCategory2' );
 158+
 159+ $boxtext = wfMsg( 'articletocategory2-create-article-under-category-text' );
 160+ $btext = wfMsg( 'articletocategory2-create-article-under-category-button' );
 161+ $boxtext2 = wfMsg( 'articletocategory2-create-category-under-category-text' );
 162+ $btext2 = wfMsg( 'articletocategory2-create-category-under-category-button' );
 163+
159164 $cattitle = $wgContLang->getNsText( NS_CATEGORY );
160165
161166 /*** javascript blocks ***/
@@ -217,7 +222,7 @@
218223 FORMEND;
219224 /*** javascript blocks end ***/
220225 $wgOut->addHTML( $formstart );
221 - if ( $wgarticletocategory2ConfigAddcat ) {
 226+ if ( $wgUser->isAllowed( 'ArticleToCategory2AddCat' ) ) {
222227 $wgOut->addHTML( $formcategory );
223228 }
224229 $wgOut->addHTML( $formend );

Follow-up revisions

RevisionCommit summaryAuthorDate
r84023Follow-up r84014: Add descriptive messages for the new user rights. These are...raymond15:10, 15 March 2011

Status & tagging log