Property changes on: branches/wmf-deployment/extensions/LiquidThreads_alpha/i18n/Lqt.i18n.php |
___________________________________________________________________ |
Deleted: svn:mergeinfo |
1 | 1 | Reverse-merged /trunk/extensions/LiquidThreads/i18n/Lqt.i18n.php:r57390,58990-59196,59198-59218,59221-59351,59353,59356-59424 |
Index: branches/wmf-deployment/extensions/LiquidThreads_alpha/lqt.css |
— | — | @@ -1,11 +1,3 @@ |
2 | | - |
3 | | -#wpTextbox1 { |
4 | | - /* Textareas in lqt use auto-sizing based on these properties */ |
5 | | - height: 7.5em; |
6 | | - max-height: 30em; |
7 | | - min-height: 7.5em; |
8 | | -} |
9 | | - |
10 | 2 | .lqt_watchlist_messages_notice { |
11 | 3 | background-color: #eee; |
12 | 4 | border: 1px solid #ddd; |
— | — | @@ -312,7 +304,6 @@ |
313 | 305 | } |
314 | 306 | |
315 | 307 | div.lqt-post-sep { |
316 | | - height: 1px; |
317 | 308 | padding: 0; |
318 | 309 | margin: 0; |
319 | 310 | margin-left: 1em; |
— | — | @@ -321,6 +312,7 @@ |
322 | 313 | background-position: bottom; |
323 | 314 | background-repeat: repeat-x; |
324 | 315 | clear: both; |
| 316 | + line-height: 1em; |
325 | 317 | } |
326 | 318 | |
327 | 319 | .lqt-thread-first > .lqt-post-wrapper { |
Index: branches/wmf-deployment/extensions/LiquidThreads_alpha/LiquidThreads.php |
— | — | @@ -47,6 +47,8 @@ |
48 | 48 | // Hooks |
49 | 49 | // Main dispatch hook |
50 | 50 | $wgHooks['MediaWikiPerformAction'][] = 'LqtDispatch::tryPage'; |
| 51 | +$wgHooks['SkinTemplateTabs'][] = 'LqtDispatch::onSkinTemplateTabs'; |
| 52 | +$wgHooks['SkinTemplateNavigation'][] = 'LqtDispatch::onSkinTemplateNavigation'; |
51 | 53 | |
52 | 54 | // Customisation of recentchanges |
53 | 55 | //$wgHooks['OldChangesListRecentChangesLine'][] = 'LqtHooks::customizeOldChangesList'; |
Index: branches/wmf-deployment/extensions/LiquidThreads_alpha/classes/Threads.php |
— | — | @@ -51,11 +51,6 @@ |
52 | 52 | static $cache_by_id = array(); |
53 | 53 | static $occupied_titles = array(); |
54 | 54 | |
55 | | - static function newThread( $root, $article, $superthread = null, |
56 | | - $type = self::TYPE_NORMAL, $subject = '' ) { |
57 | | - return Thread::create( $root, $article, $superthread, $type, $subject ); |
58 | | - } |
59 | | - |
60 | 55 | /** |
61 | 56 | * Create the talkpage if it doesn't exist so that links to it |
62 | 57 | * will show up blue instead of red. For use upon new thread creation. |
— | — | @@ -196,7 +191,7 @@ |
197 | 192 | static function newReplyTitle( $thread, $user ) { |
198 | 193 | $topThread = $thread->topmostThread(); |
199 | 194 | |
200 | | - $base = $topThread->title()->getText() . '/' . $user->getName(); |
| 195 | + $base = $topThread->title()->getText() . '/reply'; |
201 | 196 | |
202 | 197 | return self::incrementedTitle( $base, NS_LQT_THREAD ); |
203 | 198 | } |
Index: branches/wmf-deployment/extensions/LiquidThreads_alpha/classes/View.php |
— | — | @@ -419,13 +419,30 @@ |
420 | 420 | wfMsgExt( $msg, 'parse' ) ); |
421 | 421 | } |
422 | 422 | |
| 423 | + global $wgRequest; |
423 | 424 | // Quietly force a preview if no subject has been specified. |
424 | 425 | if ( ( !$valid_subject && $subject ) || ( $subject_expected && !$subject ) ) { |
425 | 426 | // Dirty hack to prevent saving from going ahead |
426 | | - global $wgRequest; |
427 | 427 | $wgRequest->setVal( 'wpPreview', true ); |
428 | 428 | } |
429 | 429 | |
| 430 | + // For new posts and replies, remove the summary field and use a boilerplate |
| 431 | + // default. |
| 432 | + if ( $edit_type == 'new' ) { |
| 433 | + $e->mShowSummaryField = false; |
| 434 | + |
| 435 | + $summary = wfMsgForContent( 'lqt-newpost-summary', $subject ); |
| 436 | + $wgRequest->setVal( 'wpSummary', $summary ); |
| 437 | + } elseif ( $edit_type == 'reply' ) { |
| 438 | + $e->mShowSummaryField = false; |
| 439 | + |
| 440 | + $reply_subject = $edit_applies_to->subject(); |
| 441 | + $reply_title = $edit_applies_to->title()->getPrefixedText(); |
| 442 | + $summary = wfMsgForContent( 'lqt-reply-summary', |
| 443 | + $reply_subject, $reply_title ); |
| 444 | + $wgRequest->setVal( 'wpSummary', $summary ); |
| 445 | + } |
| 446 | + |
430 | 447 | // Add an offset so it works if it's on the wrong page. |
431 | 448 | if ( $edit_applies_to ) { |
432 | 449 | $dbr = wfGetDB( DB_SLAVE ); |
— | — | @@ -493,10 +510,12 @@ |
494 | 511 | // $this->renameThread( $thread, $subject, $e->summary ); |
495 | 512 | } |
496 | 513 | |
| 514 | + $bump = $this->request->getBool( 'wpBumpThread' ); |
| 515 | + |
497 | 516 | $thread = self::postEditUpdates( |
498 | 517 | $edit_type, $edit_applies_to, $article, |
499 | 518 | $this->article, $subject, $e->summary, $thread, |
500 | | - $e->textbox1 |
| 519 | + $e->textbox1, $bump |
501 | 520 | ); |
502 | 521 | |
503 | 522 | if ( $submitted_nonce && $nonce_key ) { |
— | — | @@ -520,22 +539,25 @@ |
521 | 540 | } |
522 | 541 | |
523 | 542 | static function postEditUpdates( $edit_type, $edit_applies_to, $edit_page, $article, |
524 | | - $subject, $edit_summary, $thread, $new_text ) { |
| 543 | + $subject, $edit_summary, $thread, $new_text, |
| 544 | + $bump = null ) { |
525 | 545 | // Update metadata - create and update thread and thread revision objects as |
526 | 546 | // appropriate. |
527 | 547 | |
528 | 548 | if ( $edit_type == 'reply' ) { |
529 | 549 | $subject = $edit_applies_to->subject(); |
530 | 550 | |
531 | | - $thread = Threads::newThread( $edit_page, $article, $edit_applies_to, |
532 | | - Threads::TYPE_NORMAL, $subject ); |
| 551 | + $thread = Thread::create( $edit_page, $article, $edit_applies_to, |
| 552 | + Threads::TYPE_NORMAL, $subject, |
| 553 | + $edit_summary, $bump ); |
533 | 554 | |
534 | 555 | global $wgUser; |
535 | 556 | NewMessages::markThreadAsReadByUser( $edit_applies_to, $wgUser ); |
536 | 557 | } elseif ( $edit_type == 'summarize' ) { |
537 | 558 | $edit_applies_to->setSummary( $edit_page ); |
538 | 559 | $edit_applies_to->commitRevision( Threads::CHANGE_EDITED_SUMMARY, |
539 | | - $edit_applies_to, $edit_summary ); |
| 560 | + $edit_applies_to, $edit_summary, |
| 561 | + $bump); |
540 | 562 | } elseif ( $edit_type == 'editExisting' ) { |
541 | 563 | // Use a separate type if the content is blanked. |
542 | 564 | $type = strlen( trim( $new_text ) ) |
— | — | @@ -543,10 +565,11 @@ |
544 | 566 | : Threads::CHANGE_ROOT_BLANKED; |
545 | 567 | |
546 | 568 | // Add the history entry. |
547 | | - $thread->commitRevision( $type, $thread, $edit_summary ); |
| 569 | + $thread->commitRevision( $type, $thread, $edit_summary, $bump ); |
548 | 570 | } else { |
549 | | - $thread = Threads::newThread( $edit_page, $article, null, |
550 | | - Threads::TYPE_NORMAL, $subject ); |
| 571 | + $thread = Thread::create( $edit_page, $article, null, |
| 572 | + Threads::TYPE_NORMAL, $subject, |
| 573 | + $edit_summary ); |
551 | 574 | } |
552 | 575 | |
553 | 576 | return $thread; |
— | — | @@ -1279,7 +1302,7 @@ |
1280 | 1303 | $repliesClass = 'lqt-thread-replies lqt-thread-replies-' . |
1281 | 1304 | $this->threadNestingLevel; |
1282 | 1305 | $div = Xml::openElement( 'div', array( 'class' => $repliesClass ) ); |
1283 | | - $this->output->addHTML( $div ); |
| 1306 | + $sep = Xml::tags( 'div', array( 'class' => 'lqt-post-sep' ), ' ' ); |
1284 | 1307 | |
1285 | 1308 | $subthreadCount = count( $thread->subthreads() ); |
1286 | 1309 | $i = 0; |
— | — | @@ -1303,7 +1326,7 @@ |
1304 | 1327 | // We've shown too many threads. |
1305 | 1328 | $link = $this->getShowMore( $thread, $st, $i ); |
1306 | 1329 | |
1307 | | - $this->output->addHTML( $link ); |
| 1330 | + $this->output->addHTML( $div.$link ); |
1308 | 1331 | $showThreads = false; |
1309 | 1332 | continue; |
1310 | 1333 | } |
— | — | @@ -1312,10 +1335,7 @@ |
1313 | 1336 | if ( $showCount == 1 ) { |
1314 | 1337 | // There's a post sep before each reply group to |
1315 | 1338 | // separate from the parent thread. |
1316 | | - $this->output->addHTML( |
1317 | | - Xml::tags( 'div', |
1318 | | - array( 'class' => 'lqt-post-sep' ), |
1319 | | - ' ' ) ); |
| 1339 | + $this->output->addHTML( $sep.$div ); |
1320 | 1340 | } |
1321 | 1341 | |
1322 | 1342 | $this->showThread( $st, $i, $subthreadCount, $cascadeOptions ); |
— | — | @@ -1583,4 +1603,16 @@ |
1584 | 1604 | |
1585 | 1605 | return $sig; |
1586 | 1606 | } |
| 1607 | + |
| 1608 | + function customizeTabs( $skin, &$links ) { |
| 1609 | + // No-op |
| 1610 | + } |
| 1611 | + |
| 1612 | + function customizeNavigation( $skin, &$links ) { |
| 1613 | + // No-op |
| 1614 | + } |
| 1615 | + |
| 1616 | + function show() { |
| 1617 | + return true; // No-op |
| 1618 | + } |
1587 | 1619 | } |
Index: branches/wmf-deployment/extensions/LiquidThreads_alpha/classes/Dispatch.php |
— | — | @@ -3,6 +3,7 @@ |
4 | 4 | class LqtDispatch { |
5 | 5 | /** static cache of per-page LiquidThreads activation setting */ |
6 | 6 | static $userLqtOverride; |
| 7 | + static $primaryView = null; |
7 | 8 | |
8 | 9 | static function talkpageMain( &$output, &$article, &$title, &$user, &$request ) { |
9 | 10 | // We are given a talkpage article and title. Fire up a TalkpageView |
— | — | @@ -48,7 +49,9 @@ |
49 | 50 | } else { |
50 | 51 | $viewname = 'TalkpageView'; |
51 | 52 | } |
| 53 | + |
52 | 54 | $view = new $viewname( $output, $article, $title, $user, $request ); |
| 55 | + self::$primaryView = $view; |
53 | 56 | return $view->show(); |
54 | 57 | } |
55 | 58 | |
— | — | @@ -79,12 +82,14 @@ |
80 | 83 | } |
81 | 84 | |
82 | 85 | $view = new $viewname( $output, $article, $title, $user, $request ); |
| 86 | + self::$primaryView = $view; |
83 | 87 | return $view->show(); |
84 | 88 | } |
85 | 89 | |
86 | 90 | static function threadSummaryMain( &$output, &$article, &$title, &$user, &$request ) { |
87 | 91 | $viewname = 'SummaryPageView'; |
88 | 92 | $view = new $viewname( $output, $article, $title, $user, $request ); |
| 93 | + self::$primaryView = $view; |
89 | 94 | return $view->show(); |
90 | 95 | } |
91 | 96 | |
— | — | @@ -167,4 +172,20 @@ |
168 | 173 | } |
169 | 174 | return true; |
170 | 175 | } |
| 176 | + |
| 177 | + static function onSkinTemplateNavigation( $skinTemplate, &$links ) { |
| 178 | + if ( !self::$primaryView ) return true; |
| 179 | + |
| 180 | + self::$primaryView->customizeNavigation( $skinTemplate, $links ); |
| 181 | + |
| 182 | + return true; |
| 183 | + } |
| 184 | + |
| 185 | + static function onSkinTemplateTabs( $skinTemplate, &$links ) { |
| 186 | + if ( !self::$primaryView ) return true; |
| 187 | + |
| 188 | + self::$primaryView->customizeTabs( $skinTemplate, $links ); |
| 189 | + |
| 190 | + return true; |
| 191 | + } |
171 | 192 | } |
Index: branches/wmf-deployment/extensions/LiquidThreads_alpha/classes/Hooks.php |
— | — | @@ -283,6 +283,7 @@ |
284 | 284 | } |
285 | 285 | |
286 | 286 | static function editCheckboxes( $editPage, &$checkboxes, &$tabIndex ) { |
| 287 | + global $wgRequest; |
287 | 288 | $article = $editPage->getArticle(); |
288 | 289 | $title = $article->getTitle(); |
289 | 290 | |
— | — | @@ -290,6 +291,25 @@ |
291 | 292 | unset( $checkboxes['minor'] ); |
292 | 293 | } |
293 | 294 | |
| 295 | + if ( $title->getNamespace() == NS_LQT_THREAD && self::$editType != 'new' ) { |
| 296 | + wfLoadExtensionMessages( 'LiquidThreads' ); |
| 297 | + $label = wfMsgExt( 'lqt-edit-bump', 'parseinline' ); |
| 298 | + $tooltip = wfMsgExt( 'lqt-edit-bump-tooltip', 'parsemag' ); |
| 299 | + |
| 300 | + $checked = ! $wgRequest->wasPosted() || |
| 301 | + $wgRequest->getBool( 'wpBumpThread' ); |
| 302 | + |
| 303 | + $html = |
| 304 | + Xml::check( 'wpBumpThread', $checked, array( |
| 305 | + 'title' => $tooltip, 'id' => 'wpBumpThread' |
| 306 | + ) ); |
| 307 | + |
| 308 | + $html .= Xml::tags( 'label', array( 'for' => 'wpBumpThread', |
| 309 | + 'title' => $tooltip ), $label ); |
| 310 | + |
| 311 | + $checkboxes['bump'] = $html; |
| 312 | + } |
| 313 | + |
294 | 314 | return true; |
295 | 315 | } |
296 | 316 | |
Index: branches/wmf-deployment/extensions/LiquidThreads_alpha/classes/Thread.php |
— | — | @@ -55,7 +55,8 @@ |
56 | 56 | } |
57 | 57 | |
58 | 58 | static function create( $root, $article, $superthread = null, |
59 | | - $type = Threads::TYPE_NORMAL, $subject = '' ) { |
| 59 | + $type = Threads::TYPE_NORMAL, $subject = '', |
| 60 | + $summary = '', $bump = null ) { |
60 | 61 | |
61 | 62 | $dbw = wfGetDB( DB_MASTER ); |
62 | 63 | |
— | — | @@ -91,7 +92,7 @@ |
92 | 93 | if ( $superthread ) { |
93 | 94 | $superthread->addReply( $thread ); |
94 | 95 | |
95 | | - $superthread->commitRevision( $change_type, $thread ); |
| 96 | + $superthread->commitRevision( $change_type, $thread, $summary, $bump ); |
96 | 97 | } else { |
97 | 98 | $hthread = ThreadRevision::create( $thread, $change_type ); |
98 | 99 | } |
Index: branches/wmf-deployment/extensions/LiquidThreads_alpha/pages/ThreadWatchView.php |
— | — | @@ -3,9 +3,4 @@ |
4 | 4 | if ( !defined( 'MEDIAWIKI' ) ) die; |
5 | 5 | |
6 | 6 | class ThreadWatchView extends ThreadPermalinkView { |
7 | | - function show() { |
8 | | - global $wgHooks; |
9 | | - $wgHooks['SkinTemplateTabs'][] = array( $this, 'customizeTabs' ); |
10 | | - return true; |
11 | | - } |
12 | 7 | } |
Index: branches/wmf-deployment/extensions/LiquidThreads_alpha/pages/ThreadDiffView.php |
— | — | @@ -3,20 +3,22 @@ |
4 | 4 | if ( !defined( 'MEDIAWIKI' ) ) die; |
5 | 5 | |
6 | 6 | class ThreadDiffView { |
7 | | - function customizeTabs( $skintemplate, $content_actions ) { |
| 7 | + function customizeTabs( $skintemplate, &$content_actions ) { |
8 | 8 | unset( $content_actions['edit'] ); |
9 | 9 | unset( $content_actions['viewsource'] ); |
10 | 10 | unset( $content_actions['talk'] ); |
11 | 11 | |
12 | | - $content_actions['talk']['class'] = false; |
13 | 12 | $content_actions['history']['class'] = 'selected'; |
14 | | - |
15 | | - return true; |
16 | 13 | } |
| 14 | + |
| 15 | + function customizeNavigation( $skin, &$links ) { |
| 16 | + $remove = array( 'views/edit', 'views/viewsource' ); |
17 | 17 | |
18 | | - function show() { |
19 | | - global $wgHooks; |
20 | | - $wgHooks['SkinTemplateTabs'][] = array( $this, 'customizeTabs' ); |
21 | | - return true; |
| 18 | + foreach( $remove as $rem ) { |
| 19 | + list($section, $item) = explode( '/', $rem, 2 ); |
| 20 | + unset( $links[$section][$item] ); |
| 21 | + } |
| 22 | + |
| 23 | + $links['views']['history']['class'] = 'selected'; |
22 | 24 | } |
23 | 25 | } |
Index: branches/wmf-deployment/extensions/LiquidThreads_alpha/pages/TalkpageHeaderView.php |
— | — | @@ -4,7 +4,7 @@ |
5 | 5 | // Pass-through wrapper with an extra note at the top |
6 | 6 | |
7 | 7 | class TalkpageHeaderView extends LqtView { |
8 | | - function customizeTabs( $skintemplate, $content_actions ) { |
| 8 | + function customizeTabs( $skintemplate, &$content_actions ) { |
9 | 9 | unset( $content_actions['edit'] ); |
10 | 10 | unset( $content_actions['addsection'] ); |
11 | 11 | unset( $content_actions['history'] ); |
— | — | @@ -15,16 +15,28 @@ |
16 | 16 | $content_actions['header'] = array( |
17 | 17 | 'class' => 'selected', |
18 | 18 | 'text' => wfMsg( 'lqt-talkpage-history-tab' ), |
19 | | - 'href' => '' |
| 19 | + 'href' => '', |
20 | 20 | ); |
21 | | - |
22 | | - return true; |
23 | 21 | } |
| 22 | + |
| 23 | + function customizeNavigation( $skin, &$links ) { |
| 24 | + $remove = array( 'actions/edit', 'actions/addsection', 'views/history', |
| 25 | + 'actions/watch', 'actions/move' ); |
| 26 | + |
| 27 | + foreach( $remove as $rem ) { |
| 28 | + list($section, $item) = explode( '/', $rem, 2 ); |
| 29 | + unset( $links[$section][$item] ); |
| 30 | + } |
| 31 | + |
| 32 | + $links['views']['header'] = array( |
| 33 | + 'class' => 'selected', |
| 34 | + 'text' => wfMsg( 'lqt-talkpage-history-tab' ), |
| 35 | + 'href' => '', |
| 36 | + ); |
| 37 | + } |
24 | 38 | |
25 | 39 | function show() { |
26 | | - global $wgHooks, $wgOut, $wgTitle, $wgRequest; |
27 | | - // Why is a hook added here? |
28 | | - $wgHooks['SkinTemplateTabs'][] = array( $this, 'customizeTabs' ); |
| 40 | + global $wgOut, $wgTitle, $wgRequest; |
29 | 41 | |
30 | 42 | if ( $wgRequest->getVal( 'action' ) === 'edit' ) { |
31 | 43 | wfLoadExtensionMessages( 'LiquidThreads' ); |
Index: branches/wmf-deployment/extensions/LiquidThreads_alpha/pages/ThreadProtectionFormView.php |
— | — | @@ -3,25 +3,38 @@ |
4 | 4 | if ( !defined( 'MEDIAWIKI' ) ) die; |
5 | 5 | |
6 | 6 | // Pass-through wrapper |
7 | | -class ThreadProtectionFormView { |
8 | | - function customizeTabs( $skintemplate, $content_actions ) { |
9 | | - unset( $content_actions['edit'] ); |
10 | | - unset( $content_actions['addsection'] ); |
11 | | - unset( $content_actions['viewsource'] ); |
12 | | - unset( $content_actions['talk'] ); |
13 | | - |
14 | | - $content_actions['talk']['class'] = false; |
| 7 | +class ThreadProtectionFormView extends LqtView { |
| 8 | + function customizeTabs( $skintemplate, &$content_actions ) { |
| 9 | + ThreadPermalinkView::customizeThreadTabs( $skintemplate, $content_actions, $this ); |
| 10 | + |
15 | 11 | if ( array_key_exists( 'protect', $content_actions ) ) |
16 | 12 | $content_actions['protect']['class'] = 'selected'; |
17 | 13 | else if ( array_key_exists( 'unprotect', $content_actions ) ) |
18 | 14 | $content_actions['unprotect']['class'] = 'selected'; |
19 | | - |
20 | | - return true; |
21 | 15 | } |
| 16 | + |
| 17 | + function customizeNavigation( $skintemplate, &$links ) { |
| 18 | + ThreadPermalinkView::customizeThreadNavigation( $skintemplate, $links, $this ); |
| 19 | + |
| 20 | + if ( isset( $links['actions']['protect'] ) ) { |
| 21 | + $links['actions']['protect']['class'] = 'selected'; |
| 22 | + } |
| 23 | + |
| 24 | + if ( isset( $links['actions']['unprotect'] ) ) { |
| 25 | + $links['actions']['unprotect']['class'] = 'selected'; |
| 26 | + } |
| 27 | + } |
| 28 | + |
| 29 | + function __construct( &$output, &$article, &$title, &$user, &$request ) { |
| 30 | + parent::__construct( $output, $article, $title, $user, $request ); |
22 | 31 | |
23 | | - function show() { |
24 | | - global $wgHooks; |
25 | | - $wgHooks['SkinTemplateTabs'][] = array( $this, 'customizeTabs' ); |
26 | | - return true; |
| 32 | + $t = Threads::withRoot( $this->article ); |
| 33 | + |
| 34 | + $this->thread = $t; |
| 35 | + if ( !$t ) { |
| 36 | + return; |
| 37 | + } |
| 38 | + |
| 39 | + $this->article = $t->article(); |
27 | 40 | } |
28 | 41 | } |
Index: branches/wmf-deployment/extensions/LiquidThreads_alpha/pages/IndividualThreadHistoryView.php |
— | — | @@ -5,11 +5,17 @@ |
6 | 6 | class IndividualThreadHistoryView extends ThreadPermalinkView { |
7 | 7 | protected $oldid; |
8 | 8 | |
9 | | - function customizeTabs( $skintemplate, $content_actions ) { |
| 9 | + function customizeTabs( $skintemplate, &$content_actions ) { |
10 | 10 | $content_actions['history']['class'] = 'selected'; |
11 | 11 | parent::customizeTabs( $skintemplate, $content_actions ); |
12 | 12 | return true; |
13 | 13 | } |
| 14 | + |
| 15 | + function customizeNavigation( $skin, &$links ) { |
| 16 | + $links['views']['history']['class'] = 'selected'; |
| 17 | + parent::customizeNavigation( $skin, $links ); |
| 18 | + return true; |
| 19 | + } |
14 | 20 | |
15 | 21 | /* This customizes the subtitle of a history *listing* from the hook, |
16 | 22 | and of an old revision from getSubtitle() below. */ |
— | — | @@ -40,8 +46,6 @@ |
41 | 47 | return false; |
42 | 48 | } |
43 | 49 | |
44 | | - $wgHooks['SkinTemplateTabs'][] = array( $this, 'customizeTabs' ); |
45 | | - |
46 | 50 | $wgHooks['PageHistoryBeforeList'][] = array( $this, 'customizeSubtitle' ); |
47 | 51 | |
48 | 52 | return true; |
Index: branches/wmf-deployment/extensions/LiquidThreads_alpha/pages/ThreadHistoricalRevisionView.php |
— | — | @@ -114,9 +114,6 @@ |
115 | 115 | |
116 | 116 | $this->showHistoryInfo(); |
117 | 117 | |
118 | | - global $wgHooks; |
119 | | - $wgHooks['SkinTemplateTabs'][] = array( $this, 'customizeTabs' ); |
120 | | - |
121 | 118 | if ( !$this->thread ) { |
122 | 119 | $this->showMissingThreadPage(); |
123 | 120 | return false; |
Index: branches/wmf-deployment/extensions/LiquidThreads_alpha/pages/TalkpageHistoryView.php |
— | — | @@ -4,9 +4,8 @@ |
5 | 5 | |
6 | 6 | class TalkpageHistoryView extends TalkpageView { |
7 | 7 | function show() { |
8 | | - global $wgHooks, $wgUser; |
9 | | - $wgHooks['SkinTemplateTabs'][] = array( $this, 'customizeTabs' ); |
10 | | - |
| 8 | + global $wgUser; |
| 9 | + |
11 | 10 | self::addJSandCSS(); |
12 | 11 | wfLoadExtensionMessages( 'LiquidThreads' ); |
13 | 12 | |
— | — | @@ -32,6 +31,19 @@ |
33 | 32 | |
34 | 33 | return false; |
35 | 34 | } |
| 35 | + |
| 36 | + function customizeTabs( $skin, &$links ) { |
| 37 | + TalkpageView::customizeTalkpageTabs( $skin, $links, $this ); |
| 38 | + |
| 39 | + $tabid = $this->article->getTitle()->getNamespaceKey(); |
| 40 | + $links['history']['class'] = 'selected'; |
| 41 | + } |
| 42 | + |
| 43 | + function customizeNavigation( $skin, &$links ) { |
| 44 | + TalkpageView::customizeTalkpageNavigation( $skin, $links, $this ); |
| 45 | + $links['views']['history']['class'] = 'selected'; |
| 46 | + $links['views']['view']['class'] = ''; |
| 47 | + } |
36 | 48 | } |
37 | 49 | |
38 | 50 | class TalkpageHistoryPager extends ThreadHistoryPager { |
Index: branches/wmf-deployment/extensions/LiquidThreads_alpha/pages/ThreadPermalinkView.php |
— | — | @@ -4,62 +4,131 @@ |
5 | 5 | |
6 | 6 | class ThreadPermalinkView extends LqtView { |
7 | 7 | protected $thread; |
| 8 | + |
| 9 | + function customizeTabs( $skin, &$links ) { |
| 10 | + self::customizeThreadTabs( $skin, $links, $this ); |
| 11 | + } |
| 12 | + |
| 13 | + function customizeNavigation( $skin, &$links ) { |
| 14 | + self::customizeThreadNavigation( $skin, $links, $this ); |
| 15 | + } |
8 | 16 | |
9 | | - function customizeTabs( $skintemplate, $content_actions ) { |
| 17 | + static function customizeThreadTabs( $skintemplate, &$content_actions, $view ) { |
10 | 18 | wfLoadExtensionMessages( 'LiquidThreads' ); |
11 | | - // Insert fake 'article' and 'discussion' tabs before the thread tab. |
12 | | - // If you call the key 'talk', the url gets re-set later. TODO: |
13 | | - // the access key for the talk tab doesn't work. |
14 | | - if ( $this->thread ) { |
15 | | - $article_t = $this->thread->article()->getTitle(); |
16 | | - $talk_t = $this->thread->article()->getTitle(); |
17 | | - } else { |
| 19 | + |
| 20 | + if ( !$view->thread ) { |
18 | 21 | return true; |
19 | 22 | } |
20 | 23 | |
21 | | - $articleTab = |
22 | | - array( |
23 | | - 'text' => wfMsg( $article_t->getNamespaceKey() ), |
24 | | - 'href' => $article_t->getFullURL(), |
25 | | - 'class' => $article_t->exists() ? '' : 'new' |
26 | | - ); |
27 | | - efInsertIntoAssoc( 'article', $articleTab, 'nstab-thread', $content_actions ); |
| 24 | + // Insert 'article' and 'discussion' tabs before the thread tab. |
28 | 25 | |
29 | | - $talkTab = |
30 | | - array( |
31 | | - // talkpage certainly exists since this thread is from it. |
32 | | - 'text' => wfMsg( 'talk' ), |
33 | | - 'href' => $talk_t->getFullURL() |
34 | | - ); |
35 | | - |
36 | | - efInsertIntoAssoc( 'not_talk', $talkTab, 'nstab-thread', $content_actions ); |
| 26 | + $tabs = self::getCustomTabs( $view ); |
| 27 | + $content_actions = $tabs + $content_actions; |
37 | 28 | |
38 | 29 | unset( $content_actions['edit'] ); |
39 | 30 | unset( $content_actions['viewsource'] ); |
40 | 31 | unset( $content_actions['talk'] ); |
41 | 32 | |
42 | | - $subpage = $this->thread->title()->getPrefixedText(); |
| 33 | + $subpage = $view->thread->title()->getPrefixedText(); |
43 | 34 | |
44 | | - if ( array_key_exists( 'move', $content_actions ) && $this->thread ) { |
| 35 | + // Repoint move/delete/history tabs |
| 36 | + if ( array_key_exists( 'move', $content_actions ) && $view->thread ) { |
45 | 37 | $content_actions['move']['href'] = |
46 | | - SpecialPage::getTitleFor( 'MoveThread', $subpage )->getFullURL(); |
| 38 | + SpecialPage::getTitleFor( 'MoveThread', $subpage )->getFullURL(); |
47 | 39 | } |
48 | 40 | |
49 | | - if ( array_key_exists( 'delete', $content_actions ) && $this->thread ) { |
| 41 | + if ( array_key_exists( 'delete', $content_actions ) && $view->thread ) { |
50 | 42 | $content_actions['delete']['href'] = |
51 | | - $this->thread->title()->getFullURL( 'action=delete' ); |
| 43 | + $view->thread->title()->getFullURL( 'action=delete' ); |
52 | 44 | } |
53 | 45 | |
54 | 46 | if ( array_key_exists( 'history', $content_actions ) ) { |
55 | | - $content_actions['history']['href'] = self::permalinkUrl( $this->thread, 'thread_history' ); |
56 | | - if ( $this->methodApplies( 'thread_history' ) ) { |
| 47 | + $content_actions['history']['href'] = self::permalinkUrl( $view->thread, 'thread_history' ); |
| 48 | + if ( $view->methodApplies( 'thread_history' ) ) { |
57 | 49 | $content_actions['history']['class'] = 'selected'; |
58 | 50 | } |
59 | 51 | } |
60 | 52 | |
61 | 53 | return true; |
62 | 54 | } |
| 55 | + |
| 56 | + static function customizeThreadNavigation( $skin, &$links, $view ) { |
| 57 | + if ( !$view->thread ) { |
| 58 | + return true; |
| 59 | + } |
| 60 | + |
| 61 | + // Insert 'article' and 'discussion' namespace-tabs |
| 62 | + $new_nstabs = self::getCustomTabs( $view ); |
| 63 | + |
| 64 | + $nstabs =& $links['namespaces']; |
63 | 65 | |
| 66 | + $talkKey = $view->thread->title()->getNamespaceKey('').'_talk'; |
| 67 | + unset( $nstabs[$talkKey] ); |
| 68 | + $nstabs = $new_nstabs + $nstabs; |
| 69 | + |
| 70 | + // Remove some views. |
| 71 | + $views =& $links['views']; |
| 72 | + unset( $views['viewsource'] ); |
| 73 | + unset( $views['edit'] ); |
| 74 | + |
| 75 | + // Re-point move, delete and history actions |
| 76 | + $subpage = $view->thread->title()->getPrefixedText(); |
| 77 | + $actions =& $links['actions']; |
| 78 | + if ( isset($actions['move']) ) { |
| 79 | + $actions['move']['href'] = |
| 80 | + SpecialPage::getTitleFor( 'MoveThread', $subpage )->getFullURL(); |
| 81 | + } |
| 82 | + |
| 83 | + if ( isset($actions['delete']) ) { |
| 84 | + $actions['delete']['href'] = |
| 85 | + $view->thread->title()->getFullURL( 'action=delete' ); |
| 86 | + } |
| 87 | + |
| 88 | + if ( isset($views['history']) ) { |
| 89 | + $views['history']['href'] = |
| 90 | + self::permalinkUrl( $view->thread, 'thread_history' ); |
| 91 | + if ( $view->methodApplies( 'thread_history' ) ) { |
| 92 | + $views['history']['class'] = 'selected'; |
| 93 | + } |
| 94 | + } |
| 95 | + } |
| 96 | + |
| 97 | + // Pre-generates the tabs to be included, for customizeTabs and customizeNavigation |
| 98 | + // to insert in the appropriate place |
| 99 | + static function getCustomTabs( $view ) { |
| 100 | + $tabs = array(); |
| 101 | + |
| 102 | + $articleTitle = $view->thread->article()->getTitle()->getSubjectPage(); |
| 103 | + $talkTitle = $view->thread->article()->getTitle()->getTalkPage(); |
| 104 | + |
| 105 | + $articleClasses = array(); |
| 106 | + if ( !$articleTitle->exists() ) $articleClasses[] = 'new'; |
| 107 | + if ( $articleTitle->equals( $view->thread->article()->getTitle() ) ) |
| 108 | + $articleClasses[] = 'selected'; |
| 109 | + |
| 110 | + $talkClasses = array(); |
| 111 | + if ( !$talkTitle->exists() ) $talkClasses[] = 'new'; |
| 112 | + if ( $talkTitle->equals( $view->thread->article()->getTitle() ) ) |
| 113 | + $talkClasses[] = 'selected'; |
| 114 | + |
| 115 | + $tabs['article'] = |
| 116 | + array( |
| 117 | + 'text' => wfMsg( $articleTitle->getNamespaceKey() ), |
| 118 | + 'href' => $articleTitle->getFullURL(), |
| 119 | + 'class' => implode( ' ', $articleClasses ), |
| 120 | + ); |
| 121 | + |
| 122 | + $tabs['lqt_talk'] = |
| 123 | + array( |
| 124 | + // talkpage certainly exists since this thread is from it. |
| 125 | + 'text' => wfMsg( 'talk' ), |
| 126 | + 'href' => $talkTitle->getFullURL(), |
| 127 | + 'class' => implode( ' ', $talkClasses ), |
| 128 | + ); |
| 129 | + |
| 130 | + return $tabs; |
| 131 | + } |
| 132 | + |
64 | 133 | function showThreadHeading( $thread ) { |
65 | 134 | parent::showThreadHeading( $thread ); |
66 | 135 | } |
— | — | @@ -108,26 +177,21 @@ |
109 | 178 | } |
110 | 179 | |
111 | 180 | function __construct( &$output, &$article, &$title, &$user, &$request ) { |
112 | | - |
113 | 181 | parent::__construct( $output, $article, $title, $user, $request ); |
114 | 182 | |
115 | 183 | $t = Threads::withRoot( $this->article ); |
116 | 184 | |
117 | 185 | $this->thread = $t; |
118 | 186 | if ( !$t ) { |
119 | | - return; // error reporting is handled in show(). this kinda sucks. |
| 187 | + return; |
120 | 188 | } |
121 | 189 | |
122 | 190 | // $this->article gets saved to thread_article, so we want it to point to the |
123 | 191 | // subject page associated with the talkpage, always, not the permalink url. |
124 | 192 | $this->article = $t->article(); # for creating reply threads. |
125 | | - |
126 | 193 | } |
127 | 194 | |
128 | 195 | function show() { |
129 | | - global $wgHooks; |
130 | | - $wgHooks['SkinTemplateTabs'][] = array( $this, 'customizeTabs' ); |
131 | | - |
132 | 196 | if ( !$this->thread ) { |
133 | 197 | $this->showMissingThreadPage(); |
134 | 198 | return false; |
Index: branches/wmf-deployment/extensions/LiquidThreads_alpha/pages/ThreadHistoryListingView.php |
— | — | @@ -4,9 +4,6 @@ |
5 | 5 | |
6 | 6 | class ThreadHistoryListingView extends ThreadPermalinkView { |
7 | 7 | function show() { |
8 | | - global $wgHooks; |
9 | | - $wgHooks['SkinTemplateTabs'][] = array( $this, 'customizeTabs' ); |
10 | | - |
11 | 8 | if ( ! $this->thread ) { |
12 | 9 | $this->showMissingThreadPage(); |
13 | 10 | return false; |
— | — | @@ -33,5 +30,16 @@ |
34 | 31 | |
35 | 32 | return false; |
36 | 33 | } |
| 34 | + |
| 35 | + function customizeTabs( $skin, &$links ) { |
| 36 | + parent::customizeTabs( $skin, $links ); |
| 37 | + $links['history']['class'] = 'selected'; |
| 38 | + } |
| 39 | + |
| 40 | + function customizeNavigation( $skin, &$links ) { |
| 41 | + parent::customizeNavigation( $skin, $links ); |
| 42 | + $links['views']['history']['class'] = 'selected'; |
| 43 | + $links['views']['view']['class'] = ''; |
| 44 | + } |
37 | 45 | } |
38 | 46 | |
Index: branches/wmf-deployment/extensions/LiquidThreads_alpha/pages/TalkpageView.php |
— | — | @@ -4,7 +4,7 @@ |
5 | 5 | |
6 | 6 | class TalkpageView extends LqtView { |
7 | 7 | /* Added to SkinTemplateTabs hook in TalkpageView::show(). */ |
8 | | - function customizeTabs( $skintemplate, &$content_actions ) { |
| 8 | + static function customizeTalkpageTabs( $skintemplate, &$content_actions, $view ) { |
9 | 9 | // The arguments are passed in by reference. |
10 | 10 | unset( $content_actions['edit'] ); |
11 | 11 | unset( $content_actions['viewsource'] ); |
— | — | @@ -12,13 +12,34 @@ |
13 | 13 | |
14 | 14 | # Protection against non-SkinTemplate skins |
15 | 15 | if ( isset( $content_actions['history'] ) ) { |
16 | | - $thisTitle = $this->article->getTitle(); |
| 16 | + $thisTitle = $view->article->getTitle(); |
17 | 17 | $history_url = $thisTitle->getFullURL( 'lqt_method=talkpage_history' ); |
18 | 18 | $content_actions['history']['href'] = $history_url; |
19 | 19 | } |
20 | | - |
21 | | - return true; |
22 | 20 | } |
| 21 | + |
| 22 | + static function customizeTalkpageNavigation( $skin, &$links, $view ) { |
| 23 | + $remove = array( 'views/edit', 'views/viewsource', 'actions/delete' ); |
| 24 | + |
| 25 | + foreach( $remove as $rem ) { |
| 26 | + list($section, $item) = explode( '/', $rem, 2 ); |
| 27 | + unset( $links[$section][$item] ); |
| 28 | + } |
| 29 | + |
| 30 | + if ( isset( $links['views']['history'] ) ) { |
| 31 | + $title = $view->article->getTitle(); |
| 32 | + $history_url = $title->getFullURL( 'lqt_method=talkpage_history' ); |
| 33 | + $links['views']['history']['href'] = $history_url; |
| 34 | + } |
| 35 | + } |
| 36 | + |
| 37 | + function customizeTabs( $skintemplate, &$links ) { |
| 38 | + self::customizeTalkpageTabs( $skintemplate, $links, $this ); |
| 39 | + } |
| 40 | + |
| 41 | + function customizeNavigation( $skintemplate, &$links ) { |
| 42 | + self::customizeTalkpageNavigation( $skintemplate, $links, $this ); |
| 43 | + } |
23 | 44 | |
24 | 45 | function showHeader() { |
25 | 46 | /* Show the contents of the actual talkpage article if it exists. */ |
— | — | @@ -178,10 +199,7 @@ |
179 | 200 | } |
180 | 201 | |
181 | 202 | function show() { |
182 | | - global $wgHooks; |
183 | 203 | wfLoadExtensionMessages( 'LiquidThreads' ); |
184 | | - // FIXME Why is a hook added here? |
185 | | - $wgHooks['SkinTemplateTabs'][] = array( $this, 'customizeTabs' ); |
186 | 204 | |
187 | 205 | $this->output->setPageTitle( $this->title->getPrefixedText() ); |
188 | 206 | self::addJSandCSS(); |
Index: branches/wmf-deployment/extensions/LiquidThreads_alpha/api/ApiThreadAction.php |
— | — | @@ -30,6 +30,11 @@ |
31 | 31 | 'text' => 'The text of the post to create', |
32 | 32 | 'render' => 'If set, on post/reply methods, the top-level thread '. |
33 | 33 | 'after the change will be rendered and returned in the result.', |
| 34 | + 'bump' => 'If set, overrides default behaviour as to whether or not to ', |
| 35 | + "increase the thread's sort key. If true, sets it to current ". |
| 36 | + "timestamp. If false, does not set it. Default depends on ". |
| 37 | + "the action being taken. Presently only works for newthread ". |
| 38 | + "and reply actions.", |
34 | 39 | ); |
35 | 40 | } |
36 | 41 | |
— | — | @@ -54,6 +59,7 @@ |
55 | 60 | 'newparent' => null, |
56 | 61 | 'text' => null, |
57 | 62 | 'render' => null, |
| 63 | + 'bump' => null, |
58 | 64 | ); |
59 | 65 | } |
60 | 66 | |
— | — | @@ -294,6 +300,8 @@ |
295 | 301 | return; |
296 | 302 | } |
297 | 303 | |
| 304 | + $bump = isset($params['bump']) ? $params['bump'] : null; |
| 305 | + |
298 | 306 | $subject = $params['subject']; |
299 | 307 | $title = null; |
300 | 308 | $subjectOk = Thread::validateSubject( $subject, $title, null, $talkpage ); |
— | — | @@ -357,7 +365,7 @@ |
358 | 366 | $title->resetArticleID( $articleId ); |
359 | 367 | |
360 | 368 | $thread = LqtView::postEditUpdates( 'new', null, $article, $talkpage, |
361 | | - $subject, $summary, null, $text ); |
| 369 | + $subject, $summary, null, $text, $bump ); |
362 | 370 | |
363 | 371 | $maxLag = wfGetLB()->getMaxLag(); |
364 | 372 | $maxLag = $maxLag[1]; |
— | — | @@ -414,6 +422,8 @@ |
415 | 423 | |
416 | 424 | $text = $params['text']; |
417 | 425 | |
| 426 | + $bump = isset($params['bump']) ? $params['bump'] : null; |
| 427 | + |
418 | 428 | // Generate/pull summary |
419 | 429 | $summary = wfMsgForContent( 'lqt-reply-summary', $replyTo->subject(), |
420 | 430 | $replyTo->title()->getPrefixedText() ); |
— | — | @@ -468,7 +478,7 @@ |
469 | 479 | $title->resetArticleID( $articleId ); |
470 | 480 | |
471 | 481 | $thread = LqtView::postEditUpdates( 'reply', $replyTo, $article, $talkpage, |
472 | | - $subject, $summary, null, $text ); |
| 482 | + $subject, $summary, null, $text, $bump ); |
473 | 483 | |
474 | 484 | $maxLag = wfGetLB()->getMaxLag(); |
475 | 485 | $maxLag = $maxLag[1]; |
Index: branches/wmf-deployment/extensions/LiquidThreads_alpha/lqt.js |
— | — | @@ -97,7 +97,7 @@ |
98 | 98 | var cancelButton = $j(container).find('#mw-editform-cancel'); |
99 | 99 | cancelButton.click( liquidThreads.cancelEdit ); |
100 | 100 | |
101 | | - $j(container).find('#wpTextbox1')[0].rows = 10; |
| 101 | + $j(container).find('#wpTextbox1').attr( 'rows', 12 ); |
102 | 102 | |
103 | 103 | // Add toolbar |
104 | 104 | mwSetupToolbar(); |
— | — | @@ -466,6 +466,7 @@ |
467 | 467 | var threadId = thread.data('thread-id'); |
468 | 468 | var replies = thread.parent().find('.lqt-thread-replies'); |
469 | 469 | var loader = $j('<div class="mw-ajax-loader"/>'); |
| 470 | + var sep = $j('<div class="lqt-post-sep"> </div>'); |
470 | 471 | |
471 | 472 | replies.empty(); |
472 | 473 | replies.hide(); |
— | — | @@ -493,6 +494,8 @@ |
494 | 495 | liquidThreads.setupThread( $j(this) ); |
495 | 496 | } ); |
496 | 497 | |
| 498 | + replies.before(sep); |
| 499 | + |
497 | 500 | // Show |
498 | 501 | loader.remove(); |
499 | 502 | replies.fadeIn('slow'); |
— | — | @@ -641,8 +644,15 @@ |
642 | 645 | |
643 | 646 | var text = editform.find('#wpTextbox1').val(); |
644 | 647 | var summary = editform.find('#wpSummary').val(); |
| 648 | + |
| 649 | + // Check if summary is undefined |
| 650 | + if (summary === undefined) { |
| 651 | + summary = ''; |
| 652 | + } |
| 653 | + |
645 | 654 | var subject = editform.find( '#lqt_subject_field' ).val(); |
646 | 655 | var replyThread = editform.find('input[name=lqt_operand]').val(); |
| 656 | + var bump = editform.find('#wpBumpThread').is(':checked') ? 1 : 0; |
647 | 657 | |
648 | 658 | var spinner = $j('<div class="mw-ajax-loader"/>'); |
649 | 659 | editform.prepend(spinner); |
— | — | @@ -747,18 +757,19 @@ |
748 | 758 | }; |
749 | 759 | |
750 | 760 | if ( type == 'reply' ) { |
751 | | - liquidThreads.doReply( replyThread, text, summary, doneCallback); |
| 761 | + liquidThreads.doReply( replyThread, text, summary, |
| 762 | + doneCallback, bump ); |
752 | 763 | |
753 | 764 | e.preventDefault(); |
754 | 765 | } else if ( type == 'talkpage_new_thread' ) { |
755 | 766 | liquidThreads.doNewThread( wgPageName, subject, text, summary, |
756 | | - doneCallback ); |
| 767 | + doneCallback, bump ); |
757 | 768 | |
758 | 769 | e.preventDefault(); |
759 | 770 | } |
760 | 771 | }, |
761 | 772 | |
762 | | - 'doNewThread' : function( talkpage, subject, text, summary, callback ) { |
| 773 | + 'doNewThread' : function( talkpage, subject, text, summary, callback, bump ) { |
763 | 774 | liquidThreads.getToken( |
764 | 775 | function(token) { |
765 | 776 | var newTopicParams = |
— | — | @@ -771,7 +782,8 @@ |
772 | 783 | 'token' : token, |
773 | 784 | 'format' : 'json', |
774 | 785 | 'render' : '1', |
775 | | - 'reason' : summary |
| 786 | + 'reason' : summary, |
| 787 | + 'bump' : bump |
776 | 788 | }; |
777 | 789 | |
778 | 790 | $j.post( wgScriptPath+'/api'+wgScriptExtension, newTopicParams, |
— | — | @@ -783,7 +795,7 @@ |
784 | 796 | } ); |
785 | 797 | }, |
786 | 798 | |
787 | | - 'doReply' : function( thread, text, summary, callback ) { |
| 799 | + 'doReply' : function( thread, text, summary, callback, bump ) { |
788 | 800 | liquidThreads.getToken( |
789 | 801 | function(token) { |
790 | 802 | var replyParams = |
— | — | @@ -795,7 +807,8 @@ |
796 | 808 | 'token' : token, |
797 | 809 | 'format' : 'json', |
798 | 810 | 'render' : '1', |
799 | | - 'reason' : summary |
| 811 | + 'reason' : summary, |
| 812 | + 'bump' : bump |
800 | 813 | }; |
801 | 814 | |
802 | 815 | $j.post( wgScriptPath+'/api'+wgScriptExtension, replyParams, |
Property changes on: branches/wmf-deployment/extensions/LiquidThreads_alpha |
___________________________________________________________________ |
Modified: svn:mergeinfo |
803 | 816 | Merged /trunk/extensions/LiquidThreads:r59354-59416,59418-59419,59421-59422,59424-59427 |