r95467 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r95466‎ | r95467 | r95468 >
Date:09:44, 25 August 2011
Author:catrope
Status:ok
Tags:
Comment:
Followup r92155, move preferences-specific code introduced in HTMLForm to Preferences.php. Dropping $displayTitle and replacing it with something else is OK since $displayTitle was introduced as a hack for the preferences form anyway
Modified paths:
  • /trunk/phase3/includes/HTMLForm.php (modified) (history)
  • /trunk/phase3/includes/Preferences.php (modified) (history)
  • /trunk/phase3/resources/mediawiki.special/mediawiki.special.preferences.js (modified) (history)

Diff [purge]

Index: trunk/phase3/resources/mediawiki.special/mediawiki.special.preferences.js
@@ -28,7 +28,7 @@
2929 });
3030 var $a = $( '<a/>', {
3131 text : $legend.text(),
32 - id : ident.replace('prefsection', 'preftab'),
 32+ id : ident.replace( 'mw-prefsection', 'preftab' ),
3333 href : '#' + ident
3434 }).click( function( e ) {
3535 e.preventDefault();
@@ -52,8 +52,8 @@
5353 // On document ready:
5454 $( function() {
5555 var hash = window.location.hash;
56 - if( hash.match( /^#prefsection-[\w-]+/ ) ) {
57 - var $tab = $( hash.replace('prefsection', 'preftab') );
 56+ if( hash.match( /^#mw-prefsection-[\w-]+/ ) ) {
 57+ var $tab = $( hash.replace( 'mw-prefsection', 'preftab' ) );
5858 $tab.click();
5959 }
6060 } );
Index: trunk/phase3/includes/Preferences.php
@@ -1535,6 +1535,6 @@
15361536 * Get the whole body of the form.
15371537 */
15381538 function getBody() {
1539 - return $this->displaySection( $this->mFieldTree, '', true );
 1539+ return $this->displaySection( $this->mFieldTree, '', 'mw-prefsection-' );
15401540 }
15411541 }
Index: trunk/phase3/includes/HTMLForm.php
@@ -681,9 +681,11 @@
682682
683683 /**
684684 * TODO: Document
685 - * @param $fields
 685+ * @param $fields array of fields (either arrays or objects)
 686+ * @param $sectionName string ID attribute of the <table> tag for this section, ignored if empty
 687+ * @param $fieldsetIDPrefix string ID prefix for the <fieldset> tag of each subsection, ignored if empty
686688 */
687 - function displaySection( $fields, $sectionName = '', $displayTitle = false ) {
 689+ function displaySection( $fields, $sectionName = '', $fieldsetIDPrefix = '' ) {
688690 $tableHtml = '';
689691 $subsectionHtml = '';
690692 $hasLeftColumn = false;
@@ -708,8 +710,8 @@
709711 $section .= $this->mSectionFooters[$key];
710712 }
711713 $attributes = array();
712 - if ( $displayTitle ) {
713 - $attributes["id"] = 'prefsection-' . Sanitizer::escapeId( $key, 'noninitial' );
 714+ if ( $fieldsetIDPrefix ) {
 715+ $attributes['id'] = Sanitizer::escapeId( "$fieldsetIDPrefix$key" );
714716 }
715717 $subsectionHtml .= Xml::fieldset( $legend, $section, $attributes ) . "\n";
716718 }

Sign-offs

UserFlagDate
Nikerabbitinspected14:37, 25 August 2011

Follow-up revisions

RevisionCommit summaryAuthorDate
r964981.18: MFT r95171, r95409, r95436, r95458, r95467, r95470, r95475, r95493, r95...catrope21:04, 7 September 2011

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r92155Restructure tab code of mediawiki.special.preferences.js . * 10 levels of ind...diebuche12:49, 14 July 2011

Status & tagging log