r65721 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r65720‎ | r65721 | r65722 >
Date:02:17, 1 May 2010
Author:jeroendedauw
Status:deferred
Tags:
Comment:
Added language change control to story edit form
Modified paths:
  • /trunk/extensions/Storyboard/specials/Story/Story_body.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Storyboard/specials/Story/Story_body.php
@@ -90,7 +90,8 @@
9191 'story_text',
9292 'story_created',
9393 'story_modified',
94 - 'story_state'
 94+ 'story_state',
 95+ 'story_lang_code',
9596 ),
9697 array( 'story_title' => $title )
9798 );
@@ -116,6 +117,7 @@
117118 elseif ( !$isEdit ) {
118119 $wgOut->addWikiMsg( 'storyboard-storyunpublished' );
119120
 121+ // FIXME: subpage in link broken
120122 if ( $wgUser->isAllowed( 'storyreview' ) ) {
121123 global $wgTitle;
122124 $wgOut->addWikiMsg(
@@ -217,13 +219,33 @@
218220 'name' => 'storystate',
219221 'id' => 'storystate'
220222 ),
221 - '<option value="' . Storyboard_STORY_UNPUBLISHED . '">' . wfMsg( 'storyboard-option-unpublished' ) . '</option>' .
222 - '<option value="' . Storyboard_STORY_PUBLISHED . '">' . wfMsg( 'storyboard-option-published' ) . '</option>' .
223 - '<option value="' . Storyboard_STORY_HIDDEN . '">' . wfMsg( 'storyboard-option-hidden' ) . '</option>'
 223+ '<option value="' . Storyboard_STORY_UNPUBLISHED . '">' . htmlspecialchars( wfMsg( 'storyboard-option-unpublished' ) ) . '</option>' .
 224+ '<option value="' . Storyboard_STORY_PUBLISHED . '">' . htmlspecialchars( wfMsg( 'storyboard-option-published' ) ) . '</option>' .
 225+ '<option value="' . Storyboard_STORY_HIDDEN . '">' . htmlspecialchars( wfMsg( 'storyboard-option-hidden' ) ) . '</option>'
224226 ) .
225227 '</td></tr>';
226228
 229+ $languages = Language::getLanguageNames( false );
 230+ ksort( $languages );
 231+
 232+ $options = array();
 233+ foreach ( $languages as $code => $name ) {
 234+ $display = wfBCP47( $code ) . ' - ' . $name;
 235+ $options[$display] = $code;
 236+ }
 237+
 238+ $languageSelector = new HTMLSelectField( array(
 239+ 'name' => 'language',
 240+ 'options' => $options
 241+ ) );
 242+
227243 $formBody .= '<tr>' .
 244+ Html::element( 'td', array( 'width' => '100%' ), wfMsg( 'storyboard-language' ) ) .
 245+ '<td>' .
 246+ $languageSelector->getInputHTML( $story->story_lang_code ) .
 247+ '</td></tr>';
 248+
 249+ $formBody .= '<tr>' .
228250 Html::element( 'td', array( 'width' => '100%' ), wfMsg( 'storyboard-authorname' ) ) .
229251 '<td>' .
230252 Html::input(
@@ -404,6 +426,7 @@
405427 'story_text' => $wgRequest->getText( 'storytext' ),
406428 'story_modified' => $dbw->timestamp( time() ),
407429 'story_state' => $wgRequest->getIntOrNull( 'storystate' ),
 430+ 'story_lang_code' => $wgRequest->getText( 'wplanguage' )
408431 ),
409432 array(
410433 'story_id' => $wgRequest->getText( 'storyId' ),

Follow-up revisions

RevisionCommit summaryAuthorDate
r65722Follow up to r65721 - added lang keyjeroendedauw02:19, 1 May 2010

Status & tagging log