Index: trunk/phase3/includes/Html.php |
— | — | @@ -737,39 +737,43 @@ |
738 | 738 | $params['selected'] = ''; |
739 | 739 | } |
740 | 740 | |
741 | | - // Array holding the <option> elements |
| 741 | + // Associative array between option-values and option-labels |
742 | 742 | $options = array(); |
743 | 743 | |
744 | 744 | 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. |
747 | 747 | $options[$params['all']] = wfMsg( 'namespacesall' ); |
748 | 748 | } |
749 | | - // Add defaults <option> according to content language |
| 749 | + // Add all namespaces as options (in the content langauge) |
750 | 750 | $options += $wgContLang->getFormattedNamespaces(); |
751 | 751 | |
752 | | - // Convert $options to HTML |
| 752 | + // Convert $options to HTML and filter out namespaces below 0 |
753 | 753 | $optionsHtml = array(); |
754 | 754 | foreach ( $options as $nsId => $nsName ) { |
755 | 755 | if ( $nsId < NS_MAIN ) { |
756 | 756 | continue; |
757 | 757 | } |
758 | 758 | 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)") |
759 | 761 | $nsName = wfMsg( 'blanknamespace' ); |
760 | 762 | } |
761 | 763 | $optionsHtml[] = Xml::option( $nsName, $nsId, $nsId === $params['selected'] ); |
762 | 764 | } |
763 | 765 | |
764 | | - // Forge a <select> element and returns it |
765 | 766 | $ret = ''; |
766 | 767 | if ( isset( $params['label'] ) ) { |
767 | 768 | $ret .= Xml::label( $params['label'], $selectAttribs['id'] ) . ' '; |
768 | 769 | } |
| 770 | + |
| 771 | + // Wrap options in a <select> |
769 | 772 | $ret .= Html::openElement( 'select', $selectAttribs ) |
770 | 773 | . "\n" |
771 | 774 | . implode( "\n", $optionsHtml ) |
772 | 775 | . "\n" |
773 | 776 | . Html::closeElement( 'select' ); |
| 777 | + |
774 | 778 | return $ret; |
775 | 779 | } |
776 | 780 | |