r97244 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r97243‎ | r97244 | r97245 >
Date:06:51, 16 September 2011
Author:werdna
Status:deferred
Tags:
Comment:
LiquidThreads: Fix a few more URLs, implement non-AJAX edit form
Modified paths:
  • /branches/lqt-updates/extensions/LiquidThreads/classes/view/PostEditForm.php (modified) (history)
  • /branches/lqt-updates/extensions/LiquidThreads/classes/view/PostFormatter.php (modified) (history)
  • /branches/lqt-updates/extensions/LiquidThreads/classes/view/PostToolbar.php (modified) (history)

Diff [purge]

Index: branches/lqt-updates/extensions/LiquidThreads/classes/view/PostFormatter.php
@@ -157,7 +157,23 @@
158158 if ( $showAnything && $this->runCallback( $object, $context ) ) {
159159 $html .= Xml::openElement( 'div', array( 'class' => $divClass ) );
160160
161 - $text = $version->getContentHTML();
 161+ if ( $context->getActionFor( $object ) == 'edit' ) {
 162+ $form = new LiquidThreadsPostEditForm(
 163+ $context->get('user'),
 164+ $object
 165+ );
 166+ $formResult = $form->show();
 167+
 168+ if ( $formResult === true ) {
 169+ $object = $form->getModifiedObject();
 170+ $version = $object->getCurrentVersion();
 171+ $text .= $version->getContentHTML();
 172+ } else {
 173+ $text = $formResult;
 174+ }
 175+ } else {
 176+ $text = $version->getContentHTML();
 177+ }
162178
163179 $html .= $text;
164180
Index: branches/lqt-updates/extensions/LiquidThreads/classes/view/PostEditForm.php
@@ -39,7 +39,7 @@
4040 protected function getSummaryBox() {
4141 $label = wfMsg( 'summary' );
4242 return Xml::inputLabel( $label, 'lqt-summary',
43 - 'lqt-summary', 60, $subject ) .
 43+ 'lqt-summary', 60 ) .
4444 Xml::element( 'br' );
4545 }
4646
Index: branches/lqt-updates/extensions/LiquidThreads/classes/view/PostToolbar.php
@@ -124,7 +124,6 @@
125125
126126 $replyLink = wfAppendQuery( $context->get('base-url'), $replyQuery );
127127
128 - // TODO permissions checking, proper URL
129128 $commands['reply'] = array(
130129 'label' => wfMsgExt( 'lqt_reply', 'parseinline' ),
131130 'href' => $replyLink,
@@ -172,12 +171,18 @@
173172 $history = SpecialPage::getTitleFor( 'PostHistory', $post->getID() );
174173 $commands['history'] = array(
175174 'label' => wfMsgExt( 'history_short', 'parseinline' ),
176 - 'href' => $history->getFullURL(),
 175+ 'href' => $history->getLocalURL(),
177176 'enabled' => true,
178177 );
179178
180179 // TODO permissions checking
181 - $edit_url = SpecialPage::getTitleFor( 'EditPost', $post->getID() );
 180+ $editQuery = array(
 181+ 'lqt_action' => 'edit',
 182+ 'lqt_target' => $post->getUniqueIdentifier(),
 183+ );
 184+
 185+ $edit_url = wfAppendQuery( $context->get('base-url'), $editQuery );
 186+
182187 $commands['edit'] = array(
183188 'label' => wfMsgExt( 'edit', 'parseinline' ),
184189 'href' => $edit_url,
@@ -188,7 +193,7 @@
189194 $splitUrl = SpecialPage::getTitleFor( 'SplitThread', $post->getID() )->getFullURL();
190195 $commands['split'] = array(
191196 'label' => wfMsgExt( 'lqt-thread-split', 'parseinline' ),
192 - 'href' => $splitUrl,
 197+ 'href' => $splitUrl->getLocalURL(),
193198 'enabled' => true
194199 );
195200 }
@@ -210,9 +215,11 @@
211216 // );
212217 // }
213218
 219+ $linkTarget = SpecialPage::getTitleFor( 'Post', $post->getID() );
 220+
214221 $commands['link'] = array(
215222 'label' => wfMsgExt( 'lqt_permalink', 'parseinline' ),
216 - 'href' => SpecialPage::getTitleFor( 'Post', $post->getID() ),
 223+ 'href' => $linkTarget->getLocalURL(),
217224 'enabled' => true,
218225 'showlabel' => true,
219226 'tooltip' => wfMsgExt( 'lqt_permalink', 'parseinline' )

Status & tagging log