Small optimizations
authorMarcel Werk <burntime@woltlab.com>
Thu, 23 May 2013 20:23:55 +0000 (22:23 +0200)
committerMarcel Werk <burntime@woltlab.com>
Thu, 23 May 2013 20:23:55 +0000 (22:23 +0200)
com.woltlab.wcf/template/settings.tpl
com.woltlab.wcf/template/userPanel.tpl

index d1e709250a2c39570b5fdee455040c0d3af454f4..103137646973a6f18c7409feddbde98e1bbb1e63 100644 (file)
 <form method="post" action="{link controller='Settings'}{/link}">
        <div class="container containerPadding marginTop">
                {if $category == 'general'}
-                       <fieldset>
-                               <legend>{lang}wcf.user.language{/lang}</legend>
-                               
-                               <dl>
-                                       <dt><label>{lang}wcf.user.language{/lang}</label></dt>
-                                       <dd id="languageIDContainer">
-                                               <script type="text/javascript">
-                                                       //<![CDATA[
-                                                       $(function() {
-                                                               var $languages = {
-                                                                       {implode from=$availableLanguages item=language}
-                                                                               '{@$language->languageID}': {
-                                                                                       iconPath: '{@$language->getIconPath()}',
-                                                                                       languageName: '{$language}'
-                                                                               }
-                                                                       {/implode}
-                                                               };
-                                                               
-                                                               new WCF.Language.Chooser('languageIDContainer', 'languageID', {@$languageID}, $languages);
-                                                       });
-                                                       //]]>
-                                               </script>
-                                               <noscript>
-                                                       <select name="languageID" id="languageID">
-                                                               {foreach from=$availableLanguages item=language}
-                                                                       <option value="{@$language->languageID}"{if $language->languageID == $languageID} selected="selected"{/if}>{$language}</option>
-                                                               {/foreach}
-                                                       </select>
-                                               </noscript>
-                                       </dd>
-                               </dl>
-                               
-                               {hascontent}
+                       {if $availableLanguages|count > 1}
+                               <fieldset>
+                                       <legend>{lang}wcf.user.language{/lang}</legend>
+                                       
                                        <dl>
-                                               <dt><label>{lang}wcf.user.visibleLanguages{/lang}</label></dt>
-                                               <dd class="floated">
-                                               {content}
-                                                       {foreach from=$availableContentLanguages item=language}
-                                                               <label><input name="contentLanguageIDs[]" type="checkbox" value="{@$language->languageID}"{if $language->languageID|in_array:$contentLanguageIDs} checked="checked"{/if} /> {$language}</label>
-                                                       {/foreach}
-                                               {/content}
-                                               <small>{lang}wcf.user.visibleLanguages.description{/lang}</small></dd>
+                                               <dt><label>{lang}wcf.user.language{/lang}</label></dt>
+                                               <dd id="languageIDContainer">
+                                                       <script type="text/javascript">
+                                                               //<![CDATA[
+                                                               $(function() {
+                                                                       var $languages = {
+                                                                               {implode from=$availableLanguages item=language}
+                                                                                       '{@$language->languageID}': {
+                                                                                               iconPath: '{@$language->getIconPath()}',
+                                                                                               languageName: '{$language}'
+                                                                                       }
+                                                                               {/implode}
+                                                                       };
+                                                                       
+                                                                       new WCF.Language.Chooser('languageIDContainer', 'languageID', {@$languageID}, $languages);
+                                                               });
+                                                               //]]>
+                                                       </script>
+                                                       <noscript>
+                                                               <select name="languageID" id="languageID">
+                                                                       {foreach from=$availableLanguages item=language}
+                                                                               <option value="{@$language->languageID}"{if $language->languageID == $languageID} selected="selected"{/if}>{$language}</option>
+                                                                       {/foreach}
+                                                               </select>
+                                                       </noscript>
+                                               </dd>
                                        </dl>
-                               {/hascontent}
-                               
-                               {event name='languageFields'}
-                       </fieldset>
+                                       
+                                       {hascontent}
+                                               <dl>
+                                                       <dt><label>{lang}wcf.user.visibleLanguages{/lang}</label></dt>
+                                                       <dd class="floated">
+                                                       {content}
+                                                               {foreach from=$availableContentLanguages item=language}
+                                                                       <label><input name="contentLanguageIDs[]" type="checkbox" value="{@$language->languageID}"{if $language->languageID|in_array:$contentLanguageIDs} checked="checked"{/if} /> {$language}</label>
+                                                               {/foreach}
+                                                       {/content}
+                                                       <small>{lang}wcf.user.visibleLanguages.description{/lang}</small></dd>
+                                               </dl>
+                                       {/hascontent}
+                                       
+                                       {event name='languageFields'}
+                               </fieldset>
+                       {/if}
                        
-                       <fieldset>
-                               <legend>{lang}wcf.user.style{/lang}</legend>
-                               
-                               <dl>
-                                       <dt><label for="styleID">{lang}wcf.user.style{/lang}</label></dt>
-                                       <dd>
-                                               <select id="styleID" name="styleID">
-                                                       <option value="0"></option>
-                                                       {foreach from=$availableStyles item=style}
-                                                               <option value="{@$style->styleID}"{if $style->styleID == $styleID} selected="selected"{/if}>{$style->styleName}</option>
-                                                       {/foreach}
-                                               </select>
-                                               <small>{lang}wcf.user.style.description{/lang}</small>
-                                       </dd>
-                               </dl>
-                               
-                               {event name='styleFields'}
-                       </fieldset>
+                       {if $availableStyles|count > 1}
+                               <fieldset>
+                                       <legend>{lang}wcf.user.style{/lang}</legend>
+                                       
+                                       <dl>
+                                               <dt><label for="styleID">{lang}wcf.user.style{/lang}</label></dt>
+                                               <dd>
+                                                       <select id="styleID" name="styleID">
+                                                               <option value="0"></option>
+                                                               {foreach from=$availableStyles item=style}
+                                                                       <option value="{@$style->styleID}"{if $style->styleID == $styleID} selected="selected"{/if}>{$style->styleName}</option>
+                                                               {/foreach}
+                                                       </select>
+                                                       <small>{lang}wcf.user.style.description{/lang}</small>
+                                               </dd>
+                                       </dl>
+                                       
+                                       {event name='styleFields'}
+                               </fieldset>
+                       {/if}
                {/if}
                
                {foreach from=$optionTree[0][categories][0][categories] item=optionCategory}
index eece29c1973582796071d8e3fcc49f297afd4328..5247a34b3bc2e94a83d1e0c1a0047f77a3b61caf 100644 (file)
                        </script>
                </li>
        {/if}
-       <!-- language switcher -->
-       <li id="pageLanguageContainer">
-               <script type="text/javascript">
-                       //<![CDATA[
-                       $(function() {
-                               var $languages = {
-                                       {implode from=$__wcf->getLanguage()->getLanguages() item=language}
-                                               '{@$language->languageID}': {
-                                                       iconPath: '{@$language->getIconPath()}',
-                                                       languageName: '{$language}'
-                                               }
-                                       {/implode}
-                               };
-                               
-                               new WCF.Language.Chooser('pageLanguageContainer', 'languageID', {@$__wcf->getLanguage()->languageID}, $languages, function(item) {
-                                       var $location = window.location.toString().replace(/#.*/, '').replace(/(\?|&)l=[0-9]+/g, '');
-                                       var $delimiter = ($location.indexOf('?') == -1) ? '?' : '&';
+       {if $__wcf->getLanguage()->getLanguages()|count > 1}
+               <li id="pageLanguageContainer">
+                       <script type="text/javascript">
+                               //<![CDATA[
+                               $(function() {
+                                       var $languages = {
+                                               {implode from=$__wcf->getLanguage()->getLanguages() item=language}
+                                                       '{@$language->languageID}': {
+                                                               iconPath: '{@$language->getIconPath()}',
+                                                               languageName: '{$language}'
+                                                       }
+                                               {/implode}
+                                       };
                                        
-                                       window.location = $location + $delimiter + 'l=' + item.data('languageID') + window.location.hash;
+                                       new WCF.Language.Chooser('pageLanguageContainer', 'languageID', {@$__wcf->getLanguage()->languageID}, $languages, function(item) {
+                                               var $location = window.location.toString().replace(/#.*/, '').replace(/(\?|&)l=[0-9]+/g, '');
+                                               var $delimiter = ($location.indexOf('?') == -1) ? '?' : '&';
+                                               
+                                               window.location = $location + $delimiter + 'l=' + item.data('languageID') + window.location.hash;
+                                       });
                                });
-                       });
-                       //]]>
-               </script>
-       </li>
+                               //]]>
+                       </script>
+               </li>
+       {/if}
 {/if}
 
 {if !$__hideUserMenu|isset}