Improves multilingual form
authorMatthias Schmidt <gravatronics@live.com>
Sat, 27 Apr 2013 14:29:33 +0000 (16:29 +0200)
committerMatthias Schmidt <gravatronics@live.com>
Sat, 27 Apr 2013 14:29:33 +0000 (16:29 +0200)
* Fixes typo in English language item
* Adds missing object property documentation
* Removes necessary object property
* Disables unsetting default language as available language since it will be added anyway again

wcfsetup/install/files/acp/templates/languageMultilingualism.tpl
wcfsetup/install/files/lib/acp/form/LanguageMultilingualismForm.class.php
wcfsetup/install/lang/en.xml

index 41d1f3e8ece4edf009962b0685de237127669264..c68097d4fe540df6f5325db931f6f192c7e5a7d5 100644 (file)
@@ -45,7 +45,9 @@
                        <dl id="languageIDs" class="marginTop{if $errorField == 'languageIDs'} formError{/if}">
                                <dt><label for="languageIDs">{lang}wcf.acp.language.multilingualism.languages{/lang}</label></dt>
                                <dd class="floated">
-                                       {htmlCheckboxes options=$languages name=languageIDs selected=$languageIDs disableEncoding=true}
+                                       {foreach from=$languages item='language'}
+                                               <label><input type="checkbox" name="languageIDs[]" value="{@$language->languageID}"{if $language->languageID == $defaultLanguageID} checked="checked" disabled="disabled"{elseif $language->languageID|in_array:$languageIDs} checked="checked"{/if} /> {$language}</label>
+                                       {/foreach}
                                        
                                        {if $errorField == 'languageIDs'}
                                                <small class="innerError">
index 80fcfada0b409001f75a6927065c5f5f74c9a54b..d5b5fe2d42454217b72e0fe65bbbdb13b7f5607f 100644 (file)
@@ -30,12 +30,23 @@ class LanguageMultilingualismForm extends AbstractForm {
         */
        public $neededPermissions = array('admin.language.canManageLanguage');
        
-       // data
-       // todo: comment
+       /**
+        * indicates if multilingualism is enabled
+        * @var integer
+        */
        public $enable = 0;
+       
+       /**
+        * ids of selected available languages
+        * @var array<integer>
+        */
        public $languageIDs = array();
+       
+       /**
+        * list of available content languages
+        * @var array<wcf\data\language\Language>
+        */
        public $languages = array();
-       public $languageList = array();
        
        /**
         * @see wcf\page\IPage::readParameters()
@@ -124,8 +135,6 @@ class LanguageMultilingualismForm extends AbstractForm {
                                $this->enable = 1;
                        }
                }
-               
-               $this->languageList = LanguageFactory::getInstance()->getLanguages();
        }
        
        /**
@@ -135,9 +144,10 @@ class LanguageMultilingualismForm extends AbstractForm {
                parent::assignVariables();
                
                WCF::getTPL()->assign(array(
+                       'defaultLanguageID' => LanguageFactory::getInstance()->getDefaultLanguageID(),
                        'enable' => $this->enable,
                        'languageIDs' => $this->languageIDs,
-                       'languages' => $this->languageList
+                       'languages' => $this->languages
                ));
        }
        
index 55912d2180b56ba023bcade9bf8243e991382de1..7fa232853c2b99d4dac196cf543a052623da79f7 100644 (file)
                <item name="wcf.acp.language.list"><![CDATA[Languages]]></item>
                <item name="wcf.acp.language.multilingualism"><![CDATA[Multilingualism]]></item>
                <item name="wcf.acp.language.multilingualism.enable"><![CDATA[Enable multilingualism]]></item>
-               <item name="wcf.acp.language.multilingualism.enable.description"><![CDATA[Enabling miltilingualism provides the ability to associate user-generated content with a specific language; Newly created content is automatically associated with the user’s interface language. Users may filter content for specific languages through their settings.]]></item>
+               <item name="wcf.acp.language.multilingualism.enable.description"><![CDATA[Enabling multilingualism provides the ability to associate user-generated content with a specific language; Newly created content is automatically associated with the user’s interface language. Users may filter content for specific languages through their settings.]]></item>
                <item name="wcf.acp.language.multilingualism.languages"><![CDATA[Available Languages]]></item>
                <item name="wcf.acp.language.multilingualism.languages.error.empty"><![CDATA[You need to select at least two languages.]]></item>
                <item name="wcf.acp.language.setAsDefault"><![CDATA[Set As Default]]></item>