From 54d15eb51f0728d268e32b20803e92b527028cc2 Mon Sep 17 00:00:00 2001 From: Krinkle Date: Tue, 23 Nov 2010 00:40:45 +0000 Subject: [PATCH] * Swapping enableForOther locked input-field from disabled to readonly. No need to block users from selecting the text inside, only block editing it field. * On top of that, also using javascript to hide the input-field if/when not needed, untill needed (PHP has a backup check to only use this value if the radio-button was on 'other') * Escaping special html characters in the attributes. The message for .mw-help-field-hint contained the phrase " content pages, in a "'''project namespace'''". " which (raw, unescaped) ends the attribute right after the "a". Fixed now. --- includes/installer/WebInstaller.php | 2 +- includes/installer/WebInstallerPage.php | 4 ++-- skins/common/config.js | 10 +++++++--- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/includes/installer/WebInstaller.php b/includes/installer/WebInstaller.php index 84ba806d82..7abe688e14 100644 --- a/includes/installer/WebInstaller.php +++ b/includes/installer/WebInstaller.php @@ -613,8 +613,8 @@ class WebInstaller extends CoreInstaller { array_shift( $args ); $args = array_map( 'htmlspecialchars', $args ); $text = wfMsgReal( $msg, $args, false, false, false ); + $html = htmlspecialchars( $text ); //$html = $this->parse( $text, true ); - $html = $text; return "parent->getTextBox( array( 'var' => 'wgMetaNamespace', - 'label' => '', - 'attribs' => array( 'disabled' => '' ), + 'label' => '', //TODO: Needs a label? + 'attribs' => array( 'readonly' => 'readonly', 'class' => 'enabledByOther' ), ) ) . $this->getFieldSetStart( 'config-admin-box' ) . diff --git a/skins/common/config.js b/skins/common/config.js index d137b84abd..fcd1145873 100644 --- a/skins/common/config.js +++ b/skins/common/config.js @@ -47,14 +47,18 @@ $wrapper.show( 'slow' ); } } ); - + + // Hide "other" textboxes by default + // Should not be done in CSS for javascript disabled compatibility + $( '.enabledByOther' ).closest( '.config-block' ).hide(); + // Enable/disable "other" textboxes $( '.enableForOther' ).click( function() { var $textbox = $( '#' + $(this).attr( 'rel' ) ); if ( $(this).val() == 'other' ) { // FIXME: Ugh, this is ugly - $textbox.removeAttr( 'disabled' ); + $textbox.removeAttr( 'readonly' ).closest( '.config-block' ).slideDown( 'fast' ); } else { - $textbox.attr( 'disabled', 'disabled' ); + $textbox.attr( 'readonly', 'readonly' ).closest( '.config-block' ).slideUp( 'fast' ); } } ); -- 2.20.1