* (bug 26937) [Installer] Fix for Javascript-opened sections being incorrectly open...
authorBrion Vibber <brion@users.mediawiki.org>
Sun, 27 Mar 2011 19:22:14 +0000 (19:22 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Sun, 27 Mar 2011 19:22:14 +0000 (19:22 +0000)
The sections whose visibility was being controlled by the checkbox had an initial visibility hardcoded in the page output, which had been manually set to match the expected initial default state. I've switched these to instead check what the variable is set to and base the initial style visibility on that.
Could be better to encapsulate these settings together in some way, but this'll do for now.

Note that the way these are all done now means that the sections can never be used when JS is off; if a fully-functional installer is desired in a JS-free environment, it may be necessary to change these further to default to shown, and do the initial hiding in JavaScript (could have 'flashing' issues though: the bits showing up, then quickly hiding. laaame but oh well)

includes/installer/DatabaseInstaller.php
includes/installer/WebInstallerPage.php

index 68c7b25..9e8d05c 100644 (file)
@@ -494,13 +494,14 @@ abstract class DatabaseInstaller {
         * @return String
         */
        public function getWebUserBox( $noCreateMsg = false ) {
+               $wrapperStyle = $this->getVar( '_SameAccount' ) ? 'display: none' : '';
                $s = Html::openElement( 'fieldset' ) .
                        Html::element( 'legend', array(), wfMsg( 'config-db-web-account' ) ) .
                        $this->getCheckBox(
                                '_SameAccount', 'config-db-web-account-same',
                                array( 'class' => 'hideShowRadio', 'rel' => 'dbOtherAccount' )
                        ) .
-                       Html::openElement( 'div', array( 'id' => 'dbOtherAccount', 'style' => 'display: none;' ) ) .
+                       Html::openElement( 'div', array( 'id' => 'dbOtherAccount', 'style' => $wrapperStyle ) ) .
                        $this->getTextBox( 'wgDBuser', 'config-db-username' ) .
                        $this->getPasswordBox( 'wgDBpassword', 'config-db-password' ) .
                        $this->parent->getHelpBox( 'config-db-web-help' );
index a04b298..3ea97d0 100644 (file)
@@ -745,6 +745,7 @@ class WebInstaller_Options extends WebInstallerPage {
                        }
                }
 
+               $emailwrapperStyle = $this->getVar( 'wgEnableEmail' ) ? '' : 'display: none';
                $this->startForm();
                $this->addHTML(
                        # User Rights
@@ -775,7 +776,7 @@ class WebInstaller_Options extends WebInstallerPage {
                                'attribs' => array( 'class' => 'showHideRadio', 'rel' => 'emailwrapper' ),
                        ) ) .
                        $this->parent->getHelpBox( 'config-enable-email-help' ) .
-                       "<div id=\"emailwrapper\">" .
+                       "<div id=\"emailwrapper\" style=\"$emailwrapperStyle\">" .
                        $this->parent->getTextBox( array(
                                'var' => 'wgPasswordSender',
                                'label' => 'config-email-sender'
@@ -830,6 +831,7 @@ class WebInstaller_Options extends WebInstallerPage {
                        )
                );
 
+               $uploadwrapperStyle = $this->getVar( 'wgEnableUploads' ) ? '' : 'display: none';
                $this->addHTML(
                        # Uploading
                        $this->getFieldSetStart( 'config-upload-settings' ) .
@@ -839,7 +841,7 @@ class WebInstaller_Options extends WebInstallerPage {
                                'attribs' => array( 'class' => 'showHideRadio', 'rel' => 'uploadwrapper' ),
                                'help' => $this->parent->getHelpBox( 'config-upload-help' )
                        ) ) .
-                       '<div id="uploadwrapper" style="display: none;">' .
+                       '<div id="uploadwrapper" style="' . $uploadwrapperStyle . '">' .
                        $this->parent->getTextBox( array(
                                'var' => 'wgDeletedDirectory',
                                'label' => 'config-upload-deleted',