Index: trunk/extensions/Translate/tag/SpecialPageTranslation.php |
— | — | @@ -158,17 +158,10 @@ |
159 | 159 | return $res; |
160 | 160 | } |
161 | 161 | |
162 | | - public function listPages() { |
163 | | - global $wgOut; |
164 | | - |
165 | | - $res = $this->loadPagesFromDB(); |
166 | | - if ( !$res->numRows() ) { |
167 | | - $wgOut->addWikiMsg( 'tpt-list-nopages' ); |
168 | | - return; |
169 | | - } |
170 | | - |
| 162 | + protected function buildPageArray( /*db result*/ $res ) { |
171 | 163 | $pages = array(); |
172 | 164 | foreach ( $res as $r ) { |
| 165 | + // We have multiple rows for same page, because of different tags |
173 | 166 | if ( !isset( $pages[$r->page_id] ) ) { |
174 | 167 | $pages[$r->page_id] = array(); |
175 | 168 | $title = Title::newFromRow( $r ); |
— | — | @@ -179,7 +172,19 @@ |
180 | 173 | $tag = RevTag::typeToTag( $r->rt_type ); |
181 | 174 | $pages[$r->page_id][$tag] = intval( $r->rt_revision ); |
182 | 175 | } |
| 176 | + return $pages; |
| 177 | + } |
183 | 178 | |
| 179 | + public function listPages() { |
| 180 | + global $wgOut; |
| 181 | + |
| 182 | + $res = $this->loadPagesFromDB(); |
| 183 | + $pages = $this->buildPageArray( $res ); |
| 184 | + if ( !count( $pages ) ) { |
| 185 | + $wgOut->addWikiMsg( 'tpt-list-nopages' ); |
| 186 | + return; |
| 187 | + } |
| 188 | + |
184 | 189 | // Pages where mark <= tag |
185 | 190 | $items = array(); |
186 | 191 | foreach ( $pages as $index => $page ) { |
— | — | @@ -196,7 +201,7 @@ |
197 | 202 | $link = "<b>$link</b>"; |
198 | 203 | } |
199 | 204 | $acts = $this->actionLinks( $page['title'], $page['tp:mark'], $page['latest'], 'old' ); |
200 | | - $items[] = "<li>$link ($acts) </li>"; |
| 205 | + $items[] = "<li>$link $acts</li>"; |
201 | 206 | unset( $pages[$index] ); |
202 | 207 | } |
203 | 208 | |
— | — | @@ -222,7 +227,7 @@ |
223 | 228 | |
224 | 229 | $link = $this->user->getSkin()->link( $page['title'] ); |
225 | 230 | $acts = $this->actionLinks( $page['title'], $page['tp:tag'], $page['latest'], 'new' ); |
226 | | - $items[] = "<li>$link ($acts) </li>"; |
| 231 | + $items[] = "<li>$link $acts</li>"; |
227 | 232 | |
228 | 233 | unset( $pages[$index] ); |
229 | 234 | } |
— | — | @@ -239,7 +244,7 @@ |
240 | 245 | foreach ( $pages as $index => $page ) { |
241 | 246 | $link = $this->user->getSkin()->link( $page['title'] ); |
242 | 247 | $acts = $this->actionLinks( $page['title'], $page['tp:tag'], $page['latest'], 'stuck' ); |
243 | | - $items[] = "<li>$link ($acts) </li>"; |
| 248 | + $items[] = "<li>$link $acts</li>"; |
244 | 249 | |
245 | 250 | unset( $pages[$index] ); |
246 | 251 | } |
— | — | @@ -261,22 +266,6 @@ |
262 | 267 | protected function actionLinks( $title, $rev, $latest, $old = 'old' ) { |
263 | 268 | $actions = array(); |
264 | 269 | |
265 | | - /* For pages that have been marked for translation at some point, |
266 | | - * but there has been new changes since then, provide a link to |
267 | | - * to view the differences between last marked version and latest |
268 | | - * version of the page. |
269 | | - */ |
270 | | - if ( $latest !== $rev && $old !== 'new' ) { |
271 | | - $actions[] = $this->user->getSkin()->link( |
272 | | - $title, |
273 | | - htmlspecialchars( wfMsg( 'tpt-rev-old', $rev ) ), |
274 | | - array(), |
275 | | - array( 'oldid' => $rev, 'diff' => $title->getLatestRevId() ) |
276 | | - ); |
277 | | - } else { |
278 | | - $actions[] = wfMsgHtml( 'tpt-rev-latest' ); |
279 | | - } |
280 | | - |
281 | 270 | if ( $this->user->isAllowed( 'pagetranslation' ) ) { |
282 | 271 | $token = $this->user->editToken(); |
283 | 272 | |
— | — | @@ -308,18 +297,12 @@ |
309 | 298 | } |
310 | 299 | } |
311 | 300 | |
312 | | - if ( $old === 'old' && $this->user->isAllowed( 'translate' ) ) { |
313 | | - $actions[] = $this->user->getSkin()->link( |
314 | | - SpecialPage::getTitleFor( 'Translate' ), |
315 | | - wfMsgHtml( 'tpt-translate-this' ), |
316 | | - array(), |
317 | | - array( 'group' => TranslatablePage::getMessageGroupIdFromTitle( $title ) ) |
318 | | - ); |
| 301 | + if ( !count( $actions ) ) { |
| 302 | + return ''; |
319 | 303 | } |
320 | | - |
321 | 304 | global $wgLang; |
322 | | - |
323 | | - return $wgLang->semicolonList( $actions ); |
| 305 | + $flattened = $wgLang->semicolonList( $actions ); |
| 306 | + return Html::rawElement( 'span', array( 'class' => 'mw-tpt-actions' ), "($flattened)" ); |
324 | 307 | } |
325 | 308 | |
326 | 309 | public function checkInput( TranslatablePage $page, &$error = false ) { |
Index: trunk/extensions/Translate/PageTranslation.i18n.php |
— | — | @@ -56,11 +56,8 @@ |
57 | 57 | but no version of {{PLURAL:$1|this page is|these pages are}} currently marked for translation.', |
58 | 58 | 'tpt-other-pages' => '{{PLURAL:$1|An old version of this page is|Older versions of these pages are}} marked for translation, |
59 | 59 | but the latest {{PLURAL:$1|version|versions}} cannot be marked for translation.', |
60 | | - 'tpt-rev-latest' => 'latest version', |
61 | | - 'tpt-rev-old' => 'difference to previous marked version', |
62 | 60 | 'tpt-rev-mark-new' => 'mark this version for translation', |
63 | 61 | 'tpt-rev-unmark' => 'remove this page from translation', |
64 | | - 'tpt-translate-this' => 'translate this page', |
65 | 62 | |
66 | 63 | # Source and translation page headers |
67 | 64 | 'translate-tag-translate-link-desc' => 'Translate this page', |