Index: branches/liquidthreads/extensions/LqtExtension.php |
— | — | @@ -388,7 +388,7 @@ |
389 | 389 | |
390 | 390 | $this->openDiv('lqt_archive_widget'); |
391 | 391 | $this->output->addHTML(<<<HTML |
392 | | - <form id="lqt_archive_browser_form"><select name="lqt_archive_month" id="lqt_archive_month"> |
| 392 | + <form id="lqt_archive_browser_form" action="{$this->title->getLocalURL()}"><select name="lqt_archive_month" id="lqt_archive_month"> |
393 | 393 | HTML |
394 | 394 | ); |
395 | 395 | foreach( $options as $label => $value ) { |
— | — | @@ -449,13 +449,16 @@ |
450 | 450 | |
451 | 451 | $this->output->setPageTitle( "Thread: #$thread_id" ); // Default if no subject line. |
452 | 452 | |
453 | | -$talkpage_link = $this->user->getSkin()->makeKnownLinkObj($t->article()->getTitle()->getTalkpage()); |
| 453 | + // Make a link back to the talk page, including the correct archive month. |
| 454 | + if (Date::now()->nDaysAgo(30)->midnight()->isBefore( new Date($t->touched()) )) |
| 455 | + $query = ''; |
| 456 | + else |
| 457 | + $query = 'lqt_archive_month=' . substr($t->touched(),0,6); |
| 458 | + |
| 459 | + $talkpage = $t->article()->getTitle()->getTalkpage(); |
| 460 | + $talkpage_link = $this->user->getSkin()->makeKnownLinkObj($talkpage, '', $query); |
| 461 | + |
454 | 462 | if ( $t->superthread() ) { |
455 | | -/* $this->output->addHTML(<<<HTML |
456 | | - <p class="lqt_context_message">You are viewing a reply to another post. |
457 | | - <a href="{$this->permalinkUrl($t->topmostThread())}">View the entire discussion.</a></p> |
458 | | -HTML |
459 | | -);*/ |
460 | 463 | $this->output->setSubtitle( "a fragment of <a href=\"{$this->permalinkUrl($t->topmostThread())}\">a discussion</a> from " . $talkpage_link ); |
461 | 464 | } else { |
462 | 465 | |
Index: branches/liquidthreads/extensions/LqtModel.php |
— | — | @@ -46,9 +46,16 @@ |
47 | 47 | } |
48 | 48 | function midnight() { |
49 | 49 | $d = clone $this; |
50 | | - $d->hours = $d->minutes = $d->seconds = 0; |
| 50 | + $d->hour = $d->minute = $d->second = 0; |
51 | 51 | return $d; |
52 | 52 | } |
| 53 | + function isBefore($d) { |
| 54 | + foreach(array('year', 'month', 'day', 'hour', 'minute', 'second') as $part) { |
| 55 | + if ( $this->$part < $d->$part ) return true; |
| 56 | + if ( $this->$part > $d->$part ) return false; |
| 57 | + } |
| 58 | + return true; // exactly the same time; arguable. |
| 59 | + } |
53 | 60 | } |
54 | 61 | |
55 | 62 | class Post extends Article { |
— | — | @@ -244,7 +251,7 @@ |
245 | 252 | $startdate = Date::now()->nDaysAgo($n)->midnight(); |
246 | 253 | return Thread::threadsWhere( array('thread_article' => $article->getID(), |
247 | 254 | 'thread_subthread_of is null', |
248 | | - 'thread_touched > ' . $startdate->text() ), |
| 255 | + 'thread_touched >= ' . $startdate->text() ), |
249 | 256 | array('ORDER BY' => 'thread_touched DESC' ) ); |
250 | 257 | } |
251 | 258 | |