Index: branches/liquidthreads/maintenance/lqt.sql |
— | — | @@ -26,18 +26,11 @@ |
27 | 27 | hthread_id int(8) unsigned NOT NULL, |
28 | 28 | hthread_revision int(8) unsigned NOT NULL, |
29 | 29 | hthread_contents BLOB NOT NULL, |
| 30 | + hthread_affected_id int(8) unsigned NOT NULL, |
| 31 | + hthread_action int(1) unsigned NOT NULL, |
30 | 32 | PRIMARY KEY hthread_id_revision (hthread_id, hthread_revision) |
31 | 33 | ) TYPE=InnoDB; |
32 | 34 | |
33 | | -CREATE TABLE /*$wgDBprefix*/hthread_contents ( |
34 | | - htcontents_child int(8) unsigned NOT NULL, |
35 | | - htcontents_hthread int(8) unsigned NOT NULL, |
36 | | - htcontents_rev_start int(8) unsigned NOT NULL, |
37 | | - htcontents_rev_end int(8) unsigned NULL |
38 | | -) TYPE=InnoDB; |
39 | | - |
40 | 35 | /* |
41 | 36 | old_superthread and old_article are mutually exclusive. |
42 | 37 | New position is recorded either in the text movement or in the |
Index: branches/liquidthreads/extensions/LqtExtension.php |
— | — | @@ -64,10 +64,45 @@ |
65 | 65 | } |
66 | 66 | return true; |
67 | 67 | } |
| 68 | + |
| 69 | + static function onPageMove( $movepage, $ot, $nt ) { |
| 70 | + /* If the user moved a subject page, we are responsible for moving the articles |
| 71 | + associated with the talkpage directly; we will not be invoked a second time when |
| 72 | + MW attempts to move the talk page, because it doesn't actually exist. */ |
| 73 | + if( $movepage->moveTalk && !$ot->isTalkPage() && !$nt->isTalkPage() ) { |
| 74 | + $ntt = $nt->getTalkPage(); |
| 75 | + $ott = $ot->getTalkPage(); |
| 76 | + return self::onPageMove($movepage, $ott, $ntt); |
| 77 | + } |
| 78 | + |
| 79 | + if( $ot->getNamespace() == NS_LQT_HEADER || |
| 80 | + $nt->getNamespace() == NS_LQT_HEADER ) return true; |
| 81 | + |
| 82 | + # TODO look up namespace name |
| 83 | + $oht = Title::newFromText( 'Header:' . $ot->getPrefixedText() ); |
| 84 | + |
| 85 | + |
| 86 | + if( $oht->exists() ) { |
| 87 | + $nht = Title::newFromText( 'Header:' . $nt->getPrefixedText() ); |
| 88 | + |
| 89 | + $error = $oht->moveTo( $nht, true, $movepage->reason ); |
| 90 | + if ( $error === true ) { |
| 91 | + wfRunHooks( 'SpecialMovepageAfterMove', array( &$movepage, &$oht, &$nht ) ) ; |
| 92 | + } else { |
| 93 | + $talkmoved = $error; |
| 94 | + } |
| 95 | + } else { |
| 96 | + $talkmoved = 'notalkpage'; |
| 97 | + } |
| 98 | + # TODO we have no apparent way to report any error or success that goes on here. |
| 99 | + |
| 100 | + return true; |
| 101 | + } |
68 | 102 | } |
69 | 103 | |
70 | 104 | |
71 | 105 | $wgHooks['MediaWikiPerformAction'][] = array('LqtDispatch::tryPage'); |
| 106 | +$wgHooks['SpecialMovepageAfterMove'][] = array('LqtDispatch::onPageMove'); |
72 | 107 | |
73 | 108 | |
74 | 109 | class LqtView { |
— | — | @@ -172,6 +207,11 @@ |
173 | 208 | return $title->getFullURL( $query ); |
174 | 209 | } |
175 | 210 | |
| 211 | + function headerTitle() { |
| 212 | + # TODO |
| 213 | + return Title::newFromText( 'Header:' . $this->title->getPrefixedText() ); |
| 214 | + } |
| 215 | + |
176 | 216 | /************************************************************* |
177 | 217 | * Editing methods (here be dragons) * |
178 | 218 | * Forget dragons: This section distorts the rest of the code * |
— | — | @@ -594,6 +634,10 @@ |
595 | 635 | $action = $this->request->getVal('lqt_header_action'); |
596 | 636 | |
597 | 637 | $article = new Article( $this->title ); |
| 638 | + |
| 639 | + $headert = $this->headerTitle(); |
| 640 | + $headera = new Article($headert); |
| 641 | + |
598 | 642 | if( $action == 'edit' || $action=='submit' ) { |
599 | 643 | // TODO this is scary and horrible. |
600 | 644 | $e = new EditPage($article); |
— | — | @@ -605,18 +649,18 @@ |
606 | 650 | $this->output->addHTML("Disclaimer: history doesn't really work yet."); |
607 | 651 | $history = new PageHistory( $article ); |
608 | 652 | $history->history(); |
609 | | - } else if ( $article->exists() ) { |
610 | | - $edit = $this->title->getFullURL( 'lqt_header_action=edit' ); |
611 | | - $history = $this->title->getFullURL( 'lqt_header_action=history' ); |
| 653 | + } else if ( $headera->exists() ) { |
| 654 | + $edit = $headert->getFullURL( 'action=edit' ); |
| 655 | + $history = $headert->getFullURL( 'action=history' ); |
612 | 656 | $this->openDiv('lqt_header_content'); |
613 | | - $this->showPostBody($article); |
| 657 | + $this->showPostBody($headera); |
614 | 658 | $this->outputList('ul', 'lqt_header_commands', null, array( |
615 | 659 | "[<a href=\"$edit\">edit</a>]", |
616 | 660 | "[<a href=\"$history\">history</a>]" |
617 | 661 | )); |
618 | 662 | $this->closeDiv(); |
619 | 663 | } else { |
620 | | - $this->output->addHTML("<p class=\"lqt_header_notice\">[<a href=\"{$this->title->getFullURL('lqt_header_action=edit')}\">add header</a>]</p>"); |
| 664 | + $this->output->addHTML("<p class=\"lqt_header_notice\">[<a href=\"{$headert->getFullURL('action=edit')}\">add header</a>]</p>"); |
621 | 665 | } |
622 | 666 | } |
623 | 667 | |
Index: branches/liquidthreads/extensions/LqtModel.php |
— | — | @@ -216,6 +216,8 @@ |
217 | 217 | } |
218 | 218 | |
219 | 219 | function commitRevision() { |
| 220 | + global $wgUser; // TODO global. |
| 221 | + |
220 | 222 | // TODO open a transaction. |
221 | 223 | HistoricalThread::create( $this->double ); |
222 | 224 | |
— | — | @@ -233,6 +235,10 @@ |
234 | 236 | 'thread_article_title' => $this->articleTitle), |
235 | 237 | /* WHERE */ array( 'thread_id' => $this->id, ), |
236 | 238 | __METHOD__); |
| 239 | + |
| 240 | + /* RecentChange::notifyEdit( wfTimestampNow(), $this->root(), /*minor*/false, $wgUser, $summary, |
| 241 | + $lastRevision, $this->getTimestamp(), $bot, '', $oldsize, $newsize, |
| 242 | + $revisionId );*/ |
237 | 243 | } |
238 | 244 | |
239 | 245 | function __construct($line, $children) { |
Index: branches/liquidthreads/includes/Defines.php |
— | — | @@ -65,6 +65,8 @@ |
66 | 66 | define('NS_LQT_THREAD_TALK', 17); |
67 | 67 | define('NS_LQT_SUMMARY', 18); |
68 | 68 | define('NS_LQT_SUMMARY_TALK', 19); |
| 69 | +define('NS_LQT_HEADER', 20); |
| 70 | +define('NS_LQT_HEADER_TALK', 21); |
69 | 71 | /**#@-*/ |
70 | 72 | |
71 | 73 | /** |
Index: branches/liquidthreads/includes/Title.php |
— | — | @@ -2466,11 +2466,11 @@ |
2467 | 2467 | } |
2468 | 2468 | |
2469 | 2469 | /** |
2470 | | - * Check if page exists |
| 2470 | + * Check if page exists LQT HACK |
2471 | 2471 | * @return bool |
2472 | 2472 | */ |
2473 | 2473 | public function exists() { |
2474 | | - return $this->getArticleId() != 0; |
| 2474 | + return $this->getArticleId() != 0 || $this->isTalkPage(); |
2475 | 2475 | } |
2476 | 2476 | |
2477 | 2477 | /** |
Index: branches/liquidthreads/includes/Namespace.php |
— | — | @@ -28,7 +28,9 @@ |
29 | 29 | NS_LQT_THREAD => 'Thread', |
30 | 30 | NS_LQT_THREAD_TALK => 'Thread_talk', |
31 | 31 | NS_LQT_SUMMARY => 'Summary', |
32 | | - NS_LQT_SUMMARY_TALK => 'Summary_talk' |
| 32 | + NS_LQT_SUMMARY_TALK => 'Summary_talk', |
| 33 | + NS_LQT_HEADER => 'Header', |
| 34 | + NS_LQT_HEADER_TALK => 'Header_talk' |
33 | 35 | ); |
34 | 36 | |
35 | 37 | if( is_array( $wgExtraNamespaces ) ) { |
Index: branches/liquidthreads/languages/messages/MessagesEn.php |
— | — | @@ -106,7 +106,9 @@ |
107 | 107 | NS_LQT_THREAD => 'Thread', |
108 | 108 | NS_LQT_THREAD_TALK => 'Thread_talk', |
109 | 109 | NS_LQT_SUMMARY => 'Summary', |
110 | | - NS_LQT_SUMMARY_TALK => 'Summary_talk' |
| 110 | + NS_LQT_SUMMARY_TALK => 'Summary_talk', |
| 111 | + NS_LQT_HEADER => 'Header', |
| 112 | + NS_LQT_HEADER_TALK => 'Header_talk' |
111 | 113 | ); |
112 | 114 | |
113 | 115 | /** |