Merge "Convert Special:AllMessages to use OOUI"
[lhc/web/wiklou.git] / includes / specials / SpecialTags.php
index 6b0598c..fe8fa19 100644 (file)
@@ -136,7 +136,7 @@ class SpecialTags extends SpecialPage {
                }
 
                // Write the headers
-               $html = Xml::tags( 'tr', null, Xml::tags( 'th', null, $this->msg( 'tags-tag' )->parse() ) .
+               $thead = Xml::tags( 'tr', null, Xml::tags( 'th', null, $this->msg( 'tags-tag' )->parse() ) .
                        Xml::tags( 'th', null, $this->msg( 'tags-display-header' )->parse() ) .
                        Xml::tags( 'th', null, $this->msg( 'tags-description-header' )->parse() ) .
                        Xml::tags( 'th', null, $this->msg( 'tags-source-header' )->parse() ) .
@@ -148,26 +148,28 @@ class SpecialTags extends SpecialPage {
                                '' )
                );
 
+               $tbody = '';
                // Used in #doTagRow()
                $this->softwareActivatedTags = array_fill_keys(
                        ChangeTags::listSoftwareActivatedTags(), true );
 
                // Insert tags that have been applied at least once
                foreach ( $tagStats as $tag => $hitcount ) {
-                       $html .= $this->doTagRow( $tag, $hitcount, $userCanManage,
+                       $tbody .= $this->doTagRow( $tag, $hitcount, $userCanManage,
                                $userCanDelete, $userCanEditInterface );
                }
                // Insert tags defined somewhere but never applied
                foreach ( $definedTags as $tag ) {
                        if ( !isset( $tagStats[$tag] ) ) {
-                               $html .= $this->doTagRow( $tag, 0, $userCanManage, $userCanDelete, $userCanEditInterface );
+                               $tbody .= $this->doTagRow( $tag, 0, $userCanManage, $userCanDelete, $userCanEditInterface );
                        }
                }
 
                $out->addHTML( Xml::tags(
                        'table',
                        [ 'class' => 'mw-datatable sortable mw-tags-table' ],
-                       $html
+                       Xml::tags( 'thead', null, $thead ) .
+                       Xml::tags( 'tbody', null, $tbody )
                ) );
        }
 
@@ -307,7 +309,7 @@ class SpecialTags extends SpecialPage {
 
                        $headerText = $this->msg( 'tags-create-warnings-above', $tag,
                                count( $status->getWarningsArray() ) )->parseAsBlock() .
-                               $out->parse( $status->getWikiText() ) .
+                               $out->parseAsInterface( $status->getWikiText() ) .
                                $this->msg( 'tags-create-warnings-below' )->parseAsBlock();
 
                        $subform = HTMLForm::factory( 'ooui', $fields, $this->getContext() );
@@ -321,8 +323,7 @@ class SpecialTags extends SpecialPage {
                        $out->addBacklinkSubtitle( $this->getPageTitle() );
                        return true;
                } else {
-                       $out->addWikiText( "<div class=\"error\">\n" . $status->getWikiText() .
-                               "\n</div>" );
+                       $out->wrapWikiTextAsInterface( 'error', $status->getWikiText() );
                        return false;
                }
        }
@@ -340,8 +341,7 @@ class SpecialTags extends SpecialPage {
                // is the tag actually able to be deleted?
                $canDeleteResult = ChangeTags::canDeleteTag( $tag, $user );
                if ( !$canDeleteResult->isGood() ) {
-                       $out->addWikiText( "<div class=\"error\">\n" . $canDeleteResult->getWikiText() .
-                               "\n</div>" );
+                       $out->wrapWikiTextAsInterface( 'error', $canDeleteResult->getWikiText() );
                        if ( !$canDeleteResult->isOK() ) {
                                return;
                        }
@@ -402,8 +402,7 @@ class SpecialTags extends SpecialPage {
                $func = $activate ? 'canActivateTag' : 'canDeactivateTag';
                $result = ChangeTags::$func( $tag, $user );
                if ( !$result->isGood() ) {
-                       $out->addWikiText( "<div class=\"error\">\n" . $result->getWikiText() .
-                               "\n</div>" );
+                       $out->wrapWikiTextAsInterface( 'error', $result->getWikiText() );
                        if ( !$result->isOK() ) {
                                return;
                        }
@@ -449,14 +448,13 @@ class SpecialTags extends SpecialPage {
                        return true;
                } elseif ( $status->isOK() && $form->tagAction === 'delete' ) {
                        // deletion succeeded, but hooks raised a warning
-                       $out->addWikiText( $this->msg( 'tags-delete-warnings-after-delete', $tag,
+                       $out->addWikiTextAsInterface( $this->msg( 'tags-delete-warnings-after-delete', $tag,
                                count( $status->getWarningsArray() ) )->text() . "\n" .
                                $status->getWikitext() );
                        $out->addReturnTo( $this->getPageTitle() );
                        return true;
                } else {
-                       $out->addWikiText( "<div class=\"error\">\n" . $status->getWikitext() .
-                               "\n</div>" );
+                       $out->wrapWikiTextAsInterface( 'error', $status->getWikitext() );
                        return false;
                }
        }