Index: branches/liquidthreads/skins/monobook/main.css |
— | — | @@ -78,9 +78,9 @@ |
79 | 79 | |
80 | 80 | .lqt_thread_permalink_summary { |
81 | 81 | clear: both; |
82 | | - border: solid 1px #ddd; |
| 82 | +/* border: solid 1px #ddd;*/ |
83 | 83 | padding-left: 1em; padding-right: 1em; |
84 | | - margin: 2em 2em 0.7em 1em; |
| 84 | + margin: 3em 2em 0.7em 1em; |
85 | 85 | } |
86 | 86 | .lqt_thread_permalink_summary_title { |
87 | 87 | float: left; |
Index: branches/liquidthreads/extensions/LqtExtension.php |
— | — | @@ -61,6 +61,9 @@ |
62 | 62 | |
63 | 63 | protected $queries; |
64 | 64 | |
| 65 | + public $archive_start_days = 14; |
| 66 | + public $archive_recent_days = 5; |
| 67 | + |
65 | 68 | function __construct(&$output, &$article, &$title, &$user, &$request) { |
66 | 69 | $this->article = $article; |
67 | 70 | $this->output = $output; |
— | — | @@ -74,18 +77,21 @@ |
75 | 78 | |
76 | 79 | function initializeQueries() { |
77 | 80 | $g = new QueryGroup(); |
78 | | - $startdate = Date::now()->nDaysAgo(14)->midnight(); |
| 81 | + $startdate = Date::now()->nDaysAgo($this->archive_start_days)->midnight(); |
79 | 82 | $g->addQuery('fresh', |
80 | 83 | array('thread_article' => $this->article->getID(), |
81 | 84 | 'thread_subthread_of is null', |
82 | | - 'thread_touched >= ' . $startdate->text() ), |
| 85 | + '(thread_touched >= ' . $startdate->text() . |
| 86 | + ' OR thread_summary_page is NULL)'), |
83 | 87 | array('ORDER BY' => 'thread_touched DESC' )); |
84 | | - $g->addQuery('recently-archived', |
| 88 | + $g->addQuery('archived', |
85 | 89 | array('thread_article' => $this->article->getID(), |
86 | 90 | 'thread_subthread_of is null', |
87 | | - 'thread_touched < ' . $startdate->text(), |
88 | | - 'thread_touched >=' . $startdate->nDaysAgo(5)->text()), |
| 91 | + 'thread_summary_page is not null', |
| 92 | + 'thread_touched < ' . $startdate->text()), |
89 | 93 | array('ORDER BY' => 'thread_touched DESC')); |
| 94 | + $g->extendQuery('archived', 'recently-archived', |
| 95 | + array('thread_touched >=' . $startdate->nDaysAgo($this->archive_recent_days)->text())); |
90 | 96 | return $g; |
91 | 97 | } |
92 | 98 | |
— | — | @@ -444,22 +450,19 @@ |
445 | 451 | // array('class'=>'lqt_header'), |
446 | 452 | // $html) ); |
447 | 453 | } |
448 | | - if ( !$thread->superthread() && !$thread->summary() ) { |
449 | | - $url = $this->permalinkUrl( $thread, 'lqt_summarize=1' ); |
450 | | - $this->output->addHTML( <<<HTML |
451 | | - <span class="lqt_summarize_command">[<a href="{$url}">Summarize</a>]</span> |
452 | | -HTML |
453 | | - ); |
454 | | - } |
455 | 454 | } |
456 | 455 | |
457 | 456 | function showThread( $thread, $suppress_summaries = false ) { |
458 | 457 | $this->showThreadHeading( $thread ); |
459 | 458 | |
| 459 | + $touched = new Date($thread->touched()); |
460 | 460 | if( $thread->summary() && !$suppress_summaries ) { |
461 | 461 | $this->showSummary($thread); |
462 | 462 | $this->output->addHTML( "<a href=\"{$this->permalinkUrl($thread)}\" class=\"lqt_thread_show_summary\">Show this thread</a>" ); |
463 | 463 | return; |
| 464 | + } else if ( $touched->isBefore(Date::now()->nDaysAgo($this->archive_start_days)) |
| 465 | + && !$thread->summary() && !$thread->superthread() ) { |
| 466 | + $this->output->addHTML("<p class=\"lqt_summary_notice\">If this discussion seems to be concluded, you are encouraged to <a href=\"{$this->permalinkUrl($thread, 'lqt_summarize=1')}\">write a summary</a>. There have been no changed here for at least $this->archive_start_days days.</p>"); |
464 | 467 | } |
465 | 468 | |
466 | 469 | $this->openDiv('lqt_thread', "lqt_thread_id_{$thread->id()}"); |
— | — | @@ -617,19 +620,22 @@ |
618 | 621 | you're editing the talkpage itself here. |
619 | 622 | */ |
620 | 623 | |
621 | | - $action = $this->request->getVal('action'); |
| 624 | + $action = $this->request->getVal('lqt_header_action'); |
622 | 625 | |
623 | 626 | $article = new Article( $this->title ); |
624 | 627 | if( $action == 'edit' || $action=='submit' ) { |
625 | 628 | $e = new EditPage($article); |
626 | 629 | $e->suppressIntro = true; |
| 630 | + $e->editFormTextBeforeContent .= |
| 631 | + $this->perpetuate('lqt_header_action', 'hidden'); |
627 | 632 | $e->edit(); |
628 | 633 | } else if ( $action == 'history' ) { |
| 634 | + $this->output->addHTML("Disclaimer: history doesn't really work yet."); |
629 | 635 | $history = new PageHistory( $article ); |
630 | 636 | $history->history(); |
631 | 637 | } else if ( $article->exists() ) { |
632 | | - $edit = $this->title->getFullURL( 'action=edit' ); |
633 | | - $history = $this->title->getFullURL( 'action=history' ); |
| 638 | + $edit = $this->title->getFullURL( 'lqt_header_action=edit' ); |
| 639 | + $history = $this->title->getFullURL( 'lqt_header_action=history' ); |
634 | 640 | $this->outputList('ul', 'lqt_header_commands', null, array( |
635 | 641 | "<a href=\"$edit\">edit</a>", |
636 | 642 | "<a href=\"$history\">history</a>" |
— | — | @@ -712,8 +718,6 @@ |
713 | 719 | $this->showSummarizeForm($t); |
714 | 720 | } else if ( $t->summary() ) { |
715 | 721 | $this->showSummary($t); |
716 | | - } else if ( !$t->superthread() ) { |
717 | | - $this->output->addHTML("<p class=\"lqt_summary_notice\">If this discussion seems to be concluded, you are encouraged to <a href=\"{$this->permalinkUrl($t, 'lqt_summarize=1')}\">write a summary</a>.</p>"); |
718 | 722 | } |
719 | 723 | |
720 | 724 | $this->showThread($t, true); |
Index: branches/liquidthreads/extensions/LqtModel.php |
— | — | @@ -103,7 +103,7 @@ |
104 | 104 | |
105 | 105 | function setSuperthread($thread) { |
106 | 106 | $this->superthreadId = $thread->id(); |
107 | | - $this->updateRecord(); |
| 107 | + $this->touch(); |
108 | 108 | } |
109 | 109 | |
110 | 110 | function superthread() { |
— | — | @@ -119,7 +119,7 @@ |
120 | 120 | |
121 | 121 | function setArticle($a) { |
122 | 122 | $this->articleId = $a->getID(); |
123 | | - $this->updateRecord(); |
| 123 | + $this->touch(); |
124 | 124 | } |
125 | 125 | |
126 | 126 | function article() { |
— | — | @@ -185,7 +185,7 @@ |
186 | 186 | |
187 | 187 | function setSubject($s) { |
188 | 188 | $this->subject = $s; |
189 | | - $this->updateRecord(); |
| 189 | + $this->touch(); |
190 | 190 | } |
191 | 191 | |
192 | 192 | function hasSubthreads() { |
— | — | @@ -199,7 +199,8 @@ |
200 | 200 | } |
201 | 201 | |
202 | 202 | function touch() { |
203 | | - $this->updateRecord(); // TODO side-effect, ugly, etc. |
| 203 | + $this->touched = wfTimestampNow(); |
| 204 | + $this->updateRecord(); |
204 | 205 | if ( $this->superthread() ) { |
205 | 206 | $this->superthread()->touch(); |
206 | 207 | } |
— | — | @@ -217,7 +218,7 @@ |
218 | 219 | 'thread_subthread_of' => $this->superthreadId, |
219 | 220 | 'thread_summary_page' => $this->summaryId, |
220 | 221 | 'thread_subject' => $this->subject, |
221 | | - 'thread_touched' => wfTimestampNow() ), |
| 222 | + 'thread_touched' => $this->touched ), |
222 | 223 | /* WHERE */ array( 'thread_id' => $this->id, ), |
223 | 224 | __METHOD__); |
224 | 225 | } |
— | — | @@ -333,6 +334,14 @@ |
334 | 335 | $this->queries[$name] = array($where, $options); |
335 | 336 | } |
336 | 337 | |
| 338 | + function extendQuery( $original, $newname, $where, $options = array() ) { |
| 339 | + if (!array_key_exists($original,$this->queries)) return; |
| 340 | + $q = $this->queries[$original]; |
| 341 | + $q[0] += $where; |
| 342 | + $q[1] += $options; |
| 343 | + $this->queries[$newname] = $q; |
| 344 | + } |
| 345 | + |
337 | 346 | function deleteQuery( $name ) { |
338 | 347 | unset ($this->queries[$name]); |
339 | 348 | } |