Index: branches/liquidthreads/skins/monobook/main.css |
— | — | @@ -83,7 +83,12 @@ |
84 | 84 | background-color: white; |
85 | 85 | } |
86 | 86 | |
87 | | -.lqt_post { border: solid 0px #ddd; margin-bottom: 0em; padding: 0 0 0.5em 0; } |
| 87 | +.lqt_post { |
| 88 | + /*border: solid 1px #ddd; |
| 89 | + border-left: 2px solid;*/ |
| 90 | + margin-bottom: 0em; |
| 91 | + padding: 0 0 0.5em 0em; |
| 92 | +} |
88 | 93 | |
89 | 94 | .lqt_post_highlight { border: solid 1px #fabd23; margin-top: 0.1in; padding: 0.2em; } |
90 | 95 | |
— | — | @@ -93,8 +98,19 @@ |
94 | 99 | margin: 0em 0 0em 0 ; |
95 | 100 | font-size: smaller; |
96 | 101 | color: #777; |
| 102 | + |
| 103 | + padding-left: 0.3em; /* for post colors */ |
| 104 | + border-left: 0.3em solid; |
97 | 105 | } |
98 | 106 | |
| 107 | +.lqt_post_color_1 { border-left-color: #cd9800; } |
| 108 | +.lqt_post_color_2 { border-left-color: #cd0098; } |
| 109 | +.lqt_post_color_3 { border-left-color: #98cd00; } |
| 110 | +.lqt_post_color_4 { border-left-color: #9800cd; } |
| 111 | +.lqt_post_color_5 { border-left-color: #0098cd; } |
| 112 | +.lqt_post_color_6 { border-left-color: #00cd98; } |
| 113 | + |
| 114 | + |
99 | 115 | .lqt_footer li { |
100 | 116 | display: inline; |
101 | 117 | list-style-type: none; |
— | — | @@ -135,10 +151,10 @@ |
136 | 152 | .lqt_post:hover .lqt_footer { |
137 | 153 | color: black; |
138 | 154 | } |
139 | | - |
| 155 | +/* |
140 | 156 | .lqt_post:hover { |
141 | 157 | border-color: #aaa; |
142 | | -} |
| 158 | +}*/ |
143 | 159 | |
144 | 160 | .lqt_post .lqt_footer:hover a { |
145 | 161 | color: #002bb8; |
Index: branches/liquidthreads/extensions/LqtExtension.php |
— | — | @@ -38,15 +38,21 @@ |
39 | 39 | protected $title; |
40 | 40 | protected $request; |
41 | 41 | |
| 42 | + protected $user_colors; |
| 43 | + protected $user_color_index; |
| 44 | + const number_of_user_colors = 6; |
| 45 | + |
42 | 46 | function __construct(&$output, &$article, &$title, &$user, &$request) { |
43 | 47 | $this->article = $article; |
44 | 48 | $this->output = $output; |
45 | 49 | $this->user = $user; |
46 | 50 | $this->title = $title; |
47 | 51 | $this->request = $request; |
| 52 | + $this->user_colors = array(); |
| 53 | + $this->user_color_index = 1; |
48 | 54 | } |
49 | | - |
50 | 55 | |
| 56 | + |
51 | 57 | /** h1, h2, h3, etc. */ |
52 | 58 | var $headerLevel = 1; |
53 | 59 | |
— | — | @@ -231,7 +237,8 @@ |
232 | 238 | |
233 | 239 | function showThreadFooter( $thread ) { |
234 | 240 | |
235 | | - $this->output->addHTML(wfOpenElement('ul', array('class'=>'lqt_footer'))); |
| 241 | + $color_number = $this->selectNewUserColor( $thread->rootPost()->originalAuthor() ); |
| 242 | + $this->output->addHTML(wfOpenElement('ul', array('class'=>"lqt_footer lqt_post_color_$color_number" ))); |
236 | 243 | |
237 | 244 | $this->output->addHTML( wfOpenElement( 'li' ) ); |
238 | 245 | $p = new Parser(); $sig = $p->getUserSig( $thread->rootPost()->originalAuthor() ); |
— | — | @@ -251,9 +258,24 @@ |
252 | 259 | $this->output->addHTML(wfCloseELement('ul')); |
253 | 260 | } |
254 | 261 | |
| 262 | + function selectNewUserColor( $user ) { |
| 263 | + $userkey = $user->isAnon() ? "anon:" . $user->getName() : "user:" . $user->getId(); |
| 264 | + |
| 265 | + if( !array_key_exists( $userkey, $this->user_colors ) ) { |
| 266 | + $this->user_colors[$userkey] = $this->user_color_index; |
| 267 | + $this->user_color_index += 1; |
| 268 | + if ( $this->user_color_index > self::number_of_user_colors ) { |
| 269 | + $this->user_color_index = 1; |
| 270 | + } |
| 271 | + } |
| 272 | + return $this->user_colors[$userkey]; |
| 273 | + } |
| 274 | + |
255 | 275 | function showRootPost( $thread ) { |
256 | 276 | $post = $thread->rootPost(); |
257 | 277 | |
| 278 | +/* $color_number = $this->selectNewUserColor( $thread->rootPost()->originalAuthor() ); |
| 279 | + $this->openDiv( "lqt_post lqt_post_color_$color_number" );*/ |
258 | 280 | $this->openDiv( 'lqt_post' ); |
259 | 281 | |
260 | 282 | if( $this->commandApplies( 'lqt_edit_post', $post ) ) { |
— | — | @@ -306,6 +328,15 @@ |
307 | 329 | unset($content_actions['edit']); |
308 | 330 | unset($content_actions['addsection']); |
309 | 331 | unset($content_actions['history']); |
| 332 | + unset($content_actions['watch']); |
| 333 | + |
| 334 | + /* |
| 335 | + TODO: |
| 336 | + We could make these tabs actually follow the tab metaphor if we repointed |
| 337 | + the 'history' and 'edit' tabs to the original subject page. That way 'discussion' |
| 338 | + would just be one of four ways to view the article. But then those other tabs, for |
| 339 | + logged-in users, don't really fit the metaphor. What to do, what to do? |
| 340 | + */ |
310 | 341 | } |
311 | 342 | function show() { |
312 | 343 | global $wgHooks; |
— | — | @@ -319,7 +350,7 @@ |
320 | 351 | $url = $this->lqtTalkpageUrl( $this->title, 'lqt_new_thread_form' ); |
321 | 352 | $this->output->addHTML("<strong><a href=\"$url\">Start a Discussion</a></strong>"); |
322 | 353 | } |
323 | | - $threads = Thread::allThreadsOfArticle($this->article); |
| 354 | + $threads = Thread::latestNThreadsOfArticle($this->article, 10); |
324 | 355 | foreach($threads as $t) { |
325 | 356 | $this->showThread($t); |
326 | 357 | } |