Index: trunk/extensions/LiquidThreads/i18n/Lqt.i18n.php |
— | — | @@ -154,6 +154,9 @@ |
155 | 155 | 'lqt-history-time' => 'Time', |
156 | 156 | 'lqt-history-user' => 'User', |
157 | 157 | 'lqt-history-action' => 'Activity', |
| 158 | + 'lqt-thread-edited-author'=> 'Edited by author', |
| 159 | + 'lqt-thread-edited-others'=> 'Edited by other users', |
| 160 | + 'lqt-header-actions' => 'Actions', |
158 | 161 | |
159 | 162 | // Logging |
160 | 163 | 'lqt-log-name' => 'Threaded discussion log', |
Index: trunk/extensions/LiquidThreads/lqt.css |
— | — | @@ -310,7 +310,6 @@ |
311 | 311 | |
312 | 312 | .lqt_footer { |
313 | 313 | margin: 0; |
314 | | - font-size: smaller; |
315 | 314 | color: #777; |
316 | 315 | padding-top: 0; |
317 | 316 | padding-bottom: 0; |
— | — | @@ -322,12 +321,6 @@ |
323 | 322 | .lqt_footer li { |
324 | 323 | display: inline; |
325 | 324 | list-style-type: none; |
326 | | - padding-right: 0.6em; |
327 | | - margin-top: 0; |
328 | | - margin-bottom: 0; |
329 | | - |
330 | | - background-color: #efefef; |
331 | | - border-bottom: solid 1px #ddd; |
332 | 325 | } |
333 | 326 | |
334 | 327 | /* This doesn't work in IE, so we need to replace it. What we want is |
— | — | @@ -466,3 +459,96 @@ |
467 | 460 | vertical-align: top; |
468 | 461 | padding-top: 1em; |
469 | 462 | } |
| 463 | + |
| 464 | +.lqt-thread-header { |
| 465 | + border-bottom: 1px solid #aaaaaa; |
| 466 | + clear: both; |
| 467 | + line-height: 2em; |
| 468 | +} |
| 469 | + |
| 470 | +.lqt-thread-header-info > span { |
| 471 | + padding-left: 1em; |
| 472 | + padding-right: 1em; |
| 473 | +} |
| 474 | + |
| 475 | +.lqt-thread-header-author { |
| 476 | + font-weight: bold; |
| 477 | +} |
| 478 | + |
| 479 | +.lqt-thread-header-edited-author { |
| 480 | + font-weight: bold; |
| 481 | +} |
| 482 | + |
| 483 | +.lqt-thread-header-edited-others { |
| 484 | + font-weight: bold; |
| 485 | + color: #880000; |
| 486 | +} |
| 487 | + |
| 488 | +.lqt-command-icon { |
| 489 | + width: 1.5em; |
| 490 | + height: 1.5em; |
| 491 | +} |
| 492 | + |
| 493 | +li.lqt-command-reply { |
| 494 | + text-align: right; |
| 495 | +} |
| 496 | + |
| 497 | +.lqt-thread-header-commands { |
| 498 | + float: right; |
| 499 | + font-size: 85%; |
| 500 | + margin: 0; |
| 501 | + margin-right: 2em; |
| 502 | +} |
| 503 | + |
| 504 | +.lqt-thread-header-commands:hover { |
| 505 | + background-color: #eeeeee; |
| 506 | +} |
| 507 | + |
| 508 | +.lqt-thread-actions-trigger { |
| 509 | + padding: 0.5em; |
| 510 | +} |
| 511 | + |
| 512 | +.lqt-thread-header-commands:hover .lqt-thread-actions-trigger { |
| 513 | + border: 1px solid #aaaaaa; |
| 514 | + border-bottom: none; |
| 515 | +} |
| 516 | + |
| 517 | +.lqt-thread-header-commands ul { |
| 518 | + display: none; |
| 519 | + position: absolute; |
| 520 | + list-style-type: none !important; |
| 521 | + list-style-image: none !important; |
| 522 | + border: 1px solid #aaaaaa; |
| 523 | + border-top: none; |
| 524 | + background-color: #eeeeee; |
| 525 | + margin: 0 !important; |
| 526 | +} |
| 527 | + |
| 528 | +.lqt-thread-header-commands:hover ul { |
| 529 | + display: block; |
| 530 | +} |
| 531 | + |
| 532 | +.lqt-thread-header-command-list li { |
| 533 | + padding-left: 0.5em; |
| 534 | + padding-right: 0.5em; |
| 535 | + margin-top: 0; |
| 536 | + margin-bottom: 0; |
| 537 | + list-style-type: none; |
| 538 | + list-style-image: none; |
| 539 | +} |
| 540 | + |
| 541 | +.lqt-thread-actions-trigger { |
| 542 | + margin-bottom: 0; |
| 543 | +} |
| 544 | + |
| 545 | +.lqt-thread-actions-icon { |
| 546 | + background-image: url('icons/arrow-down-icon.png'); |
| 547 | + background-position: center-bottom; |
| 548 | + background-repeat: no-repeat; |
| 549 | + height: 80%; |
| 550 | + width: 1em; |
| 551 | + height: 1em; |
| 552 | + display: inline-block; |
| 553 | + vertical-align: middle; |
| 554 | + padding-bottom: 0.5em; |
| 555 | +} |
Index: trunk/extensions/LiquidThreads/classes/LqtView.php |
— | — | @@ -548,45 +548,59 @@ |
549 | 549 | /** |
550 | 550 | * Example return value: |
551 | 551 | * array ( |
552 | | - * 0 => array( 'label' => 'Edit', |
| 552 | + * edit => array( 'label' => 'Edit', |
553 | 553 | * 'href' => 'http...', |
554 | 554 | * 'enabled' => false ), |
555 | | - * 1 => array( 'label' => 'Reply', |
| 555 | + * reply => array( 'label' => 'Reply', |
556 | 556 | * 'href' => 'http...', |
557 | 557 | * 'enabled' => true ) |
558 | 558 | * ) |
559 | 559 | */ |
560 | | - function threadFooterCommands( $thread ) { |
| 560 | + function threadCommands( $thread ) { |
561 | 561 | wfLoadExtensionMessages( 'LiquidThreads' ); |
562 | 562 | $commands = array(); |
563 | 563 | |
564 | 564 | $user_can_edit = $thread->root()->getTitle()->quickUserCan( 'edit' ); |
| 565 | + $editMsg = $user_can_edit ? 'edit' : 'viewsource'; |
565 | 566 | |
566 | | - $commands[] = array( 'label' => $user_can_edit |
567 | | - ? wfMsg( 'edit' ) : wfMsg( 'viewsource' ), |
| 567 | + $commands['edit'] = array( 'label' => wfMsgExt( $editMsg, 'parseinline' ), |
568 | 568 | 'href' => $this->talkpageUrl( $this->title, 'edit', $thread ), |
569 | 569 | 'enabled' => true ); |
570 | 570 | |
571 | | - $commands[] = array( 'label' => wfMsg( 'history_short' ), |
572 | | - 'href' => self::permalinkUrlWithQuery( $thread, 'action=history' ), |
| 571 | + $history_url = self::permalinkUrlWithQuery( $thread, array( 'action' => 'history' ) ); |
| 572 | + $commands['history'] = array( 'label' => wfMsgExt( 'history_short', 'parseinline' ), |
| 573 | + 'href' => $history_url, |
573 | 574 | 'enabled' => true ); |
574 | 575 | |
575 | | - $commands[] = array( 'label' => wfMsg( 'lqt_permalink' ), |
| 576 | + $commands['permalink'] = array( 'label' => wfMsgExt( 'lqt_permalink', 'parseinline' ), |
576 | 577 | 'href' => self::permalinkUrl( $thread ), |
577 | 578 | 'enabled' => true ); |
578 | 579 | |
579 | | - if ( in_array( 'delete', $this->user->getRights() ) ) { |
580 | | - $delete_url = SpecialPage::getTitleFor( 'DeleteThread' )->getFullURL() |
581 | | - . '/' . $thread->title()->getPrefixedURL(); |
582 | | - $commands[] = array( 'label' => $thread->type() == Threads::TYPE_DELETED ? wfMsg( 'lqt_undelete' ) : wfMsg( 'delete' ), |
583 | | - 'href' => $delete_url, |
| 580 | + if ( $this->user->isAllowed( 'delete' ) ) { |
| 581 | + $threadText = $thread->title()->getPrefixedText(); |
| 582 | + $deleteTitle = SpecialPage::getTitleFor( 'DeleteThread', $threadText ); |
| 583 | + $delete_url = $deleteTitle->getFullURL(); |
| 584 | + $deleteMsg = $thread->type() == Threads::TYPE_DELETED ? 'lqt_undelete' : 'delete'; |
| 585 | + |
| 586 | + $commands['delete'] = array( 'label' => wfMsgExt( $deleteMsg, 'parseinline' ), |
| 587 | + 'href' => $delete_url, |
584 | 588 | 'enabled' => true ); |
585 | 589 | } |
586 | 590 | |
587 | | - $commands[] = array( 'label' => '<b class="lqt_reply_link">' . wfMsg( 'lqt_reply' ) . '</b>', |
| 591 | + return $commands; |
| 592 | + } |
| 593 | + |
| 594 | + // Commands for the bottom. |
| 595 | + function threadFooterCommands( $thread ) { |
| 596 | + wfLoadExtensionMessages( 'LiquidThreads' ); |
| 597 | + |
| 598 | + $commands = array(); |
| 599 | + |
| 600 | + $commands['reply'] = array( 'label' => wfMsgExt( 'lqt_reply', 'parseinline' ), |
588 | 601 | 'href' => $this->talkpageUrl( $this->title, 'reply', $thread ), |
589 | | - 'enabled' => $user_can_edit ); |
590 | | - |
| 602 | + 'enabled' => true, |
| 603 | + 'icon' => 'reply.png'); |
| 604 | + |
591 | 605 | return $commands; |
592 | 606 | } |
593 | 607 | |
— | — | @@ -594,23 +608,23 @@ |
595 | 609 | wfLoadExtensionMessages( 'LiquidThreads' ); |
596 | 610 | $commands = array(); |
597 | 611 | |
598 | | - $commands[] = array( 'label' => wfMsg( 'history_short' ), |
| 612 | + $commands['history'] = array( 'label' => wfMsg( 'history_short' ), |
599 | 613 | 'href' => self::permalinkUrl( $thread, 'thread_history' ), |
600 | 614 | 'enabled' => true ); |
601 | 615 | |
602 | 616 | if ( in_array( 'move', $this->user->getRights() ) ) { |
603 | 617 | $move_href = SpecialPage::getTitleFor( 'MoveThread' )->getFullURL() |
604 | 618 | . '/' . $thread->title()->getPrefixedURL(); |
605 | | - $commands[] = array( 'label' => wfMsg( 'move' ), |
| 619 | + $commands['move'] = array( 'label' => wfMsg( 'move' ), |
606 | 620 | 'href' => $move_href, |
607 | 621 | 'enabled' => true ); |
608 | 622 | } |
609 | 623 | if ( !$this->user->isAnon() && !$thread->title()->userIsWatching() ) { |
610 | | - $commands[] = array( 'label' => wfMsg( 'watch' ), |
| 624 | + $commands['watch'] = array( 'label' => wfMsg( 'watch' ), |
611 | 625 | 'href' => self::permalinkUrlWithQuery( $thread, 'action=watch' ), |
612 | 626 | 'enabled' => true ); |
613 | 627 | } else if ( !$this->user->isAnon() ) { |
614 | | - $commands[] = array( 'label' => wfMsg( 'unwatch' ), |
| 628 | + $commands['unwatch'] = array( 'label' => wfMsg( 'unwatch' ), |
615 | 629 | 'href' => self::permalinkUrlWithQuery( $thread, 'action=unwatch' ), |
616 | 630 | 'enabled' => true ); |
617 | 631 | } |
— | — | @@ -620,7 +634,7 @@ |
621 | 635 | $thread->title()->getPrefixedText() ); |
622 | 636 | $delete_href = $delete_title->getFullURL(); |
623 | 637 | |
624 | | - $commands[] = array( 'label' => wfMsg( 'delete' ), |
| 638 | + $commands['delete'] = array( 'label' => wfMsg( 'delete' ), |
625 | 639 | 'href' => $delete_href, |
626 | 640 | 'enabled' => true ); |
627 | 641 | } |
— | — | @@ -667,35 +681,71 @@ |
668 | 682 | } |
669 | 683 | $this->output->addHTML( '</li></div>' ); |
670 | 684 | } |
| 685 | + |
| 686 | + function showThreadHeader( $thread ) { |
| 687 | + global $wgLang; |
| 688 | + |
| 689 | + $sk = $this->user->getSkin(); |
| 690 | + $html = ''; |
| 691 | + |
| 692 | + $infoElements = array(); |
| 693 | + |
| 694 | + // Author name. |
| 695 | + $author = $thread->root()->originalAuthor(); |
| 696 | + $signature = $sk->userLink( $author->getId(), $author->getName() ); |
| 697 | + $signature = Xml::tags( 'span', array( 'class' => 'lqt-thread-header-author' ), |
| 698 | + $signature ); |
| 699 | + $signature .= $sk->userToolLinks( $author->getId(), $author->getName() ); |
| 700 | + $infoElements[] = Xml::tags( 'span', array( 'class' => 'lqt-thread-header-signature' ), |
| 701 | + $signature ); |
| 702 | + |
| 703 | + $timestamp = $wgLang->timeanddate( $thread->created(), true ); |
| 704 | + $infoElements[] = Xml::element( 'span', array( 'class' => 'lqt-thread-header-timestamp' ), |
| 705 | + $timestamp ); |
| 706 | + |
| 707 | + // Check for edited flag. |
| 708 | + $editedFlag = $thread->editedness(); |
| 709 | + $ebLookup = array( Threads::EDITED_BY_AUTHOR => 'author', |
| 710 | + Threads::EDITED_BY_OTHERS => 'others' ); |
| 711 | + if ( isset( $ebLookup[$editedFlag] ) ) { |
671 | 712 | |
| 713 | + $editedBy = $ebLookup[$editedFlag]; |
| 714 | + $editedNotice = wfMsgExt( 'lqt-thread-edited-'.$editedBy, 'parseinline' ); |
| 715 | + $infoElements[] = Xml::element( 'span', array( 'class' => |
| 716 | + 'lqt-thread-header-edited-'.$editedBy ), |
| 717 | + $editedNotice ); |
| 718 | + } |
| 719 | + |
| 720 | + $html .= Xml::tags( 'span', array( 'class' => 'lqt-thread-header-info' ), |
| 721 | + $wgLang->pipeList( $infoElements ) ); |
| 722 | + |
| 723 | + /// RHS � actions. Show as a drop-down |
| 724 | + $commands = $this->threadCommands( $thread ); |
| 725 | + $commandHTML = Xml::tags( 'ul', array( 'class' => 'lqt-thread-header-command-list' ), |
| 726 | + $this->listItemsForCommands( $commands ) ); |
| 727 | + |
| 728 | + $triggerText = wfMsgExt( 'lqt-header-actions', 'parseinline' ) . |
| 729 | + Xml::tags( 'span', array('class' => 'lqt-thread-actions-icon'), |
| 730 | + ' '); |
| 731 | + $dropDownTrigger = Xml::tags( 'span', |
| 732 | + array( 'class' => 'lqt-thread-actions-trigger' ), |
| 733 | + $triggerText ); |
| 734 | + $dropDown = Xml::tags( 'div', |
| 735 | + array( 'class' => 'lqt-thread-header-commands' ), |
| 736 | + $dropDownTrigger . $commandHTML ); |
| 737 | + $html .= $dropDown; |
| 738 | + |
| 739 | + $html = Xml::tags( 'div', array( 'class' => 'lqt-thread-header' ), $html ); |
| 740 | + |
| 741 | + $this->output->addHTML( $html ); |
| 742 | + } |
| 743 | + |
672 | 744 | function showThreadFooter( $thread ) { |
673 | 745 | global $wgLang, $wgUser; |
674 | 746 | |
675 | 747 | $sk = $wgUser->getSkin(); |
676 | 748 | $html = ''; |
677 | 749 | |
678 | | - // Author signature. |
679 | | - $author = $thread->root()->originalAuthor(); |
680 | | - $sig = $this->user->getSkin()->userLink( $author->getID(), $author->getName() ) . |
681 | | - $this->user->getSkin()->userToolLinks( $author->getID(), $author->getName() ); |
682 | | - $html .= Xml::tags( 'li', array( 'class' => 'lqt_author_sig' ), $sig ); |
683 | | - |
684 | | - // Edited flag |
685 | | - if ( $thread->editedness() == Threads::EDITED_BY_AUTHOR || $thread->editedness() == Threads::EDITED_BY_OTHERS ) { |
686 | | - wfLoadExtensionMessages( 'LiquidThreads' ); |
687 | | - list($edited_title) = self::permalinkData( $thread ); |
688 | | - $edited_text = wfMsgExt( 'lqt_edited_notice', 'parseinline' ); |
689 | | - $edited_link = $sk->link( $edited_title, $edited_text, |
690 | | - array( 'class' => 'lqt_edited_notice'), |
691 | | - array( 'action' => 'history' ) ); |
692 | | - |
693 | | - $html .= Xml::tags( 'li', array( 'class' => 'lqt_edited_notice' ), $edited_link ); |
694 | | - } |
695 | | - |
696 | | - // Timestamp |
697 | | - $timestamp = $wgLang->timeanddate( $thread->created(), true ); |
698 | | - $html .= Xml::element( 'li', null, $timestamp ); |
699 | | - |
700 | 750 | // Footer commands |
701 | 751 | $footerCommands = |
702 | 752 | $this->listItemsForCommands( $this->threadFooterCommands( $thread ) ); |
— | — | @@ -709,35 +759,57 @@ |
710 | 760 | |
711 | 761 | function listItemsForCommands( $commands ) { |
712 | 762 | $result = array(); |
713 | | - foreach ( $commands as $command ) { |
| 763 | + foreach ( $commands as $key => $command ) { |
714 | 764 | $label = $command['label']; |
715 | 765 | $href = $command['href']; |
716 | 766 | $enabled = $command['enabled']; |
| 767 | + |
| 768 | + if ( isset( $command['icon'] ) ) { |
| 769 | + global $wgScriptPath; |
| 770 | + $src = $wgScriptPath . '/extensions/LiquidThreads/icons/'.$command['icon']; |
| 771 | + $icon = Xml::element( 'img', array( 'src' => $src, |
| 772 | + 'alt' => $label, |
| 773 | + 'class' => 'lqt-command-icon' ) ); |
| 774 | + $label = $icon.' '.$label; |
| 775 | + } |
| 776 | + |
| 777 | + $thisCommand = ''; |
717 | 778 | |
718 | 779 | if ( $enabled ) { |
719 | | - $result[] = "<li><a href=\"$href\">$label</a></li>"; |
| 780 | + $thisCommand = Xml::tags( 'a', array( 'href' => $href ), $label ); |
720 | 781 | } else { |
721 | | - $result[] = "<li><span class=\"lqt_command_disabled\">$label</span></li>"; |
| 782 | + $thisCommand = Xml::tags( 'span', array( 'class' => 'lqt_command_disabled' ), |
| 783 | + $label ); |
722 | 784 | } |
| 785 | + |
| 786 | + $thisCommand = Xml::tags( 'li', |
| 787 | + array( 'class' => 'lqt-command lqt-command-'.$key ), |
| 788 | + $thisCommand ); |
| 789 | + |
| 790 | + $result[] = $thisCommand; |
723 | 791 | } |
724 | | - return join( "", $result ); |
| 792 | + return join( ' ', $result ); |
725 | 793 | } |
726 | 794 | |
727 | | - function showRootPost( $thread ) { |
| 795 | + /** Shows a normal (i.e. not deleted or moved) thread body */ |
| 796 | + function showThreadBody( $thread ) { |
| 797 | + |
| 798 | + // Remove 'editsection', it won't work. |
728 | 799 | $popts = $this->output->parserOptions(); |
729 | 800 | $previous_editsection = $popts->getEditSection(); |
730 | 801 | $popts->setEditSection( false ); |
731 | 802 | $this->output->parserOptions( $popts ); |
732 | 803 | |
733 | 804 | $post = $thread->root(); |
| 805 | + |
| 806 | + $divClass = $this->postDivClass( $thread ); |
| 807 | + $html = Xml::openElement( 'div', array( 'class' => $divClass ) ); |
734 | 808 | |
735 | 809 | // This is a bit of a hack to have individual histories work. |
736 | 810 | // We can grab oldid either from lqt_oldid (which is a thread rev), |
737 | 811 | // or from oldid (which is a page rev). But oldid only applies to the |
738 | 812 | // thread being requested, not any replies. TODO: eliminate the need |
739 | 813 | // for article-level histories. |
740 | | - $divClass = $this->postDivClass( $thread ); |
741 | | - $html = Xml::openElement( 'div', array( 'class' => $divClass ) ); |
742 | 814 | $page_rev = $this->request->getVal( 'oldid', null ); |
743 | 815 | if ( $page_rev !== null && $this->title->equals( $thread->root()->getTitle() ) ) { |
744 | 816 | $oldid = $page_rev; |
— | — | @@ -745,6 +817,7 @@ |
746 | 818 | $oldid = $thread->isHistorical() ? $thread->rootRevision() : null; |
747 | 819 | } |
748 | 820 | |
| 821 | + // If we're editing the thread, show the editing form. |
749 | 822 | if ( $this->methodAppliesToThread( 'edit', $thread ) ) { |
750 | 823 | $this->output->addHTML( $html ); |
751 | 824 | $html = ''; |
— | — | @@ -753,13 +826,17 @@ |
754 | 827 | // so I'm just flushing the HTML and displaying it as-is. |
755 | 828 | $this->showPostEditingForm( $thread ); |
756 | 829 | } else { |
| 830 | + $html .= $this->showThreadHeader( $thread ); |
| 831 | + $html .= $this->getReplyContext( $thread ); |
757 | 832 | $html .= $this->showPostBody( $post, $oldid ); |
758 | 833 | $html .= $this->showThreadFooter( $thread ); |
759 | 834 | } |
760 | 835 | |
761 | 836 | // wish I didn't have to use this open/closeElement cruft. |
762 | 837 | $html .= Xml::closeElement( 'div' ); |
763 | | - |
| 838 | + |
| 839 | + |
| 840 | + // If we're replying to this thread, show the reply form after it. |
764 | 841 | if ( $this->methodAppliesToThread( 'reply', $thread ) ) { |
765 | 842 | // As with above, flush HTML to avoid refactoring EditPage. |
766 | 843 | $html .= $this->indent( $thread ); |
— | — | @@ -774,6 +851,8 @@ |
775 | 852 | $this->output->parserOptions( $popts ); |
776 | 853 | } |
777 | 854 | |
| 855 | + /** Shows the headING for a thread (as opposed to the headeER for a post within |
| 856 | + a thread). */ |
778 | 857 | function showThreadHeading( $thread ) { |
779 | 858 | if ( $thread->hasDistinctSubject() ) { |
780 | 859 | if ( $thread->hasSuperthread() ) { |
— | — | @@ -803,21 +882,9 @@ |
804 | 883 | static function anchorName( $thread ) { |
805 | 884 | return "lqt_thread_{$thread->id()}"; |
806 | 885 | } |
807 | | - |
808 | | - function showThread( $thread ) { |
809 | | - global $wgLang; |
810 | | - |
811 | | - $sk = $this->user->getSkin(); |
812 | | - |
813 | | - $html = ''; |
814 | | - |
815 | | - // Safeguard |
816 | | - if ( $thread->type() == Threads::TYPE_DELETED |
817 | | - && ! ($this->request->getBool( 'lqt_show_deleted_threads' ) |
818 | | - && $this->user->isAllowed( 'deletedhistory' ) ) ) { |
819 | | - return; |
820 | | - } |
821 | | - |
| 886 | + |
| 887 | + // Gets HTML for the 'in reply to' thing if warranted. |
| 888 | + function getReplyContext( $thread ) { |
822 | 889 | if ( $this->lastUnindentedSuperthread ) { |
823 | 890 | wfLoadExtensionMessages( 'LiquidThreads' ); |
824 | 891 | $tmp = $this->lastUnindentedSuperthread; |
— | — | @@ -826,52 +893,72 @@ |
827 | 894 | $msg = wfMsgExt( 'lqt_in_response_to', array( 'parseinline', 'replaceafter' ), |
828 | 895 | array( $replyLink, $tmp->root()->originalAuthor()->getName() ) ); |
829 | 896 | |
830 | | - $html .= Xml::tags( 'span', array( 'class' => 'lqt_nonindent_message' ), |
| 897 | + return Xml::tags( 'span', array( 'class' => 'lqt_nonindent_message' ), |
831 | 898 | "← $msg" ); |
832 | 899 | } |
| 900 | + |
| 901 | + return ''; |
| 902 | + } |
| 903 | + |
| 904 | + // Display a moved thread |
| 905 | + function showMovedThread( $thread ) { |
| 906 | + global $wgLang; |
| 907 | + |
| 908 | + // Grab target thread |
| 909 | + $article = new Article( $thread->title() ); |
| 910 | + $target = Title::newFromRedirect( $article->getText() ); |
| 911 | + $t_thread = Threads::withRoot( new Article( $target ) ); |
| 912 | + |
| 913 | + // Grab data about the new post. |
| 914 | + $author = $thread->root()->originalAuthor(); |
| 915 | + $sig = $sk->userLink( $author->getID(), $author->getName() ) . |
| 916 | + $sk->userToolLinks( $author->getID(), $author->getName() ); |
| 917 | + |
| 918 | + $html = |
| 919 | + wfMsgExt( 'lqt_move_placeholder', array( 'parseinline', 'replaceafter' ), |
| 920 | + $sk->link( $target ), |
| 921 | + $sig, |
| 922 | + $wgLang->date( $thread->modified() ), |
| 923 | + $wgLang->time( $thread->modified() ) |
| 924 | + ); |
| 925 | + |
| 926 | + $this->output->addHTML( $html ); |
| 927 | + } |
| 928 | + |
| 929 | + /** Shows a deleted thread. Returns true to show the thread body */ |
| 930 | + function showDeletedThread( $thread ) { |
| 931 | + if ( $this->user->isAllowed( 'deletedhistory' ) ) { |
| 932 | + $this->output->addWikiMsg( 'lqt_thread_deleted_for_sysops' ); |
| 933 | + return true; |
| 934 | + } else { |
| 935 | + $msg = wfMsgExt( 'lqt_thread_deleted', 'parseinline' ); |
| 936 | + $msg = Xml::tags( 'em', null, $msg ); |
| 937 | + $msg = Xml::tags( 'p', null, $msg ); |
833 | 938 | |
834 | | - |
835 | | - $html .= $this->showThreadHeading( $thread ); |
836 | | - |
837 | | - $html .= Xml::element( 'a', array( 'name' => $this->anchorName($thread) ), ' ' ); |
838 | | - |
| 939 | + $this->output->addHTML( $msg ); |
| 940 | + return false; |
| 941 | + } |
| 942 | + } |
| 943 | + |
| 944 | + // Shows a single thread, rather than a thread tree. |
| 945 | + function showSingleThread( $thread ) { |
| 946 | + wfLoadExtensionMessages( 'LiquidThreads' ); |
| 947 | + |
| 948 | + $html = ''; |
| 949 | + |
| 950 | + // If it's a 'moved' thread, show the placeholder |
839 | 951 | if ( $thread->type() == Threads::TYPE_MOVED ) { |
840 | | - wfLoadExtensionMessages( 'LiquidThreads' ); |
| 952 | + $this->showMovedThread( $thread ); |
| 953 | + return; |
| 954 | + } elseif ( $thread->type() == Threads::TYPE_DELETED ) { |
| 955 | + $res = $this->showDeletedThread( $thread ); |
841 | 956 | |
842 | | - $revision = Revision::newFromTitle( $thread->title() ); |
843 | | - $target = Title::newFromRedirect( $revision->getText() ); |
844 | | - $t_thread = Threads::withRoot( new Article( $target ) ); |
845 | | - $author = $thread->root()->originalAuthor(); |
846 | | - $sig = $sk->userLink( $author->getID(), $author->getName() ) . |
847 | | - $sk->userToolLinks( $author->getID(), $author->getName() ); |
848 | | - |
849 | | - $html .= |
850 | | - wfMsgExt( 'lqt_move_placeholder', array( 'parseinline', 'replaceafter' ), |
851 | | - $sk->link( $target ), |
852 | | - $sig, |
853 | | - $wgLang->date( $thread->modified() ), |
854 | | - $wgLang->time( $thread->modified() ) |
855 | | - ); |
856 | | - return $html; |
| 957 | + if (!$res) return; |
857 | 958 | } |
858 | | - |
859 | | - if ( $thread->type() == Threads::TYPE_DELETED ) { |
860 | | - wfLoadExtensionMessages( 'LiquidThreads' ); |
861 | | - if ( in_array( 'deletedhistory', $this->user->getRights() ) ) { |
862 | | - $html .= wfMsgExt( 'lqt_thread_deleted_for_sysops', 'parse' ); |
863 | | - } |
864 | | - else { |
865 | | - $msg = wfMsgExt( 'lqt_thread_deleted', 'parseinline' ); |
866 | | - $msg = Xml::tags( 'em', null, $msg ); |
867 | | - $msg = Xml::tags( 'p', null, $msg ); |
868 | | - $html .= $msg; |
869 | | - return $html; |
870 | | - } |
871 | | - } |
| 959 | + |
872 | 960 | if ( $thread->summary() ) { |
873 | 961 | $html .= $this->showPostBody( $thread->summary() ); |
874 | | - } elseif( $thread->isArchiveEligible() ) |
875 | | - { |
| 962 | + } elseif ( $thread->isArchiveEligible() ) { |
876 | 963 | wfLoadExtensionMessages( 'LiquidThreads' ); |
877 | 964 | |
878 | 965 | $permalink_text = wfMsgNoTrans( 'lqt_summary_notice_link' ); |
— | — | @@ -882,17 +969,41 @@ |
883 | 970 | |
884 | 971 | $html .= $msg; |
885 | 972 | } |
| 973 | + |
| 974 | + // Unfortunately, I can't rewrite showRootPost() to pass back HTML |
| 975 | + // as it would involve rewriting EditPage, which I do NOT intend to do. |
886 | 976 | |
| 977 | + $this->output->addHTML( $html ); |
| 978 | + |
| 979 | + $this->showThreadBody( $thread ); |
| 980 | + |
| 981 | + } |
| 982 | + |
| 983 | + function showThread( $thread ) { |
| 984 | + global $wgLang; |
| 985 | + |
| 986 | + // Safeguard |
| 987 | + if ( $thread->type() == Threads::TYPE_DELETED |
| 988 | + && ! ($this->request->getBool( 'lqt_show_deleted_threads' ) |
| 989 | + && $this->user->isAllowed( 'deletedhistory' ) ) ) { |
| 990 | + return; |
| 991 | + } |
| 992 | + |
| 993 | + $sk = $this->user->getSkin(); |
| 994 | + |
| 995 | + $html = ''; |
| 996 | + |
| 997 | + $html .= Xml::element( 'a', array( 'name' => $this->anchorName($thread) ), ' ' ); |
| 998 | + $html .= $this->showThreadHeading( $thread ); |
| 999 | + |
887 | 1000 | // Sigh. |
888 | 1001 | $html .= Xml::openElement( 'div', array( 'class' => 'lqt_thread', |
889 | 1002 | 'id' => 'lqt_thread_id_'. $thread->id() ) ); |
890 | | - |
891 | | - // Unfortunately, I can't rewrite showRootPost() to pass back HTML |
892 | | - // as it would involve rewriting EditPage, which I do NOT intend to do. |
893 | 1003 | |
| 1004 | + // Flush output to display thread |
894 | 1005 | $this->output->addHTML( $html ); |
895 | 1006 | |
896 | | - $this->showRootPost( $thread ); |
| 1007 | + $this->showSingleThread( $thread ); |
897 | 1008 | |
898 | 1009 | if ( $thread->hasSubthreads() ) { |
899 | 1010 | $this->output->addHTML( $this->indent( $thread ) ); |
Index: trunk/extensions/LiquidThreads/pages/TalkpageView.php |
— | — | @@ -269,7 +269,7 @@ |
270 | 270 | $recently_archived_threads = $this->queries->query( 'recently-archived' ); |
271 | 271 | |
272 | 272 | $toc = ''; |
273 | | - if ( count( $threads ) > 3 || count( $recently_archived_threads ) > 0 ) { |
| 273 | + if ( count( $threads ) > 1 || count( $recently_archived_threads ) > 0 ) { |
274 | 274 | $toc = $this->getTOC( $threads ); |
275 | 275 | } |
276 | 276 | |
Index: trunk/extensions/LiquidThreads/icons/arrow-down-icon.png |
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes on: trunk/extensions/LiquidThreads/icons/arrow-down-icon.png |
___________________________________________________________________ |
Name: svn:mime-type |
277 | 277 | + application/octet-stream |
Index: trunk/extensions/LiquidThreads/icons/reply.png |
— | — | @@ -0,0 +1,39 @@ |
| 2 | +�PNG
|
| 3 | + |
| 4 | +
+IHDR 3 . ��!o sBIT|d� pHYs
+�
+�B(�x tEXtSoftware www.inkscape.org��< �IDATh��Yy���}�������Sم�!�I�!��ETbL�1�Q��#��"D
+ e��$��á��Zʊ�0^�)�����=�����13��콬���zӯ_���;��R"K˗/�87�SG��B0�TEuM��]�I�u� �|h��`.�_���N��}�K㙮{�ؠ�@�d2��[��wGS���{�
+���I)1o�<_ ���[���>�f��Z(cE����p��a��ʪ�5���9s�BݻI)�dٟ�_}�w��֎�x|h?`II ����>�x�_S�j۱� !�+J$UU�*�0S�kw��~K� H����kɲ�C�566�ڴ�� W]~�2r�H�x� ���"�uKb�����X�Ȣ�ļ�o���.P���o��DϢA����]��[�,�B$Bn�1�`���{���;�m��P����d��лs��w�|�53U ��cp]g�@�tbI�,�bQ�5q�2bĈ .�v����U�B�iڊ+D��H)(��TTT�Ņ��Ι<UWH���� D`P��)R�*<w����[UU)��'e���u]�������:��Sj�9�g���1�_@���$3�Ra�?{}1"(ٙ<���
+
+���B lG�X�V% ��44U��W@h?87�A�NE���ЙPEF-W
+'R�CӘ(���s�H |
| 5 | +�}��
+I> ( |
| 6 | +# 06���� ��pj Y�HF���hnu��R�dw���2C&m�(7p���dE��i����� o���ф����ѥ1M�E�'��й�q���Y.�9�:h~t�=`�PM �
+ێx�>qX(X����]��f�DB_߰�����/�b�S\��mP����KBfv ^��)+-��5�Щ5c�>�w��y���& P��A�a�-V��t]�6��b��#�us"}v�����66n����y/��r���
+ڂ�s=�U<�����'���O������+ �y5~�#���������P����C�]���*y�hk`K㖟��Y���4�F0ؽVG���U���MR=uᄑ#����*�-�0b���-�f F0<���iKY�Fv ��#�������ګ���a��dž�٪>~}�\S�v�kÙ�jQ��CU��;��0��;�`��8E�Q�t���h���%MW
+�OsH��1��;�_}Ŏ��y�' �^;b$����x |
| 7 | +uK0PS]�1�k`9�d |
| 8 | +����4�$b����[�l��x=^�-a�Z�r���hq�яEdY�_�r�eY�uO<���k�a�6��.�(RU���w�5�{4Ǹ�PT�G�t7�LQ |
| 9 | +��=Y��־��T;lXeʴ]-a�$�@�p��"IϾ/�����z�7�tm眍�7ֺ�=�ЍA�e�X�l#V�Մ`Y)��A�pL |
| 10 | +#Rv� ��d�����b�so���*{ڈ�-����II �T�P8�H[���=��3.�� ��m?
+N<묇 |
| 11 | +d��c������@�)P4
+ �F�`����.�����ys�{�5�����k����>�і�+�0�1$��JY"3�ea��R����O�s]��^~�X�1��J��<�#�9el��^lҷx�?���:�5U2͠S�LaHq�:��D �$ci!�e��i[��j��Go#]� �go��p�]Z����e�Pu�O����ぢ�`��D+o9� |
| 12 | + $ "0�$�䜃K2���!�Xձ�Y�H����@:)[vzꭤV�݁e�����WZ��� �{�
+Hr9��U��bDZ#ɶ����f; I' ���)�;7k>��'���A3<�q�d[�Nbֱ��ʽ�i�B@Z�B��k�Ǹ��P
+�ʪ�;�M�p���X�AG����3�wꙻX�h҄�_$���:�s�=���8 ��D |
| 13 | +�d$$��q�-����L�:yR� ����&2C�@@�R^!�uw�dV=x=�|3��$�r�a�ckU�Jx�қ7�2��#'�e����I)� ���͘4��/�1n�b�aƢ٨=)B��L�Cn{K����?1(y�g�����a۶QQQ M�2e |
| 14 | +����Iou��3��lf�w�x���xܱhZ�۠��+5��
+'eAH )�\خc���G�
+܉=yxÃ�@�j�?���57��e�^�(�P����c|��I����d���՝�I��<�|#}����?�k�NF#𐃀�:r��B�O���i}sYs����X��n��N�.T����tvQ� ����<��z8���KQ~���q���q��5��h�� 4����2�cT�w���i��H_�P ���_� |
| 15 | +~U��^c&�J���K�'S)���p�� |
| 16 | +�Yz3~���`�;`�"=�� �_/��lFY!��9,d>;����3�����fD��̻���p��W�3V�{��BY��t��Ek��P;t�q�J�h�D���k�� ��=���n��M�g�y�\M�.v��y�c]8]�=i�FDy���X�z����м^����Xd����\�#�)���d�P���ZSS�q\W�3ι,
+z�{͌�U�����zJJJ�X���0�\��; |
| 17 | +��k��`f��.��`:A�=�����'�3e�S�2�L�cy���]�
+�=� ���}m(��U4e7cw, �>�����-�vC����e�y�hk�1*p�w�bօ^�Ig�����_(�\�G�L�f؍�#���,ټ���Ϭ\�c��WM�y^6�>�k�G_�V�Dǂ�'G}e � ^ E �� (P�@U�O��9����Ï,��ۿ�ͦ�H$"�<�蝌Lw?Y�7�d�B�Y#�N����hEc���ʋ�ϭZi�R)���O���[< |