r84875 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r84874‎ | r84875 | r84876 >
Date:19:22, 27 March 2011
Author:brion
Status:ok
Tags:
Comment:
* (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)
Modified paths:
  • /trunk/phase3/includes/installer/DatabaseInstaller.php (modified) (history)
  • /trunk/phase3/includes/installer/WebInstallerPage.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/installer/DatabaseInstaller.php
@@ -494,13 +494,14 @@
495495 * @return String
496496 */
497497 public function getWebUserBox( $noCreateMsg = false ) {
 498+ $wrapperStyle = $this->getVar( '_SameAccount' ) ? 'display: none' : '';
498499 $s = Html::openElement( 'fieldset' ) .
499500 Html::element( 'legend', array(), wfMsg( 'config-db-web-account' ) ) .
500501 $this->getCheckBox(
501502 '_SameAccount', 'config-db-web-account-same',
502503 array( 'class' => 'hideShowRadio', 'rel' => 'dbOtherAccount' )
503504 ) .
504 - Html::openElement( 'div', array( 'id' => 'dbOtherAccount', 'style' => 'display: none;' ) ) .
 505+ Html::openElement( 'div', array( 'id' => 'dbOtherAccount', 'style' => $wrapperStyle ) ) .
505506 $this->getTextBox( 'wgDBuser', 'config-db-username' ) .
506507 $this->getPasswordBox( 'wgDBpassword', 'config-db-password' ) .
507508 $this->parent->getHelpBox( 'config-db-web-help' );
Index: trunk/phase3/includes/installer/WebInstallerPage.php
@@ -745,6 +745,7 @@
746746 }
747747 }
748748
 749+ $emailwrapperStyle = $this->getVar( 'wgEnableEmail' ) ? '' : 'display: none';
749750 $this->startForm();
750751 $this->addHTML(
751752 # User Rights
@@ -775,7 +776,7 @@
776777 'attribs' => array( 'class' => 'showHideRadio', 'rel' => 'emailwrapper' ),
777778 ) ) .
778779 $this->parent->getHelpBox( 'config-enable-email-help' ) .
779 - "<div id=\"emailwrapper\">" .
 780+ "<div id=\"emailwrapper\" style=\"$emailwrapperStyle\">" .
780781 $this->parent->getTextBox( array(
781782 'var' => 'wgPasswordSender',
782783 'label' => 'config-email-sender'
@@ -830,6 +831,7 @@
831832 )
832833 );
833834
 835+ $uploadwrapperStyle = $this->getVar( 'wgEnableUploads' ) ? '' : 'display: none';
834836 $this->addHTML(
835837 # Uploading
836838 $this->getFieldSetStart( 'config-upload-settings' ) .
@@ -839,7 +841,7 @@
840842 'attribs' => array( 'class' => 'showHideRadio', 'rel' => 'uploadwrapper' ),
841843 'help' => $this->parent->getHelpBox( 'config-upload-help' )
842844 ) ) .
843 - '<div id="uploadwrapper" style="display: none;">' .
 845+ '<div id="uploadwrapper" style="' . $uploadwrapperStyle . '">' .
844846 $this->parent->getTextBox( array(
845847 'var' => 'wgDeletedDirectory',
846848 'label' => 'config-upload-deleted',

Follow-up revisions

RevisionCommit summaryAuthorDate
r85012MFT installer changes: r84755, r84756, r84875, r84881, r84882, r84970, r84976demon14:46, 30 March 2011

Status & tagging log