Index: branches/liquidthreads/extensions/LqtExtension.php |
— | — | @@ -21,7 +21,7 @@ |
22 | 22 | require_once('LqtModel.php'); |
23 | 23 | |
24 | 24 | class LqtDispatch { |
25 | | - /** Invoked from performAction() in Wiki.php if this is a discussion namespace. */ |
| 25 | + /* Invoked from performAction() in Wiki.php if this is a discussion namespace. */ |
26 | 26 | static function talkpageMain(&$output, &$talk_article, &$title, &$user, &$request) { |
27 | 27 | // We are given a talkpage article and title. Find the associated |
28 | 28 | // non-talk article and pass that to the view. |
— | — | @@ -67,18 +67,18 @@ |
68 | 68 | } |
69 | 69 | return $q; |
70 | 70 | } |
71 | | - |
| 71 | + |
72 | 72 | /** |
73 | | - @return href for a link to the same page as is being currently viewed, |
74 | | - but with additional query variables. |
75 | | - @param $vars array( 'query_variable_name' => 'value', ... ). |
| 73 | + * @return href for a link to the same page as is being currently viewed, |
| 74 | + * but with additional query variables. |
| 75 | + * @param $vars array( 'query_variable_name' => 'value', ... ). |
76 | 76 | */ |
77 | 77 | function selflink( $vars = null ) { |
78 | 78 | return $this->title->getFullURL( $this->queryStringFromArray($vars) ); |
79 | 79 | } |
80 | 80 | |
81 | 81 | /** |
82 | | - @return true if the value of the give query variable name is equal to the given post's ID. |
| 82 | + * @return true if the value of the give query variable name is equal to the given post's ID. |
83 | 83 | */ |
84 | 84 | function commandApplies( $command, $post ) { |
85 | 85 | return $this->request->getVal($command) == $post->getTitle()->getPrefixedURL(); |
— | — | @@ -210,13 +210,18 @@ |
211 | 211 | } |
212 | 212 | } |
213 | 213 | |
214 | | - function showThreadCommands( $thread ) { |
215 | | - |
| 214 | + function showThreadFooter( $thread ) { |
| 215 | + |
| 216 | + $this->output->addHTML(wfOpenElement('ul', array('class'=>'lqt_footer'))); |
| 217 | + |
| 218 | + $this->output->addHTML( wfOpenElement( 'li' ) ); |
| 219 | + $p = new Parser(); $sig = $p->getUserSig( $thread->rootPost()->originalAuthor() ); |
| 220 | + $this->output->addWikitext( $sig, false ); |
| 221 | + $this->output->addHTML( wfCloseElement( 'li' ) ); |
| 222 | + |
216 | 223 | $commands = array( 'Edit' => $this->selflink( array( LQT_COMMAND_EDIT_POST => $thread->rootPost()->getTitle()->getPrefixedURL() ) ), |
217 | 224 | 'Reply' => $this->selflink( array( LQT_COMMAND_REPLY_TO_POST => $thread->id() ) )); |
218 | 225 | |
219 | | - $this->output->addHTML(wfOpenElement('ul', array('class'=>'lqt_footer'))); |
220 | | - |
221 | 226 | foreach( $commands as $label => $href ) { |
222 | 227 | $this->output->addHTML( wfOpenElement( 'li' ) ); |
223 | 228 | $this->output->addHTML( wfElement('a', array('href'=>$href), $label) ); |
— | — | @@ -235,7 +240,7 @@ |
236 | 241 | $this->showPostEditingForm( $thread ); |
237 | 242 | } else{ |
238 | 243 | $this->showPostBody( $post ); |
239 | | - $this->showThreadCommands( $thread ); |
| 244 | + $this->showThreadFooter( $thread ); |
240 | 245 | } |
241 | 246 | |
242 | 247 | $this->closeDiv(); |
— | — | @@ -281,7 +286,7 @@ |
282 | 287 | if( $this->request->getBool('lqt_new_thread_form') ) { |
283 | 288 | $this->showNewThreadForm(); |
284 | 289 | } else { |
285 | | - $this->output->addHTML("<a href=\"{$this->title->getFullURL('lqt_new_thread_form=1')}\">New Thread</a>"); |
| 290 | + $this->output->addHTML("<a href=\"{$this->title->getFullURL('lqt_new_thread_form=1')}\">Start a Discussion</a>"); |
286 | 291 | } |
287 | 292 | $threads = Thread::allThreadsOfArticle($this->article); |
288 | 293 | foreach($threads as $t) { |
Index: branches/liquidthreads/extensions/LqtModel.php |
— | — | @@ -4,7 +4,25 @@ |
5 | 5 | |
6 | 6 | |
7 | 7 | class Post extends Article { |
8 | | - // Empty for the time being. |
| 8 | + /** |
| 9 | + * Return the User object representing the author of the first revision |
| 10 | + * (or null, if the database is screwed up). |
| 11 | + */ |
| 12 | + function originalAuthor() { |
| 13 | + $dbr =& wfGetDB( DB_SLAVE ); |
| 14 | + |
| 15 | + $line = $dbr->selectRow( array('revision', 'page'), 'rev_user_text', |
| 16 | + array('rev_page = page_id', |
| 17 | + 'page_id' => $this->getID()), |
| 18 | + __METHOD__, |
| 19 | + array('ORDER BY'=> 'rev_timestamp', |
| 20 | + 'LIMIT' => '1') ); |
| 21 | + if ( $line ) |
| 22 | + return User::newFromName($line->rev_user_text, false); |
| 23 | + else |
| 24 | + return null; |
| 25 | + } |
| 26 | + |
9 | 27 | } |
10 | 28 | |
11 | 29 | class Thread { |