Index: trunk/extensions/WikimediaIncubator/ListUsersTestWiki.php |
— | — | @@ -5,21 +5,27 @@ |
6 | 6 | */ |
7 | 7 | class ListUsersTestWiki { |
8 | 8 | /** |
9 | | - * Get the &testwiki=wx/xyz parameter and validate it |
10 | | - * @return Array |
| 9 | + * If the &testwiki= parameter matches the project site (Incubator), return that |
| 10 | + * @return Array or null |
11 | 11 | */ |
12 | | - static function getTestWiki() { |
13 | | - global $wgRequest; |
14 | | - return IncubatorTest::analyzePrefix( $wgRequest->getVal( 'testwiki' ), true ); |
| 12 | + static function getProjectInput() { |
| 13 | + global $wmincProjectSite, $wgRequest; |
| 14 | + $input = strtolower( $wgRequest->getVal( 'testwiki' ) ); |
| 15 | + if( $input == strtolower( $wmincProjectSite['name'] ) || $input == strtolower( $wmincProjectSite['short'] ) ) { |
| 16 | + return $wmincProjectSite; |
| 17 | + } |
| 18 | + return; |
15 | 19 | } |
16 | 20 | |
17 | 21 | /** |
18 | 22 | * Input form |
19 | 23 | */ |
20 | 24 | static function onSpecialListusersHeaderForm( $pager, &$out ) { |
21 | | - $testwiki = self::getTestWiki(); |
| 25 | + $testwiki = IncubatorTest::getUrlParam(); |
| 26 | + $project = self::getProjectInput(); |
| 27 | + $input = $project ? $project['name'] : ( $testwiki ? $testwiki['prefix'] : null ); |
22 | 28 | $out .= Xml::label( wfMsg( 'wminc-testwiki' ), 'testwiki' ) . ' ' . |
23 | | - Xml::input( 'testwiki', 20, ( $testwiki['error'] ? null : $testwiki['prefix'] ), array( 'id' => 'testwiki' ) ) . '<br />'; |
| 29 | + Xml::input( 'testwiki', 20, $input, array( 'id' => 'testwiki' ) ) . '<br />'; |
24 | 30 | return true; |
25 | 31 | } |
26 | 32 | |
— | — | @@ -27,9 +33,11 @@ |
28 | 34 | * Show a message that you are viewing a list of users of a certain test wiki |
29 | 35 | */ |
30 | 36 | static function onSpecialListusersHeader( $pager, &$out ) { |
31 | | - $testwiki = self::getTestWiki(); |
32 | | - if( !$testwiki['error'] ) { |
33 | | - $out .= wfMsgWikiHtml( 'wminc-listusers-testwiki', $testwiki['prefix'] ); |
| 37 | + if( $project = self::getProjectInput() ) { |
| 38 | + $out .= wfMsgWikiHtml( 'wminc-listusers-testwiki', '"' . $project['name'] . '"' ); |
| 39 | + } elseif( $testwiki = IncubatorTest::getUrlParam() ) { |
| 40 | + $link = Linker::linkKnown( Title::newFromText( $testwiki['prefix'] ) ); |
| 41 | + $out .= wfMsgWikiHtml( 'wminc-listusers-testwiki', $link ); |
34 | 42 | } |
35 | 43 | return true; |
36 | 44 | } |
— | — | @@ -38,21 +46,25 @@ |
39 | 47 | * Query |
40 | 48 | */ |
41 | 49 | static function onSpecialListusersQueryInfo( $pager, &$query ) { |
42 | | - $testwiki = self::getTestWiki(); |
43 | | - if( !$testwiki['error'] ) { |
44 | | - global $wmincPref; |
45 | | - $dbr = wfGetDB( DB_SLAVE ); |
46 | | - $projectPrefName = $dbr->addQuotes( "$wmincPref-project" ); |
47 | | - $projectPrefVal = $dbr->addQuotes( $testwiki['project'] ); |
48 | | - $langPrefName = $dbr->addQuotes( "$wmincPref-code" ); |
49 | | - $langPrefVal = $dbr->addQuotes( $testwiki['lang'] ); |
50 | | - $query['tables']['p1'] = 'user_properties'; |
51 | | - $query['tables']['p2'] = 'user_properties'; |
52 | | - $query['join_conds']['p1'] = array( 'JOIN', |
53 | | - "user_id=p1.up_user AND (p1.up_property=$projectPrefName AND p1.up_value=$projectPrefVal)" ); |
54 | | - $query['join_conds']['p2'] = array( 'JOIN', |
55 | | - "user_id=p2.up_user AND (p2.up_property=$langPrefName AND p2.up_value=$langPrefVal)" ); |
| 50 | + $testwiki = IncubatorTest::getUrlParam(); |
| 51 | + $project = self::getProjectInput(); |
| 52 | + if( !$project && !$testwiki ) { |
| 53 | + return true; # no input or invalid input |
56 | 54 | } |
| 55 | + global $wmincPref; |
| 56 | + $query['tables']['p1'] = 'user_properties'; |
| 57 | + $query['join_conds']['p1'] = array( 'JOIN', array( 'user_id=p1.up_user', |
| 58 | + 'p1.up_property' => "$wmincPref-project", |
| 59 | + 'p1.up_value' => $project ? $project['short'] : $testwiki['project'] |
| 60 | + ) ); |
| 61 | + if( $project ) { |
| 62 | + return true; # project site doesn't need language code = returning |
| 63 | + } |
| 64 | + $query['tables']['p2'] = 'user_properties'; |
| 65 | + $query['join_conds']['p2'] = array( 'JOIN', array( 'user_id=p2.up_user', |
| 66 | + 'p2.up_property' => "$wmincPref-code", |
| 67 | + 'p2.up_value' => $testwiki['lang'] |
| 68 | + ) ); |
57 | 69 | return true; |
58 | 70 | } |
59 | 71 | } |
Index: trunk/extensions/WikimediaIncubator/WikimediaIncubator.i18n.php |
— | — | @@ -45,7 +45,7 @@ |
46 | 46 | 'wminc-ip' => '"$1" is an IP address.', |
47 | 47 | |
48 | 48 | # User groups |
49 | | - 'right-viewuserlang' => 'View [[Special:ViewUserLang|user language and test wiki]]', |
| 49 | + 'right-viewuserlang' => 'View user language and test wiki', |
50 | 50 | 'group-test-sysop' => 'Test wiki administrators', |
51 | 51 | 'group-test-sysop-member' => 'test wiki administrator', |
52 | 52 | 'grouppage-test-sysop' => 'Project:Test wiki administrators', |
— | — | @@ -56,7 +56,7 @@ |
57 | 57 | 'wminc-code-retired' => 'This language code has been changed and no longer refers to the original language.', |
58 | 58 | |
59 | 59 | # Special:ListUsers |
60 | | - 'wminc-listusers-testwiki' => 'You are viewing users who have set their test wiki preference to [[$1]].', |
| 60 | + 'wminc-listusers-testwiki' => 'You are viewing users who have set their test wiki preference to $1.', |
61 | 61 | ); |
62 | 62 | |
63 | 63 | /** Message documentation (Message documentation) |
Index: trunk/extensions/WikimediaIncubator/InfoPage.css |
— | — | @@ -50,6 +50,6 @@ |
51 | 51 | #ca-nstab-main a { |
52 | 52 | color: black; |
53 | 53 | } |
54 | | -.subpages { |
55 | | - display: none; |
| 54 | +span.subpages { |
| 55 | + display: none !important; |
56 | 56 | } |
\ No newline at end of file |