Index: trunk/extensions/Translate/tag/SpecialPageTranslation.php |
— | — | @@ -34,9 +34,11 @@ |
35 | 35 | |
36 | 36 | global $wgRequest, $wgOut, $wgUser; |
37 | 37 | $this->user = $wgUser; |
| 38 | + $request = $wgRequest; |
38 | 39 | |
39 | 40 | $target = $wgRequest->getText( 'target', $parameters ); |
40 | 41 | $revision = $wgRequest->getInt( 'revision', 0 ); |
| 42 | + $action = $request->getVal( 'do' ); |
41 | 43 | |
42 | 44 | // No specific page or invalid input |
43 | 45 | $title = Title::newFromText( $target ); |
— | — | @@ -69,7 +71,26 @@ |
70 | 72 | return; |
71 | 73 | } |
72 | 74 | |
73 | | - if ( $revision === -1 ) { |
| 75 | + if ( $action === 'discourage' || $action === 'encourage' ) { |
| 76 | + $id = TranslatablePage::getMessageGroupIdFromTitle( $title ); |
| 77 | + $dbw = wfGetDB( DB_MASTER ); |
| 78 | + $table = 'translate_groupreviews'; |
| 79 | + $row = array( |
| 80 | + 'tgr_group' => $id, |
| 81 | + 'tgr_lang' => '*priority', |
| 82 | + 'tgr_state' => 'discouraged', |
| 83 | + ); |
| 84 | + if ( $action === 'encourage' ) { |
| 85 | + $dbw->delete( $table, $row, __METHOD__ ); |
| 86 | + } else { |
| 87 | + $index = array( 'tgr_group', 'tgr_lang' ); |
| 88 | + $dbw->replace( $table, array( $index ), $row, __METHOD__ ); |
| 89 | + } |
| 90 | + $this->listPages(); |
| 91 | + return; |
| 92 | + } |
| 93 | + |
| 94 | + if ( $action === 'unmark' ) { |
74 | 95 | $page = TranslatablePage::newFromTitle( $title ); |
75 | 96 | $page->removeTags(); |
76 | 97 | $page->getTitle()->invalidateCache(); |
— | — | @@ -230,7 +251,7 @@ |
231 | 252 | $out->addHtml( '<ol>' ); |
232 | 253 | foreach ( $pages as $page ) { |
233 | 254 | $link = $linker->link( $page['title'] ); |
234 | | - $acts = $this->actionLinks( $page['title'], $page['tp:tag'], $page['latest'], 'new' ); |
| 255 | + $acts = $this->actionLinks( $page, 'proposed' ); |
235 | 256 | $out->addHtml( "<li>$link $acts</li>" ); |
236 | 257 | } |
237 | 258 | $out->addHtml( '</ol>' ); |
— | — | @@ -243,13 +264,11 @@ |
244 | 265 | $out->addHtml( '<ol>' ); |
245 | 266 | foreach ( $pages as $page ) { |
246 | 267 | $link = $linker->link( $page['title'] ); |
247 | | - $canUpdate = 'old'; |
248 | 268 | if ( $page['tp:mark'] !== $page['tp:tag'] ) { |
249 | 269 | $link = "<b>$link</b>"; |
250 | | - $canUpdate = 'new'; |
251 | 270 | } |
252 | 271 | |
253 | | - $acts = $this->actionLinks( $page['title'], $page['tp:tag'], $page['latest'], $canUpdate ); |
| 272 | + $acts = $this->actionLinks( $page, 'active' ); |
254 | 273 | $out->addHtml( "<li>$link $acts</li>" ); |
255 | 274 | } |
256 | 275 | $out->addHtml( '</ol>' ); |
— | — | @@ -262,7 +281,7 @@ |
263 | 282 | $out->addHtml( '<ol>' ); |
264 | 283 | foreach ( $pages as $page ) { |
265 | 284 | $link = $linker->link( $page['title'] ); |
266 | | - $acts = $this->actionLinks( $page['title'], $page['tp:tag'], $page['latest'], 'stuck' ); |
| 285 | + $acts = $this->actionLinks( $page, 'broken' ); |
267 | 286 | $out->addHtml( "<li>$link $acts</li>" ); |
268 | 287 | } |
269 | 288 | $out->addHtml( '</ol>' ); |
— | — | @@ -275,13 +294,11 @@ |
276 | 295 | $out->addHtml( '<ol>' ); |
277 | 296 | foreach ( $pages as $page ) { |
278 | 297 | $link = $linker->link( $page['title'] ); |
279 | | - $canUpdate = 'old'; |
280 | 298 | if ( $page['tp:mark'] !== $page['tp:tag'] ) { |
281 | 299 | $link = "<b>$link</b>"; |
282 | | - $canUpdate = 'new'; |
283 | 300 | } |
284 | 301 | |
285 | | - $acts = $this->actionLinks( $page['title'], $page['tp:tag'], $page['latest'], $canUpdate ); |
| 302 | + $acts = $this->actionLinks( $page, 'discouraged' ); |
286 | 303 | $out->addHtml( "<li>$link $acts</li>" ); |
287 | 304 | } |
288 | 305 | $out->addHtml( '</ol>' ); |
— | — | @@ -290,45 +307,71 @@ |
291 | 308 | } |
292 | 309 | |
293 | 310 | /** |
294 | | - * @param $title Title |
295 | | - * @param $rev |
296 | | - * @param $latest |
297 | | - * @param $old string |
| 311 | + * @param $page array |
| 312 | + * @param $type string |
298 | 313 | * @return string |
299 | 314 | */ |
300 | | - protected function actionLinks( $title, $rev, $latest, $type = 'old' ) { |
| 315 | + protected function actionLinks( array $page, $type ) { |
301 | 316 | $actions = array(); |
302 | 317 | $linker = class_exists( 'DummyLinker' ) ? new DummyLinker : new Linker; |
303 | 318 | |
| 319 | + $title = $page['title']; |
| 320 | + |
304 | 321 | if ( $this->user->isAllowed( 'pagetranslation' ) ) { |
305 | 322 | $token = $this->user->editToken(); |
306 | 323 | |
307 | | - if ( |
308 | | - ( $type === 'new' && $latest === $rev ) || |
309 | | - ( $type === 'old' && $latest !== $rev ) |
310 | | - ) { |
| 324 | + $pending = $type === 'active' && $page['latest'] !== $page['tp:mark']; |
| 325 | + if ( $type === 'proposed' || $pending ) { |
311 | 326 | $actions[] = $linker->link( |
312 | 327 | $this->getTitle(), |
313 | | - wfMsgHtml( 'tpt-rev-mark-new' ), |
| 328 | + wfMsgHtml( 'tpt-rev-mark' ), |
314 | 329 | array(), |
315 | 330 | array( |
| 331 | + 'do' => 'mark', |
316 | 332 | 'target' => $title->getPrefixedText(), |
317 | 333 | 'revision' => $title->getLatestRevId(), |
318 | 334 | 'token' => $token, |
319 | 335 | ) |
320 | 336 | ); |
321 | | - } elseif ( $type === 'stuck' ) { |
| 337 | + } elseif ( $type === 'broken' ) { |
322 | 338 | $actions[] = $linker->link( |
323 | 339 | $this->getTitle(), |
324 | 340 | wfMsgHtml( 'tpt-rev-unmark' ), |
325 | 341 | array(), |
326 | 342 | array( |
| 343 | + 'do' => 'unmark', |
327 | 344 | 'target' => $title->getPrefixedText(), |
328 | 345 | 'revision' => -1, |
329 | 346 | 'token' => $token, |
330 | 347 | ) |
331 | 348 | ); |
332 | 349 | } |
| 350 | + |
| 351 | + if ( $type === 'active' ) { |
| 352 | + $actions[] = $linker->link( |
| 353 | + $this->getTitle(), |
| 354 | + wfMsgHtml( 'tpt-rev-discourage' ), |
| 355 | + array( 'title' => wfMsg( 'tpt-rev-discourage-tooltip' ) ), |
| 356 | + array( |
| 357 | + 'do' => 'discourage', |
| 358 | + 'target' => $title->getPrefixedText(), |
| 359 | + 'revision' => -1, |
| 360 | + 'token' => $token, |
| 361 | + ) |
| 362 | + ); |
| 363 | + } elseif ( $type === 'discouraged' ) { |
| 364 | + $actions[] = $linker->link( |
| 365 | + $this->getTitle(), |
| 366 | + wfMsgHtml( 'tpt-rev-encourage' ), |
| 367 | + array( 'title' => wfMsg( 'tpt-rev-encourage-tooltip' ) ), |
| 368 | + array( |
| 369 | + 'do' => 'encourage', |
| 370 | + 'target' => $title->getPrefixedText(), |
| 371 | + 'revision' => -1, |
| 372 | + 'token' => $token, |
| 373 | + ) |
| 374 | + ); |
| 375 | + } |
333 | 376 | } |
334 | 377 | |
335 | 378 | if ( !count( $actions ) ) { |
Index: trunk/extensions/Translate/PageTranslation.i18n.php |
— | — | @@ -64,9 +64,17 @@ |
65 | 65 | but the latest {{PLURAL:$1|version|versions}} cannot be marked for translation.', |
66 | 66 | 'tpt-discouraged-pages' => '{{PLURAL:$1|This page has|These pages have}} been discouraged from further translation.', |
67 | 67 | |
68 | | - 'tpt-rev-mark-new' => 'mark this version for translation', |
69 | | - 'tpt-rev-unmark' => 'remove this page from translation', |
| 68 | + 'tpt-rev-mark' => 'mark for translation', |
| 69 | + 'tpt-rev-unmark' => 'remove from translation', |
| 70 | + 'tpt-rev-discourage' => 'discourage', |
| 71 | + 'tpt-rev-encourage' => 'restore', |
70 | 72 | |
| 73 | + 'tpt-rev-mark-tooltip' => 'Mark the latest version of this page for translation.', |
| 74 | + 'tpt-rev-unmark-tooltip' => 'Remove this page from translation.', |
| 75 | + 'tpt-rev-discourage-tooltip' => 'Discourage further translations on this page.', |
| 76 | + 'tpt-rev-encourage-tooltip' => 'Restore this page to normal translation.', |
| 77 | + |
| 78 | + |
71 | 79 | # Source and translation page headers |
72 | 80 | 'translate-tag-translate-link-desc' => 'Translate this page', |
73 | 81 | 'translate-tag-markthis' => 'Mark this page for translation', |
— | — | @@ -196,7 +204,7 @@ |
197 | 205 | * @author Umherirrender |
198 | 206 | */ |
199 | 207 | $messages['qqq'] = array( |
200 | | - 'pagetranslation' => 'Title of [[Special:PageTranslation]] and its name in [[Special:SpecialPages]].', |
| 208 | + 'pagetranslation' => 'Title of [[Special:PageTranslation]] and its name in [[Special:SpecialPages]]. [[Image:Page translation admin view.png|thumb|Admin view]]', |
201 | 209 | 'right-pagetranslation' => '{{doc-right|pagetranslation}}', |
202 | 210 | 'tpt-desc' => '{{desc}}', |
203 | 211 | 'tpt-sections-oldnew' => '"New and existing" refers to the sum of: (a) new translation units in a translatable page, plus (b) the already existing ones from previous version of a translatable page.', |
— | — | @@ -204,14 +212,14 @@ |
205 | 213 | $2 is a count of sections which can be used with PLURAL, |
206 | 214 | $3 is an URL.', |
207 | 215 | 'tpt-mark-summary' => 'This message is used as an edit summary.', |
208 | | - 'tpt-new-pages-title' => 'Header in [[Special:PageTranslation]]', |
209 | | - 'tpt-old-pages-title' => 'Header in [[Special:PageTranslation]]', |
210 | | - 'tpt-other-pages-title' => 'Header in [[Special:PageTranslation]]', |
211 | | - 'tpt-discouraged-pages-title' => 'Header in [[Special:PageTranslation]]', |
212 | | - 'tpt-new-pages' => '$1 is the number of pages in the following list.', |
213 | | - 'tpt-old-pages' => 'The words "some version" refer to "one version of the page", or "a single version of each of the pages", respectively. Each page can have either one or none of its versions marked for translaton. $1 is the number of pages', |
214 | | - 'tpt-other-pages' => '$1 is the number of pages in the following list.', |
215 | | - 'tpt-discouraged-pages' => '$1 is the number of pages in the following list.', |
| 216 | + 'tpt-new-pages-title' => 'Header in [[Special:PageTranslation]] [[Image:Page translation admin view.png|thumb|Admin view]]', |
| 217 | + 'tpt-old-pages-title' => 'Header in [[Special:PageTranslation]] [[Image:Page translation admin view.png|thumb|Admin view]]', |
| 218 | + 'tpt-other-pages-title' => 'Header in [[Special:PageTranslation]] [[Image:Page translation admin view.png|thumb|Admin view]]', |
| 219 | + 'tpt-discouraged-pages-title' => 'Header in [[Special:PageTranslation]] [[Image:Page translation admin view.png|thumb|Admin view]]', |
| 220 | + 'tpt-new-pages' => '$1 is the number of pages in the following list. [[Image:Page translation admin view.png|thumb|Admin view]]', |
| 221 | + 'tpt-old-pages' => 'The words "some version" refer to "one version of the page", or "a single version of each of the pages", respectively. Each page can have either one or none of its versions marked for translaton. $1 is the number of pages [[Image:Page translation admin view.png|thumb|Admin view]]', |
| 222 | + 'tpt-other-pages' => '$1 is the number of pages in the following list. [[Image:Page translation admin view.png|thumb|Admin view]]', |
| 223 | + 'tpt-discouraged-pages' => '$1 is the number of pages in the following list. [[Image:Page translation admin view.png|thumb|Admin view]]', |
216 | 224 | 'translate-tag-markthisagain' => '"has changes" is to be understood as "has been altered/edited"', |
217 | 225 | 'translate-tag-hasnew' => '"has changes" is to be understood as "has been altered/edited"', |
218 | 226 | 'tpt-languages-legend' => 'The caption of a language selector displayed using <code><languages /></code>, e.g. on [[Project list]].', |
— | — | @@ -233,6 +241,16 @@ |
234 | 242 | 'pt-deletepage-action-check' => 'This is a button label. "List" is an imperative verb.', |
235 | 243 | 'pt-deletepage-current' => '{{Identical|Page name}}', |
236 | 244 | 'pt-deletepage-reason' => '{{Identical|Reason}}', |
| 245 | + |
| 246 | + 'tpt-rev-mark' => 'Possible page action and link text in [[Special:PageTranslation]]. In parenthesis after page name. [[Image:Page translation admin view.png|thumb|Admin view]]', |
| 247 | + 'tpt-rev-unmark' => 'Possible page action and link text in [[Special:PageTranslation]]. In parenthesis after page name. [[Image:Page translation admin view.png|thumb|Admin view]]', |
| 248 | + 'tpt-rev-discourage' => 'Possible page action and link text in [[Special:PageTranslation]]. In parenthesis after page name. [[Image:Page translation admin view.png|thumb|Admin view]]', |
| 249 | + 'tpt-rev-encourage' => 'Possible page action and link text in [[Special:PageTranslation]]. In parenthesis after page name. [[Image:Page translation admin view.png|thumb|Admin view]]', |
| 250 | + |
| 251 | + 'tpt-rev-mark-tooltip' => 'Tooltip for page action link text in [[Special:PageTranslation]] [[Image:Page translation admin view.png|thumb|Admin view]]', |
| 252 | + 'tpt-rev-unmark-tooltip' => 'Tooltip for page action link text in [[Special:PageTranslation]] [[Image:Page translation admin view.png|thumb|Admin view]]', |
| 253 | + 'tpt-rev-discourage-tooltip' => 'Tooltip for page action link text in [[Special:PageTranslation]] [[Image:Page translation admin view.png|thumb|Admin view]]', |
| 254 | + 'tpt-rev-encourage-tooltip' => 'Tooltip for page action link text in [[Special:PageTranslation]] [[Image:Page translation admin view.png|thumb|Admin view]]', |
237 | 255 | ); |
238 | 256 | |
239 | 257 | /** ꢱꣃꢬꢵꢯ꣄ꢡ꣄ꢬꢵ (ꢱꣃꢬꢵꢯ꣄ꢡ꣄ꢬꢵ) |