r52132 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r52131‎ | r52132 | r52133 >
Date:17:41, 18 June 2009
Author:werdna
Status:ok
Tags:
Comment:
Add quoting functionality to LQT reply view
Modified paths:
  • /trunk/extensions/LiquidThreads/Lqt.i18n.php (modified) (history)
  • /trunk/extensions/LiquidThreads/classes/LqtView.php (modified) (history)
  • /trunk/phase3/includes/EditPage.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/EditPage.php
@@ -103,7 +103,8 @@
104104 $this->editFormTextBeforeContent =
105105 $this->editFormTextAfterWarn =
106106 $this->editFormTextAfterTools =
107 - $this->editFormTextBottom = "";
 107+ $this->editFormTextBottom =
 108+ $this->mPreloadText = "";
108109 }
109110
110111 function getArticle() {
@@ -200,6 +201,11 @@
201202 wfProfileOut( __METHOD__ );
202203 return $text;
203204 }
 205+
 206+ /** Use this method before edit() to preload some text into the edit box */
 207+ public function setPreloadedText( $text ) {
 208+ $this->mPreloadText = $text;
 209+ }
204210
205211 /**
206212 * Get the contents of a page from its title and remove includeonly tags
@@ -208,7 +214,9 @@
209215 * @return string The contents of the page.
210216 */
211217 protected function getPreloadedText( $preload ) {
212 - if ( $preload === '' ) {
 218+ if ( !empty($this->mPreloadText) ) {
 219+ return $this->mPreloadText;
 220+ } elseif ( $preload === '' ) {
213221 return '';
214222 } else {
215223 $preloadTitle = Title::newFromText( $preload );
Index: trunk/extensions/LiquidThreads/classes/LqtView.php
@@ -365,6 +365,24 @@
366366 Xml::inputLabel( $subject_label, 'lqt_subject_field', 'lqt_subject_field',
367367 60, $subject, $disableattr ) . Xml::element( 'br' );
368368 }
 369+
 370+ // Quote the original message if we're replying
 371+ if ( $edit_type == 'reply' ) {
 372+ global $wgContLang;
 373+
 374+ $thread_article = new Post( $edit_applies_to->title() );
 375+
 376+ $quote_text = $thread_article->getContent();
 377+ $timestamp = $edit_applies_to->created();
 378+ $fTime = $wgContLang->time($timestamp);
 379+ $fDate = $wgContLang->date($timestamp);
 380+ $user = $thread_article->originalAuthor()->getName();
 381+
 382+ $quoteIntro = wfMsgForContent( 'lqt-quote-intro', $user, $fTime, $fDate );
 383+ $quote_text = "$quoteIntro\n<blockquote>\n$quote_text\n</blockquote>\n";
 384+
 385+ $e->setPreloadedText( $quote_text );
 386+ }
369387
370388 $e->edit();
371389
Index: trunk/extensions/LiquidThreads/Lqt.i18n.php
@@ -169,6 +169,9 @@
170170 was created on $3 at $4.
171171
172172 You can see it at <$6>",
 173+
 174+ // Quoting functionality
 175+ 'lqt-quote-intro' => 'On $2 at $3, [[User:$1]] wrote:',
173176 );
174177
175178 /** Message documentation (Message documentation)

Follow-up revisions

RevisionCommit summaryAuthorDate
r52135Add link label for 'lqt-quote-intro' which was added in r52132siebrand17:57, 18 June 2009

Status & tagging log