Added a separate error message for mkdir failures
[lhc/web/wiklou.git] / includes / htmlform / HTMLCheckMatrix.php
index 83f1266..a0566a0 100644 (file)
@@ -85,7 +85,13 @@ class HTMLCheckMatrix extends HTMLFormField implements HTMLNestedFilterable {
                $rows = $this->mParams['rows'];
                $columns = $this->mParams['columns'];
 
-               $attribs = $this->getAttributes( array( 'disabled', 'tabindex' ) );
+               $mappings = array();
+
+               if ( $this->mParent instanceof OOUIHTMLForm ) {
+                       $mappings['tabindex'] = 'tabIndex';
+               }
+
+               $attribs = $this->getAttributes( array( 'disabled', 'tabindex' ), $mappings );
 
                // Build the column headers
                $headerContents = Html::rawElement( 'td', array(), ' ' );
@@ -113,9 +119,8 @@ class HTMLCheckMatrix extends HTMLFormField implements HTMLNestedFilterable {
                        foreach ( $columns as $columnTag ) {
                                $thisTag = "$columnTag-$rowTag";
                                // Construct the checkbox
-                               $thisId = "{$this->mID}-$thisTag";
                                $thisAttribs = array(
-                                       'id' => $thisId,
+                                       'id' => "{$this->mID}-$thisTag",
                                        'value' => $thisTag,
                                );
                                $checked = in_array( $thisTag, (array)$value, true );
@@ -126,17 +131,13 @@ class HTMLCheckMatrix extends HTMLFormField implements HTMLNestedFilterable {
                                        $checked = true;
                                        $thisAttribs['disabled'] = 1;
                                }
-                               $chkBox = Xml::check( "{$this->mName}[]", $checked, $attribs + $thisAttribs );
-                               if ( $this->mParent->getConfig()->get( 'UseMediaWikiUIEverywhere' ) ) {
-                                       $chkBox = Html::openElement( 'div', array( 'class' => 'mw-ui-checkbox' ) ) .
-                                               $chkBox .
-                                               Html::element( 'label', array( 'for' => $thisId ) ) .
-                                               Html::closeElement( 'div' );
-                               }
+
+                               $checkbox = $this->getOneCheckbox( $checked, $attribs + $thisAttribs );
+
                                $rowContents .= Html::rawElement(
                                        'td',
                                        array(),
-                                       $chkBox
+                                       $checkbox
                                );
                        }
                        $tableContents .= Html::rawElement( 'tr', array(), "\n$rowContents\n" );
@@ -150,6 +151,25 @@ class HTMLCheckMatrix extends HTMLFormField implements HTMLNestedFilterable {
                return $html;
        }
 
+       protected function getOneCheckbox( $checked, $attribs ) {
+               if ( $this->mParent instanceof OOUIHTMLForm ) {
+                       return new OOUI\CheckboxInputWidget( array(
+                               'name' => "{$this->mName}[]",
+                               'selected' => $checked,
+                               'value' => $attribs['value'],
+                       ) + $attribs );
+               } else {
+                       $checkbox = Xml::check( "{$this->mName}[]", $checked, $attribs );
+                       if ( $this->mParent->getConfig()->get( 'UseMediaWikiUIEverywhere' ) ) {
+                               $checkbox = Html::openElement( 'div', array( 'class' => 'mw-ui-checkbox' ) ) .
+                                       $checkbox .
+                                       Html::element( 'label', array( 'for' => $attribs['id'] ) ) .
+                                       Html::closeElement( 'div' );
+                       }
+                       return $checkbox;
+               }
+       }
+
        protected function isTagForcedOff( $tag ) {
                return isset( $this->mParams['force-options-off'] )
                        && in_array( $tag, $this->mParams['force-options-off'] );