Index: trunk/extensions/CentralAuth/specials/SpecialWikiSets.php |
— | — | @@ -152,7 +152,8 @@ |
153 | 153 | } |
154 | 154 | $form['centralauth-editset-type'] = $this->buildTypeSelector( 'wpType', $type ); |
155 | 155 | $form['centralauth-editset-wikis'] = Xml::textarea( 'wpWikis', $wikis ); |
156 | | - $form['centralauth-editset-reason'] = Xml::input( 'wpReason', false, $reason ); |
| 156 | + $form['centralauth-editset-restwikis'] = $this->buildRestWikiList( $set->getWikisRaw() ); |
| 157 | + $form['centralauth-editset-reason'] = Xml::input( 'wpReason', 50, $reason ); |
157 | 158 | |
158 | 159 | $wgOut->addHTML( Xml::buildForm( $form, 'centralauth-editset-submit' ) ); |
159 | 160 | |
— | — | @@ -164,6 +165,7 @@ |
165 | 166 | $form['centralauth-editset-usage'] = $usage; |
166 | 167 | $form['centralauth-editset-type'] = wfMsg( "centralauth-editset-{$type}" ); |
167 | 168 | $form['centralauth-editset-wikis'] = $this->buildWikiList( $set->getWikisRaw() ); |
| 169 | + $form['centralauth-editset-restwikis'] = $this->buildRestWikiList( $set->getWikisRaw() ); |
168 | 170 | |
169 | 171 | $wgOut->addHTML( Xml::buildForm( $form ) ); |
170 | 172 | } |
— | — | @@ -183,21 +185,67 @@ |
184 | 186 | } |
185 | 187 | |
186 | 188 | /** |
187 | | - * @param $list array |
| 189 | + * @param $list array List of wikis defined in the wiki set (either opt-in or opt-out) |
188 | 190 | * @return string |
189 | 191 | */ |
190 | 192 | function buildWikiList( $list ) { |
191 | 193 | sort( $list ); |
192 | | - $html = '<ul>'; |
193 | | - foreach ( $list as $wiki ) { |
| 194 | + |
| 195 | + $firstCol = round( count( $list ) / 2 ); |
| 196 | + $list1 = array_slice( $list, 0, $firstCol ); |
| 197 | + $list2 = array_slice( $list, $firstCol ); |
| 198 | + |
| 199 | + $html = '<table><tbody><tr style="vertical-align:top;"><td><ul>'; |
| 200 | + foreach ( $list1 as $wiki ) { |
194 | 201 | $escWiki = htmlspecialchars( $wiki ); |
195 | 202 | $html .= "<li>{$escWiki}</li>"; |
196 | 203 | } |
197 | | - $html .= '</ul>'; |
| 204 | + $html .= '</ul></td><td> </td><td><ul>'; |
| 205 | + foreach ( $list2 as $wiki ) { |
| 206 | + $escWiki = htmlspecialchars( $wiki ); |
| 207 | + $html .= "<li>{$escWiki}</li>"; |
| 208 | + } |
| 209 | + $html .= '</ul></td></tr></tbody></table>'; |
| 210 | + |
198 | 211 | return $html; |
199 | 212 | } |
200 | 213 | |
201 | 214 | /** |
| 215 | + * This list shows all databases *excluding* the defined ones |
| 216 | + * So for opt-out, it shows the databases on which the wiki set is enabled |
| 217 | + * And for opt-in, it shows the databases on which the wiki set is disabled |
| 218 | + * |
| 219 | + * @param $list array List of wikis defined in the wiki set (either opt-in or opt-out) |
| 220 | + * @return string |
| 221 | + */ |
| 222 | + function buildRestWikiList( $list ) { |
| 223 | + global $wgLocalDatabases; |
| 224 | + |
| 225 | + sort( $wgLocalDatabases ); |
| 226 | + foreach( $wgLocalDatabases as $wiki ) { |
| 227 | + if( !in_array( $wiki, $list ) ) { |
| 228 | + $restWikis[] = htmlspecialchars( $wiki ); |
| 229 | + } |
| 230 | + } |
| 231 | + |
| 232 | + if( $this->mCanEdit ) { |
| 233 | + $html = Xml::textarea( 'wpWikis', implode( "\n", $restWikis ), 40, 5, array( 'readonly' => true ) ); |
| 234 | + } else { |
| 235 | + $firstCol = round( count( $restWikis ) / 2 ); |
| 236 | + $list1 = array_slice( $restWikis, 0, $firstCol ); |
| 237 | + $list2 = array_slice( $restWikis, $firstCol ); |
| 238 | + |
| 239 | + $html = '<table><tbody><tr style="vertical-align:top;"><td><ul>' . |
| 240 | + '<li>' . implode( '</li><li>', $list2 ) . '</li>' . |
| 241 | + '</ul></td><td> </td><td><ul>' . |
| 242 | + '<li>' . implode( '</li><li>', $list2 ) . '</li>' . |
| 243 | + '</ul></td></tr></tbody></table>'; |
| 244 | + } |
| 245 | + |
| 246 | + return $html; |
| 247 | + } |
| 248 | + |
| 249 | + /** |
202 | 250 | * @param $subpage |
203 | 251 | * @return mixed |
204 | 252 | */ |
Index: trunk/extensions/CentralAuth/CentralAuth.i18n.php |
— | — | @@ -346,6 +346,7 @@ |
347 | 347 | 'centralauth-editset-name' => 'Name:', |
348 | 348 | 'centralauth-editset-type' => 'Type:', |
349 | 349 | 'centralauth-editset-wikis' => 'Wikis:', |
| 350 | + 'centralauth-editset-restwikis' => 'Wikis not included above:', |
350 | 351 | 'centralauth-editset-reason' => 'Reason:', |
351 | 352 | 'centralauth-editset-submit' => 'Submit', |
352 | 353 | 'centralauth-editset-submit-delete' => 'Delete', |
— | — | @@ -522,6 +523,8 @@ |
523 | 524 | 'centralauth-editset-subtitle' => 'Do not translate the <code>Special:WikiSets<code> part.', |
524 | 525 | 'centralauth-editset-name' => '{{Identical|Name}}', |
525 | 526 | 'centralauth-editset-type' => '{{Identical|Type}}', |
| 527 | + 'centralauth-editset-wikis' => 'List of wiki databases defined in this wiki set (either opt-in or opt-out)', |
| 528 | + 'centralauth-editset-restwikis' => 'All wiki databases *not* defined in this wiki set (either opt-in or opt-out)', |
526 | 529 | 'centralauth-editset-reason' => '{{identical|Reason}}', |
527 | 530 | 'centralauth-editset-submit' => '{{Identical|Submit}}', |
528 | 531 | 'centralauth-editset-submit-delete' => '{{Identical|Delete}}', |