From 4ac9bc6a0a9aae3ce852c1718f7bbaa195a71076 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Sun, 27 Mar 2011 19:22:14 +0000 Subject: [PATCH] * (bug 26937) [Installer] Fix for Javascript-opened sections being incorrectly open or closed when returning to page 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 | 3 ++- includes/installer/WebInstallerPage.php | 6 ++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/includes/installer/DatabaseInstaller.php b/includes/installer/DatabaseInstaller.php index 68c7b259f4..9e8d05cc6f 100644 --- a/includes/installer/DatabaseInstaller.php +++ b/includes/installer/DatabaseInstaller.php @@ -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' ); diff --git a/includes/installer/WebInstallerPage.php b/includes/installer/WebInstallerPage.php index a04b298776..3ea97d0a86 100644 --- a/includes/installer/WebInstallerPage.php +++ b/includes/installer/WebInstallerPage.php @@ -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' ) . - "
" . + "
" . $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' ) ) ) . - '