r65766 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r65765‎ | r65766 | r65767 >
Date:21:48, 1 May 2010
Author:jeroendedauw
Status:deferred
Tags:
Comment:
Added fallback for when there is no or an invalid lang code stored in the db
Modified paths:
  • /trunk/extensions/Storyboard/specials/Story/Story_body.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Storyboard/specials/Story/Story_body.php
@@ -185,7 +185,7 @@
186186 * @param $story
187187 */
188188 private function showStoryForm( $story ) {
189 - global $wgOut, $wgLang, $wgRequest, $wgUser, $wgJsMimeType, $wgScriptPath;
 189+ global $wgOut, $wgLang, $wgRequest, $wgUser, $wgJsMimeType, $wgScriptPath, $wgContLanguageCode;
190190 global $egStoryboardScriptPath, $egStorysubmissionWidth, $egStoryboardMaxStoryLen, $egStoryboardMinStoryLen;
191191
192192 $wgOut->setPageTitle( $story->story_title );
@@ -225,9 +225,12 @@
226226 '</td></tr>';
227227
228228 $languages = Language::getLanguageNames( false );
 229+
 230+ $currentLang = array_key_exists( $story->story_lang_code, $languages ) ? $story->story_lang_code : $wgContLanguageCode;
 231+
 232+ $options = array();
229233 ksort( $languages );
230 -
231 - $options = array();
 234+
232235 foreach ( $languages as $code => $name ) {
233236 $display = wfBCP47( $code ) . ' - ' . $name;
234237 $options[$display] = $code;
@@ -241,7 +244,7 @@
242245 $formBody .= '<tr>' .
243246 Html::element( 'td', array( 'width' => '100%' ), wfMsg( 'storyboard-language' ) ) .
244247 '<td>' .
245 - $languageSelector->getInputHTML( $story->story_lang_code ) .
 248+ $languageSelector->getInputHTML( $currentLang ) .
246249 '</td></tr>';
247250
248251 $formBody .= '<tr>' .

Status & tagging log