Revision: 52132 Author: werdna Date: 2009-06-18 17:41:33 +0000 (Thu, 18 Jun 2009)
Log Message: ----------- Add quoting functionality to LQT reply view Modified Paths: -------------- trunk/extensions/LiquidThreads/Lqt.i18n.php trunk/extensions/LiquidThreads/classes/LqtView.php trunk/phase3/includes/EditPage.php Modified: trunk/extensions/LiquidThreads/Lqt.i18n.php =================================================================== --- trunk/extensions/LiquidThreads/Lqt.i18n.php 2009-06-18 17:38:07 UTC (rev 52131) +++ trunk/extensions/LiquidThreads/Lqt.i18n.php 2009-06-18 17:41:33 UTC (rev 52132) @@ -169,6 +169,9 @@ was created on $3 at $4. You can see it at <$6>", + + // Quoting functionality + 'lqt-quote-intro' => 'On $2 at $3, [[User:$1]] wrote:', ); /** Message documentation (Message documentation) Modified: trunk/extensions/LiquidThreads/classes/LqtView.php =================================================================== --- trunk/extensions/LiquidThreads/classes/LqtView.php 2009-06-18 17:38:07 UTC (rev 52131) +++ trunk/extensions/LiquidThreads/classes/LqtView.php 2009-06-18 17:41:33 UTC (rev 52132) @@ -365,6 +365,24 @@ Xml::inputLabel( $subject_label, 'lqt_subject_field', 'lqt_subject_field', 60, $subject, $disableattr ) . Xml::element( 'br' ); } + + // Quote the original message if we're replying + if ( $edit_type == 'reply' ) { + global $wgContLang; + + $thread_article = new Post( $edit_applies_to->title() ); + + $quote_text = $thread_article->getContent(); + $timestamp = $edit_applies_to->created(); + $fTime = $wgContLang->time($timestamp); + $fDate = $wgContLang->date($timestamp); + $user = $thread_article->originalAuthor()->getName(); + + $quoteIntro = wfMsgForContent( 'lqt-quote-intro', $user, $fTime, $fDate ); + $quote_text = "$quoteIntro\n<blockquote>\n$quote_text\n</blockquote>\n"; + + $e->setPreloadedText( $quote_text ); + } $e->edit(); Modified: trunk/phase3/includes/EditPage.php =================================================================== --- trunk/phase3/includes/EditPage.php 2009-06-18 17:38:07 UTC (rev 52131) +++ trunk/phase3/includes/EditPage.php 2009-06-18 17:41:33 UTC (rev 52132) @@ -103,7 +103,8 @@ $this->editFormTextBeforeContent = $this->editFormTextAfterWarn = $this->editFormTextAfterTools = - $this->editFormTextBottom = ""; + $this->editFormTextBottom = + $this->mPreloadText = ""; } function getArticle() { @@ -200,6 +201,11 @@ wfProfileOut( __METHOD__ ); return $text; } + + /** Use this method before edit() to preload some text into the edit box */ + public function setPreloadedText( $text ) { + $this->mPreloadText = $text; + } /** * Get the contents of a page from its title and remove includeonly tags @@ -208,7 +214,9 @@ * @return string The contents of the page. */ protected function getPreloadedText( $preload ) { - if ( $preload === '' ) { + if ( !empty($this->mPreloadText) ) { + return $this->mPreloadText; + } elseif ( $preload === '' ) { return ''; } else { $preloadTitle = Title::newFromText( $preload ); _______________________________________________ MediaWiki-CVS mailing list MediaWiki-CVS@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs