http://www.mediawiki.org/wiki/Special:Code/MediaWiki/65766

Revision: 65766
Author:   jeroendedauw
Date:     2010-05-01 21:48:27 +0000 (Sat, 01 May 2010)

Log Message:
-----------
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: trunk/extensions/Storyboard/specials/Story/Story_body.php
===================================================================
--- trunk/extensions/Storyboard/specials/Story/Story_body.php   2010-05-01 
21:26:30 UTC (rev 65765)
+++ trunk/extensions/Storyboard/specials/Story/Story_body.php   2010-05-01 
21:48:27 UTC (rev 65766)
@@ -185,7 +185,7 @@
         * @param $story
         */
        private function showStoryForm( $story ) {
-               global $wgOut, $wgLang, $wgRequest, $wgUser, $wgJsMimeType, 
$wgScriptPath;
+               global $wgOut, $wgLang, $wgRequest, $wgUser, $wgJsMimeType, 
$wgScriptPath, $wgContLanguageCode;
                global $egStoryboardScriptPath, $egStorysubmissionWidth, 
$egStoryboardMaxStoryLen, $egStoryboardMinStoryLen;
                
                $wgOut->setPageTitle( $story->story_title );
@@ -225,9 +225,12 @@
                '</td></tr>';
                
                $languages = Language::getLanguageNames( false );
+               
+               $currentLang = array_key_exists( $story->story_lang_code, 
$languages ) ? $story->story_lang_code : $wgContLanguageCode;
+               
+               $options = array();
                ksort( $languages );
-
-               $options = array();
+               
                foreach ( $languages as $code => $name ) {
                        $display = wfBCP47( $code ) . ' - ' . $name;
                        $options[$display] = $code;
@@ -241,7 +244,7 @@
                $formBody .= '<tr>' .
                        Html::element( 'td', array( 'width' => '100%' ), wfMsg( 
'storyboard-language' ) ) .
                        '<td>' .
-                       $languageSelector->getInputHTML( 
$story->story_lang_code ) .
+                       $languageSelector->getInputHTML( $currentLang ) .
                        '</td></tr>';
                
                $formBody .= '<tr>' .



_______________________________________________
MediaWiki-CVS mailing list
MediaWiki-CVS@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to