X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2FXml.php;h=159f711464c7ac78d7f1ebe8d93aaf596f13ed02;hb=1e2a0526b3d92323e0a983ba9649aecdf98ce562;hp=7761ecc0a64e3989ee55f0e54c695f4fb09972f2;hpb=23376a76c91b26353e5d2f546520002490c761d7;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/Xml.php b/includes/Xml.php index 7761ecc0a6..159f711464 100644 --- a/includes/Xml.php +++ b/includes/Xml.php @@ -134,31 +134,6 @@ class Xml { return self::openElement( $element, $attribs ) . $contents . ""; } - /** - * Build a drop-down box for selecting a namespace - * - * @param string $selected Namespace which should be pre-selected - * @param string|null $all Value of an item denoting all namespaces, or null to omit - * @param string $element_name Value of the "name" attribute of the select tag - * @param string $label Optional label to add to the field - * @return string - * @deprecated since 1.19 - */ - public static function namespaceSelector( $selected = '', $all = null, - $element_name = 'namespace', $label = null - ) { - wfDeprecated( __METHOD__, '1.19' ); - return Html::namespaceSelector( array( - 'selected' => $selected, - 'all' => $all, - 'label' => $label, - ), array( - 'name' => $element_name, - 'id' => 'namespace', - 'class' => 'namespaceselector', - ) ); - } - /** * Create a date selector * @@ -317,7 +292,8 @@ class Xml { $attributes['value'] = $value; } - return self::element( 'input', $attributes + $attribs ); + return self::element( 'input', + Html::getTextInputAttributes( $attributes + $attribs ) ); } /** @@ -453,9 +429,16 @@ class Xml { * @return string HTML */ public static function checkLabel( $label, $name, $id, $checked = false, $attribs = array() ) { - return self::check( $name, $checked, array( 'id' => $id ) + $attribs ) . + global $wgUseMediaWikiUIEverywhere; + $chkLabel = self::check( $name, $checked, array( 'id' => $id ) + $attribs ) . ' ' . self::label( $label, $id, $attribs ); + + if ( $wgUseMediaWikiUIEverywhere ) { + $chkLabel = self::openElement( 'div', array( 'class' => 'mw-ui-checkbox' ) ) . + $chkLabel . self::closeElement( 'div' ); + } + return $chkLabel; } /** @@ -480,12 +463,26 @@ class Xml { /** * Convenience function to build an HTML submit button + * When $wgUseMediaWikiUIEverywhere is true it will default to a constructive button * @param string $value Label text for the button * @param array $attribs Optional custom attributes * @return string HTML */ public static function submitButton( $value, $attribs = array() ) { - return Html::element( 'input', array( 'type' => 'submit', 'value' => $value ) + $attribs ); + global $wgUseMediaWikiUIEverywhere; + $baseAttrs = array( + 'type' => 'submit', + 'value' => $value, + ); + // Done conditionally for time being as it is possible + // some submit forms + // might need to be mw-ui-destructive (e.g. delete a page) + if ( $wgUseMediaWikiUIEverywhere ) { + $baseAttrs['class'] = 'mw-ui-button mw-ui-constructive'; + } + // Any custom attributes will take precendence of anything in baseAttrs e.g. override the class + $attribs = $attribs + $baseAttrs; + return Html::element( 'input', $attribs ); } /** @@ -617,12 +614,14 @@ class Xml { */ public static function textarea( $name, $content, $cols = 40, $rows = 5, $attribs = array() ) { return self::element( 'textarea', - array( - 'name' => $name, - 'id' => $name, - 'cols' => $cols, - 'rows' => $rows - ) + $attribs, + Html::getTextInputAttributes( + array( + 'name' => $name, + 'id' => $name, + 'cols' => $cols, + 'rows' => $rows + ) + $attribs + ), $content, false ); }