Fix up AJAX watch and enable it by default.
[lhc/web/wiklou.git] / includes / SpecialCategories.php
index 9336214..fd3a51e 100644 (file)
@@ -16,11 +16,15 @@ function wfSpecialCategories() {
                );
 }
 
+/**
+ * @addtogroup SpecialPage
+ * @addtogroup Pager
+ */
 class CategoryPager extends AlphabeticPager {
        function getQueryInfo() {
                return array(
                        'tables' => array('categorylinks'),
-                       'fields' => array('cl_to','count(*) count'),
+                       'fields' => array('cl_to','count(*) AS count'),
                        'options' => array('GROUP BY' => 'cl_to')
                        );
        }
@@ -29,12 +33,12 @@ class CategoryPager extends AlphabeticPager {
                return "cl_to";
        }
        
+       /* Override getBody to apply LinksBatch on resultset before actually outputting anything. */
        function getBody() {
                if (!$this->mQueryDone) {
                        $this->doQuery();
                }
                $batch = new LinkBatch;
-               $db = $this->mDb;
        
                $this->mResult->rewind();
                
@@ -49,13 +53,10 @@ class CategoryPager extends AlphabeticPager {
        function formatRow($result) {
                global $wgLang;
                $title = Title::makeTitle( NS_CATEGORY, $result->cl_to );
-               return ( 
-                       '<li>' .
-                       $this->getSkin()->makeLinkObj( $title, $title->getText() )
-                       . ' ' .
-                       wfMsgExt( 'nmembers', array( 'parsemag', 'escape'),
-                               $wgLang->formatNum( $result->count ) )
-                       . "</li>\n" );
+               $titleText = $this->getSkin()->makeLinkObj( $title, htmlspecialchars( $title->getText() ) );
+               $count = wfMsgExt( 'nmembers', array( 'parsemag', 'escape'),
+                               $wgLang->formatNum( $result->count ) );
+               return Xml::tags('li', null, "$titleText ($count)" ) . "\n";
        }
 }