r111315 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r111314‎ | r111315 | r111316 >
Date:18:58, 12 February 2012
Author:krinkle
Status:ok
Tags:
Comment:
[Html.php] Follow-up r110275, comment fixes.
* $options does not contain <option> elements, but associative array between option-values and option-labels
Modified paths:
  • /trunk/phase3/includes/Html.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/Html.php
@@ -737,39 +737,43 @@
738738 $params['selected'] = '';
739739 }
740740
741 - // Array holding the <option> elements
 741+ // Associative array between option-values and option-labels
742742 $options = array();
743743
744744 if ( isset( $params['all'] ) ) {
745 - // add an <option> that would let the user select all namespaces.
746 - // Value is provided by user, the name shown is localized.
 745+ // add an option that would let the user select all namespaces.
 746+ // Value is provided by user, the name shown is localized for the user.
747747 $options[$params['all']] = wfMsg( 'namespacesall' );
748748 }
749 - // Add defaults <option> according to content language
 749+ // Add all namespaces as options (in the content langauge)
750750 $options += $wgContLang->getFormattedNamespaces();
751751
752 - // Convert $options to HTML
 752+ // Convert $options to HTML and filter out namespaces below 0
753753 $optionsHtml = array();
754754 foreach ( $options as $nsId => $nsName ) {
755755 if ( $nsId < NS_MAIN ) {
756756 continue;
757757 }
758758 if ( $nsId === 0 ) {
 759+ // For other namespaces use use the namespace prefix as label, but for
 760+ // main we don't use "" but the user message descripting it (e.g. "(Main)" or "(Article)")
759761 $nsName = wfMsg( 'blanknamespace' );
760762 }
761763 $optionsHtml[] = Xml::option( $nsName, $nsId, $nsId === $params['selected'] );
762764 }
763765
764 - // Forge a <select> element and returns it
765766 $ret = '';
766767 if ( isset( $params['label'] ) ) {
767768 $ret .= Xml::label( $params['label'], $selectAttribs['id'] ) . '&#160;';
768769 }
 770+
 771+ // Wrap options in a <select>
769772 $ret .= Html::openElement( 'select', $selectAttribs )
770773 . "\n"
771774 . implode( "\n", $optionsHtml )
772775 . "\n"
773776 . Html::closeElement( 'select' );
 777+
774778 return $ret;
775779 }
776780

Follow-up revisions

RevisionCommit summaryAuthorDate
r113272[Html::namespaceSelector] Remove default id/name attributes...krinkle19:14, 7 March 2012

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r110275comment / style for Html::namespaceSelector()...hashar11:02, 30 January 2012

Status & tagging log