i18n input is now properly forced upon request
authorAlexander Ebert <ebert@woltlab.com>
Fri, 10 Feb 2012 14:26:57 +0000 (15:26 +0100)
committerAlexander Ebert <ebert@woltlab.com>
Fri, 10 Feb 2012 14:26:57 +0000 (15:26 +0100)
Fixes #422

wcfsetup/install/files/js/WCF.js

index b381ef1d187ba64cc4612be8e56dd4c7b3d3fca6..8e13577f13e256031ee4286d05a6d2247d6ac8d1 100644 (file)
@@ -1836,7 +1836,7 @@ WCF.MultipleLanguageInput.prototype = {
                $button.click($.proxy(this._enable, this));
                WCF.CloseOverlayHandler.addCallback(this._element.wcfIdentify(), $.proxy(this._closeSelection, this));
                
-               if (enableOnInit) {
+               if (enableOnInit || this._forceSelection) {
                        $button.trigger('click');
 
                        // pre-select current language
@@ -1877,7 +1877,9 @@ WCF.MultipleLanguageInput.prototype = {
                                }
 
                                // disable language input
-                               $('<li class="divider">disable i18n</li>').click($.proxy(this._disable, this)).appendTo(this._list);
+                               if (!this._forceSelection) {
+                                       $('<li class="divider">disable i18n</li>').click($.proxy(this._disable, this)).appendTo(this._list);
+                               }
                        }
 
                        this._isEnabled = true;
@@ -1967,6 +1969,10 @@ WCF.MultipleLanguageInput.prototype = {
         * Disables language selection for current element.
         */
        _disable: function() {
+               if (this._forceSelection) {
+                       return;
+               }
+               
                // remove active marking
                this._list.prev('.wcf-dropdownCaption').children('span').removeClass('active').text('enable i18n');
                this._closeSelection();