r64416 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r64415‎ | r64416 | r64417 >
Date:01:33, 31 March 2010
Author:jeroendedauw
Status:deferred
Tags:
Comment:
Added returnto functionallity to Special:Story for edit actions comming from Special:StoryReview. Added SkinTemplateNavigation hook, not working yet though. Minor fixes.
Modified paths:
  • /trunk/extensions/Storyboard/Storyboard.php (modified) (history)
  • /trunk/extensions/Storyboard/specials/Story/Story_body.php (modified) (history)
  • /trunk/extensions/Storyboard/specials/StoryReview/StoryReview_body.php (modified) (history)
  • /trunk/extensions/Storyboard/tags/Storyboard/Storyboard_body.php (modified) (history)
  • /trunk/extensions/Storyboard/tags/Storysubmission/Storysubmission_body.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Storyboard/tags/Storyboard/Storyboard_body.php
@@ -37,7 +37,7 @@
3838 'style' => "height: $height; width: $width;"
3939 )
4040 );
41 - return array( $output, 'noparse' => 'true', 'isHTML' => 'true' );
 41+ return array( $output, 'noparse' => true, 'isHTML' => true );
4242 }
4343
4444 }
Index: trunk/extensions/Storyboard/tags/Storysubmission/Storysubmission_body.php
@@ -29,7 +29,7 @@
3030 $output = self::getFrom( $parser, $args );
3131 }
3232
33 - return $output;
 33+ return array( $output, 'noparse' => true, 'isHTML' => true );
3434
3535 wfProfileOut( __METHOD__ );
3636 }
Index: trunk/extensions/Storyboard/specials/Story/Story_body.php
@@ -28,6 +28,12 @@
2929 if ( $wgRequest->wasPosted() && $wgUser->matchEditToken( $wgRequest->getVal( 'wpEditToken' ) ) ) {
3030 if ( $wgUser->isAllowed( 'storyreview' ) ) {
3131 $this->saveStory();
 32+
 33+ // Redirect the user when the redirect parameter is set.
 34+ if ( $wgRequest->getVal( 'returnto' ) ) {
 35+ $titleObj = Title::newFromText( $wgRequest->getVal( 'returnto' ) );
 36+ $wgOut->redirect( $titleObj->getFullURL() );
 37+ }
3238 } else {
3339 $wgOut->addWikiMsg( 'storyboard-cantedit' );
3440 }
@@ -98,13 +104,15 @@
99105 $wgOut->addWikiMsg( 'storyboard-unpublished' );
100106
101107 if ( $wgUser->isAllowed( 'storyreview' ) ) {
102 - global $wgParser;
103 -
104 - $wgOut->addWikiMsgArray(
105 - //$wgParser->recursiveTagParse(
 108+ global $wgTitle;
 109+ $wgOut->addHTML( // TODO: this still isn't working properly
 110+ wfMsgHtml(
106111 'storyboard-canedit',
107 - $this->getTitle()->getLocalURL( 'action=edit' )
108 - //)
 112+ $wgUser->getSkin()->link(
 113+ $wgTitle,
 114+ strtolower( wfMsg( 'edit' ) )
 115+ )
 116+ )
109117 );
110118 }
111119 }
@@ -222,13 +230,16 @@
223231 $formBody .= Html::hidden( 'wpEditToken', $wgUser->editToken() );
224232 $formBody .= Html::hidden( 'storyId', $story->story_id );
225233
 234+ $returnToQuery = $wgRequest->getVal( 'returnto' );
 235+ if ( $returnToQuery ) $returnToQuery = 'returnto=' . $returnToQuery;
 236+
226237 $formBody = Html::rawElement(
227238 'form',
228239 array(
229240 'id' => 'storyform',
230241 'name' => 'storyform',
231242 'method' => 'post',
232 - 'action' => $this->getTitle( $story->story_title )->getLocalURL(),
 243+ 'action' => $this->getTitle( $story->story_title )->getLocalURL( $returnToQuery ),
233244 ),
234245 $formBody
235246 );
Index: trunk/extensions/Storyboard/specials/StoryReview/StoryReview_body.php
@@ -114,7 +114,8 @@
115115 $deleteImageMsg = htmlspecialchars( wfMsg( 'storyboard-deleteimage' ) );
116116
117117 // TODO: add some returnto feature here
118 - $editUrl = SpecialPage::getTitleFor( 'story', $story->story_title )->getFullURL('action=edit');
 118+ global $wgTitle;
 119+ $editUrl = SpecialPage::getTitleFor( 'story', $story->story_title )->getFullURL('action=edit&returnto=' . $wgTitle->getPrefixedText() );
119120 $editUrl = Xml::escapeJsString( $editUrl );
120121
121122 return <<<EOT
Index: trunk/extensions/Storyboard/Storyboard.php
@@ -59,7 +59,8 @@
6060 // Hooks
6161 $wgHooks['ParserFirstCallInit'][] = 'efStoryboardParserFirstCallInit';
6262 $wgHooks['LoadExtensionSchemaUpdates'][] = 'efStoryboardSchemaUpdate';
63 -$wgHooks['SkinTemplateContentActions'][] = 'efStoryboardAddStoryEditAction';
 63+$wgHooks['SkinTemplateTabs'][] = 'efStoryboardAddStoryEditAction';
 64+$wgHooks['SkinTemplateNavigation'][] = 'efStoryboardAddStoryEditActionVector';
6465
6566
6667 /**
@@ -97,10 +98,17 @@
9899 return true;
99100 }
100101
101 -function efStoryboardAddStoryEditAction( &$content_actions ) {
102 - // TODO: currently not having any affect on Special:Story for some reason
 102+function efStoryboardAddStoryEditActionVector( &$sktemplate, &$links ) {
 103+ $views_links = $links['views'];
 104+ efStoryboardAddStoryEditAction( $sktemplate, $views_links );
 105+ $links['views'] = $views_links;
 106+
 107+ return true;
 108+}
 109+
 110+function efStoryboardAddStoryEditAction( &$sktemplate, &$content_actions ) {
103111 global $wgRequest, $wgRequest, $wgTitle;
104 -
 112+
105113 $action = $wgRequest->getText( 'action' );
106114
107115 if ( $wgTitle->equals( SpecialPage::getTitleFor( 'story' ) ) ) {

Status & tagging log