Index: trunk/extensions/Deployment/specials/SpecialExtensions.php |
— | — | @@ -34,8 +34,10 @@ |
35 | 35 | 'http://svn.wikimedia.org/svnroot/mediawiki' => 'http://svn.wikimedia.org/viewvc/mediawiki', |
36 | 36 | # Doesn't work at the time of writing but maybe some day: |
37 | 37 | 'https://svn.wikimedia.org/viewvc/mediawiki' => 'http://svn.wikimedia.org/viewvc/mediawiki', |
38 | | - ); |
| 38 | + ); |
39 | 39 | |
| 40 | + protected $typeFilter; |
| 41 | + |
40 | 42 | /** |
41 | 43 | * Constructor. |
42 | 44 | */ |
— | — | @@ -52,6 +54,8 @@ |
53 | 55 | */ |
54 | 56 | public function execute( $arg ) { |
55 | 57 | global $wgOut, $wgUser; |
| 58 | + |
| 59 | + $this->typeFilter = is_null( $arg ) ? 'all' : $arg; |
56 | 60 | |
57 | 61 | $wgOut->setPageTitle( wfMsg( 'extensions-title' ) ); |
58 | 62 | |
— | — | @@ -105,22 +109,55 @@ |
106 | 110 | $extensionAmount = 0; |
107 | 111 | $filterSegments = array(); |
108 | 112 | |
109 | | - // TODO: links |
| 113 | + $extensionTypes = SpecialVersion::getExtensionTypes(); |
110 | 114 | |
111 | | - foreach ( $wgExtensionCredits as $type => $extensions ) { |
112 | | - $amount = count( $extensions ); |
113 | | - $name = SpecialVersion::getExtensionTypeName( $type ); |
| 115 | + foreach ( $extensionTypes as $type => $message ) { |
| 116 | + if ( !array_key_exists( $type, $wgExtensionCredits ) ) { |
| 117 | + continue; |
| 118 | + } |
114 | 119 | |
115 | | - $filterSegments[] = "$name ($amount)"; |
116 | | - $extensionAmount += $amount; |
| 120 | + $amount = count( $wgExtensionCredits[$type] ); |
| 121 | + |
| 122 | + if ( $amount > 0 ) { |
| 123 | + $filterSegments[] = $this->getTypeLink( $type, $message, $amount ); |
| 124 | + $extensionAmount += $amount; |
| 125 | + } |
117 | 126 | } |
118 | 127 | |
119 | | - $filterSegments = array_merge( array( "All ($extensionAmount)" ), $filterSegments ); |
| 128 | + $all = array( $this->getTypeLink( 'all', wfMsg( 'extension-type-all' ), $extensionAmount ) ); |
120 | 129 | |
121 | | - $wgOut->addHTML( implode( ' | ', $filterSegments ) ); |
| 130 | + $wgOut->addHTML( implode( ' | ', array_merge( $all, $filterSegments ) ) ); |
122 | 131 | } |
123 | 132 | |
124 | 133 | /** |
| 134 | + * Builds and returns the HTML for a single item in the filter control. |
| 135 | + * |
| 136 | + * @since 0.1 |
| 137 | + * |
| 138 | + * @param $type String |
| 139 | + * @param $message String |
| 140 | + * @param $amount Integer |
| 141 | + * |
| 142 | + * @return string |
| 143 | + */ |
| 144 | + protected function getTypeLink( $type, $message, $amount ) { |
| 145 | + if ( $this->typeFilter == $type ) { |
| 146 | + $name = Html::element( 'b', array(), $message ); |
| 147 | + } |
| 148 | + else { |
| 149 | + $name = Html::element( |
| 150 | + 'a', |
| 151 | + array( |
| 152 | + 'href' => self::getTitle( $type )->getFullURL() |
| 153 | + ), |
| 154 | + $message |
| 155 | + ); |
| 156 | + } |
| 157 | + |
| 158 | + return "$name ($amount)"; |
| 159 | + } |
| 160 | + |
| 161 | + /** |
125 | 162 | * Creates and outputs the bilk actions control. |
126 | 163 | * |
127 | 164 | * @since 0.1 |
Index: trunk/extensions/Deployment/Deployment.i18n.php |
— | — | @@ -35,6 +35,7 @@ |
36 | 36 | |
37 | 37 | // Special:Extensions |
38 | 38 | 'add-new-extensions' => 'Add new', |
| 39 | + 'extension-type-all' => 'All', |
39 | 40 | |
40 | 41 | // Special:Update |
41 | 42 | 'mediawiki-up-to-date' => 'You have the latest version of MediaWiki.', |