Index: trunk/extensions/LiquidThreads/Lqt.i18n.php |
— | — | @@ -22,7 +22,11 @@ |
23 | 23 | 'lqt_browse_archive_without_recent' => 'View archived threads', |
24 | 24 | 'lqt_browse_archive_with_recent' => 'older', |
25 | 25 | 'lqt_recently_archived' => 'Recently archived:', |
26 | | - 'lqt_contents_title' => 'Contents:', |
| 26 | + 'lqt_contents_title' => 'Contents', |
| 27 | + 'lqt_toc_thread_title' => 'Thread Title', |
| 28 | + 'lqt_toc_thread_author' => 'Started By', |
| 29 | + 'lqt_toc_thread_replycount' => 'Replies', |
| 30 | + 'lqt_toc_thread_modified' => 'Last Modified', |
27 | 31 | 'lqt_add_header' => 'Add header', |
28 | 32 | 'lqt_new_thread' => 'Start a new discussion', |
29 | 33 | 'lqt_invalid_subject' => 'The subject you entered is invalid. It may: |
Index: trunk/extensions/LiquidThreads/lqt.css |
— | — | @@ -134,7 +134,6 @@ |
135 | 135 | .lqt_toc_archive_wrapper { |
136 | 136 | margin-top: 0.5em; |
137 | 137 | margin-bottom: 1.5em; |
138 | | - float: left; |
139 | 138 | } |
140 | 139 | .lqt_archive_teaser ul, |
141 | 140 | .lqt_toc_wrapper ul { |
— | — | @@ -442,3 +441,15 @@ |
443 | 442 | .lqt_rc_author_notice_others { |
444 | 443 | color: #cd9800; |
445 | 444 | } |
| 445 | + |
| 446 | +.lqt_toc { |
| 447 | + width: 80%; |
| 448 | + border-collapse: collapse; |
| 449 | +} |
| 450 | + |
| 451 | +.lqt_toc td,.lqt_toc th { |
| 452 | + margin: 0; |
| 453 | + padding: 0.2em; |
| 454 | + border-bottom: 1px solid #aaaaaa; |
| 455 | + text-align: left; |
| 456 | +} |
Index: trunk/extensions/LiquidThreads/pages/TalkpageView.php |
— | — | @@ -69,28 +69,53 @@ |
70 | 70 | } |
71 | 71 | $this->output->addHTML( Xml::closeElement( $kind ) ); |
72 | 72 | } |
73 | | - |
| 73 | + |
74 | 74 | function showTOC( $threads ) { |
| 75 | + global $wgLang; |
| 76 | + |
75 | 77 | wfLoadExtensionMessages( 'LiquidThreads' ); |
76 | 78 | |
77 | 79 | $sk = $this->user->getSkin(); |
78 | | - $toclines = array(); |
79 | | - $i = 1; |
80 | | - $toclines[] = $sk->tocIndent(); |
81 | | - foreach ( $threads as $t ) { |
82 | | - $toclines[] = $sk->tocLine( $this->anchorName( $t ), $t->subjectWithoutIncrement(), $i, 1 ); |
83 | | - $i++; |
| 80 | + |
| 81 | + $title = Xml::tags( 'h2', null, wfMsgExt( 'lqt_contents_title', 'parseinline' ) ); |
| 82 | + $this->output->addHTML( $title ); |
| 83 | + |
| 84 | + $html = ''; |
| 85 | + |
| 86 | + // Header row |
| 87 | + $headerRow = ''; |
| 88 | + $headers = array( 'lqt_toc_thread_title', 'lqt_toc_thread_author', |
| 89 | + 'lqt_toc_thread_replycount', 'lqt_toc_thread_modified' ); |
| 90 | + foreach( $headers as $msg ) { |
| 91 | + $headerRow .= Xml::tags( 'th', null, wfMsgExt( $msg, 'parseinline' ) ); |
84 | 92 | } |
85 | | - $toclines[] = $sk->tocUnindent( 1 ); |
86 | | - |
87 | | - $this->openDiv( 'lqt_toc_wrapper' ); |
88 | | - $this->output->addHTML( '<h2 class="lqt_toc_title">' . wfMsg( 'lqt_contents_title' ) . '</h2> <ul>' ); |
89 | | - |
90 | | - foreach ( $threads as $t ) { |
91 | | - $this->output->addHTML( '<li><a href="#' . $this->anchorName( $t ) . '">' . $t->subjectWithoutIncrement() . '</a></li>' ); |
| 93 | + $headerRow = Xml::tags( 'tr', null, $headerRow ); |
| 94 | + $headerRow = Xml::tags( 'thead', null, $headerRow ); |
| 95 | + |
| 96 | + // Table body |
| 97 | + $rows = array(); |
| 98 | + foreach( $threads as $thread ) { |
| 99 | + $row = ''; |
| 100 | + $subject = $this->output->parseInline( $thread->subjectWithoutIncrement() ); |
| 101 | + $row .= Xml::tags( 'td', null, $subject ); |
| 102 | + |
| 103 | + $author = $thread->root()->originalAuthor(); |
| 104 | + $authorLink = $sk->userLink( $author->getID(), $author->getName() ); |
| 105 | + $row .= Xml::tags( 'td', null, $authorLink ); |
| 106 | + |
| 107 | + $row .= Xml::element( 'td', null, count( $thread->replies() ) ); |
| 108 | + |
| 109 | + $timestamp = $wgLang->timeanddate( $thread->created(), true ); |
| 110 | + $row .= Xml::element( 'td', null, $timestamp ); |
| 111 | + |
| 112 | + $row = Xml::tags( 'tr', null, $row ); |
| 113 | + $rows[] = $row; |
92 | 114 | } |
93 | | - |
94 | | - $this->output->addHTML( '</ul></div>' ); |
| 115 | + |
| 116 | + $html = $headerRow . "\n" . Xml::tags( 'tbody', null, implode( "\n", $rows ) ); |
| 117 | + $html = Xml::tags( 'table', array( 'class' => 'lqt_toc' ), $html ); |
| 118 | + |
| 119 | + $this->output->addHTML( $html ); |
95 | 120 | } |
96 | 121 | |
97 | 122 | function showArchiveWidget( $threads ) { |