Fix up Configure extension logo setting handling:
[lhc/web/wiklou.git] / includes / Xml.php
index 1551878..78f958f 100644 (file)
@@ -112,11 +112,11 @@ class Xml {
         *
         * @param $selected Mixed: Namespace which should be pre-selected
         * @param $all Mixed: Value of an item denoting all namespaces, or null to omit
-        * @param $hidden Mixed: Include hidden namespaces? [WTF? --RC]
         * @param $element_name String: value of the "name" attribute of the select tag
+        * @param $label String: optional label to add to the field
         * @return string
         */
-       public static function namespaceSelector( $selected = '', $all = null, $hidden = false, $element_name = 'namespace' ) {
+       public static function namespaceSelector( $selected = '', $all = null, $element_name = 'namespace', $label = null ) {
                global $wgContLang;
                $namespaces = $wgContLang->getFormattedNamespaces();
                $options = array();
@@ -139,12 +139,16 @@ class Xml {
                        $options[] = self::option( $name, $index, $index === $selected );
                }
 
-               return Xml::openElement( 'select', array( 'id' => 'namespace', 'name' => $element_name,
+               $ret = Xml::openElement( 'select', array( 'id' => 'namespace', 'name' => $element_name,
                        'class' => 'namespaceselector' ) )
                        . "\n"
                        . implode( "\n", $options )
                        . "\n"
                        . Xml::closeElement( 'select' );
+               if ( !is_null( $label ) ) {
+                       $ret = Xml::label( $label, $element_name ) . ' ' . $ret;
+               }
+               return $ret;
        }
 
        /**
@@ -640,15 +644,19 @@ class Xml {
                        
                        $form .= Xml::openElement( 'tr', array( 'id' => $id ) );
                        $form .= Xml::tags( 'td', array('class' => 'mw-label'), wfMsgExt( $labelmsg, array('parseinline') ) );
-                       $form .= Xml::openElement( 'td' ) . $input . Xml::closeElement( 'td' );
+                       $form .= Xml::openElement( 'td', array( 'class' => 'mw-input' ) ) . $input . Xml::closeElement( 'td' );
+                       $form .= Xml::closeElement( 'tr' );
+               }
+
+               if( $submitLabel ) {
+                       $form .= Xml::openElement( 'tr', array( 'id' => $id ) );
+                       $form .= Xml::tags( 'td', array(), '' );
+                       $form .= Xml::openElement( 'td', array( 'class' => 'mw-submit' ) ) . Xml::submitButton( wfMsg( $submitLabel ) ) . Xml::closeElement( 'td' );
                        $form .= Xml::closeElement( 'tr' );
                }
        
                $form .= "</tbody></table>";
-               
-               if ($submitLabel) {     
-                       $form .= Xml::submitButton( wfMsg($submitLabel) );
-               }
+
        
                return $form;
        }
@@ -674,7 +682,8 @@ class XmlSelect {
        }
 
        public function addOption( $name, $value = false ) {
-               $value = $value ? $value : $name;
+               // Stab stab stab
+               $value = ($value !== false) ? $value : $name;
                $this->options[] = Xml::option( $name, $value, $value === $this->default );
        }